semiotic 3.5.3 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +2 -2
- package/README.md +5 -5
- package/ai/componentMetadata.cjs +9 -2
- package/ai/dist/mcp-server.js +4 -1
- package/ai/examples.md +27 -0
- package/ai/schema.json +286 -41
- package/ai/system-prompt.md +1 -1
- package/dist/components/charts/index.d.ts +3 -3
- package/dist/components/charts/network/Treemap.d.ts +8 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +22 -0
- package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
- package/dist/components/charts/shared/hooks.d.ts +2 -2
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
- package/dist/components/charts/shared/types.d.ts +11 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +15 -0
- package/dist/components/semiotic-ai.d.ts +1 -1
- package/dist/components/semiotic-realtime.d.ts +3 -3
- package/dist/components/semiotic-server.d.ts +1 -0
- package/dist/components/semiotic-xy.d.ts +1 -1
- package/dist/components/semiotic.d.ts +5 -4
- package/dist/components/server/renderToStaticSVG.d.ts +2 -0
- package/dist/components/server/staticLegend.d.ts +35 -0
- package/dist/components/store/ThemeStore.d.ts +2 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
- package/dist/components/stream/SVGOverlay.d.ts +2 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/geoTypes.d.ts +2 -1
- package/dist/components/stream/hoverUtils.d.ts +1 -0
- package/dist/components/stream/legendRenderer.d.ts +2 -1
- package/dist/components/stream/networkTypes.d.ts +2 -1
- package/dist/components/stream/ordinalTypes.d.ts +16 -2
- package/dist/components/stream/renderers/wedgePathBuilder.d.ts +31 -0
- package/dist/components/stream/types.d.ts +2 -1
- package/dist/components/types/legendTypes.d.ts +15 -0
- package/dist/components/types/marginType.d.ts +17 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +3 -3
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +1 -1
- package/dist/semiotic.d.ts +5 -4
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +13 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as o 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 m,scaleBand as v}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 C,curveMonotoneY as M,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 $,brushY as I}from"d3-brush";const R=Object.freeze([]);function D(e){if(!e)return R;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class F{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=D(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=D(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class E{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class N{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function W(e,t,n){return e+(t-e)*n}function z(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 n=e||t;return e=>+e[n]}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,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Y(e){const t=e.map(V),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return X(e,n,o)}if(e>=1){const[e,o,i]=t[n];return X(e,o,i)}const o=e*n,i=Math.floor(o),r=o-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"],Z=Y(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),K=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"]),ne=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 oe=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:Z,reds:K,greens:U,oranges:J,purples:ee,viridis:te,plasma:ne},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,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ge.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):ue[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%ue.length]}function pe(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=de[n]||de.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return y().domain(o).range(e).unknown("#999")}}function ye(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function me(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ve(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,d=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,u=null!=i.sweepAngle&&360>i.sweepAngle&&Object.keys(o).length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0,h=Object.values(o);for(let e=0;h.length>e;e++){const t=h[e],n=c+t.pctStart*d,o=c+(t.pctStart+t.pct)*d,g=r(t.pieceData[0],t.name),f=0===e,p=e===h.length-1,y=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:n,endAngle:o},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:g,datum:t.pieceData,category:t.name});u&&(y.roundedEnds={start:f,end:p}),s.push(y)}return s}function be(e){var t,n,o;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!==(n=x(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=x(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function xe(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}const we={bar:function(e,t){var n,o,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,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;y&&n>0&&(a/=n);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:o+a),n=0>a?u(i+a)-u(i):u(o)-u(o+a);g.push(me(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(p){const t=u(0>a?i+a:o),n=0>a?u(i)-u(i+a):u(o+a)-u(o);g.push(me(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="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!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))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(o)){const t=e.width/f,n=.2*t,o=t-n,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+n/2,a=l(0),u=l(c);d.push(me(r,Math.min(a,u),o,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),u=l(c);d.push(me(Math.min(a,u),r,Math.abs(u-a),o,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 n,o;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!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),d=f&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=d(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return u},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),d=r(o,e.name),u=d.r||4,h=(7919*n%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:o})}}return l},pie:ve,donut:ve,boxplot:function(e,t){var n,o,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,m=!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!==(n=x(l,.25))&&void 0!==n?n:c,v=null!==(o=x(l,.5))&&void 0!==o?o:(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(m)for(const e of t.pieceData){const n=u(e);if(k>n||n>A){const o=y?t.middle:g(n),i=y?g(n):t.middle;_.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(O),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:O,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:_}),m)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 n,o,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),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const n=d(r+(t+.5)*a);v+=` L ${e.middle+u[t]/y*m} ${n}`}v+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const n=d(r+(t+.5)*a);v+=` L ${e.middle-u[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*m}`;v+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const a=null!==(n=x(t,.25))&&void 0!==n?n:r,l=null!==(o=x(t,.5))&&void 0!==o?o:(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:v,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:be(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],d=r.bins||25,u=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/d||1,r=Array(d).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/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 o=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(me(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,y,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,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 o=t[0],i=t[t.length-1],r=(i-o)/u||1,c=Array(u).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;u>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;u>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};d.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:be(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,d=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(me(n,e.x,i-n,e.width,d,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(me(e.x,n,e.width,i-n,d,t,e.name))}}return l},funnel:function(e,t){var n,o,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,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const b=[],x=new Set;for(const e of v)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 v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>A&&(A=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const O=new Map;for(const e of b){const t=k[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,j=w?.95*p:.9*t.width,_=m().domain([0,A]).range([0,j]),C=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let M=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,d=0===t,u=o.width,h=.55*u,m=o.x+(u-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=p,i=p;for(let r=0;b.length>r;r++){const a=b[r],l=n.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:o.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=m,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+c/2,S.__funnelValueLabelY=m,S.__funnelBarW=c),f.push(me(x,m,c,h,w,S,a)),v.set(a,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=p-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],u=l?a:o.name,x=g(c,u),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:d,category:l?a:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=m,k.__funnelBarW=t),f.push(me(s,m,t,h,x,k,u)),v.set(a,{x:s,y:m,w:t,h:h})}if(t>0&&M.size>0){const t=w?b:[b[0]];for(const i of t){const t=M.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.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:C},datum:null!==(c=null===(l=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};f.push(d)}}M=v}return f},"bar-funnel":function(e,t){var n,o,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 n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,s=e>0?y[e-1]:null,a=n.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=m.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=o?0:Math.max(0,k-y),O=n.x+e*a+l/2,S=v(y),j=v(0)-S,_=c(f.pieces[0],p?h:n.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:O+d/2,__barFunnelLabelY:v(y+A)});if(u.push(me(O,S,d,j,_,C,p?h:n.name)),A>0){const e=v(y+A),t=S-e,o=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});u.push(me(O,e,d,t,o,i,p?h:n.name))}}}return u},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,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!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=u?me(s,n.x,a,n.width,o,null,"__track__"):me(n.x,s,n.width,a,o,null,"__track__");d.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=d.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let f;if(u){const r=l(t),s=l(t+o);f=me(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=me(e.x,r,e.width,s-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=o}if(p>0&&d.length>n){const e=d.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return d}};class ke{constructor(e){this.rExtent=new N,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(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 N)):(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(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,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=v().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(s).range([o,n])}else a?(d=v().domain(r).range([0,e.height]).padding(c),u=m().domain(s).range([0,e.width])):(d=v().domain(r).range([0,e.width]).padding(c),u=m().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((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);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?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,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,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const 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"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.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,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>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===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){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,n,o,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"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==o){d=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of d)d.set(t,n/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;d?(c=h,g=d.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.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 n,o;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!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=we[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;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 n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(n)||d.set(n,[]),d.get(n).push({x:o,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===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1: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 n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=function(e,t,n){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:n}(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!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:xe(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||he,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];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 n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,ke.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=b().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const o=d.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o: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(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const A=new Set,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!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o: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 n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,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 o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=W(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=W(o.x,e._targetX,s),e.y=W(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=W(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=W(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=W(n.x,e._targetX,s),e.y=W(n.y,e._targetY,s),void 0!==n.w&&(e.w=W(n.w,e._targetW,s),e.h=W(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:W(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=W(n.startAngle,e._targetStartAngle,s),e.endAngle=W(n.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]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,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&&!z(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!z(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!z(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(z(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 n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!z(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 N)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!z(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!z(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!z(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function Ae(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function Oe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Se(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function je(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function _e(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Oe(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Ce(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Se(Math.atan2(i,o)),a=Se(e.startAngle),l=Se(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,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Pe(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Le(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Te(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}ke.QUADTREE_THRESHOLD=500;const He={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 Be(e,t,n,o){let i;return i="function"==typeof n?n(e):(0,He[n])(o(e,t)),i}function $e(){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,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Re=(n,o,i,r,s,a,l,c,d,u)=>{const{type:h="fill",styleFn:g,items:f}=n,p=[];let y=0;const m=!(!o&&!i),v="isolate"===u||void 0===u&&null!=s;return f.forEach((n,u)=>{const b=Be(n,u,h,g),x=Ie(n,r,s),w=s&&s.size>0&&s.has(n.label);p.push(e("g",{transform:`translate(0,${y})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:m?c===a&&u===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?w||!1:void 0,"aria-current":m&&!v&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:m?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;d(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{d(c,u),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:x,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:24+7*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,w&&t($e,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+u)),y+=22}),p};function De({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(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+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:o,height:n,fill:`url(#${u})`,rx:2}),t("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),t("text",{x:i+o,y:n+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 n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(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 Fe(n){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"}=n,[f,p]=o.useState(0),[y,m]=o.useState(0),v=o.useCallback((e,t)=>{p(e),m(t)},[]),b="vertical"===g?(({legendGroups:e,width:n,customClickBehavior:o,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:n,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,o,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:v,legendInteraction:c}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h})=>{let g=0;const f=[];n.forEach((n,o)=>{let p=0;n.label&&(p+=16);const y=((n,o,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0,v=0;const b=!(!o&&!i),x="isolate"===u||void 0===u&&null!=s;p.forEach((n,u)=>{const w=Be(n,u,g,f),k=Ie(n,r,s),A=s&&s.size>0&&s.has(n.label),O=26+7*n.label.length;h&&h>0&&m>0&&m+O>h&&(v++,m=0),y.push(e("g",{transform:`translate(${m},${22*v})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):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&&n.label===r||void 0,"aria-label":n.label,onKeyDown:b?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(u+("ArrowRight"===e.key?1:-1)+p.length)%p.length;d(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:b?e=>{d(c,u),i&&i(n);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*n.label.length,height:20,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,A&&t($e,{}),t("text",{y:8,x:22,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+u)),m+=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=v+1;return{items:y,offset:w,totalRows:A,totalHeight:22*A}})(n,r,s,a,l,c,d,o,u,h,i);p+=y.offset+5,f.push(Object.assign(Object.assign({label:n.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=n[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,n[i+1]&&y.push(t("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(e.totalHeight||o)+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:v,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 Ee(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ne(e){const{legend:n,totalWidth:o,totalHeight:i,margin:r,legendPosition:s="right",title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=e;if(!n)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=o-r.right+10,p=r.top),t("g",{transform:`translate(${f}, ${p})`,children:(y=n,"object"==typeof y&&null!==y&&"gradient"in y?t(De,{config:n.gradient,orientation:g?"horizontal":"vertical",width:g?o:100}):Ee(n)?t(Fe,{legendGroups:n.legendGroups,title:"",width:g?o:100,orientation:g?"horizontal":"vertical",customHoverBehavior:l,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):n)});var y}function We(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function ze(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ge(n,o,i,r){if(!n)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=n;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=a?u?[a]:We(a,d):[],m=s?u?[s]:We(s,d):[],v="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,n)=>t("tspan",{x:v,dy:0===n?0:p,children:e},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:m.map((e,n)=>t("tspan",{x:v,dy:0===n?0:p,children:e},n))},"annotation-note-label"));let k=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const e=Math.min(d,120);let n=0,o=e;"end"===f?(n=-e,o=0):"middle"===f&&(n=-e/2,o=e/2),k=t("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=e;"bottom"===g?(n=-e,o=0):"middle"===g&&(n=-e/2,o=e/2),k=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function qe(e,n,o,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-e;a.push(t("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(t("line",{x1:(n.x1||0)-e,y1:i,x2:(n.x2||0)-e,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(t("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==e&&a.push(t("path",{d:ze((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function Ve(e,n,o,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,o=s.height||0;if(t>0||o>0){const i=t/2,r=o/2,s=e-i,a=n-r;if(0!==s||0!==a){const e=Math.abs(s),n=Math.abs(a),d=t/2,u=o/2,h=e*u>n*d?d/e:u/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*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 Xe(t){const{x:n=0,y:o=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,m=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===v&&0===b)if(void 0!==d.width){v=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;v=e+(0>e?-5:5),b=d.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&&Ve(v,b,c,h,x,d),!m.has("subject")&&qe(x,d,h,n,o),!m.has("note")&&Ge(l,v,b,h)]}))}function Ye(e){var n,o;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!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:e,ny:a});return t(Xe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(Xe,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Qe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ze(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ke(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,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)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Qe(e,n),c=Ze(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ue(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Je={linear:L,monotoneX:P,monotoneY:M,step:C,stepAfter:_,stepBefore:j,basis:S,cardinal:O,catmullRom:A};function et(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function tt(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==d?void 0:d.projection),m="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||y?[]:(f||et(d.r,5,p)).map(e=>({value:e,pixel:d.r(e),label:(g||nt)(e)})),[d,g,y,f,p]),b=h&&d&&!y,x=u&&d&&!y;return b||x?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:[b&&t("g",{className:"ordinal-grid",children:v.map((e,n)=>t("line",{x1:m?e.pixel:0,y1:m?0:e.pixel,x2:m?e.pixel:i,y2:m?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&t(n,{children:e(n,m?{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 nt(e){return Math.round(100*e)/100+""}function ot(o){var i,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:A,legend:O,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:C,legendPosition:M="right",foregroundGraphics:P,annotations:T,svgAnnotationRules:B,xAccessor:$,yAccessor:I,annotationData:R,underlayRendered:D,children:F}=o,E="radial"===(null==g?void 0:g.projection),N="horizontal"===(null==g?void 0:g.projection),W=!1!==p,z=r(()=>f&&W&&g&&!E?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,W,g,v,E]),G=o.rTickValues,q=o.tickLabelEdgeAlign,V=o.axisExtent,X=r(()=>f&&g&&!E?(G||et(g.r,5,V)).map(e=>({value:e,pixel:g.r(e),label:(b||nt)(e)})):[],[f,g,b,E,G,V]),Y=s(new Map),Q=s(null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0),Z=null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0;Q.current!==Z&&(Q.current=Z,Y.current=new Map);const K=r(()=>{if(!T||0===T.length)return null;const n=function(n,o,i){var r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,A,O,S,j,_,C,M,P,T,B,$,I,R,D,F,E,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne;switch(n.type){case"label":{const e=Ke(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ue(r,s,i)?t(Ye,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const e=Ke(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ue(r,s,i)?t(Ye,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Qe(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.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:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ze(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.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:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ze(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=n.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ze(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.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:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const e=i.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,o)=>{const r=Qe(e,i),a=Ze(e,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const e=Qe(n,i),r=Ze(n,i);return t(Ye,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p="ordinal"===i.frameType,y="horizontal"===i.projection,m=p?g:null,v=p?f:null;let b;const x=[],w=new Map;if(p&&m&&v){for(const e of h){const t=e[m];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=h.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=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,A=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(!k||!A)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,j=A;let _;if(p)if(y){const e=O(j);_=(t,n)=>[S(n),e(t)]}else{const e=O(S);_=(t,n)=>[e(t),j(n)]}else _=(e,t)=>[S(e),j(t)];const C=n.method||"linear";let M;M="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;n>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}(b,null!==(u=n.bandwidth)&&void 0!==u?u:.3):("polynomial"===C?H.polynomial(b,{order:n.order||2}):H.linear(b)).points;const P=M.map(([e,t])=>{const[n,o]=_(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=M[M.length-1],[B,$]=_(T[0],T[1]);return e("g",{children:[t("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:B+4,y:$-4,fill:L,fontSize:11,children:n.label})]},"ann-"+o)}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(n.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(n.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:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v: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=n.upperAccessor||"upperBounds",d=n.lowerAccessor||"lowerBounds",u=n.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=Je[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=n.fill||"#6366f1";return e("g",{children:[t("path",{d:f,fill:p,fillOpacity:null!==(S=n.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),n.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:n.label})]},"ann-"+o)}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===(C=i.scales)||void 0===C?void 0:C.time,l=null!==(P=null===(M=i.scales)||void 0===M?void 0:M.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=n.threshold)&&void 0!==B?B:2,f=d-g*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==($=n.fillOpacity)&&void 0!==$?$:.1,v=n.anomalyColor||"#ef4444",b=null!==(I=n.anomalyRadius)&&void 0!==I?I: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:m}),k.map((e,n)=>{const o=Qe(e,i),r=Ze(e,i);return null==o||null==r?null:t("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(D=null===(R=i.scales)||void 0===R?void 0:R.x)&&void 0!==D?D:null===(F=i.scales)||void 0===F?void 0:F.time,c=null!==(N=null===(E=i.scales)||void 0===E?void 0:E.y)&&void 0!==N?N:null===(W=i.scales)||void 0===W?void 0:W.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"===(n.method||"linear")){const e=H.polynomial(d,{order:n.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=d.length;let t=0,n=0,o=0,i=0;for(const[e,r]of d)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-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),m=null!==(z=n.confidence)&&void 0!==z?z:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(G=n.steps)&&void 0!==G?G:5,x=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),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const 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))}`,_=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(q=n.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),t("polyline",{points:`${j} ${S}`,fill:"none",stroke:_,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(X=n.strokeDasharray)&&void 0!==X?X:"6,3"}),n.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:n.label})]},"ann-"+o)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=Ke(n,o,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ue(e,r,i))return null;const s=null!==(Y=n.dx)&&void 0!==Y?Y:0,a=null!==(Q=n.dy)&&void 0!==Q?Q:0,l=null!==(Z=n.width)&&void 0!==Z?Z:32,c=null!==(K=n.height)&&void 0!==K?K:32,d=null!==(U=n.content)&&void 0!==U?U:t("span",{style:{fontSize:18,cursor:"default"},title:n.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-"+o)}case"text":{const e=Ke(n,o,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=null===(J=i.scales)||void 0===J?void 0:J.o,l=null===(ee=i.scales)||void 0===ee?void 0:ee.x,c=null===(te=i.scales)||void 0===te?void 0:te.y,d=s(a)?a:s(l)?l:s(c)?c:null;if(!d)return null;const u=d(r+"");if(null==u)return null;const h=d.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return e("g",(i.projection?"vertical"===i.projection:d===l)?{children:[t("rect",{x:u,y:0,width:h,height:i.height||0,fill:g,fillOpacity:f}),p&&t("text",{x:u+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[t("rect",{x:0,y:u,width:i.width||0,height:h,fill:g,fillOpacity:f}),p&&t("text",{x:12,y:u+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o="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:o?g.r:i||g.r,y:o&&i||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:$,yAccessor:I,width:l,height:c,data:R,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:Y.current};return T.map((e,t)=>{if(B){const o=B(e,t,r);return null!=o?o:n(e,t,r)}return n(e,t,r)}).filter(Boolean)},[T,B,l,c,g,$,I,R]);return f||A||O||P||K&&K.length>0||x||F?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&&!E&&!D&&t("g",{className:"ordinal-grid",children:X.map((e,n)=>t("line",{x1:N?e.pixel:0,y1:N?0:e.pixel,x2:N?e.pixel:l,y2:N?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&g&&!E&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 10px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return t("g",{className:"ordinal-axes",children:e(n,N?{children:[e("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),z.map((n,i)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),e("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(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})(),X.map((n,i)=>{const r=q?0===i?"start":i===X.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),m&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[e("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,n=0>e||e>c?c:e;return t("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),z.map((n,i)=>e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),e("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),X.map((n,i)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),m&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),K,P,F]}),A&&t("text",{x:d/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof A?A:null}),Ne({legend:O,totalWidth:d,totalHeight:u,margin:h,legendPosition:M,title:A,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:C})]}):null}function it(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function rt({width:e,height:n,totalWidth:o,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),m=s(y);return m.current=y,i(()=>{if(!d.current)return;const t=B(d.current).select(".brush-g"),o=y?$():I();return o.extent([[0,0],[e,n]]),o.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),t.call(o),u.current=o,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),u.current=null}},[e,n,y]),i(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=B(d.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);y?(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1)},[l,y]),t("svg",{ref:d,width:o,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"}})})}function st(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function at(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const lt=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ct(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=lt(i,r),t=lt(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=lt(i,r),t=lt(i,s),n=lt(o,s),l=lt(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return ct(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),d=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),u=(s-r)/2,h=!!e.roundStart&&u>c,g=!!e.roundEnd&&u>c;if(!h&&!g)return ct(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const f=r+(h?c:0),p=s-(g?c:0),y=r+(h?d:0),m=s-(g?d:0),v=lt(i,f),b=lt(i,p),x=(i-l)*Math.cos(c),w=lt(x,r),k=lt(x,s),A=a?null:lt(o,m),O=a?null:lt(o,y),S=a?0:(o+l)*Math.cos(d),j=a?null:lt(S,r),_=a?null:lt(S,s),C=p-f>Math.PI?1:0,M=a?0:m-y>Math.PI?1:0;let P="";if(h)P+=`M${w.x},${w.y}`,P+=` A${l},${l} 0 0 1 ${v.x},${v.y}`;else{const e=lt(i,r);P+=`M${e.x},${e.y}`}if(g)P+=` A${i},${i} 0 ${C} 1 ${b.x},${b.y}`,P+=` A${l},${l} 0 0 1 ${k.x},${k.y}`;else{const e=lt(i,s);P+=` A${i},${i} 0 ${C} 1 ${e.x},${e.y}`}if(a)P+=" L0,0";else{if(g)P+=` L${_.x},${_.y}`,P+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=lt(o,s);P+=` L${e.x},${e.y}`}if(h)P+=` A${o},${o} 0 ${M} 0 ${O.x},${O.y}`,P+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=lt(o,r);P+=` A${o},${o} 0 ${M} 0 ${e.x},${e.y}`}}return P+=" Z",P}const dt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ut(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const ht="undefined"==typeof window||"undefined"==typeof document,gt="undefined"!=typeof window?c:i,ft=()=>()=>{},pt=()=>!1,yt=()=>!0;function mt(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function vt(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function bt(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 xt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,wt=new WeakMap;let kt=0,At=!1,Ot=null,St=null,jt=null;function _t(e,t){var n,o;if(!t)return t;const i=xt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(At)return;if("undefined"==typeof window||"undefined"==typeof document)return;At=!0;const e=()=>{kt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ot=new MutationObserver(e),Ot.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{St=window.matchMedia("(prefers-color-scheme: dark)"),jt=e,"function"==typeof St.addEventListener?St.addEventListener("change",jt):"function"==typeof St.addListener&&St.addListener(jt)}catch(e){}}();let s=wt.get(r);s&&s.version===kt||(s={version:kt,map:new Map},wt.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const Ct=o.createContext(null),Mt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Pt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){const e=t.type+"";n[e]=(n[e]||0)+1}const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Lt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Tt={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"},Ht={marginBottom:8,paddingRight:28,color:"var(--semiotic-text-secondary, #666)",fontSize:12,letterSpacing:"0.01em"},Bt={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)"},$t={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},It={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)"},Rt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},Dt={textAlign:"left",fontSize:11,color:"var(--semiotic-text-secondary, #999)",marginBottom:4,fontStyle:"italic"};function Ft({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),d=o.useContext(Ct),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=o.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=o.useCallback(()=>{l||u||c(!0)},[l,u]),y=o.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:Mt}):null;if(!h)return t("div",{id:r,tabIndex:-1,onFocus:p,style:Mt,role:"region","aria-label":f,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,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 n=0;e.length>n&&t.length>n;n++){const t=e[n];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 n=0;e.length>n&&t.length>n;n++){const t=e[n];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!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o: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!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.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}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Lt(e.min)} to ${Lt(e.max)}, mean ${Lt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.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:Tt,role:"region","aria-label":f,children:[t("button",{type:"button",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Bt,children:"×"}),t("div",{role:"note",style:Ht,children:b}),e("table",{role:"table","aria-label":"Sample data for "+i,style:$t,children:[e("caption",{style:Dt,children:["First ",x.length," of ",m.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:It,children:"type"}),k.map(e=>t("th",{style:It,children:e},e))]})}),t("tbody",{children:x.map((n,o)=>e("tr",{children:[t("td",{style:Rt,children:n.label}),k.map(e=>{return t("td",{style:Rt,children:(o=n.values[e],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Lt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},e);var o})]},o))})]})]})}function Et({summary:e}){return e?t("div",{role:"note",style:Mt,children:e}):null}function Nt({tableId:e}){return t("a",{href:"#"+e,style:Mt,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Mt)},children:"Skip to data table"})}function Wt({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="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:Mt,children:n})}const zt="var(--semiotic-focus, #005fcc)";function Gt({active:e,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!e||!n)return null;const l=n.x+o.left,c=n.y+o.top;let d;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),n=Math.max(a,4);d=t("rect",{x:l-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:zt,strokeWidth:2,strokeDasharray:"4,2"})}else d=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:zt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:zt,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})}const qt={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 Vt(e,t){return"function"==typeof t?t(e):e[t]}function Xt(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 Yt(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Vt(n,i);l=Xt(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Vt(n,o);c.push({label:t,value:Xt(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Xt(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Xt(n[e[0]],r))}}const d=Object.assign(Object.assign({},qt),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,n)=>e("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},n))]})}}function Qt(e){if(!0!==e){if("function"==typeof e){const n=e;return e=>{var o;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!==(o=e.data)&&void 0!==o?o:{}:e,r=n(i);return null==r?null:t("div",{className:"semiotic-tooltip",style:qt,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Yt(e):Yt())}}function Zt({x:e,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(e)&&Number.isFinite(n),u=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let f;f=h?`translate(${h.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(a),y=p?null:qt;return d?t("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+e,top:s.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function Kt(e){let n=null;const o=()=>(n||(n=h(null)),n),i=Ut(e);return[function({children:n,initialState:i}){const a=s(i),l=r(()=>Ut(e,a.current),[]),c=o();return t(c.Provider,{value:l,children:n})},e=>{var t;const n=o(),r=null!==(t=d(n))&&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 Ut(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function Jt(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 en(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:tn})})),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 tn=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],nn={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}},on={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}},rn={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:tn,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 sn(e,t){if("light"===t)return nn;if("dark"===t)return on;if("high-contrast"===t)return rn;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?on:nn;return en(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 en(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[an,ln]=Kt(e=>({theme:nn,setTheme(t){e(e=>({theme:sn(e.theme,t)}))}}));const cn="undefined"==typeof window?i:c;function dn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function un(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){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=s(t);n.current=t;const[l,c]=function(e,t,n){const o=s(null),[r,l]=a(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(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=dn(e.foregroundGraphics,c,d),p=dn(e.backgroundGraphics,c,d),y=ln(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.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)},[]),C=u(e=>{S.current={clientX:e.clientX,clientY:e.clientY},0===j.current&&(j.current=requestAnimationFrame(_))},[_]),M=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 cn(()=>{P&&(kt++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:M}}function hn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function gn(e,t,n=.3){hn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function fn(e,t,n=.6){var o,i,r,s,a;if(!hn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o: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*n,e.stroke()}function pn(e,t,n,o=.35){hn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function yn(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function mn(e,t,n){return null==t?n:"string"!=typeof t?t:_t(e,t)||n}function vn(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)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(o,i,r,s),[h,g,f]=yn(e,n);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function bn(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=at(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function xn(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 wn=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)kn(e,t);else if(t.cornerRadii&&st(t.cornerRadii)){const n=mn(e,t.style.fill,_t(e,"var(--semiotic-primary, #007bff)")),o=xn(t),i=t.fillGradient&&"string"==typeof n?vn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,bn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=mn(e,t.style.fill,_t(e,"var(--semiotic-primary, #007bff)")),o=xn(t),i=t.fillGradient&&"string"==typeof n?vn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x: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=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=mn(e,t.style.fill,_t(e,"var(--semiotic-primary, #007bff)")),o=xn(t),i=t.fillGradient&&"string"==typeof n?vn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}gn(e,t),e.globalAlpha=1}};function kn(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const An=(e,t,n,o)=>{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 n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=mn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=mn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),fn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function On(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 Sn(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=T().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}const jn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,e.fillStyle=("string"==typeof t.style.fill?_t(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=ct({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Sn(e,t)):(On(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(On(e,t),pn(e,t)),e.globalAlpha=1}},_n=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=_t(e,"var(--semiotic-primary, #007bff)"),a=_t(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?_t(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?_t(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(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Cn=(e,t,n,o)=>{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 n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?_t(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Mn=(e,t,n,o)=>{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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=_t(e,n.style.stroke)||("string"==typeof n.style.fill?_t(e,n.style.fill):n.style.fill)||_t(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Pn=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(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=_t(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Ln(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 Tn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let Hn=null;function Bn(e={},t){const{background:n="transparent",stroke:o="#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):(Hn||(Hn=document.createElement("canvas")),Hn.width=e,Hn.height=e,Hn)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,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 $n=new Map;function In(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=$n.get(n);if(void 0!==o)return o;const i=Bn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return $n.set(n,i),i}function Rn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function Dn(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 Fn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const En=e=>[Mn,...e],Nn={bar:En([wn]),clusterbar:En([wn]),point:En([An]),swarm:En([An]),pie:[jn],donut:[jn],boxplot:En([_n,An]),violin:En([Cn]),histogram:En([wn]),ridgeline:En([Cn]),timeline:En([wn]),funnel:[wn,Pn,(e,t,n,o)=>{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,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Ln(i):null!=r?`${Ln(i)} (${Tn(r)})`:Ln(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Ln(i),e.measureText(c).width+16>o)continue}const d=n.__funnelValueLabelX,u=(null!==(a=n.__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":[wn,(e,t,n,o)=>{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 n=("string"==typeof t.style.fill?t.style.fill:null)||_t(e,"var(--semiotic-border, #999)"),o=In(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=yn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,_t(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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,d=r?Fn(i):"",u=Dn(o);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=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Rn(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Rn(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3))}e.lineWidth=1}],swimlane:En([wn]),custom:En([wn,An,jn,_n,Cn,Pn])},Wn={top:50,right:40,bottom:60,left:70},zn={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 Gn({hover:n}){var o,i,r,s,a,l;const c=n.data||{},d=n.stats,u=n.category;if(Array.isArray(c)){const n=u||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(d)return e("div",{className:"semiotic-tooltip",style:zn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),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:zn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return e("div",{className:"semiotic-tooltip",style:zn,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===n.length&&e("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:zn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},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 n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:zn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e("div",{className:"semiotic-tooltip",style:zn,children:[p&&t("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&t("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}Gn.ownsChrome=!0;const qn=g(function(n,c){var d,h,g,p,y,m,v,b,x,w,k;const{chartType:A,runtimeMode:O,data:S,oAccessor:j="category",rAccessor:_="value",colorAccessor:C,stackBy:M,groupBy:P,multiAxis:L,timeAccessor:H,valueAccessor:B,categoryAccessor:$,projection:I="vertical",size:R=[600,400],responsiveWidth:E,responsiveHeight:N,margin:W,barPadding:z,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:Z,startAngle:K,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:ne,amplitude:oe,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:me,barColors:ve,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:we,valueLabel:Se,categoryFormat:He,valueFormat:Be,oLabel:$e,rLabel:Ie,oFormat:Re,rFormat:De,rTickValues:Fe,tickLabelEdgeAlign:Ee,axisExtent:Ne,enableHover:We=!0,hoverAnnotation:ze,tooltipContent:Ge,customHoverBehavior:qe,annotations:Ve,svgAnnotationRules:Xe,showGrid:Ye=!1,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Je,legendPosition:et,legendCategoryAccessor:nt,onCategoriesChange:lt,backgroundGraphics:xt,foregroundGraphics:wt,title:kt,className:At,background:Ot,centerContent:St,decay:jt,pulse:Ct,transition:Mt,animate:Lt,staleness:Tt,brush:Ht,onBrush:Bt,accessibleTable:$t=!0,description:It,summary:Rt,customLayout:Dt,layoutConfig:zt}=n,qt=s(!0),Vt=un({sizeProp:R,responsiveWidth:E,responsiveHeight:N,userMargin:W,marginDefault:Wn,foregroundGraphics:wt,backgroundGraphics:xt,animate:Lt,transitionProp:Mt,themeDirtyRef:qt}),{reducedMotionRef:Xt,responsiveRef:Yt,size:Qt,margin:Kt,adjustedWidth:Ut,adjustedHeight:en,resolvedForeground:tn,resolvedBackground:nn,currentTheme:on,transition:rn,introEnabled:sn,tableId:an,rafRef:ln,renderFnRef:cn,scheduleRender:dn}=Vt,hn=function(){const[e,t]=a(!1);return gt(()=>{t(!0)},[]),e}(),gn=function(){const e=l(ft,pt,yt);return s(e).current}(),fn=r(()=>D(S),[S]),pn=null!=we?we:$e,yn=null!=Se?Se:Ie,mn=null!=He?He:Re,vn=null!=Be?Be:De,bn=s(null),xn=s(null),wn=s([]),kn=s(nt),An=s(lt);kn.current=nt,An.current=lt;const[On,Sn]=a(null),[jn,_n]=a(null),[Cn,Mn]=a(0),[Pn,Ln]=a(!1),[Tn,Hn]=a(null),Bn=u(()=>{var e,t;Hn(null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),$n=We||ze,In="streaming"===O,Rn=r(()=>{var e,t,n;return{chartType:A,runtimeMode:In?"streaming":"bounded",windowSize:fe,windowMode:ge,extentPadding:ue,projection:I,oAccessor:In?void 0:j,rAccessor:In?void 0:_,colorAccessor:C,stackBy:M,groupBy:P,multiAxis:L,timeAccessor:In?H:void 0,valueAccessor:In?B||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:In?$||j:void 0,rExtent:ce,oExtent:de,axisExtent:Ne,barPadding:z,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:Z,startAngle:K,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:ne,amplitude:oe,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,oSort:he,pieceStyle:pe,summaryStyle:ye,colorScheme:me,themeCategorical:null===(e=null==on?void 0:on.colors)||void 0===e?void 0:e.categorical,themeSemantic:Jt(on),themeSequential:null===(t=null==on?void 0:on.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==on?void 0:on.colors)||void 0===n?void 0:n.diverging,barColors:ve,decay:jt,pulse:Ct,transition:rn,introAnimation:sn,staleness:Tt,customLayout:Dt,layoutConfig:zt,layoutMargin:Kt}},[A,fe,ge,ue,I,j,_,C,M,P,L,H,B,$,ce,de,Ne,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne,oe,ie,re,se,ae,le,he,pe,ye,me,ve,jt,Ct,null==rn?void 0:rn.duration,null==rn?void 0:rn.easing,sn,Tt,In,on,Dt,zt,Kt]),Dn=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 vt(e,t);if(!bt(e)||!bt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!vt(n,i))return!1}else{if(!bt(n)||!bt(i))return!1;if(!mt(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Rn),Fn=s(null);Fn.current||(Fn.current=new ke(Dn));const En=u(()=>{var e,t;const n=kn.current,o=An.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,wn.current)||(wn.current=i,o(i))},[]);i(()=>{var e;null===(e=Fn.current)||void 0===e||e.updateConfig(Dn),qt.current=!0,dn()},[Dn,dn]);const zn=s(null);zn.current||(zn.current=new F(e=>{const t=Fn.current;t&&t.ingest(e)&&(qt.current=!0,dn())}));const qn=u(e=>{var t;null===(t=zn.current)||void 0===t||t.push(e)},[]),Vn=u(e=>{var t;null===(t=zn.current)||void 0===t||t.pushMany(e)},[]),Xn=u(()=>{var e,t;null===(e=zn.current)||void 0===e||e.clear(),null===(t=Fn.current)||void 0===t||t.clear(),qt.current=!0,dn()},[dn]),Yn=u(e=>{var t,n;null===(t=zn.current)||void 0===t||t.clearLastData(),null===(n=zn.current)||void 0===n||n.setReplacementData(e)},[]);f(c,()=>({push:qn,pushMany:Vn,replace:Yn,remove:e=>{var t,n,o,i;null===(t=zn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=Fn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=xn.current)||void 0===i?void 0:i.data;!!xn.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(xn.current=null,Sn(null)),qt.current=!0,dn()}return r},update:(e,t)=>{var n,o,i;null===(n=zn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Fn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(qt.current=!0,dn()),r},clear:Xn,getData:()=>{var e,t,n;return null===(e=zn.current)||void 0===e||e.flush(),null!==(n=null===(t=Fn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Fn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[qn,Vn,Yn,Xn,dn]),i(()=>{var e;S&&(null===(e=zn.current)||void 0===e||e.setBoundedData(fn))},[S,fn]);const{hoverHandlerRef:Qn,hoverLeaveRef:Zn,onPointerMove:Kn,onPointerLeave:Un}=Vt;Qn.current=e=>{if(!$n)return;const t=bn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Kt.left,i=e.clientY-n.top-Kt.top;if(0>o||o>Ut||0>i||i>en)return void(xn.current&&(xn.current=null,Sn(null),qe&&qe(null),dn()));const r=Fn.current;if(!r||0===r.scene.length)return;const s="radial"===I,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+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-n,a=Math.sqrt(r*r+s*s);Oe(e.r,o)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}(i,t,n,o,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=je(r,t,n);break;case"point":if(i)break;e=_e(r,t,n,o);break;case"wedge":e=Ce(r,t,n);break;case"boxplot":e=Me(r,t,n);break;case"violin":e=Pe(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-Ut/2:o,s?i-en/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(xn.current&&(xn.current=null,Sn(null),qe&&qe(null),dn()));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;xn.current=l,Sn(l),qe&&(qe(l),qt.current=!0),dn()},Zn.current=()=>{xn.current&&(xn.current=null,Sn(null),qe&&(qe(null),qt.current=!0),dn())};const Jn=s(-1),eo=s(null),to=s(null),no=u(e=>{const t=Fn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(to.current&&to.current.version===n)o=to.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("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;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),to.current={version:n,graph:o}}const i=Jn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Jn.current=0;const t=o.flat[0];eo.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},Te(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});return xn.current=n,Sn(n),qe&&qe(n),void dn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Le(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Le(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Jn.current=-1,eo.current=null,xn.current=null,Sn(null),qe&&qe(null),void dn();Jn.current=s;const a=o.flat[s];eo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Te(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});xn.current=l,Sn(l),qe&&qe(l),dn()},[qe,dn]),oo=u(e=>{Jn.current=-1,eo.current=null,Kn(e)},[Kn]);cn.current=()=>{var e,t;ln.current=0;const n=bn.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Fn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Xt.current?r+1e6:r),a=!Xt.current&&s,l=qt.current;l&&!s&&(i.computeScene({width:Ut,height:en}),En(),Bn(),qt.current=!1),(l||a)&&n.setAttribute("aria-label",Pt(i.scene,A+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,d=Qt[0]*c,u=Qt[1]*c;n.width===d&&n.height===u||(n.width=d,n.height=u,n.style.width=Qt[0]+"px",n.style.height=Qt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Qt[0],Qt[1]);const h=null!==(e=null==Tt?void 0:Tt.threshold)&&void 0!==e?e:5e3,g=Tt&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==Tt?void 0:Tt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ot&&!xt){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=Ot||(e&&"transparent"!==e?e:null),i=t?_t(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,Qt[0],Qt[1]))}const f="radial"===I;o.save(),o.beginPath(),o.rect(Kt.left,Kt.top,Ut,en),o.clip(),f?(o.save(),o.translate(Kt.left+Ut/2,Kt.top+en/2)):o.translate(Kt.left,Kt.top);const p=Dt?Nn.custom:Nn[A]||[],y={width:Ut,height:en};for(const e of p)e(o,i.scene,i.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(_n(i.scales),Mn(e=>e+1)),(null==Tt?void 0:Tt.showBadge)&&Ln(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(ln.current=requestAnimationFrame(()=>cn.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:a,cleanup:l}=e;gt(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,n]);const c=s(l);c.current=l,i(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:hn,wasHydratingFromSSR:gn,storeRef:Fn,dirtyRef:qt,renderFnRef:cn,cleanup:()=>{var e;return null===(e=zn.current)||void 0===e?void 0:e.clear()}}),i(()=>{qt.current=!0,dn()},[A,Ut,en,be,Ot,dn]),function(e,t,n,o,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),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(Tt,Fn,qt,dn,Pn,Ln);const io=$n&&On?Ge?Ge(On):t(Gn,{hover:On}):null,ro="radial"===I,so=io?t(Zt,{x:On?ro?On.x+Ut/2:On.x:0,y:On?ro?On.y+en/2:On.y:0,containerWidth:Ut,containerHeight:en,margin:Kt,className:"stream-ordinal-tooltip",children:io}):null,ao=it(j,0,"__semiotic_resolvedO"),lo=it(_,0,"__semiotic_resolvedR"),co=ao.key,uo=lo.key,ho=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(ao,lo,Ve&&Ve.length>0||!1);if(ht||!hn&&gn){const n=Fn.current;n&&S&&(n.ingest({inserts:fn,bounded:!0}),n.computeScene({width:Ut,height:en}));const i=null!==(d=null==n?void 0:n.scene)&&void 0!==d?d:[],r=null!==(h=null==n?void 0:n.scales)&&void 0!==h?h:null,s="radial"===I,a=s?Kt.left+Ut/2:Kt.left,l=s?Kt.top+en/2:Kt.top;return e("div",{ref:Yt,className:"stream-ordinal-frame"+(At?" "+At:""),role:"img","aria-label":It||("string"==typeof kt?kt:"Ordinal chart"),style:{position:"relative",width:E?"100%":Qt[0],height:N?"100%":Qt[1]},children:[t(Et,{summary:Rt}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Qt[0],height:Qt[1],style:{position:"absolute",left:0,top:0},children:[nn&&t("g",{transform:`translate(${Kt.left},${Kt.top})`,children:nn}),e("g",{transform:`translate(${a},${l})`,children:[Ot&&t("rect",{x:0,y:0,width:Ut,height:en,fill:Ot}),i.map((n,i)=>function(n,i){var r,s,a,l,c;const d=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",u=e=>`ord-${n.type}-${d}-${i}-${e}`,h=`ord-${n.type}-${d}-${i}`;switch(n.type){case"rect":{const i=n,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,n){const o=e.fillGradient;if(!o)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 o){const e=o.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 n=0;e.length>n;n++)l.push(t("stop",{offset:e[n].offset,stopColor:e[n].color},n))}else{const n=ut(e.style.fill);l.push(t("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return t("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:ut(i.style.fill);if(i.cornerRadii&&st(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=at(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:n,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},h)}if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+d-n} A${n},${n} 0 0 0 ${r+n},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r+n},${l+d} A${n},${n} 0 0 1 ${r},${l+d-n} Z`;break;default:u=`M${r},${l+d} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d} Z`}return e(o.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(o.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=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:ut(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=n;let o;if(e.roundedEnds)o=ct({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundedEnds.start,roundEnd:e.roundedEnds.end});else{const t=T().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&t.cornerRadius(e.cornerRadius),o=t(dt)||""}return t("path",{d:o,transform:`translate(${e.cx},${e.cy})`,fill:ut(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},h)}case"boxplot":{const o=n,i=o.columnWidth/2;return e("g","vertical"===o.projection?{children:[t("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:ut(o.style.fill),fillOpacity:null!==(s=o.style.fillOpacity)&&void 0!==s?s:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:ut(o.style.fill),fillOpacity:null!==(a=o.style.fillOpacity)&&void 0!==a?a:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},h)}case"violin":{const e=n,o=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:ut(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 n=e.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.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"))):o.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:o},h)}case"connector":return t("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(c=n.style.opacity)&&void 0!==c?c:.5},h);case"trapezoid":{const e=n,o=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:o,fill:ut(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},h)}default:return null}}(n,i)).filter(Boolean)]})]}),t(ot,{width:Ut,height:en,totalWidth:Qt[0],totalHeight:Qt[1],margin:Kt,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:pn,rLabel:yn,oFormat:mn,rFormat:vn,rTickValues:Fe,tickLabelEdgeAlign:Ee,axisExtent:Ne,showGrid:Ye,title:kt,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Je,legendPosition:et,foregroundGraphics:Ae(tn,null===(g=Fn.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:Ve,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:co,yAccessor:uo,annotationData:ho(null==n?void 0:n.getData())}),St&&"radial"===I&&t("div",{style:{position:"absolute",left:Kt.left+Ut/2,top:Kt.top+en/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:St})]})}return e("div",{ref:Yt,className:"stream-ordinal-frame"+(At?" "+At:""),role:"group","aria-label":It||("string"==typeof kt?kt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:E?"100%":Qt[0],height:N?"100%":Qt[1],overflow:"visible"},onKeyDown:no,children:[$t&&t(Nt,{tableId:an}),$t&&t(Ft,{scene:null!==(y=null===(p=Fn.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],chartType:A+" chart",tableId:an,chartTitle:"string"==typeof kt?kt:void 0}),t(Et,{summary:Rt}),e("div",{role:"img","aria-label":It||("string"==typeof kt?kt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:$n?oo:void 0,onMouseLeave:$n?Un:void 0,children:[nn&&t("svg",{style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1],pointerEvents:"none"},children:t("g",{transform:`translate(${Kt.left},${Kt.top})`,children:nn})}),t(tt,{width:Ut,height:en,totalWidth:Qt[0],totalHeight:Qt[1],margin:Kt,scales:jn,showAxes:be,showGrid:Ye,rFormat:vn,rTickValues:Fe,axisExtent:Ne}),t("canvas",{ref:bn,"aria-label":Pt(null!==(v=null===(m=Fn.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:Qt[0],height:Qt[1]}}),t(Wt,{hoverPoint:On}),t(ot,{width:Ut,height:en,totalWidth:Qt[0],totalHeight:Qt[1],margin:Kt,scales:jn,showAxes:be,showCategoryTicks:xe,oLabel:pn,rLabel:yn,oFormat:mn,rFormat:vn,rTickValues:Fe,axisExtent:Ne,showGrid:Ye,title:kt,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Je,legendPosition:et,foregroundGraphics:Ae(tn,Tn),annotations:Ve,svgAnnotationRules:Xe,annotationFrame:Cn,xAccessor:co,yAccessor:uo,annotationData:ho(null===(b=Fn.current)||void 0===b?void 0:b.getData()),underlayRendered:!0}),(Ht||Bt)&&"radial"!==I&&t(rt,{width:Ut,height:en,totalWidth:Qt[0],totalHeight:Qt[1],margin:Kt,scales:jn,onBrush:Bt||(()=>{})}),St&&"radial"===I&&t("div",{style:{position:"absolute",left:Kt.left+Ut/2,top:Kt.top+en/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:St}),(null==Tt?void 0:Tt.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Tt.badgePosition?{top:4,left:4}:"bottom-left"===Tt.badgePosition?{bottom:4,left:4}:"bottom-right"===Tt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Pn?"#dc3545":"#28a745",color:"white"}),children:Pn?"STALE":"LIVE"}),t(Gt,{active:Jn.current>=0,hoverPoint:On,margin:Kt,size:Qt,shape:null===(x=eo.current)||void 0===x?void 0:x.shape,width:null===(w=eo.current)||void 0===w?void 0:w.w,height:null===(k=eo.current)||void 0===k?void 0:k.h}),so]})]})});function Vn(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function Xn(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function Yn(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Qt(t)||n}}qn.displayName="StreamOrdinalFrame";const Qn=h(null);function Zn(){return d(Qn)}function Kn(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function Un(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Jn,eo]=Kt(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Un(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=Un(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[to,no]=Kt(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let oo={positions:new Map};const io=new Set;function ro(){for(const e of io)e()}function so(e,t){const n=oo.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(oo.positions);o.delete(e),oo={positions:o},ro()}function ao(e){const t=p(),n=e.clientId||t,{name:o}=e,i=eo(e=>e.selections.get(o)),s=eo(e=>e.setClause),a=eo(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Kn(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:u(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:u(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:u(()=>{a(o,n)},[a,o,n]),clientId:n}}function lo(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const co=h(!1),uo=h(null),ho="undefined"==typeof window?i:c;function go(e){const t=d(uo),n=p(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),i=s([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i.current,o)||(i.current=o);const r=i.current;ho(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ho(()=>{t&&t.registerCategories(n,r)},[t,n,r])}function fo({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&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?o(s,t,n):n?n(i):he[r%he.length];return{label:i+"",color:a}}),label:""}]}}function po(){return ln(e=>e.theme)}function yo(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function mo(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 vo(){var e;const t=po(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function bo(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const xo={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 wo(e,t,n){var o,i,r,s,a,l,c;const d=xo[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?d.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?d.height:n.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:ko(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function ko(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Ao(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Oo(e,t){if(!t)return Ao(e);try{const n=t(e);return null==n?Ao(e):n}catch(t){return Ao(e)}}function So(e,t){return"function"==typeof t?t(e):e[t]}function jo({categoryAccessor:n,valueAccessor:o,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=So(d,n),h=So(d,o),g=i?So(d,i):void 0;return e("div",{className:"semiotic-tooltip",style:qt,children:[t("div",{style:{fontWeight:"bold"},children:Ao(u)}),t("div",{style:{marginTop:4},children:Oo(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(f=i,"string"==typeof f?f:"value"),": ",Ao(g)]})]});var f}}function _o({componentName:n,message:o,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:n}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),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 Co extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,n=this.state.error;return"function"==typeof e?e(n):void 0!==e?e:t(_o,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Mo;const Po="undefined"!=typeof process&&"production"!==(null===(Mo=process.env)||void 0===Mo?void 0:Mo.NODE_ENV);function Lo({componentName:e,width:n,height:o,children:i}){return t(Co,{fallback:i=>t(_o,{componentName:e,message:i.message,width:n,height:o}),children:i})}const To={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"},Ho={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Bo(e,t,n,o){if(!Po)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function $o(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Io(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=$o(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Ro({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=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(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Io(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Do(e){const{data:n,rawData:o,colorBy:s,colorScheme:l,legendInteraction:c,legendPosition:h,selection:g,linkedHover:f,fallbackFields:y,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,hoverHighlight:S,loading:j,loadingContent:_,emptyContent:C,width:M,height:P}=e,L=void 0===o,T=r(()=>D(n),[n]),[H,B]=a([]),$=u(e=>{B(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:F,customHoverBehavior:E,customClickBehavior:N,crosshairSourceId:W}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!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,n),m=ao({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=ao({name:t});return{onHover:u(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=no(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,k]=a(null),A=g||n[0],O=r(()=>{if(!h||null==w||!A)return null;const e=w,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,A]),S=u(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=yo(e,t,y.xField);null!=n&&function(e,t,n){const o=oo.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(oo={positions:new Map(oo.positions).set(e,{xValue:t,sourceId:n})},ro())}(y.name||"hover",n,f)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&so(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];k(null!=n?n+"":null)}else k(null);if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const i=mo(e),r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,y,f,s,l,c,b,h,A]),j=u(e=>{var t,n,o,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 n=yo(e,t,y.xField);null!=n&&function(e,t,n){const o=oo.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(oo.positions);return t.delete(e),oo={positions:t},ro(),!1}oo={positions:new Map(oo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},ro()}(y.name||"hover",n,f)}if(e&&d){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),d(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const n=mo(e),r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o: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 n=oo.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(oo.positions);o.delete(e),oo={positions:o},ro()}(e,f),so(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:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:S,colorByField:I}),z=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(f,W),G=function(e,t,n){const o=Zn(),i=vo();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=pe(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return pe(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=pe(e,t,s);return e=>o[e]||n(e)}return pe(e,t,s)}if(o&&Object.keys(o).length>0){const e=pe([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(T,s,l),q=r(()=>{if(!s)return[];const e=new Set;for(const t of T){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[T,s]),V=r(()=>L&&H.length>0?H:q,[L,H,q]),X=function(e,t,n){const[o,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 o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(c,s,V),Y=r(()=>F||(X.legendSelectionHook?X.legendSelectionHook:R),[F,X.legendSelectionHook,R]),Q=function(e){const t=ln(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),Z=vo(),K=Zn(),U=r(()=>{if(G)return G;if(!s||0===V.length)return;const e=Array.isArray(l)&&l.length>0||"string"==typeof l&&l.length>0?l:Z&&Z.length>0?Z:he,t="__streamCat",n=pe(V.map(e=>({[t]:e})),t,e);return e=>(null==K?void 0:K[e])||n(e)||"#999"},[G,s,V,l,Z,K]),{legend:J,margin:ee,legendPosition:te}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=d(co),u=null!==d(uo),h=void 0!==o?o:!c&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==l)return l;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[l,t,e,g]);go(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=fo({data:e,colorBy:t,colorScale:n,getColor:fe,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[h,t,e,n,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),n=t=>null!=e[t];return p&&("right"===i&&!n("right")&&110>t.right?t.right=110:"left"===i&&!n("left")&&110>t.left?t.left=110:"top"===i&&!n("top")&&50>t.top?t.top=50:"bottom"===i&&!n("bottom")&&80>t.bottom&&(t.bottom=80)),t},[a,s,p,i]);return{legend:p,margin:y,legendPosition:i}}({data:T,colorBy:s,colorScale:U,showLegend:w,legendPosition:h,userMargin:k,defaults:A,categories:V}),ne=r(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te),c&&"none"!==c&&(e.legendHoverBehavior=X.onLegendHover,e.legendClickBehavior=X.onLegendClick,e.legendHighlightedCategory=X.highlightedCategory,e.legendIsolatedCategories=X.isolatedCategories),L&&s&&(e.legendCategoryAccessor=s,e.onCategoriesChange=$),e},[J,te,c,X.onLegendHover,X.onLegendClick,X.highlightedCategory,X.isolatedCategories,L,s,$]),oe=Array.isArray(o)?D(o):o,ie=function(e,n,o,i){if(!e)return null;if(!1===i)return null;if(null!=i)return t("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return t("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Ho),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(j,M,P,_),re=ie?null:function(e,n,o,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},To),{width:n,height:o}),children:i||"No data available"}):null}(oe,M,P,C);return{data:T,colorScale:G,allCategories:V,legendState:X,effectiveSelectionHook:Y,activeSelectionHook:R,customHoverBehavior:E,customClickBehavior:N,legend:J,margin:ee,legendPosition:te,earlyReturn:ie||re||null,legendBehaviorProps:ne,crosshairProps:z,resolvedSelection:Q}}function Fo({ref:e,frameRef:t,setup:n}){return f(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function Eo(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function No(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=fe(e,t,n)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=de[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(o,i,s,f?r:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,s,a,f,p,y]),v=r(()=>Eo(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:d,opacity:u}),[m,l,c,d,u]);return r(()=>{return e=v,n=g,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,g])}function Wo(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}const zo=g(function(e,n){const o=wo(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:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:H,emptyContent:B,legendInteraction:$,legendPosition:I,color:R,stroke:F,strokeWidth:E,opacity:N,showCategoryTicks:W,categoryFormat:z,dataIdAccessor:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:Z,description:K,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,ne=r(()=>D(a),[a]),oe=Do({data:ne,rawData:a,colorBy:f,colorScheme:p,legendInteraction:$,legendPosition:I,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:H,emptyContent:B,width:q,height:V}),{effectiveLegendProps:ie,effectiveMargin:re}=Fo({ref:n,frameRef:i,setup:oe});if(oe.earlyReturn)return oe.earlyReturn;Bo("BarChart",ne,"categoryAccessor",d),Bo("BarChart",ne,"valueAccessor",u);const se=bo(ne,y,u),ae=vo(),le=r(()=>new Map,[ne]),ce=No({colorBy:f,colorScale:oe.colorScale,color:R,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:F,strokeWidth:E,opacity:N,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),de=r(()=>jo({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),ue=Ro({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return t(_o,{componentName:"BarChart",message:ue,width:q,height:V});const he=Wo(A),ge=he?[he,...k||[]]:k,fe=Object.assign(Object.assign(Object.assign(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:se}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),G&&{dataIdAccessor:G}),{baselinePadding:x,enableHover:X,showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:g}),z&&{oFormat:z}),{showGrid:Y,showCategoryTicks:W,oSort:y}),ie),Vn({title:Z,description:K,summary:U,accessibleTable:J,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:w,defaultTooltipContent:de})),Xn({linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),ge&&ge.length>0&&{annotations:ge}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"BarChart",width:q,height:V,children:t(qn,Object.assign({ref:i},fe))})});zo.displayName="BarChart";const Go=g(function(e,n){const o=wo(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:m=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:H,emptyContent:B,legendInteraction:$,legendPosition:I,color:R,stroke:F,strokeWidth:E,opacity:N,categoryFormat:W}=e,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=o,ee=r(()=>D(a),[a]),te=p||u,ne=Do({data:ee,rawData:a,colorBy:te,colorScheme:y,legendInteraction:$,legendPosition:I,selection:j,linkedHover:_,fallbackFields:te?["string"==typeof te?te:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:H,emptyContent:B,width:z,height:G});if(ne.earlyReturn)return ne.earlyReturn;const oe=vo(),ie=r(()=>new Map,[ee]),re=No({colorBy:te,colorScale:ne.colorScale,color:R,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:F,strokeWidth:E,opacity:N,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),se=r(()=>jo({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ae=Ro({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Fo({ref:n,frameRef:i,setup:ne}),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:"bar"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[z,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:V}),le),Vn({title:Y,description:Q,summary:Z,accessibleTable:K,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:k,defaultTooltipContent:se})),Xn({linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ae?t(_o,{componentName:"StackedBarChart",message:ae,width:z,height:G}):t(Lo,{componentName:"StackedBarChart",width:z,height:G,children:t(qn,Object.assign({ref:i},de))})});Go.displayName="StackedBarChart";const qo=g(function(e,n){const o=wo(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:m=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,loadingContent:T,emptyContent:H,legendInteraction:B,legendPosition:$,color:I,stroke:R,strokeWidth:F,opacity:E,categoryFormat:N}=e,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=o,J=r(()=>D(a),[a]),ee=p||u,te=Do({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:B,legendPosition:$,selection:S,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"GroupedBarChart",chartId:P,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:H,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const ne=vo(),oe=r(()=>new Map,[J]),ie=No({colorBy:ee,colorScale:te.colorScale,color:I,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:O.pieceStyle,stroke:R,strokeWidth:F,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>jo({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),se=Ro({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=Fo({ref:n,frameRef:i,setup:te}),ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q}),ae),Vn({title:X,description:Y,summary:Q,accessibleTable:Z,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:w,defaultTooltipContent:re})),Xn({linkedHover:j,onObservation:_,onClick:C,hoverHighlight:M,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 se?t(_o,{componentName:"GroupedBarChart",message:se,width:W,height:z}):t(Lo,{componentName:"GroupedBarChart",width:W,height:z,children:t(qn,Object.assign({ref:i},ce))})});function Vo({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=ao({name:t}),c=n&&o?"xyBrush":n?"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)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&lo(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&lo(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,o,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 o?o:"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||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}qo.displayName="GroupedBarChart";const Xo=g(function(e,n){const o=wo(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:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:C,chartId:M,loading:P,loadingContent:L,emptyContent:T,legendInteraction:H,legendPosition:B,color:$,stroke:I,strokeWidth:R,opacity:F,categoryFormat:E,rTickValues:N,tickLabelEdgeAlign:W,showCategoryTicks:z,gradientFill:G,trackFill:q,roundedTop:V,valueExtent:X}=e,{width:Y,height:Q,enableHover:Z,showGrid:K,showLegend:U,title:J,description:ee,summary:te,accessibleTable:ne,categoryLabel:oe,valueLabel:ie}=o,re=r(()=>D(a),[a]),se=p||u,ae=r(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(re.map(e=>"function"==typeof d?d(e):e[d])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?Q:Y)-2*n)/(n-1))):1},[m,e.mode,re,d,g,Y,Q]),le=Do({data:re,rawData:a,colorBy:se,colorScheme:y,legendInteraction:H,legendPosition:B,selection:O,linkedHover:S,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:C,chartType:"SwimlaneChart",chartId:M,showLegend:U,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:Y,height:Q}),ce=Vo({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h});if(le.earlyReturn)return le.earlyReturn;const de=vo(),ue=r(()=>new Map,[re]),he=No({colorBy:se,colorScale:le.colorScale,color:$,themeCategorical:de,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:I,strokeWidth:R,opacity:F,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,cycleByCategory:!0}),ge=r(()=>jo({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),fe=Ro({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:pe,effectiveMargin:ye}=Fo({ref:n,frameRef:i,setup:le}),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(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:re}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:he,size:[Y,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:ae,enableHover:Z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===z?void 0:oe,rLabel:ie,rFormat:f}),N&&{rTickValues:N}),null!=W&&{tickLabelEdgeAlign:W}),E&&{oFormat:E}),void 0!==z&&{showCategoryTicks:z}),{showGrid:K}),pe),Vn({title:J,description:ee,summary:te,accessibleTable:ne,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:v,defaultTooltipContent:ge})),Xn({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:C,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),b&&b.length>0&&{annotations:b}),G&&{gradientFill:!0===G?{topOpacity:.8,bottomOpacity:.05}:G}),null!=q&&{trackFill:q}),null!=V&&{roundedTop:V}),X&&{rExtent:X}),ce.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return fe?t(_o,{componentName:"SwimlaneChart",message:fe,width:Y,height:Q}):t(Lo,{componentName:"SwimlaneChart",width:Y,height:Q,children:t(qn,Object.assign({ref:i},me))})});function Yo(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;f(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Xo.displayName="SwimlaneChart";const Qo=g(function(e,n){const o=wo(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);Yo(n,{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:m=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:A,brush:O,onBrush:S,linkedBrush:j,frameProps:_={},selection:C,linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,chartId:H,loading:B,loadingContent:$,emptyContent:I,legendInteraction:R,legendPosition:F,color:E,stroke:N,strokeWidth:W,opacity:z,showCategoryTicks:G,categoryFormat:q}=e,{width:V,height:X,enableHover:Y,showGrid:Q,showLegend:Z,title:K,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=o,oe=r(()=>D(a),[a]),ie=Do({data:oe,rawData:a,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:F,selection:C,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:H,showLegend:Z,userMargin:l,marginDefaults:o.marginDefaults,loading:B,loadingContent:$,emptyContent:I,width:V,height:X}),re=Vo({brushProp:O,onBrushProp:S,linkedBrush:j,valueAccessor:u});if(ie.earlyReturn)return ie.earlyReturn;const se=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]),ae=vo(),le=r(()=>new Map,[oe]),ce=No({colorBy:f,colorScale:ie.colorScale,color:E,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:null==_?void 0:_.pieceStyle,stroke:N,strokeWidth:W,opacity:z,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?ye(e,y,m,se):v})}),de=r(()=>jo({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),ue=Ro({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return t(_o,{componentName:"SwarmPlot",message:ue,width:V,height:X});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({chartType:"swarm"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[V,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,barPadding:x,enableHover:Y}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:te,rLabel:ne,rFormat:g}),q&&{oFormat:q}),{showGrid:Q,showCategoryTicks:G}),ie.legendBehaviorProps),Vn({title:K,description:U,summary:J,accessibleTable:ee,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:w,defaultTooltipContent:de})),Xn({linkedHover:M,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),re.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"SwarmPlot",width:V,height:X,children:t(qn,Object.assign({ref:i},he))})});function Zo(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:qt,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==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),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:qt,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:qt,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}Qo.displayName="SwarmPlot";const Ko=g(function(e,n){const o=wo(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);Yo(n,{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:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:C,loadingContent:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:H,stroke:B,strokeWidth:$,opacity:I,showCategoryTicks:R,categoryFormat:F}=e,{width:E,height:N,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=o,K=r(()=>D(a),[a]),U=Do({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,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:G,userMargin:l,marginDefaults:o.marginDefaults,loading:C,loadingContent:M,emptyContent:P,width:E,height:N});if(U.earlyReturn)return U.earlyReturn;const J=vo(),ee=r(()=>new Map,[K]),te=No({colorBy:f,colorScale:U.colorScale,color:H,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:void 0,stroke:B,strokeWidth:$,opacity:I,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=r(()=>Zo(),[]),oe=Ro({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(oe)return t(_o,{componentName:"BoxPlot",message:oe,width:E,height:N});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,showOutliers:y,size:[E,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:m,enableHover:W}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:z,showCategoryTicks:R}),U.legendBehaviorProps),Vn({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:v,defaultTooltipContent:ne})),Xn({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"BoxPlot",width:E,height:N,children:t(qn,Object.assign({ref:i},ie))})});Ko.displayName="BoxPlot";const Uo=g(function(n,o){const i=wo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);Yo(o,{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:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:H,emptyContent:B,legendInteraction:$,legendPosition:I,color:R,stroke:F,strokeWidth:E,opacity:N,showCategoryTicks:W,categoryFormat:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=r(()=>D(l),[l]),ne=Do({data:te,rawData:l,colorBy:y,colorScheme:m,legendInteraction:$,legendPosition:I,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"Histogram",chartId:L,showLegend:Y,userMargin:c,marginDefaults:i.marginDefaults,loading:T,loadingContent:H,emptyContent:B,width:G,height:q}),oe=Vo({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:h});if(ne.earlyReturn)return ne.earlyReturn;const ie=r(()=>{if(0===te.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of te){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[te,h]),re=vo(),se=r(()=>new Map,[te]),ae=No({colorBy:y,colorScale:ne.colorScale,color:R,themeCategorical:re,colorScheme:m,categoryIndexMap:se,userPieceStyle:void 0,stroke:F,strokeWidth:E,opacity:N,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),le=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return e("div",{className:"semiotic-tooltip",style:qt,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=Ro({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ce)return t(_o,{componentName:"Histogram",message:ce,width:G,height:q});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:te}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),w?{rExtent:w}:ie&&{rExtent:ie}),{size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:p}),z&&{oFormat:z}),{showGrid:X,showCategoryTicks:W}),ne.legendBehaviorProps),Vn({title:Q,description:Z,summary:K,accessibleTable:U,className:d,animate:n.animate,axisExtent:n.axisExtent})),Yn({tooltip:b,defaultTooltipContent:le})),Xn({linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),x&&x.length>0&&{annotations:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"Histogram",width:G,height:q,children:t(qn,Object.assign({ref:a},de))})});Uo.displayName="Histogram";const Jo=g(function(e,n){const o=wo(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);Yo(n,{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:m,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:A,linkedBrush:O,frameProps:S={},selection:j,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,loading:T,loadingContent:H,emptyContent:B,legendInteraction:$,legendPosition:I,color:R,stroke:F,strokeWidth:E,opacity:N,showCategoryTicks:W,categoryFormat:z}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=o,te=r(()=>D(a),[a]),ne=Do({data:te,rawData:a,colorBy:y,colorScheme:m,legendInteraction:$,legendPosition:I,selection:j,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:H,emptyContent:B,width:G,height:q}),oe=Vo({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const ie=vo(),re=r(()=>new Map,[te]),se=No({colorBy:y,colorScale:ne.colorScale,color:R,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:F,strokeWidth:E,opacity:N,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ae=r(()=>Zo({valueAccessor:u}),[u]),le=Ro({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(le)return t(_o,{componentName:"ViolinPlot",message:le,width:G,height:q});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:te}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:se,bins:g,showIQR:f,size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:p}),z&&{oFormat:z}),{showGrid:X,showCategoryTicks:W}),ne.legendBehaviorProps),Vn({title:Q,description:Z,summary:K,accessibleTable:U,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:b,defaultTooltipContent:ae})),Xn({linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"ViolinPlot",width:G,height:q,children:t(qn,Object.assign({ref:i},ce))})});Jo.displayName="ViolinPlot";const ei=g(function(e,n){var o;const i=wo(e.mode,{width:e.width,height:e.height,showGrid:null===(o=e.showGrid)||void 0===o||o,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);Yo(n,{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:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:C,hoverHighlight:M,chartId:P,loading:L,loadingContent:T,emptyContent:H,legendInteraction:B,legendPosition:$,color:I,stroke:R,strokeWidth:F,opacity:E,categoryFormat:N}=e,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=r(()=>D(l),[l]),ee=Do({data:J,rawData:l,colorBy:p,colorScheme:y,legendInteraction:B,legendPosition:$,selection:S,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:C,hoverHighlight:M,chartType:"DotPlot",chartId:P,showLegend:V,userMargin:c,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:H,width:W,height:z});if(ee.earlyReturn)return ee.earlyReturn;const te=bo(J,m,h),ne=vo(),oe=r(()=>new Map,[J]),ie=No({colorBy:p,colorScale:ee.colorScale,color:I,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:R,strokeWidth:F,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),re=r(()=>jo({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),se=Ro({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(se)return t(_o,{componentName:"DotPlot",message:se,width:W,height:z});const ae=Wo(k),le=ae?[ae,...w||[]]:w,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:"point"},null!=l&&{data:te}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:b,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q,oSort:m}),ee.legendBehaviorProps),Vn({title:X,description:Y,summary:Q,accessibleTable:Z,className:d,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:x,defaultTooltipContent:re})),Xn({linkedHover:j,onObservation:_,onClick:C,hoverHighlight:M,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),le&&le.length>0&&{annotations:le}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"DotPlot",width:W,height:z,children:t(qn,Object.assign({ref:a},ce))})});ei.displayName="DotPlot";const ti=g(function(e,n){var o,i;const a=wo(e.mode,{width:null!==(o=e.width)&&void 0!==o?o: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:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,loadingContent:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:$}=e,{width:I,height:R,enableHover:F,showLegend:E,title:N,description:W,summary:z,accessibleTable:G}=a,q=r(()=>D(c),[c]),V=f||h,X=Do({data:q,rawData:c,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"PieChart",chartId:j,showLegend:E,userMargin:d,marginDefaults:a.marginDefaults,loading:_,loadingContent:C,emptyContent:M,width:I,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=vo(),Q=r(()=>new Map,[q]),Z=No({colorBy:V,colorScale:X.colorScale,color:T,themeCategorical:Y,colorScheme:p,categoryIndexMap:Q,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:H,strokeWidth:B,opacity:$,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),K=r(()=>jo({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),U=Ro({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:ee}=Fo({ref:n,frameRef:l,setup:X}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:q}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Z,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),J),Vn({title:N,description:W,summary:z,accessibleTable:G,className:u,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:v,defaultTooltipContent:K})),Xn({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return U?t(_o,{componentName:"PieChart",message:U,width:I,height:R}):t(Lo,{componentName:"PieChart",width:I,height:R,children:t(qn,Object.assign({ref:l},te))})});ti.displayName="PieChart";const ni=g(function(e,n){const o=wo(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:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,loadingContent:C,emptyContent:M,legendInteraction:P,legendPosition:L,color:T,stroke:H,strokeWidth:B,opacity:$}=e,{width:I,height:R,enableHover:F,showLegend:E,title:N,description:W,summary:z,accessibleTable:G}=o,q=r(()=>D(a),[a]),V=f||d,X=Do({data:q,rawData:a,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"DonutChart",chartId:j,showLegend:E,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:C,emptyContent:M,width:I,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=null!=h?h:Math.max(2,.15*Math.min(I,R)),Q=vo(),Z=r(()=>new Map,[q]),K=No({colorBy:V,colorScale:X.colorScale,color:T,themeCategorical:Q,colorScheme:p,categoryIndexMap:Z,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:H,strokeWidth:B,opacity:$,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),U=r(()=>jo({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),J=Ro({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:ee,effectiveMargin:te}=Fo({ref:n,frameRef:i,setup:X}),ne=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:q}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:Y,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:F}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),Vn({title:N,description:W,summary:z,accessibleTable:G,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:v,defaultTooltipContent:U})),Xn({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(_o,{componentName:"DonutChart",message:J,width:I,height:R}):t(Lo,{componentName:"DonutChart",width:I,height:R,children:t(qn,Object.assign({ref:i},ne))})});function oi(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}ni.displayName="DonutChart";const ii=g(function(n,o){const i=wo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.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,cornerRadius:m,showNeedle:v=!0,needleColor:b="var(--semiotic-text, #333)",centerContent:x,valueFormat:w,showScaleLabels:k=!c,sweep:A=240,fillZones:O=!0,tooltip:S,annotations:j,frameProps:_={},className:C,stroke:M,strokeWidth:P,opacity:L}=n,{width:T,height:H,title:B,description:$,summary:I,accessibleTable:R}=i,D=Math.max(u,Math.min(h,d)),F=h-u||1,E=(D-u)/F,{gaugeData:N,pieceStyle:W,gaugeAnnotations:z}=r(()=>{const e=[],t=new Map,n=[];let o=g&&g.length>0?[...g].sort((e,t)=>e.value-t.value):[{value:h,color:f||"var(--semiotic-primary, #007bff)"}];o=o.map(e=>Object.assign(Object.assign({},e),{value:Math.max(u,Math.min(h,e.value))})),h>o[o.length-1].value&&o.push({value:h,color:o[o.length-1].color});let i=u;for(let n=0;o.length>n;n++){const r=o[n],s=(r.value-i)/F;if(O){const o=(i-u)/F,a=Math.max(0,Math.min(E,(r.value-u)/F)-o),l=s-a;if(a>0){const o="fill-"+n;e.push({category:o,value:a,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}if(l>0){const o="bg-"+n;e.push({category:o,value:l,_zone:r.label||"Zone "+(n+1),_isFill:!1}),t.set(o,{fill:p,opacity:.4})}}else{const o="zone-"+n;e.push({category:o,value:s,_zone:r.label||"Zone "+(n+1),_isFill:!0}),t.set(o,{fill:r.color})}i=r.value}if(k&&g&&g.length>0)for(const e of g)e.value>u&&h>e.value&&n.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:e,pieceStyle:(e,n)=>t.get(n||e.category)||{fill:p},gaugeAnnotations:n}},[d,u,h,g,f,p,E,F,k,O]),G=r(()=>Eo(W,{stroke:M,strokeWidth:P,opacity:L}),[W,M,P,L]),{sweepRad:q,startAngleDeg:V}=oi(A),X=function(e=240){const{sweepRad:t,offsetRad:n}=oi(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(A),Y=Math.min(10,Math.max(1,Math.min(T,H)/12)),Q=X.cx,Z=X.cy,K=Math.max(4,Math.min((T-2*Y)/X.width,(H-2*Y)/X.height)-2),U=Math.max(0,Math.min(K-1.5,K*(1-y))),J=T/2-Q*K,ee=H/2-Z*K,te=2*(K+4),ne=r(()=>{if(c&&null==x)return null;if(null!=x)return"function"==typeof x?x(D,u,h):x;const n=w?w(D):Math.round(D)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),k&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[x,D,u,h,w,k,K,c]),oe=r(()=>l&&null==x?{type:"gauge-value",text:w?w(D):Math.round(D)+""}:null,[l,x,D,w]),ie=r(()=>{if(!v)return null;const e=-Math.PI/2+V*Math.PI/180+E*q,t=U>20?U-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:b}},[v,E,V,q,U,b]),re=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||T)/2,s=(i.height||H)/2,a=Math.max(1,K-U),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:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const e=-Math.PI/2+V*Math.PI/180+(n.value-u)/F*q,r=U-14,s=(i.height||H)/2;return t("text",{x:(i.width||T)/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:n.label},"gauge-label-"+o)}return"gauge-value"===n.type?t("text",{x:(i.width||T)/2,y:(i.height||H)/2-.2*U,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[T,H,u,F,V,q,U,K]),se=r(()=>{const e=[...z,...j||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,j,ie,oe]),ae=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return 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(D):"Remaining"})]})},[D]);if(0===N.length)return t(_o,{componentName:"GaugeChart",message:"No data to display",width:T,height:H});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:U,startAngle:V,sweepAngle:A},null!=m&&{cornerRadius:m}),{centerContent:ne,size:[T,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ee-te/2,bottom:H-ee-te/2,left:J-te/2,right:T-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:Qt(S)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),B&&{title:B}),$&&{description:$}),I&&{summary:I}),void 0!==R&&{accessibleTable:R}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),_);return t(Lo,{componentName:"GaugeChart",width:T,height:H,children:t(qn,Object.assign({ref:a},le))})});ii.displayName="GaugeChart";const ri=g(function(e,n){const o=wo(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);Yo(n,{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:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,chartId:C,loading:M,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:H,color:B,stroke:$,strokeWidth:I,opacity:R,showCategoryTicks:F,categoryFormat:E}=e,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=o,U=r(()=>D(a),[a]),J=Do({data:U,rawData:a,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:H,selection:A,linkedHover:O,fallbackFields:y?["string"==typeof y?y:""]:["string"==typeof d?d:""],unwrapData:!0,onObservation:S,onClick:j,hoverHighlight:_,chartType:"RidgelinePlot",chartId:C,showLegend:q,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:P,emptyContent:L,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=vo(),te=r(()=>new Map,[U]),ne=No({colorBy:y,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:m,categoryIndexMap:te,userPieceStyle:void 0,stroke:$,strokeWidth:I,opacity:R,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=r(()=>Zo(),[]),ie=Ro({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ie)return t(_o,{componentName:"RidgelinePlot",message:ie,width:N,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:U}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ne,bins:g,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:K,rFormat:p}),E&&{oFormat:E}),{showGrid:G,showCategoryTicks:F,oSort:!1,amplitude:f}),J.legendBehaviorProps),Vn({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:e.animate,axisExtent:e.axisExtent})),Yn({tooltip:b,defaultTooltipContent:oe})),Xn({linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"RidgelinePlot",width:N,height:W,children:t(qn,Object.assign({ref:i},re))})});ri.displayName="RidgelinePlot";const si=g(function(n,o){const i=wo(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);Yo(o,{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:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:C,loadingContent:M,emptyContent:P,legendInteraction:L,legendPosition:T,color:H,stroke:B,strokeWidth:$,opacity:I,categoryFormat:R}=n,F="vertical"===y,{width:E,height:N,enableHover:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X}=i,Y=F?{top:G?60:40,right:20,bottom:60,left:60}:{top:G?40:10,right:10,bottom:10,left:10},Q=r(()=>D(l),[l]),Z=f||g,K=!Z,U=Do({data:Q,rawData:l,colorBy:Z,colorScheme:p,legendInteraction:L,legendPosition:T,selection:k,linkedHover:A,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"FunnelChart",chartId:_,showLegend:z,userMargin:c,marginDefaults:Y,loading:C,loadingContent:M,emptyContent:P,width:E,height:N});if(U.earlyReturn)return U.earlyReturn;Bo("FunnelChart",Q,"stepAccessor",u),Bo("FunnelChart",Q,"valueAccessor",h);const J=vo(),ee=r(()=>new Map,[Q]),te=r(()=>{if(K)return H||((null==J?void 0:J[0])?J[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,H,J,p]),ne=No({colorBy:te?void 0:Z,colorScale:U.colorScale,color:null!=te?te:H,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:B,strokeWidth:$,opacity:I,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,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!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(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:qt,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]})]})},[]),ie=Ro({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(ie)return t(_o,{componentName:"FunnelChart",message:ie,width:E,height:N});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:F?"bar-funnel":"funnel"},null!=l&&{data:Q}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:F?"vertical":"horizontal",barPadding:F?40:0,pieceStyle:ne,size:[E,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:F,showCategoryTicks:F}),R&&{oFormat:R}),{showGrid:F}),!F&&{connectorOpacity:m}),{showLabels:v}),U.legendBehaviorProps),G&&{title:G}),q&&{description:q}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?oe:Qt(b)||oe}),(A||O||S||j)&&{customHoverBehavior:U.customHoverBehavior}),(O||S||A)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(Lo,{componentName:"FunnelChart",width:E,height:N,children:t(qn,Object.assign({ref:a},re))})});si.displayName="FunnelChart";const ai={RdBu:oe,PiYG:ie,PRGn:re,BrBG:se,RdYlBu:ae,RdYlGn:le,Spectral:ce},li="__likert_neutral_neg",ci="__likert_neutral_pos";function di(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ui(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function hi(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:li,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:ci,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function gi(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===li?r=n:n.__likertLevel===ci?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const fi=new Map,pi=g(function(e,n){const i=wo(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:m="count",levels:v,orientation:b="horizontal",colorScheme:x,barPadding:w=20,tooltip:k,annotations:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:C,onClick:M,hoverHighlight:P,chartId:L,valueFormat:T,loading:H,loadingContent:B,emptyContent:$,legendInteraction:I,legendPosition:R,categoryFormat:D,stroke:F,strokeWidth:E,opacity:N}=e,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=po();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=ai[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:se,accumulatorRef:ae}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:c}){const d=!i,h=r(()=>di(n,"question"),[n]),g=r(()=>d?di(o,"score"):null,[d,o]),f=r(()=>d?null:di(i,"level"),[d,i]),p=r(()=>d?null:di(a,"count"),[d,a]),y=e||[],m=s([]),v=r(()=>{if(0===y.length)return[];let e=ui(y,t,h,g,f,p);return l&&(e=hi(e,t),e=gi(e,t)),e},[y,t,h,g,f,p,l]),b=u(e=>{var n;let o=ui(e,t,h,g,f,p);l&&(o=hi(o,t),o=gi(o,t)),null===(n=c.current)||void 0===n||n.replace(o)},[t,h,g,f,p,l,c]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:p,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:l}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const l=s(new Set),c=s([]),[d,h]=a(0),g=Zn(),f=vo(),p=u(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=u(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||l.current.has(t)||(l.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=u(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(l.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=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)},[]);go(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:he,s=t,a=i.map(e=>({[s]:e})),l=pe(a,s,r);return fo({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:fe})},[e,t,o,n,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:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:V,legendPosition:R}),de=u(ce.wrapPush(e=>{ae.current.push(e),se(ae.current)}),[ce.wrapPush,se,ae]),ue=u(ce.wrapPushMany(e=>{ae.current.push(...e),se(ae.current)}),[ce.wrapPushMany,se,ae]);f(n,()=>({push:de,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ae.current=[],ce.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}}),[de,ue,ce.resetCategories,ae]);const ge=Do({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:I,legendPosition:R,selection:j,linkedHover:_,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:V,userMargin:d,marginDefaults:i.marginDefaults,loading:H,loadingContent:B,emptyContent:$,width:W,height:z});if(ge.earlyReturn)return ge.earlyReturn;const ye=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),me=No({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:fi,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:F,strokeWidth:E,opacity:N,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===li||i===ci)return{fill:ye};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),ve=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),be=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===li||n===ci?ve:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===li||n===ci?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:qt},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ve]),xe=r(()=>{if(!v||2>v.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&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),Ro({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,p,y,m,v,te]),we=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),ke=r(()=>!1!==V?Object.assign(Object.assign({},ge.legendBehaviorProps),{legend:{legendGroups:we},legendPosition:R||ge.legendPosition||"bottom"}):ge.legendBehaviorProps,[ge.legendBehaviorProps,ge.legendPosition,R,V,we]),Ae=r(()=>{const e=Object.assign({},ge.margin);if(ee&&!1!==V){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(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[ge.margin,ce.streamingMarginAdjust,J,ee,V,R]),Oe=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]),Se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:me,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ae,barPadding:w,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U||(J?void 0:"Percentage"),rFormat:Oe}),D&&{oFormat:D}),{showGrid:q}),ke),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),h&&{className:h}),null!=e.animate&&{animate:e.animate}),void 0!==e.axisExtent&&{axisExtent:e.axisExtent}),{tooltipContent:!1===k?()=>null:!0===k?be:Qt(k)||be}),(_||C||M||P)&&{customHoverBehavior:ge.customHoverBehavior}),(C||M||_)&&{customClickBehavior:ge.customClickBehavior}),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return xe?t(_o,{componentName:"LikertChart",message:xe,width:W,height:z}):t(Lo,{componentName:"LikertChart",width:W,height:z,children:t(qn,Object.assign({ref:l},Se))})});pi.displayName="LikertChart";const yi=g(function(e,n){const{data:o,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:m,onObservation:v,onClick:b,selection:x,linkedHover:w,chartId:k,loading:A,loadingContent:O,emptyContent:S,frameProps:j={}}=e,{frameRef:_,resolved:C,safeData:M,setup:P,earlyReturn:L}=function(e){var t;const n=function(e){const t=s(null);return Yo(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:wo(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:o,normalizedMargin:i}=n,a=Do({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:o.showLegend,userMargin:i,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:a.data,setup:a,earlyReturn:a.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorScheme:p,selection:x,linkedHover:w,onObservation:v,onClick:b,chartId:k,loading:A,loadingContent:O,emptyContent:S,margin:g,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode});if(L)return L;const{width:T,height:H,enableHover:B,showGrid:$,title:I,description:R,summary:D,accessibleTable:F}=C,E=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:M}),{customLayout:i,layoutConfig:a,oAccessor:l,rAccessor:c,oExtent:d,rExtent:u,projection:h,colorScheme:p,size:[T,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,enableHover:B,showAxes:y,showGrid:$,annotations:m}),Vn({title:I,description:R,summary:D,accessibleTable:F,className:f,animate:e.animate,axisExtent:e.axisExtent})),Xn({linkedHover:w,onObservation:v,onClick:b,hoverHighlight:!1,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior})),j);return t(Lo,{componentName:"OrdinalCustomChart",width:T,height:H,children:t(qn,Object.assign({ref:_},E))})});yi.displayName="OrdinalCustomChart";export{zo as BarChart,Ko as BoxPlot,ni as DonutChart,ei as DotPlot,si as FunnelChart,ii as GaugeChart,qo as GroupedBarChart,Uo as Histogram,pi as LikertChart,yi as OrdinalCustomChart,ti as PieChart,ri as RidgelinePlot,Go as StackedBarChart,qn as StreamOrdinalFrame,Qo as SwarmPlot,Xo as SwimlaneChart,Jo as ViolinPlot,Bn as createHatchPattern};
|
|
2
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as o 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 m,scaleBand as v}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 $ from"regression";import{select as B}from"d3-selection";import{brushX as H,brushY as I}from"d3-brush";const R=Object.freeze([]);function F(e){if(!e)return R;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class D{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=F(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=F(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}class E{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class N{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function W(e,t,n){return e+(t-e)*n}function z(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 n=e||t;return e=>+e[n]}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,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Y(e){const t=e.map(V),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return X(e,n,o)}if(e>=1){const[e,o,i]=t[n];return X(e,o,i)}const o=e*n,i=Math.floor(o),r=o-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"],Z=Y(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),K=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"]),ne=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 oe=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:Z,reds:K,greens:U,oranges:J,purples:ee,viridis:te,plasma:ne},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,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ge.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):ue[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%ue.length]}function pe(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return y().domain(o).range(n).unknown("#999");const r=de[n]||de.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return y().domain(o).range(e).unknown("#999")}}function ye(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function me(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function ve(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,d=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,u=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!g&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,u=c+o*d,g=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*d,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:u,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function be(e){var t,n,o;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!==(n=x(e,.5))&&void 0!==n?n:(r+s)/2,q3:null!==(o=x(e,.75))&&void 0!==o?o:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function xe(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}const we={bar:function(e,t){var n,o,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,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(y)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;y&&n>0&&(a/=n);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:o+a),n=0>a?u(i+a)-u(i):u(o)-u(o+a);g.push(me(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(p){const t=u(0>a?i+a:o),n=0>a?u(i)-u(i+a):u(o+a)-u(o);g.push(me(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="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!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,d=[],u="vertical"===c,h=[],g=new Set;for(const e of Object.values(o))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(o)){const t=e.width/f,n=.2*t,o=t-n,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+n/2,a=l(0),u=l(c);d.push(me(r,Math.min(a,u),o,Math.abs(a-u),g,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),u=l(c);d.push(me(Math.min(a,u),r,Math.abs(u-a),o,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 n,o;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!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),d=f&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,n=d(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=d(r)):(b=d(r),x=e.middle);u.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return u},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),d=r(o,e.name),u=d.r||4,h=(7919*n%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:o})}}return l},pie:ve,donut:ve,boxplot:function(e,t){var n,o,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,m=!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!==(n=x(l,.25))&&void 0!==n?n:c,v=null!==(o=x(l,.5))&&void 0!==o?o:(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(m)for(const e of t.pieceData){const n=u(e);if(k>n||n>A){const o=y?t.middle:g(n),i=y?g(n):t.middle;_.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(O),q1Pos:g(f),medianPos:g(v),q3Pos:g(b),maxPos:g(S),stats:{n:l.length,min:O,q1:f,median:v,q3:b,max:S,mean:l.reduce((e,t)=>e+t,0)/l.length},style:j,datum:t.pieceData,category:t.name,outliers:_}),m)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 n,o,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),m=e.width/2*.9;let v="";if(g){v=`M ${e.middle} ${d(r)}`;for(let t=0;f>t;t++){const n=d(r+(t+.5)*a);v+=` L ${e.middle+u[t]/y*m} ${n}`}v+=` L ${e.middle} ${d(s)}`;for(let t=f-1;t>=0;t--){const n=d(r+(t+.5)*a);v+=` L ${e.middle-u[t]/y*m} ${n}`}v+=" Z"}else{v=`M ${d(r)} ${e.middle}`;for(let t=0;f>t;t++)v+=` L ${d(r+(t+.5)*a)} ${e.middle-u[t]/y*m}`;v+=` L ${d(s)} ${e.middle}`;for(let t=f-1;t>=0;t--)v+=` L ${d(r+(t+.5)*a)} ${e.middle+u[t]/y*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const a=null!==(n=x(t,.25))&&void 0!==n?n:r,l=null!==(o=x(t,.5))&&void 0!==o?o:(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:v,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:be(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],d=r.bins||25,u=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=g&&isFinite(g)?g:Math.min(...t),o=null!=f&&isFinite(f)?f:Math.max(...t),i=(o-n)/d||1,r=Array(d).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/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 o=(u?r[t]/h:r[t]/p)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(me(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,y,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,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 o=t[0],i=t[t.length-1],r=(i-o)/u||1,c=Array(u).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),u-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;u>e;e++)m+=` L ${l(o+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;u>e;e++){const n=l(o+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${n}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};d.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:be(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return d},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,d=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(me(n,e.x,i-n,e.width,d,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(me(e.x,n,e.width,i-n,d,t,e.name))}}return l},funnel:function(e,t){var n,o,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,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return f;const b=[],x=new Set;for(const e of v)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 v){const t=new Map;let n=0;for(const o of e.pieceData){const e=h?h(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=u(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>A&&(A=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>A&&(A=o)}if(0===A)return f;const O=new Map;for(const e of b){const t=k[0].groups.get(e);O.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const S=k[0].stepTotal,j=w?.95*p:.9*t.width,_=m().domain([0,A]).range([0,j]),M=null!==(o=e.config.connectorOpacity)&&void 0!==o?o:.3;let C=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,d=0===t,u=o.width,h=.55*u,m=o.x+(u-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=_(o.total))}let t=p,i=p;for(let r=0;b.length>r;r++){const a=b[r],l=n.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:o.name,__funnelIsFirstStep:d,__aggregateValue:l.total,__pieceCount:l.pieces.length,category:a});y&&(0===r&&(S.__funnelStepLabel=o.name,S.__funnelStepLabelX=p,S.__funnelStepLabelY=m,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+c/2,S.__funnelValueLabelY=m,S.__funnelBarW=c),f.push(me(x,m,c,h,w,S,a)),v.set(a,{x:x,y:m,w:c,h:h})}}else{const e=n.stepTotal,t=_(e),s=p-t/2,a=b[0],l="_default"!==a,c=null!==(r=null===(i=n.groups.get(a))||void 0===i?void 0:i.pieces[0])&&void 0!==r?r:o.pieceData[0],u=l?a:o.name,x=g(c,u),w=S>0?e/S*100:0,k=Object.assign(Object.assign({},c),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:d,category:l?a:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=m,k.__funnelBarW=t),f.push(me(s,m,t,h,x,k,u)),v.set(a,{x:s,y:m,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=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.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=n.groups.get(i))||void 0===l?void 0:l.pieces[0])&&void 0!==c?c:o.pieceData[0],category:"_default"===i?o.name:i};f.push(d)}}C=v}return f},"bar-funnel":function(e,t){var n,o,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 n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}y.push({col:e,groups:t,stepTotal:n})}const m=new Map;for(const e of g){const t=null===(n=y[0])||void 0===n?void 0:n.groups.get(e);m.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=d.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],n=t.col,o=0===e,s=e>0?y[e-1]:null,a=n.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=m.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=o?0:Math.max(0,k-y),O=n.x+e*a+l/2,S=v(y),j=v(0)-S,_=c(f.pieces[0],p?h:n.name),M=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name,__barFunnelLabelX:O+d/2,__barFunnelLabelY:v(y+A)});if(u.push(me(O,S,d,j,_,M,p?h:n.name)),A>0){const e=v(y+A),t=S-e,o=Object.assign({},_),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:n.name});u.push(me(O,e,d,t,o,i,p?h:n.name))}}}return u},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,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!==(n=f.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=u?me(s,n.x,a,n.width,o,null,"__track__"):me(n.x,s,n.width,a,o,null,"__track__");d.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=d.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let f;if(u){const r=l(t),s=l(t+o);f=me(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);f=me(e.x,r,e.width,s-r,c,n,i)}h&&(f.fillGradient=h,f.roundedEdge=g),d.push(f),t+=o}if(p>0&&d.length>n){const e=d.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:u?(t.cornerRadii={tl:p,bl:p},o.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},o.cornerRadii={tl:p,tr:p})}}return d}};class ke{constructor(e){this.rExtent=new N,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(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 N)):(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(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),i=t.projection||"vertical",r=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,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=v().domain(r).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=m().domain(s).range([o,n])}else a?(d=v().domain(r).range([0,e.height]).padding(c),u=m().domain(s).range([0,e.width])):(d=v().domain(r).range([0,e.width]).padding(c),u=m().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((o,i)=>{var r;const s=this.rExtents[i];s.dirty&&s.recalculate(n,o);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?m().domain([l,c]).range([0,e.width]):m().domain([l,c]).range([e.height,0])}):[];let h=o;this.rAccessors.length>1&&(h=o.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,r,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,o),this.config.pulse&&this.applyPulse(this.scene,o),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const 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"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.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,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>d&&(d=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>d&&(d=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>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===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>d&&(d=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){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,n,o,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"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let d=null;if(c&&"radial"!==o){d=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),d.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of d)d.set(t,n/e*r)}let u=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,g;d?(c=h,g=d.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.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 n,o;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!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=we[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;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 n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),d.has(n)||d.set(n,[]),d.get(n).push({x:o,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===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1: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 n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=function(e,t,n){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:n}(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!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:xe(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||he,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];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 n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,ke.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._pointQuadtree=b().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let d=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;d||(d=this.getCategoryIndexMap(t));const o=d.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o: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(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const A=new Set,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!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)u?(A.add(d),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o: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 n=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,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 o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=W(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=W(o.x,e._targetX,s),e.y=W(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=W(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=W(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=W(n.x,e._targetX,s),e.y=W(n.y,e._targetY,s),void 0!==n.w&&(e.w=W(n.w,e._targetW,s),e.h=W(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:W(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=W(n.startAngle,e._targetStartAngle,s),e.endAngle=W(n.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]),n=this.getDataId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,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&&!z(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!z(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!z(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(z(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 n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!z(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 N)):(this.getR=G(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!z(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!z(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!z(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function Ae(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:o.createElement(o.Fragment,null,...t)}function Oe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Se(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function je(e,t,n){const o=function(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function _e(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>Oe(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Me(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Se(Math.atan2(i,o)),a=Se(e.startAngle),l=Se(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 Ce(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Pe(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Le(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function Te(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}ke.QUADTREE_THRESHOLD=500;const $e={fill:(e,n)=>t("rect",{style:e,width:n,height:n}),line:(e,n)=>t("line",{style:e,x1:0,y1:0,x2:n,y2:n})};function Be(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,$e[n])(o(e,t),i),r}function He({swatchSize:e}){return t("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ie(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Re=(n,o,i,r,s,a,l,c,d,u,h)=>{const{type:g="fill",styleFn:f,items:p}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===u||void 0===u&&null!=s,{swatchSize:x,labelGap:w,rowHeight:k}=h;return p.forEach((n,u)=>{const h=Be(n,u,g,f,x),A=Ie(n,r,s),O=s&&s.size>0&&s.has(n.label);y.push(e("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&u===l?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?O||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;d(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{d(c,u),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+w+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&t(He,{swatchSize:x}),t("text",{y:x/2,x:x+w,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+u)),m+=k}),y};function Fe({config:n,orientation:i="vertical",width:r=100}){const{colorFn:s,domain:a,label:l,format:c}=n,d=c||(e=>Math.round(100*e)/100+""),u="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let e=0;64>=e;e++){const n=e/64;c.push(t("stop",{offset:100*n+"%",stopColor:s(a[0]+n*(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+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:l}),t("rect",{x:i,y:0,width:o,height:n,fill:`url(#${u})`,rx:2}),t("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:d(a[0])}),t("text",{x:i+o,y:n+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 n=e/64;h.push(t("stop",{offset:100*n+"%",stopColor:s(a[1]-n*(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 De(n){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",legendLayout:f}=n,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),w="vertical"===g?(({legendGroups:e,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=24;const g=[];return e.forEach((e,f)=>{h+=5,g.push(t("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,e.label&&(h+=16,g.push(t("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h+=8),g.push(t("g",{className:"legend-item",transform:`translate(0,${h})`,children:Re(e,o,i,r,s,a,l,f,c,d,u)},"legend-group-"+f)),h+=e.items.length*u.rowHeight+8}),g})({legendGroups:i||[],width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:c,focusedItemIndex:d,onFocusedIndexChange:u,legendInteraction:h,metrics:g})=>{var f;let p=0;const y=[];n.forEach((n,o)=>{var f;let m=0;n.label&&(m+=16);const v=((n,o,i,r,s,a,l,c,d,u,h,g)=>{const{type:f="fill",styleFn:p,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:w,align:k}=h,A=!(!o&&!i),O="isolate"===u||void 0===u&&null!=s,S=y.map(e=>v+b+7*e.label.length),j=[];let _=0,M=0;S.forEach((e,t)=>{const n=0===M?e:M+x+e;g&&g>0&&M>0&&n>g?(j.push({start:_,end:t,width:M}),_=t,M=e):M=n}),y.length>0&&j.push({start:_,end:y.length,width:M}),j.forEach((n,u)=>{let h="center"===k?Math.max(0,((null!=g?g:n.width)-n.width)/2):"end"===k?Math.max(0,(null!=g?g:n.width)-n.width):0;for(let g=n.start;n.end>g;g++){const n=y[g],k=Be(n,g,f,p,v),j=Ie(n,r,s),_=s&&s.size>0&&s.has(n.label);m.push(e("g",{transform:`translate(${h},${u*w})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:A?c===a&&g===l?0:-1:void 0,role:A?"option":void 0,"aria-selected":A&&O?_||!1:void 0,"aria-current":A&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:A?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(g+("ArrowRight"===e.key?1:-1)+y.length)%y.length;d(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:A?e=>{d(c,g),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:A?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:A?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[A&&t("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,_&&t(He,{swatchSize:v}),t("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+g)),h+=S[g]+x}});const C=Math.max(0,...j.map(e=>e.width)),P=j.length;return{items:m,offset:C,totalRows:P,totalHeight:P*w}})(n,r,s,a,l,c,d,o,u,h,g,null!==(f=g.maxWidth)&&void 0!==f?f:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),p+=m+12});const m=null!==(f=g.maxWidth)&&void 0!==f?f:i;let v=p>m?0:"center"===g.align?Math.max(0,(m-p)/2):"end"===g.align?Math.max(0,m-p):0;const b=[];return y.forEach((e,i)=>{const r=n[i];r.label&&(b.push(t("text",{transform:`translate(${v},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),v+=16),b.push(t("g",{className:"legend-item",transform:`translate(${v},0)`,children:e.items},"legend-group-"+i)),v+=e.offset+5,n[i+1]&&b.push(t("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(e.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),t("g",{children:b})})({legendGroups:i||[],title:d,height:h,width:u,customClickBehavior:r,customHoverBehavior:s,highlightedCategory:a,isolatedCategories:l,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:p}),k=!(!r&&!s);return e("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==c&&(void 0!==c||null==l))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==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}),w]})}function Ee(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ne(e){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=e;if(!o)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-m-10),b=s.top):"top"===a?(v=s.left,b=y?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),t("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?t(Fe,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Ee(o)?t(De,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:d,customClickBehavior:u,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):o)});var x}function We(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function ze(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ge(n,o,i,r){if(!n)return t("g",{className:"annotation-note"});const{label:s,title:a,orientation:l,align:c,wrap:d=120,noWrap:u}=n;if(!s&&!a)return t("g",{className:"annotation-note"});let h=l;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let g=c;g&&"dynamic"!==g||(g="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let f="start";"topBottom"===h?"right"===g?f="end":"middle"===g&&(f="middle"):f=0>o?"end":"start";const p=16,y=a?u?[a]:We(a,d):[],m=s?u?[s]:We(s,d):[],v="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,n)=>t("tspan",{x:v,dy:0===n?0:p,children:e},n))},"annotation-note-title")),b=y.length*p),m.length>0&&x.push(t("text",{className:"annotation-note-label",fill:w,textAnchor:f,y:b,children:m.map((e,n)=>t("tspan",{x:v,dy:0===n?0:p,children:e},n))},"annotation-note-label"));let k=null;if((a||s)&&(0!==o||0!==i))if("topBottom"===h){const e=Math.min(d,120);let n=0,o=e;"end"===f?(n=-e,o=0):"middle"===f&&(n=-e/2,o=e/2),k=t("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+m.length)*p+(m.length>0?p:0);let n=0,o=e;"bottom"===g?(n=-e,o=0):"middle"===g&&(n=-e/2,o=e/2),k=t("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const A=Math.max(0,y.length+m.length-1)*p;let O=0;return"topBottom"===h?O=0>i?-(A+2):18:"leftRight"===h&&(O="middle"===g?-(A+p+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===g||0>i?-(A+2):18),e("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[t("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function qe(e,n,o,i,r){var s;const a=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&a.push(t("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(e>0||i>0)&&a.push(t("rect",{width:e,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-e;a.push(t("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;a.push(t("line",{x1:(n.x1||0)-e,y1:i,x2:(n.x2||0)-e,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(t("line",{x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(t("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==e&&a.push(t("path",{d:ze((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return t("g",{className:"annotation-subject",children:a})}function Ve(e,n,o,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,o=s.height||0;if(t>0||o>0){const i=t/2,r=o/2,s=e-i,a=n-r;if(0!==s||0!==a){const e=Math.abs(s),n=Math.abs(a),d=t/2,u=o/2,h=e*u>n*d?d/e:u/n;l=i+s*h,c=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const t=(s.radius||0)+(s.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(a.push(t("line",{x1:l,y1:c,x2:e,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"},"connector-line")),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,s=Math.atan2(n-c,e-l);a.push(t("path",{d:`M${l},${c}L${l+o*Math.cos(s+r)},${c+o*Math.sin(s+r)}L${l+o*Math.cos(s-r)},${c+o*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 Xe(t){const{x:n=0,y:o=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,m=new Set(Array.isArray(f)?f:[]);let v=i||0,b=r||0;null!=s&&(v=s-n),null!=a&&(b=a-o);const x="string"==typeof u?u:"label";if("bracket"===x&&d&&0===v&&0===b)if(void 0!==d.width){v=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;v=e+(0>e?-5:5),b=d.height/2}return e("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":y},p,{children:[!m.has("connector")&&Ve(v,b,c,h,x,d),!m.has("subject")&&qe(x,d,h,n,o),!m.has("note")&&Ge(l,v,b,h)]}))}function Ye(e){var n,o;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!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:e,ny:a});return t(Xe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return t("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return t(Xe,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Qe(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ze(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Ke(e,t,n){var o,i,r,s;const a=e.anchor||"fixed";if("latest"===a){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){const r=n.pointNodes[i];if(r.pointId===e.pointId){const e={x:r.x,y:r.y};return null===(o=n.stickyPositionCache)||void 0===o||o.set(t,e),e}}const r=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,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)}}(n);return r&&(null===(i=n.stickyPositionCache)||void 0===i||i.set(t,r)),r}let l=null,c=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,c=t.y)}if(null!=l&&null!=c||(l=Qe(e,n),c=Ze(e,n)),null!=l&&null!=c)return null===(r=n.stickyPositionCache)||void 0===r||r.set(t,{x:l,y:c}),{x:l,y:c};if("sticky"===a){const e=null===(s=n.stickyPositionCache)||void 0===s?void 0:s.get(t);if(e)return e}return null}function Ue(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Je={linear:L,monotoneX:P,monotoneY:C,step:M,stepAfter:_,stepBefore:j,basis:S,cardinal:O,catmullRom:A};function et(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function tt(o){const{width:i,height:s,totalWidth:a,totalHeight:l,margin:c,scales:d,showAxes:u,showGrid:h,rFormat:g}=o,{rTickValues:f,axisExtent:p}=o,y="radial"===(null==d?void 0:d.projection),m="horizontal"===(null==d?void 0:d.projection),v=r(()=>!d||y?[]:(f||et(d.r,5,p)).map(e=>({value:e,pixel:d.r(e),label:(g||nt)(e)})),[d,g,y,f,p]),b=h&&d&&!y,x=u&&d&&!y;return b||x?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:[b&&t("g",{className:"ordinal-grid",children:v.map((e,n)=>t("line",{x1:m?e.pixel:0,y1:m?0:e.pixel,x2:m?e.pixel:i,y2:m?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),x&&t(n,{children:e(n,m?{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 nt(e){return Math.round(100*e)/100+""}function ot(o){var i,a;const{width:l,height:c,totalWidth:d,totalHeight:u,margin:h,scales:g,showAxes:f,showCategoryTicks:p,oLabel:y,rLabel:m,oFormat:v,rFormat:b,showGrid:x,title:A,legend:O,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M,legendPosition:C="right",legendLayout:P,foregroundGraphics:T,annotations:B,svgAnnotationRules:H,xAccessor:I,yAccessor:R,annotationData:F,underlayRendered:D,children:E}=o,N="radial"===(null==g?void 0:g.projection),W="horizontal"===(null==g?void 0:g.projection),z=!1!==p,G=r(()=>f&&z&&g&&!N?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:v?v(e,t):e}}):[],[f,z,g,v,N]),q=o.rTickValues,V=o.tickLabelEdgeAlign,X=o.axisExtent,Y=r(()=>f&&g&&!N?(q||et(g.r,5,X)).map(e=>({value:e,pixel:g.r(e),label:(b||nt)(e)})):[],[f,g,b,N,q,X]),Q=s(new Map),Z=s(null!==(i=null==B?void 0:B.length)&&void 0!==i?i:0),K=null!==(a=null==B?void 0:B.length)&&void 0!==a?a:0;Z.current!==K&&(Z.current=K,Q.current=new Map);const U=r(()=>{if(!B||0===B.length)return null;const n=function(n,o,i){var r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,A,O,S,j,_,M,C,P,T,B,H,I,R,F,D,E,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne;switch(n.type){case"label":{const e=Ke(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ue(r,s,i)?t(Ye,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"label",connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"callout":{const e=Ke(n,o,i);if(!e)return null;const{x:r,y:s}=e;return Ue(r,s,i)?t(Ye,{noteData:{x:r,y:s,dx:n.dx||30,dy:n.dy||-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"callout-circle",subject:{radius:n.radius||12},connector:n.connector||{end:"arrow"},color:n.color}},"ann-"+o):null}case"x-threshold":{const r=Qe(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.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:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:r+4,y:l,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"y-threshold":{const r=Ze(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,i);if(null==r)return null;const s=n.color||"#f97316",a=n.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:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:l,y:r-4,textAnchor:c,fill:s,fontSize:12,fontWeight:"bold",children:n.label})]},"ann-"+o)}case"enclose":{const r=(n.coordinates||[]).map(e=>({x:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ze(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=n.padding||10;return e("g",{children:[t("circle",{cx:s.x,cy:s.y,r:s.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:s.x,y:s.y-s.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"rect-enclose":{const r=(n.coordinates||[]).map(e=>({x:Qe(Object.assign(Object.assign({},e),{type:"point"}),i),y:Ze(Object.assign(Object.assign({},e),{type:"point"}),i)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const s=n.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:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&t("text",{x:(c+d)/2,y:u-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+o)}case"highlight":{const e=i.data||[],r="function"==typeof n.filter?e.filter(n.filter):n.field&&null!=n.value?e.filter(e=>e[n.field]===n.value):[],s={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return t("g",{children:r.map((e,o)=>{const r=Qe(e,i),a=Ze(e,i);if(null==r||null==a)return null;const l="function"==typeof n.r?n.r(e):n.r||6,c="function"==typeof n.style?n.style(e):n.style||s;return t("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+o)})},"ann-"+o)}case"bracket":{const e=Qe(n,i),r=Ze(n,i);return t(Ye,{noteData:{x:null!=e?e:0,y:null!=r?r:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+o)}case"trend":{const h=i.data||[];if(2>h.length)return null;const g=i.xAccessor||"x",f=i.yAccessor||"y",p="ordinal"===i.frameType,y="horizontal"===i.projection,m=p?g:null,v=p?f:null;let b;const x=[],w=new Map;if(p&&m&&v){for(const e of h){const t=e[m];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=h.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=h.map(e=>[e[g],e[f]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=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,A=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(!k||!A)return null;const O=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,r=e(x[n]);return r+(e(x[o])-r)*i},S=k,j=A;let _;if(p)if(y){const e=O(j);_=(t,n)=>[S(n),e(t)]}else{const e=O(S);_=(t,n)=>[e(t),j(n)]}else _=(e,t)=>[S(e),j(t)];const M=n.method||"linear";let C;C="loess"===M?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,g=0,f=0;for(let e=0;n>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}(b,null!==(u=n.bandwidth)&&void 0!==u?u:.3):("polynomial"===M?$.polynomial(b,{order:n.order||2}):$.linear(b)).points;const P=C.map(([e,t])=>{const[n,o]=_(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",T=C[C.length-1],[B,H]=_(T[0],T[1]);return e("g",{children:[t("polyline",{points:P,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&t("text",{x:B+4,y:H-4,fill:L,fontSize:11,children:n.label})]},"ann-"+o)}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(n.y0))&&void 0!==p?p:0,a=null!==(y=null==r?void 0:r(n.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:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:n.label})]},"ann-"+o)}case"envelope":{const r=i.data||[];if(2>r.length)return null;const s=i.xAccessor||"x",a=null!==(v=null===(m=i.scales)||void 0===m?void 0:m.x)&&void 0!==v?v: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=n.upperAccessor||"upperBounds",d=n.lowerAccessor||"lowerBounds",u=n.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=Je[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=n.fill||"#6366f1";return e("g",{children:[t("path",{d:f,fill:p,fillOpacity:null!==(S=n.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),n.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:n.label})]},"ann-"+o)}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=n.threshold)&&void 0!==B?B:2,f=d-g*h,p=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(H=n.fillOpacity)&&void 0!==H?H:.1,v=n.anomalyColor||"#ef4444",b=null!==(I=n.anomalyRadius)&&void 0!==I?I: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:m}),k.map((e,n)=>{const o=Qe(e,i),r=Ze(e,i);return null==o||null==r?null:t("circle",{cx:o,cy:r,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&t("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+o)}case"forecast":{const r=i.data||[];if(3>r.length)return null;const s=i.xAccessor||"x",a=i.yAccessor||"y",l=null!==(F=null===(R=i.scales)||void 0===R?void 0:R.x)&&void 0!==F?F:null===(D=i.scales)||void 0===D?void 0:D.time,c=null!==(N=null===(E=i.scales)||void 0===E?void 0:E.y)&&void 0!==N?N:null===(W=i.scales)||void 0===W?void 0:W.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"===(n.method||"linear")){const e=$.polynomial(d,{order:n.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=d.length;let t=0,n=0,o=0,i=0;for(const[e,r]of d)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-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),m=null!==(z=n.confidence)&&void 0!==z?z:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(G=n.steps)&&void 0!==G?G:5,x=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),n=f*Math.sqrt(1+1/h+(y>0?Math.pow(e-p,2)/y:0))*v;A.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const 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))}`,_=n.strokeColor||"#6366f1";return e("g",{children:[t("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(q=n.fillOpacity)&&void 0!==q?q:.15,stroke:"none"}),t("polyline",{points:`${j} ${S}`,fill:"none",stroke:_,strokeWidth:null!==(V=n.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(X=n.strokeDasharray)&&void 0!==X?X:"6,3"}),n.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:n.label})]},"ann-"+o)}case"widget":{let e=null,r=null;if(null!=n.px&&null!=n.py)e=n.px,r=n.py;else{const t=Ke(n,o,i);if(!t)return null;e=t.x,r=t.y}if(null==e||null==r)return null;if(!Ue(e,r,i))return null;const s=null!==(Y=n.dx)&&void 0!==Y?Y:0,a=null!==(Q=n.dy)&&void 0!==Q?Q:0,l=null!==(Z=n.width)&&void 0!==Z?Z:32,c=null!==(K=n.height)&&void 0!==K?K:32,d=null!==(U=n.content)&&void 0!==U?U:t("span",{style:{fontSize:18,cursor:"default"},title:n.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-"+o)}case"text":{const e=Ke(n,o,i);if(!e)return null;const{x:r,y:s}=e;return t("text",{x:r+(n.dx||0),y:s+(n.dy||0),fill:n.color||"var(--semiotic-text, #333)",fontSize:n.fontSize||11,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label},"ann-text-"+o)}case"category-highlight":{const r=n.category;if(null==r)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=null===(J=i.scales)||void 0===J?void 0:J.o,l=null===(ee=i.scales)||void 0===ee?void 0:ee.x,c=null===(te=i.scales)||void 0===te?void 0:te.y,d=s(a)?a:s(l)?l:s(c)?c:null;if(!d)return null;const u=d(r+"");if(null==u)return null;const h=d.bandwidth(),g=n.color||"var(--semiotic-primary, #4589ff)",f=null!==(ne=n.opacity)&&void 0!==ne?ne:.15,p=n.label;return e("g",(i.projection?"vertical"===i.projection:d===l)?{children:[t("rect",{x:u,y:0,width:h,height:i.height||0,fill:g,fillOpacity:f}),p&&t("text",{x:u+h/2,y:12,textAnchor:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]}:{children:[t("rect",{x:0,y:u,width:i.width||0,height:h,fill:g,fillOpacity:f}),p&&t("text",{x:12,y:u+h/2,dominantBaseline:"middle",fill:g,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+o)}default:return null}},o="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:o?g.r:i||g.r,y:o&&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:o?"horizontal":"vertical",stickyPositionCache:Q.current};return B.map((e,t)=>{if(H){const o=H(e,t,r);return null!=o?o:n(e,t,r)}return n(e,t,r)}).filter(Boolean)},[B,H,l,c,g,I,R,F]);return f||A||O||T||U&&U.length>0||x||E?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&&!N&&!D&&t("g",{className:"ordinal-grid",children:Y.map((e,n)=>t("line",{x1:W?e.pixel:0,y1:W?0:e.pixel,x2:W?e.pixel:l,y2:W?c:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),f&&g&&!N&&(()=>{const o={fontSize:"var(--semiotic-tick-font-size, 10px)"},i={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return t("g",{className:"ordinal-axes",children:e(n,W?{children:[e("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((n,i)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):t("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"right",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),e("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&t("line",{x1:0,y1:c,x2:l,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!D&&(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})(),Y.map((n,i)=>{const r=V?0===i?"start":i===Y.length-1?"end":"middle":"middle";return e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)}),m&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]}:{children:[e("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!D&&(()=>{const e=(null==g?void 0:g.r)?g.r(0):c,n=0>e||e>c?c:e;return t("line",{x1:0,y1:n,x2:l,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),G.map((n,i)=>e("g",{transform:`translate(${n.pixel},${c})`,children:[t("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?t("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label}):t("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:t("div",{style:Object.assign({textAlign:"center",userSelect:"none"},o),children:n.label})})]},"cat-"+i)),y&&t("text",{x:l/2,y:c+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:y})]}),e("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!D&&t("line",{x1:0,y1:0,x2:0,y2:c,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),Y.map((n,i)=>e("g",{transform:`translate(0,${n.pixel})`,children:[t("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),t("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o),children:n.label})]},"val-"+i)),m&&t("text",{x:15-h.left,y:c/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-h.left}, ${c/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},i),children:m})]})]})})})(),U,T,E]}),A&&t("text",{x:d/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof A?A:null}),Ne({legend:O,totalWidth:d,totalHeight:u,margin:h,legendPosition:C,title:A,legendLayout:P,legendHoverBehavior:S,legendClickBehavior:j,legendHighlightedCategory:_,legendIsolatedCategories:M})]}):null}function it(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function rt({width:e,height:n,totalWidth:o,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),m=s(y);return m.current=y,i(()=>{if(!d.current)return;const t=B(d.current).select(".brush-g"),o=y?H():I();return o.extent([[0,0],[e,n]]),o.on("brush end",e=>{if(f.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void h.current(null);const[n,o]=e.selection;let i;i=m.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,h.current(r)}),t.call(o),u.current=o,t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),u.current=null}},[e,n,y]),i(()=>{if(!l||!u.current||!p.current)return;if(!d.current)return;const e=p.current,t=B(d.current).select(".brush-g"),n=l.r(e.r[0]),o=l.r(e.r[1]);y?(f.current=!0,t.call(u.current.move,[n,o]),f.current=!1):(f.current=!0,t.call(u.current.move,[o,n]),f.current=!1)},[l,y]),t("svg",{ref:d,width:o,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"}})})}function st(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function at(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}const lt=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ct(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=lt(i,r),t=lt(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=lt(i,r),t=lt(i,s),n=lt(o,s),l=lt(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return ct(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),d=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),u=s-r,h=e.roundStart&&e.roundEnd?u/2:u,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return ct(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=s-(f?c:0),m=r+(g?d:0),v=s-(f?d:0),b=lt(i,p),x=lt(i,y),w=(i-l)*Math.cos(c),k=lt(w,r),A=lt(w,s),O=a?null:lt(o,v),S=a?null:lt(o,m),j=a?0:(o+l)*Math.cos(d),_=a?null:lt(j,r),M=a?null:lt(j,s),C=y-p>Math.PI?1:0,P=a?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=lt(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${C} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=lt(i,s);L+=` A${i},${i} 0 ${C} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${M.x},${M.y}`,L+=` A${l},${l} 0 0 1 ${O.x},${O.y}`;else{const e=lt(o,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${o},${o} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${_.x},${_.y}`;else{const e=lt(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function dt(e){const t=ct({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:ct({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const ut={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ht(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function gt(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const ft="undefined"==typeof window||"undefined"==typeof document,pt="undefined"!=typeof window?c:i,yt=()=>()=>{},mt=()=>!1,vt=()=>!0;function bt(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function xt(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function wt(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 kt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,At=new WeakMap;let Ot=0,St=!1,jt=null,_t=null,Mt=null;function Ct(e,t){var n,o;if(!t)return t;const i=kt.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(St)return;if("undefined"==typeof window||"undefined"==typeof document)return;St=!0;const e=()=>{Ot++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(jt=new MutationObserver(e),jt.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{_t=window.matchMedia("(prefers-color-scheme: dark)"),Mt=e,"function"==typeof _t.addEventListener?_t.addEventListener("change",Mt):"function"==typeof _t.addListener&&_t.addListener(Mt)}catch(e){}}();let s=At.get(r);s&&s.version===Ot||(s={version:Ot,map:new Map},At.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const Pt=o.createContext(null),Lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Tt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const $t=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Bt="semiotic-accessible-data-table",Ht=Bt+" semiotic-accessible-data-table-hidden",It=Bt+" semiotic-accessible-data-table-visible",Rt={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ft={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Dt={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Et={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Nt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Wt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},zt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #999))",marginBottom:4,fontStyle:"italic"};function Gt({scene:n,chartType:i,tableId:r,chartTitle:s}){var a;const[l,c]=o.useState(!1),d=o.useContext(Pt),u=null!==(a=null==d?void 0:d.visible)&&void 0!==a&&a,h=l||u,g=o.useRef(null),f=s?"Data summary for "+s:r?`Data summary for ${i} ${r}`:"Data summary for "+i,p=o.useCallback(()=>{l||u||c(!0)},[l,u]),y=o.useCallback(e=>{var t;u||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[u]);if(!n||0===n.length)return r?t("span",{id:r,tabIndex:-1,style:Lt}):null;if(!h)return t("div",{id:r,className:Ht,tabIndex:-1,onFocus:p,style:Lt,role:"region","aria-label":f,children:e("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const m=function(e){var t,n,o,i,r,s,a,l,c,d,u,h,g,f,p,y,m,v,b,x,w,k,A,O,S;const j=[];if(!Array.isArray(e))return j;for(const _ of e)if(_&&"object"==typeof _&&null!==_.datum)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 n=0;e.length>n&&t.length>n;n++){const t=e[n];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 n=0;e.length>n&&t.length>n;n++){const t=e[n];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!==(n=null!==(t=e.category)&&void 0!==t?t:_.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o: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!==(m=_.cx)&&void 0!==m?m:_.x,y:null!==(v=_.cy)&&void 0!==v?v:_.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}(n),v=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${$t(e.min)} to ${$t(e.max)}, mean ${$t(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(m.length,v),x=m.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,className:It,tabIndex:-1,onBlur:y,style:Rt,role:"region","aria-label":f,children:[t("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&d&&d.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:Dt,children:"×"}),t("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ft,children:b}),e("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:Et,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:zt,children:["First ",x.length," of ",m.length," data points"]}),t("thead",{children:e("tr",{children:[t("th",{style:Nt,children:"type"}),k.map(e=>t("th",{style:Nt,children:e},e))]})}),t("tbody",{children:x.map((n,o)=>e("tr",{children:[t("td",{style:Wt,children:n.label}),k.map(e=>{return t("td",{style:Wt,children:(o=n.values[e],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":$t(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},e);var o})]},o))})]})]})}function qt({summary:e}){return e?t("div",{role:"note",style:Lt,children:e}):null}function Vt({tableId:e}){return t("a",{href:"#"+e,style:Lt,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Lt)},children:"Skip to data table"})}function Xt({hoverPoint:e}){let n="";if(e){const t=e.data||e;n="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:Lt,children:n})}const Yt="var(--semiotic-focus, #005fcc)";function Qt({active:e,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!e||!n)return null;const l=n.x+o.left,c=n.y+o.top;let d;if("rect"===r&&null!=s&&null!=a){const e=Math.max(s,4),n=Math.max(a,4);d=t("rect",{x:l-e/2-3,y:c-n/2-3,width:e+6,height:n+6,rx:3,fill:"none",stroke:Yt,strokeWidth:2,strokeDasharray:"4,2"})}else d=t("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Yt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Yt,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 Zt(e){return Array.isArray(e)?e[0]:e}const Kt={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 Ut(e,t){return"function"==typeof t?t(e):e[t]}function Jt(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 en(n={}){const{fields:o,title:i,format:r,style:s={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let l;const c=[];if(i){const e=Ut(n,i);l=Jt(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Ut(n,o);c.push({label:t,value:Jt(s,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){l=Jt(n[t],r);break}if(!l){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(l=Jt(n[e[0]],r))}}const d=Object.assign(Object.assign({},Kt),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,n)=>e("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e("span",{children:[t.label,": "]}),t.value]},n))]})}}function tn(e){if(!0!==e){if("function"==typeof e){const n=e;return e=>{var o;const i=Zt(!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!==(o=e.data)&&void 0!==o?o:{}:e),r=n(i);return null==r?null:t("div",{className:"semiotic-tooltip",style:Kt,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?en(e):en())}}function nn({x:e,y:n,containerWidth:i,containerHeight:r,margin:s,children:a,className:l="stream-frame-tooltip",zIndex:c=1}){const d=Number.isFinite(e)&&Number.isFinite(n),u=o.useRef(null),[h,g]=o.useState(null);o.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();g(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,l,i,r]);let f;f=h?`translate(${h.width+12>i-e?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!o.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(a),y=p?null:Kt;return d?t("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+e,top:s.top+n,transform:f,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function on(e){let n=null;const o=()=>(n||(n=h(null)),n),i=rn(e);return[function({children:n,initialState:i}){const a=s(i),l=r(()=>rn(e,a.current),[]),c=o();return t(c.Provider,{value:l,children:n})},e=>{var t;const n=o(),r=null!==(t=d(n))&&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 rn(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function sn(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 an(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:ln})})),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 ln=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],cn={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}},dn={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}},un={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ln,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 hn(e,t){if("light"===t)return cn;if("dark"===t)return dn;if("high-contrast"===t)return un;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?dn:cn;return an(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 an(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[gn,fn]=on(e=>({theme:cn,setTheme(t){e(e=>({theme:hn(e.theme,t)}))}}));const pn="undefined"==typeof window?i:c;function yn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function mn(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){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=s(t);n.current=t;const[l,c]=function(e,t,n){const o=s(null),[r,l]=a(null);return i(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(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=yn(e.foregroundGraphics,c,d),p=yn(e.backgroundGraphics,c,d),y=fn(e=>e.theme),{transition:m,introEnabled:v}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),b="semiotic-table-"+o.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 pn(()=>{P&&(Ot++,P.current=!0,k())},[y,k,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:c,margin:d,adjustedWidth:h,adjustedHeight:g,resolvedForeground:f,resolvedBackground:p,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:A,hoverLeaveRef:O,onPointerMove:M,onPointerLeave:C}}function vn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function bn(e,t,n=.3){vn(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function xn(e,t,n=.6){var o,i,r,s,a;if(!vn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o: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*n,e.stroke()}function wn(e,t,n,o=.35){vn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function kn(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function An(e,t,n){return null==t?n:"string"!=typeof t?t:Ct(e,t)||n}function On(e,t,n,o,i,r,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,i,r,s);for(const e of n)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(o,i,r,s),[h,g,f]=kn(e,n);return u.addColorStop(0,`rgba(${h},${g},${f},${c})`),u.addColorStop(1,`rgba(${h},${g},${f},${d})`),u}function Sn(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=at(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function jn(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 _n=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Mn(e,t);else if(t.cornerRadii&&st(t.cornerRadii)){const n=An(e,t.style.fill,Ct(e,"var(--semiotic-primary, #007bff)")),o=jn(t),i=t.fillGradient&&"string"==typeof n?On(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Sn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=An(e,t.style.fill,Ct(e,"var(--semiotic-primary, #007bff)")),o=jn(t),i=t.fillGradient&&"string"==typeof n?On(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x: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=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=An(e,t.style.fill,Ct(e,"var(--semiotic-primary, #007bff)")),o=jn(t),i=t.fillGradient&&"string"==typeof n?On(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}bn(e,t),e.globalAlpha=1}};function Mn(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const Cn=(e,t,n,o)=>{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 n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=An(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=An(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),xn(e,t),e.globalAlpha=1}}finally{e.restore()}}};function Pn(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=dt({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=Ct(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function Ln(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 Tn(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=T().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}const $n=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)Pn(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Ln(e,t),wn(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?Ct(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=ct({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Tn(e,t)):(Ln(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Ln(e,t),wn(e,t)),e.globalAlpha=1}}},Bn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=Ct(e,"var(--semiotic-primary, #007bff)"),a=Ct(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Ct(e,l)||l:null!=l?l:s,d=t.style.stroke,u="string"==typeof d?Ct(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(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=g,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Hn=(e,t,n,o)=>{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 n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?Ct(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},In=(e,t,n,o)=>{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 n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=Ct(e,n.style.stroke)||("string"==typeof n.style.fill?Ct(e,n.style.fill):n.style.fill)||Ct(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Rn=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(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=Ct(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Fn(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 Dn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let En=null;function Nn(e={},t){const{background:n="transparent",stroke:o="#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):(En||(En=document.createElement("canvas")),En.width=e,En.height=e,En)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,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 Wn=new Map;function zn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Wn.get(n);if(void 0!==o)return o;const i=Nn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Wn.set(n,i),i}function Gn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function qn(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 Vn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Xn=e=>[In,...e],Yn={bar:Xn([_n]),clusterbar:Xn([_n]),point:Xn([Cn]),swarm:Xn([Cn]),pie:[$n],donut:[$n],boxplot:Xn([Bn,Cn]),violin:Xn([Hn]),histogram:Xn([_n]),ridgeline:Xn([Hn]),timeline:Xn([_n]),funnel:[_n,Rn,(e,t,n,o)=>{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,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?Fn(i):null!=r?`${Fn(i)} (${Dn(r)})`:Fn(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=Fn(i),e.measureText(c).width+16>o)continue}const d=n.__funnelValueLabelX,u=(null!==(a=n.__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":[_n,(e,t,n,o)=>{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 n=("string"==typeof t.style.fill?t.style.fill:null)||Ct(e,"var(--semiotic-border, #999)"),o=zn(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=kn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,Ct(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 n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,d=r?Vn(i):"",u=qn(o);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=n.__barFunnelLabelX,m=y-f/2,v=n.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Gn(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Gn(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(u,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3))}e.lineWidth=1}],swimlane:Xn([_n]),custom:Xn([_n,Cn,$n,Bn,Hn,Rn])},Qn={top:50,right:40,bottom:60,left:70},Zn={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 Kn({hover:n}){var o,i,r,s,a,l;const c=n.data||{},d=n.stats,u=n.category;if(Array.isArray(c)){const n=u||(null===(o=c[0])||void 0===o?void 0:o.category)||"";if(d)return e("div",{className:"semiotic-tooltip",style:Zn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),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:Zn,children:[n&&t("div",{style:{fontWeight:"bold"},children:n+""}),e("div",{children:[i," items"]})]})}if(null!=c.bin&&null!=c.count){const n=c.range||[];return e("div",{className:"semiotic-tooltip",style:Zn,children:[c.category&&t("div",{style:{fontWeight:"bold"},children:c.category+""}),e("div",{children:["Count: ",c.count]}),2===n.length&&e("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})}const h=n.__oAccessor,g=n.__rAccessor,f=n.__chartType;if("swarm"===f||"point"===f){const n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Zn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},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 n=Object.entries(c).filter(([e])=>!e.startsWith("_")&&"data"!==e);return t("div",{className:"semiotic-tooltip",style:Zn,children:n.map(([t,n])=>e("div",{children:[e("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e("div",{className:"semiotic-tooltip",style:Zn,children:[p&&t("div",{style:{fontWeight:"bold"},children:p+""}),""!==y&&t("div",{children:"number"==typeof y?y.toLocaleString():y+""})]})}Kn.ownsChrome=!0;const Un=g(function(n,c){var d,h,g,p,y,m,v,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:$,valueAccessor:B,categoryAccessor:H,projection:I="vertical",size:R=[600,400],responsiveWidth:E,responsiveHeight:N,margin:W,barPadding:z,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:Z,startAngle:K,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:ne,amplitude:oe,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:me,barColors:ve,showAxes:be=!0,showCategoryTicks:xe,categoryLabel:we,valueLabel:Se,categoryFormat:$e,valueFormat:Be,oLabel:He,rLabel:Ie,oFormat:Re,rFormat:Fe,rTickValues:De,tickLabelEdgeAlign:Ee,axisExtent:Ne,enableHover:We=!0,hoverAnnotation:ze,tooltipContent:Ge,customHoverBehavior:qe,annotations:Ve,svgAnnotationRules:Xe,showGrid:Ye=!1,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Je,legendPosition:et,legendLayout:nt,legendCategoryAccessor:lt,onCategoriesChange:kt,backgroundGraphics:At,foregroundGraphics:Ot,title:St,className:jt,background:_t,centerContent:Mt,decay:Pt,pulse:Lt,transition:$t,animate:Bt,staleness:Ht,brush:It,onBrush:Rt,accessibleTable:Ft=!0,description:Dt,summary:Et,customLayout:Nt,layoutConfig:Wt}=n,zt=s(!0),Yt=mn({sizeProp:R,responsiveWidth:E,responsiveHeight:N,userMargin:W,marginDefault:Qn,foregroundGraphics:Ot,backgroundGraphics:At,animate:Bt,transitionProp:$t,themeDirtyRef:zt}),{reducedMotionRef:Kt,responsiveRef:Ut,size:Jt,margin:en,adjustedWidth:tn,adjustedHeight:on,resolvedForeground:rn,resolvedBackground:an,currentTheme:ln,transition:cn,introEnabled:dn,tableId:un,rafRef:hn,renderFnRef:gn,scheduleRender:fn}=Yt,pn=function(){const[e,t]=a(!1);return pt(()=>{t(!0)},[]),e}(),yn=function(){const e=l(yt,mt,vt);return s(e).current}(),vn=r(()=>F(S),[S]),bn=null!=we?we:He,xn=null!=Se?Se:Ie,wn=null!=$e?$e:Re,kn=null!=Be?Be:Fe,An=s(null),On=s(null),Sn=s([]),jn=s(lt),_n=s(kt);jn.current=lt,_n.current=kt;const[Mn,Cn]=a(null),[Pn,Ln]=a(null),[Tn,$n]=a(0),[Bn,Hn]=a(!1),[In,Rn]=a(null),Fn=u(()=>{var e,t;Rn(null!==(t=null===(e=zn.current)||void 0===e?void 0:e.customLayoutOverlays)&&void 0!==t?t:null)},[]),Dn=We||ze,En="streaming"===O,Nn=r(()=>{var e,t,n;return{chartType:A,runtimeMode:En?"streaming":"bounded",windowSize:fe,windowMode:ge,extentPadding:ue,projection:I,oAccessor:En?void 0:j,rAccessor:En?void 0:_,colorAccessor:M,stackBy:C,groupBy:P,multiAxis:L,timeAccessor:En?$:void 0,valueAccessor:En?B||("string"==typeof _||"function"==typeof _?_:void 0):void 0,categoryAccessor:En?H||j:void 0,rExtent:ce,oExtent:de,axisExtent:Ne,barPadding:z,roundedTop:G,gradientFill:q,trackFill:V,baselinePadding:X,innerRadius:Y,cornerRadius:Q,normalize:Z,startAngle:K,sweepAngle:U,dynamicColumnWidth:J,bins:ee,showOutliers:te,showIQR:ne,amplitude:oe,connectorOpacity:ie,showLabels:re,connectorAccessor:se,connectorStyle:ae,dataIdAccessor:le,oSort:he,pieceStyle:pe,summaryStyle:ye,colorScheme:me,themeCategorical:null===(e=null==ln?void 0:ln.colors)||void 0===e?void 0:e.categorical,themeSemantic:sn(ln),themeSequential:null===(t=null==ln?void 0:ln.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==ln?void 0:ln.colors)||void 0===n?void 0:n.diverging,barColors:ve,decay:Pt,pulse:Lt,transition:cn,introAnimation:dn,staleness:Ht,customLayout:Nt,layoutConfig:Wt,layoutMargin:en}},[A,fe,ge,ue,I,j,_,M,C,P,L,$,B,H,ce,de,Ne,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne,oe,ie,re,se,ae,le,he,pe,ye,me,ve,Pt,Lt,null==cn?void 0:cn.duration,null==cn?void 0:cn.easing,dn,Ht,En,ln,Nt,Wt,en]),Wn=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 xt(e,t);if(!wt(e)||!wt(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!xt(n,i))return!1}else{if(!wt(n)||!wt(i))return!1;if(!bt(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(Nn),zn=s(null);zn.current||(zn.current=new ke(Wn));const Gn=u(()=>{var e,t;const n=jn.current,o=_n.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=zn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,Sn.current)||(Sn.current=i,o(i))},[]);i(()=>{var e;null===(e=zn.current)||void 0===e||e.updateConfig(Wn),zt.current=!0,fn()},[Wn,fn]);const qn=s(null);qn.current||(qn.current=new D(e=>{const t=zn.current;t&&t.ingest(e)&&(zt.current=!0,fn())}));const Vn=u(e=>{var t;null===(t=qn.current)||void 0===t||t.push(e)},[]),Xn=u(e=>{var t;null===(t=qn.current)||void 0===t||t.pushMany(e)},[]),Zn=u(()=>{var e,t;null===(e=qn.current)||void 0===e||e.clear(),null===(t=zn.current)||void 0===t||t.clear(),zt.current=!0,fn()},[fn]),Un=u(e=>{var t,n;null===(t=qn.current)||void 0===t||t.clearLastData(),null===(n=qn.current)||void 0===n||n.setReplacementData(e)},[]);f(c,()=>({push:Vn,pushMany:Xn,replace:Un,remove:e=>{var t,n,o,i;null===(t=qn.current)||void 0===t||t.flush();const r=null!==(o=null===(n=zn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=On.current)||void 0===i?void 0:i.data;!!On.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(On.current=null,Cn(null)),zt.current=!0,fn()}return r},update:(e,t)=>{var n,o,i;null===(n=qn.current)||void 0===n||n.flush();const r=null!==(i=null===(o=zn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(zt.current=!0,fn()),r},clear:Zn,getData:()=>{var e,t,n;return null===(e=qn.current)||void 0===e||e.flush(),null!==(n=null===(t=zn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=zn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Vn,Xn,Un,Zn,fn]),i(()=>{var e;S&&(null===(e=qn.current)||void 0===e||e.setBoundedData(vn))},[S,vn]);const{hoverHandlerRef:Jn,hoverLeaveRef:eo,onPointerMove:to,onPointerLeave:no}=Yt;Jn.current=e=>{if(!Dn)return;const t=An.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-en.left,i=e.clientY-n.top-en.top;if(0>o||o>tn||0>i||i>on)return void(On.current&&(On.current=null,Cn(null),qe&&qe(null),fn()));const r=zn.current;if(!r||0===r.scene.length)return;const s="radial"===I,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i){const r=Math.max(o,i+5,12),s=t-r,a=t+r,l=n-r,c=n+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-n,a=Math.sqrt(r*r+s*s);Oe(e.r,o)>=a&&u>a&&(d=e,u=a),i=i.next}while(i)}return!1}),d?{node:d,distance:u}:null}(i,t,n,o,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=je(r,t,n);break;case"point":if(i)break;e=_e(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=Me(r,t,n);break;case"boxplot":e=Ce(r,t,n);break;case"violin":e=Pe(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-tn/2:o,s?i-on/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(On.current&&(On.current=null,Cn(null),qe&&qe(null),fn()));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:Zt(c),x:d,y:u,__semioticHoverData:!0},h));var c,d,u,h;On.current=l,Cn(l),qe&&(qe(l),zt.current=!0),fn()},eo.current=()=>{On.current&&(On.current=null,Cn(null),qe&&(qe(null),zt.current=!0),fn())};const oo=s(-1),io=s(null),ro=s(null),so=u(e=>{const t=zn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(ro.current&&ro.current.version===n)o=ro.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),ro.current={version:n,graph:o}}const i=oo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),oo.current=0;const t=o.flat[0];io.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},Te(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});return On.current=n,Cn(n),qe&&qe(n),void fn()}const r=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?Le(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Le(n,n.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,r,o);if(null===s)return;if(e.preventDefault(),0>s)return oo.current=-1,io.current=null,On.current=null,Cn(null),qe&&qe(null),void fn();oo.current=s;const a=o.flat[s];io.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Te(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof _?_:void 0,__chartType:A});On.current=l,Cn(l),qe&&qe(l),fn()},[qe,fn]),ao=u(e=>{oo.current=-1,io.current=null,to(e)},[to]);gn.current=()=>{var e,t;hn.current=0;const n=An.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=zn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Kt.current?r+1e6:r),a=!Kt.current&&s,l=zt.current;l&&!s&&(i.computeScene({width:tn,height:on}),Gn(),Fn(),zt.current=!1),(l||a)&&n.setAttribute("aria-label",Tt(i.scene,A+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,d=Jt[0]*c,u=Jt[1]*c;n.width===d&&n.height===u||(n.width=d,n.height=u,n.style.width=Jt[0]+"px",n.style.height=Jt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,Jt[0],Jt[1]);const h=null!==(e=null==Ht?void 0:Ht.threshold)&&void 0!==e?e:5e3,g=Ht&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(o.globalAlpha=null!==(t=null==Ht?void 0:Ht.dimOpacity)&&void 0!==t?t:.5),"transparent"!==_t&&!At){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=_t||(e&&"transparent"!==e?e:null),i=t?Ct(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,Jt[0],Jt[1]))}const f="radial"===I;o.save(),o.beginPath(),o.rect(en.left,en.top,tn,on),o.clip(),f?(o.save(),o.translate(en.left+tn/2,en.top+on/2)):o.translate(en.left,en.top);const p=Nt?Yn.custom:Yn[A]||[],y={width:tn,height:on};for(const e of p)e(o,i.scene,i.scales,y);f&&o.restore(),o.restore(),g&&(o.globalAlpha=1),l&&i.scales&&(Ln(i.scales),$n(e=>e+1)),(null==Ht?void 0:Ht.showBadge)&&Hn(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(hn.current=requestAnimationFrame(()=>gn.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:a,cleanup:l}=e;pt(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,a.current()},[t,n]);const c=s(l);c.current=l,i(()=>()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.call(c)},[])}({hydrated:pn,wasHydratingFromSSR:yn,storeRef:zn,dirtyRef:zt,renderFnRef:gn,cleanup:()=>{var e;return null===(e=qn.current)||void 0===e?void 0:e.clear()}}),i(()=>{zt.current=!0,fn()},[A,tn,on,be,_t,fn]),function(e,t,n,o,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),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(Ht,zn,zt,fn,Bn,Hn);const lo=Dn&&Mn?Ge?Ge(Mn):t(Kn,{hover:Mn}):null,co="radial"===I,uo=lo?t(nn,{x:Mn?co?Mn.x+tn/2:Mn.x:0,y:Mn?co?Mn.y+on/2:Mn.y:0,containerWidth:tn,containerHeight:on,margin:en,className:"stream-ordinal-tooltip",children:lo}):null,ho=it(j,0,"__semiotic_resolvedO"),go=it(_,0,"__semiotic_resolvedR"),fo=ho.key,po=go.key,yo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(ho,go,Ve&&Ve.length>0||!1);if(ft||!pn&&yn){const n=zn.current;n&&S&&(n.ingest({inserts:vn,bounded:!0}),n.computeScene({width:tn,height:on}));const i=null!==(d=null==n?void 0:n.scene)&&void 0!==d?d:[],r=null!==(h=null==n?void 0:n.scales)&&void 0!==h?h:null,s="radial"===I,a=s?en.left+tn/2:en.left,l=s?en.top+on/2:en.top;return e("div",{ref:Ut,className:"stream-ordinal-frame"+(jt?" "+jt:""),role:"img","aria-label":Dt||("string"==typeof St?St:"Ordinal chart"),style:{position:"relative",width:E?"100%":Jt[0],height:N?"100%":Jt[1]},children:[t(qt,{summary:Et}),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:Jt[0],height:Jt[1],style:{position:"absolute",left:0,top:0},children:[an&&t("g",{transform:`translate(${en.left},${en.top})`,children:an}),e("g",{transform:`translate(${a},${l})`,children:[_t&&t("rect",{x:0,y:0,width:tn,height:on,fill:_t}),i.map((n,i)=>function(n,i,r){var s,a,l,c,d,u,h,g,f;const p=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",y=e=>`ord-${n.type}-${p}-${i}-${e}`,m=`ord-${n.type}-${p}-${i}`;switch(n.type){case"rect":{const i=n,r=gt(m)+"-grad",s=function(e,n){const o=e.fillGradient;if(!o)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 o){const e=o.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 n=0;e.length>n;n++)l.push(t("stop",{offset:e[n].offset,stopColor:e[n].color},n))}else{const n=ht(e.style.fill);l.push(t("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(t("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return t("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(i,r),a=s?`url(#${r})`:ht(i.style.fill);if(i.cornerRadii&&st(i.cornerRadii)){const n=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=at(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(i);return e(o.Fragment,{children:[s&&t("defs",{children:s}),t("path",{d:n,fill:a,opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}if(i.roundedTop&&i.roundedTop>0){const n=Math.min(i.roundedTop,i.w/2,i.h/2),{x:r,y:l,w:c,h:d}=i;let u;switch(i.roundedEdge){case"right":u=`M${r},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r},${l+d} Z`;break;case"left":u=`M${r+c},${l} L${r+n},${l} A${n},${n} 0 0 0 ${r},${l+n} L${r},${l+d-n} A${n},${n} 0 0 0 ${r+n},${l+d} L${r+c},${l+d} Z`;break;case"bottom":u=`M${r},${l} L${r+c},${l} L${r+c},${l+d-n} A${n},${n} 0 0 1 ${r+c-n},${l+d} L${r+n},${l+d} A${n},${n} 0 0 1 ${r},${l+d-n} Z`;break;default:u=`M${r},${l+d} L${r},${l+n} A${n},${n} 0 0 1 ${r+n},${l} L${r+c-n},${l} A${n},${n} 0 0 1 ${r+c},${l+n} L${r+c},${l+d} Z`}return e(o.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})]},m)}return e(o.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})]},m)}case"point":{const e=n;return t("circle",{cx:e.x,cy:e.y,r:e.r,fill:ht(e.style.fill),opacity:null!==(s=e.style.opacity)&&void 0!==s?s:.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},m)}case"wedge":{const o=n;if(o._gradientBand&&o._gradientBand.colors.length>0){const n=gt(`${r?r+"-":""}gauge-grad-${o.category||m}-${i}`),{clipPath:s,slices:u}=dt({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:null===(l=null===(a=o.roundedEnds)||void 0===a?void 0:a.start)||void 0===l||l,roundEnd:null===(d=null===(c=o.roundedEnds)||void 0===c?void 0:c.end)||void 0===d||d,colors:o._gradientBand.colors});return e("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[t("defs",{children:t("clipPath",{id:n,children:t("path",{d:s})})}),t("g",{clipPath:`url(#${n})`,children:u.map((e,n)=>t("path",{d:e.d,fill:ht(e.color)},n))}),o.style.stroke&&"none"!==o.style.stroke&&t("path",{d:s,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}let s;if(o.roundedEnds)s=ct({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds.start,roundEnd:o.roundedEnds.end});else{const e=T().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),s=e(ut)||""}return t("path",{d:s,transform:`translate(${o.cx},${o.cy})`,fill:ht(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},m)}case"boxplot":{const o=n,i=o.columnWidth/2;return e("g","vertical"===o.projection?{children:[t("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:o.x-i,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:ht(o.style.fill),fillOpacity:null!==(u=o.style.fillOpacity)&&void 0!==u?u:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-i,y1:o.medianPos,x2:o.x+i,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.x-.5*i,y1:o.minPos,x2:o.x+.5*i,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.x-.5*i,y1:o.maxPos,x2:o.x+.5*i,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[t("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),t("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-i,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:ht(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.medianPos,y1:o.y-i,x2:o.medianPos,y2:o.y+i,stroke:o.style.stroke||"#333",strokeWidth:2}),t("line",{x1:o.minPos,y1:o.y-.5*i,x2:o.minPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1}),t("line",{x1:o.maxPos,y1:o.y-.5*i,x2:o.maxPos,y2:o.y+.5*i,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const e=n,o=[t("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:ht(e.style.fill),fillOpacity:null!==(g=e.style.fillOpacity)&&void 0!==g?g:.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},y("path"))];if(e.iqrLine&&e.bounds){const n=e.bounds,i=n.x+n.width/2,r=n.y+n.height/2;n.height>n.width?o.push(t("line",{x1:i,y1:e.iqrLine.q1Pos,x2:i,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},y("iqr")),t("circle",{cx:i,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},y("med"))):o.push(t("line",{x1:e.iqrLine.q1Pos,y1:r,x2:e.iqrLine.q3Pos,y2:r,stroke:e.style.stroke||"#333",strokeWidth:2},y("iqr")),t("circle",{cx:e.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},y("med")))}return t("g",{children:o},m)}case"connector":return t("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:null!==(f=n.style.opacity)&&void 0!==f?f:.5},m);case"trapezoid":{const e=n,o=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return t("polygon",{points:o,fill:ht(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},m)}default:return null}}(n,i,un)).filter(Boolean)]})]}),t(ot,{width:tn,height:on,totalWidth:Jt[0],totalHeight:Jt[1],margin:en,scales:r,showAxes:be,showCategoryTicks:xe,oLabel:bn,rLabel:xn,oFormat:wn,rFormat:kn,rTickValues:De,tickLabelEdgeAlign:Ee,axisExtent:Ne,showGrid:Ye,title:St,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Je,legendPosition:et,legendLayout:nt,foregroundGraphics:Ae(rn,null===(g=zn.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:Ve,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:fo,yAccessor:po,annotationData:yo(null==n?void 0:n.getData())}),Mt&&"radial"===I&&t("div",{style:{position:"absolute",left:en.left+tn/2,top:en.top+on/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Mt})]})}return e("div",{ref:Ut,className:"stream-ordinal-frame"+(jt?" "+jt:""),role:"group","aria-label":Dt||("string"==typeof St?St:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:E?"100%":Jt[0],height:N?"100%":Jt[1],overflow:"visible"},onKeyDown:so,children:[Ft&&t(Vt,{tableId:un}),Ft&&t(Gt,{scene:null!==(y=null===(p=zn.current)||void 0===p?void 0:p.scene)&&void 0!==y?y:[],chartType:A+" chart",tableId:un,chartTitle:"string"==typeof St?St:void 0}),t(qt,{summary:Et}),e("div",{role:"img","aria-label":Dt||("string"==typeof St?St:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Dn?ao:void 0,onMouseLeave:Dn?no:void 0,children:[an&&t("svg",{style:{position:"absolute",top:0,left:0,width:Jt[0],height:Jt[1],pointerEvents:"none"},children:t("g",{transform:`translate(${en.left},${en.top})`,children:an})}),t(tt,{width:tn,height:on,totalWidth:Jt[0],totalHeight:Jt[1],margin:en,scales:Pn,showAxes:be,showGrid:Ye,rFormat:kn,rTickValues:De,axisExtent:Ne}),t("canvas",{ref:An,"aria-label":Tt(null!==(v=null===(m=zn.current)||void 0===m?void 0:m.scene)&&void 0!==v?v:[],A+" chart"),style:{position:"absolute",top:0,left:0,width:Jt[0],height:Jt[1]}}),t(Xt,{hoverPoint:Mn}),t(ot,{width:tn,height:on,totalWidth:Jt[0],totalHeight:Jt[1],margin:en,scales:Pn,showAxes:be,showCategoryTicks:xe,oLabel:bn,rLabel:xn,oFormat:wn,rFormat:kn,rTickValues:De,axisExtent:Ne,showGrid:Ye,title:St,legend:Qe,legendHoverBehavior:Ze,legendClickBehavior:Ke,legendHighlightedCategory:Ue,legendIsolatedCategories:Je,legendPosition:et,legendLayout:nt,foregroundGraphics:Ae(rn,In),annotations:Ve,svgAnnotationRules:Xe,annotationFrame:Tn,xAccessor:fo,yAccessor:po,annotationData:yo(null===(b=zn.current)||void 0===b?void 0:b.getData()),underlayRendered:!0}),(It||Rt)&&"radial"!==I&&t(rt,{width:tn,height:on,totalWidth:Jt[0],totalHeight:Jt[1],margin:en,scales:Pn,onBrush:Rt||(()=>{})}),Mt&&"radial"===I&&t("div",{style:{position:"absolute",left:en.left+tn/2,top:en.top+on/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Mt}),(null==Ht?void 0:Ht.showBadge)&&t("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ht.badgePosition?{top:4,left:4}:"bottom-left"===Ht.badgePosition?{bottom:4,left:4}:"bottom-right"===Ht.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Bn?"#dc3545":"#28a745",color:"white"}),children:Bn?"STALE":"LIVE"}),t(Qt,{active:oo.current>=0,hoverPoint:Mn,margin:en,size:Jt,shape:null===(x=io.current)||void 0===x?void 0:x.shape,width:null===(w=io.current)||void 0===w?void 0:w.w,height:null===(k=io.current)||void 0===k?void 0:k.h}),uo]})]})});function Jn(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a}=e,l={};return t&&(l.title=t),n&&(l.description=n),o&&(l.summary=o),void 0!==i&&(l.accessibleTable=i),r&&(l.className=r),null!=s&&(l.animate=s),void 0!==a&&(l.axisExtent=a),l}function eo(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function to(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:tn(t)||n}}Un.displayName="StreamOrdinalFrame";const no=h(null);function oo(){return d(no)}function io(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function ro(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[so,ao]=on(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=ro(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=ro(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[lo,co]=on(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));let uo={positions:new Map};const ho=new Set;function go(){for(const e of ho)e()}function fo(e,t){const n=uo.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(uo.positions);o.delete(e),uo={positions:o},go()}function po(e){const t=p(),n=e.clientId||t,{name:o}=e,i=ao(e=>e.selections.get(o)),s=ao(e=>e.setClause),a=ao(e=>e.clearClause),l=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(io(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:l,selectPoints:u(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(o,{clientId:n,type:"point",fields:t})},[n,o,s]),selectInterval:u(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(o,{clientId:n,type:"interval",fields:t})},[n,o,s]),clear:u(()=>{a(o,n)},[a,o,n]),clientId:n}}function yo(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const mo=h(!1),vo=h(null),bo="undefined"==typeof window?i:c;function xo(e){const t=d(vo),n=p(),o=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),i=s([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i.current,o)||(i.current=o);const r=i.current;bo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),bo(()=>{t&&t.registerCategories(n,r)},[t,n,r])}function wo({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&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?o(s,t,n):n?n(i):he[r%he.length];return{label:i+"",color:a}}),label:""}]}}function ko(){return fn(e=>e.theme)}function Ao(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function Oo(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 So(){var e;const t=ko(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function jo(e,t,n){return r(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],i="function"==typeof(r=n)?r:e=>e[r];var r;return o.sort("asc"===t?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,t,n])}o.createContext(void 0);const _o={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 Mo(e,t,n){var o,i,r,s,a,l,c;const d=_o[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?d.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?d.height:n.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:Co(d.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:u}}function Co(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Po(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Lo(e,t){if(!t)return Po(e);try{const n=t(e);return null==n?Po(e):n}catch(t){return Po(e)}}function To(e,t){return"function"==typeof t?t(e):e[t]}function $o({categoryAccessor:n,valueAccessor:o,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=To(d,n),h=To(d,o),g=i?To(d,i):void 0;return e("div",{className:"semiotic-tooltip",style:Kt,children:[t("div",{style:{fontWeight:"bold"},children:Po(u)}),t("div",{style:{marginTop:4},children:Lo(h,a)}),null!=g&&e("div",{style:{marginTop:2,opacity:.8},children:[r||(f=i,"string"==typeof f?f:"value"),": ",Po(g)]})]});var f}}function Bo({componentName:n,message:o,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:n}),t("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),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 Ho extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,n=this.state.error;return"function"==typeof e?e(n):void 0!==e?e:t(Bo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var Io;const Ro="undefined"!=typeof process&&"production"!==(null===(Io=process.env)||void 0===Io?void 0:Io.NODE_ENV);function Fo({componentName:e,width:n,height:o,children:i}){return t(Ho,{fallback:i=>t(Bo,{componentName:e,message:i.message,width:n,height:o}),children:i})}const Do={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"},Eo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function No(e,t,n,o){if(!Ro)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Wo(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function zo(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=Wo(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function Go({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(n){const o=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(o){const t=Object.keys(o);for(const[i,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=zo(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function qo(e){const{data:n,rawData:o,colorBy:s,colorScheme:l,legendInteraction:c,legendPosition:h,selection:g,linkedHover:f,fallbackFields:y,unwrapData:m=!1,onObservation:v,chartType:b,chartId:x,showLegend:w,userMargin:k,marginDefaults:A,onClick:O,hoverHighlight:S,loading:j,loadingContent:_,emptyContent:M,width:C,height:P}=e,L=void 0===o,T=r(()=>F(n),[n]),[$,B]=a([]),H=u(e=>{B(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:D,customHoverBehavior:E,customClickBehavior:N,crosshairSourceId:W}=function({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!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,n),m=po({name:(null==e?void 0:e.name)||"__unused__"}),v=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:s}=po({name:t});return{onHover:u(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&r(t)},[n,r,s,t]),predicate:o,isActive:i}}({name:(null==y?void 0:y.name)||"hover",fields:(null==y?void 0:y.fields)||n||[]}),b=co(e=>e.pushObservation),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[w,k]=a(null),A=g||n[0],O=r(()=>{if(!h||null==w||!A)return null;const e=w,t=A;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,w,A]),S=u(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=Ao(e,t,y.xField);null!=n&&function(e,t,n){const o=uo.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(uo={positions:new Map(uo.positions).set(e,{xValue:t,sourceId:n})},go())}(y.name||"hover",n,f)}"x-position"!==(null==y?void 0:y.mode)&&v.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&fo(y.name||"hover",f),"x-position"!==(null==y?void 0:y.mode)&&v.onHover(null);if(h&&A)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[A];k(null!=n?n+"":null)}else k(null);if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const i=Oo(e),r=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),b&&b(r)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});s&&s(e),b&&b(e)}}},[t,v,y,f,s,l,c,b,h,A]),j=u(e=>{var t,n,o,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 n=Ao(e,t,y.xField);null!=n&&function(e,t,n){const o=uo.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(uo.positions);return t.delete(e),uo={positions:t},go(),!1}uo={positions:new Map(uo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},go()}(y.name||"hover",n,f)}if(e&&d){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),d(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||b){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:c};if(e){const n=Oo(e),r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o: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 n=uo.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(uo.positions);o.delete(e),uo={positions:o},go()}(e,f),fo(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:m,onObservation:v,chartType:b,chartId:x,onClick:O,hoverHighlight:S,colorByField:I}),z=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(f,W),G=function(e,t,n){const o=oo(),i=So();return r(()=>{var r;if(!t)return;const s=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(o&&Object.keys(o).length>0){const e=pe(n.map(e=>({_cat:e})),"_cat",s);return t=>o[t]||e(t)}return pe(n.map(e=>({_cat:e})),"_cat",s)}if(o&&Object.keys(o).length>0){const n=pe(e,t,s);return e=>o[e]||n(e)}return pe(e,t,s)}if(o&&Object.keys(o).length>0){const e=pe([{_:"a"}],"_",s);return t=>o[t]||e(t)}},[e,t,n,o,i])}(T,s,l),q=r(()=>{if(!s)return[];const e=new Set;for(const t of T){const n="function"==typeof s?s(t):t[s];null!=n&&e.add(n+"")}return Array.from(e)},[T,s]),V=r(()=>L&&$.length>0?$:q,[L,$,q]),X=function(e,t,n){const[o,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 o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),h=r(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return s.has(o)}}:null},[e,t,o,s]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:c,onLegendClick:d,legendSelectionHook:h}}(c,s,V),Y=r(()=>D||(X.legendSelectionHook?X.legendSelectionHook:R),[D,X.legendSelectionHook,R]),Q=function(e){const t=fn(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}(g),Z=So(),K=oo(),U=r(()=>{if(G)return G;if(!s||0===V.length)return;const e=Array.isArray(l)&&l.length>0||"string"==typeof l&&l.length>0?l:Z&&Z.length>0?Z:he,t="__streamCat",n=pe(V.map(e=>({[t]:e})),t,e);return e=>(null==K?void 0:K[e])||n(e)||"#999"},[G,s,V,l,Z,K]),{legend:J,margin:ee,legendPosition:te}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:i="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=d(mo),u=null!==d(vo),h=void 0!==o?o:!c&&!!t,g=!!t&&(h||u),f=r(()=>{if(!g)return[];if(void 0!==l)return l;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[l,t,e,g]);xo(u&&t?f:[]);const p=r(()=>{if(!h||!t)return;const o=wo({data:e,colorBy:t,colorScale:n,getColor:fe,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[h,t,e,n,f]),y=r(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===i&&!o("right")&&110>n.right?n.right=110:"left"===i&&!o("left")&&110>n.left?n.left=110:"top"===i&&!o("top")&&50>n.top?n.top=50:"bottom"===i&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,s,p,i]);return{legend:p,margin:y,legendPosition:i}}({data:T,colorBy:s,colorScale:U,showLegend:w,legendPosition:h,userMargin:k,defaults:A,categories:V}),ne=r(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te),c&&"none"!==c&&(e.legendHoverBehavior=X.onLegendHover,e.legendClickBehavior=X.onLegendClick,e.legendHighlightedCategory=X.highlightedCategory,e.legendIsolatedCategories=X.isolatedCategories),L&&s&&(e.legendCategoryAccessor=s,e.onCategoriesChange=H),e},[J,te,c,X.onLegendHover,X.onLegendClick,X.highlightedCategory,X.isolatedCategories,L,s,H]),oe=Array.isArray(o)?F(o):o,ie=function(e,n,o,i){if(!e)return null;if(!1===i)return null;if(null!=i)return t("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/2);return t("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>t("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Eo),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(j,C,P,_),re=ie?null:function(e,n,o,i){return!1===i||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?t("div",{style:Object.assign(Object.assign({},Do),{width:n,height:o}),children:i||"No data available"}):null}(oe,C,P,M);return{data:T,colorScale:G,allCategories:V,legendState:X,effectiveSelectionHook:Y,activeSelectionHook:R,customHoverBehavior:E,customClickBehavior:N,legend:J,margin:ee,legendPosition:te,earlyReturn:ie||re||null,legendBehaviorProps:ne,crosshairProps:z,resolvedSelection:Q}}function Vo({ref:e,frameRef:t,setup:n}){return f(e,()=>({push:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.push(e)},pushMany:e=>{var n;return null===(n=t.current)||void 0===n?void 0:n.pushMany(e)},remove:e=>{var n,o;return null!==(o=null===(n=t.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[]},update:(e,n)=>{var o,i;return null!==(i=null===(o=t.current)||void 0===o?void 0:o.update(e,n))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=t.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getData())&&void 0!==n?n:[]},getScales:()=>{var e,n;return null!==(n=null===(e=t.current)||void 0===e?void 0:e.getScales())&&void 0!==n?n:null}}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function Xo(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function Yo(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:i,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:d,opacity:u,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=r(()=>(e,r)=>{const l="function"==typeof p?p(e,r):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=fe(e,t,n)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=de[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(o,i,s,f?r:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,i,s,a,f,p,y]),v=r(()=>Xo(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:d,opacity:u}),[m,l,c,d,u]);return r(()=>{return e=v,n=g,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,g])}function Qo(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}const Zo=g(function(e,n){const o=Mo(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:m=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:A,valueExtent:O,frameProps:S={},selection:j,linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:B,legendInteraction:H,legendPosition:I,color:R,stroke:D,strokeWidth:E,opacity:N,showCategoryTicks:W,categoryFormat:z,dataIdAccessor:G}=e,{width:q,height:V,enableHover:X,showGrid:Y,showLegend:Q,title:Z,description:K,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,ne=r(()=>F(a),[a]),oe=qo({data:ne,rawData:a,colorBy:f,colorScheme:p,legendInteraction:H,legendPosition:I,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Q,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:B,width:q,height:V}),{effectiveLegendProps:ie,effectiveMargin:re}=Vo({ref:n,frameRef:i,setup:oe});if(oe.earlyReturn)return oe.earlyReturn;No("BarChart",ne,"categoryAccessor",d),No("BarChart",ne,"valueAccessor",u);const se=jo(ne,y,u),ae=So(),le=r(()=>new Map,[ne]),ce=Yo({colorBy:f,colorScale:oe.colorScale,color:R,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:E,opacity:N,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),de=r(()=>$o({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:g}),[d,u,f,g]),ue=Go({componentName:"BarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return t(Bo,{componentName:"BarChart",message:ue,width:q,height:V});const he=Qo(A),ge=he?[he,...k||[]]:k,fe=Object.assign(Object.assign(Object.assign(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:se}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re,barPadding:m}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),G&&{dataIdAccessor:G}),{baselinePadding:x,enableHover:X,showAxes:o.showAxes,oLabel:ee,rLabel:te,rFormat:g}),z&&{oFormat:z}),{showGrid:Y,showCategoryTicks:W,oSort:y}),ie),Jn({title:Z,description:K,summary:U,accessibleTable:J,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:w,defaultTooltipContent:de})),eo({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),ge&&ge.length>0&&{annotations:ge}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"BarChart",width:q,height:V,children:t(Un,Object.assign({ref:i},fe))})});Zo.displayName="BarChart";const Ko=g(function(e,n){const o=Mo(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:m=!1,sort:v=!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,loadingContent:$,emptyContent:B,legendInteraction:H,legendPosition:I,color:R,stroke:D,strokeWidth:E,opacity:N,categoryFormat:W}=e,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=o,ee=r(()=>F(a),[a]),te=p||u,ne=qo({data:ee,rawData:a,colorBy:te,colorScheme:y,legendInteraction:H,legendPosition:I,selection:j,linkedHover:_,fallbackFields:te?["string"==typeof te?te:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:X,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:B,width:z,height:G});if(ne.earlyReturn)return ne.earlyReturn;const oe=So(),ie=r(()=>new Map,[ee]),re=Yo({colorBy:te,colorScale:ne.colorScale,color:R,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:E,opacity:N,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),se=r(()=>$o({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),ae=Go({componentName:"StackedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{stackBy:u}}),{effectiveLegendProps:le,effectiveMargin:ce}=Vo({ref:n,frameRef:i,setup:ne}),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:"bar"},null!=a&&{data:ee}),{oAccessor:d,rAccessor:h,stackBy:u,normalize:m,oSort:v,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:re,size:[z,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:q}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:U,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:V}),le),Jn({title:Y,description:Q,summary:Z,accessibleTable:K,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:k,defaultTooltipContent:se})),eo({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return ae?t(Bo,{componentName:"StackedBarChart",message:ae,width:z,height:G}):t(Fo,{componentName:"StackedBarChart",width:z,height:G,children:t(Un,Object.assign({ref:i},de))})});Ko.displayName="StackedBarChart";const Uo=g(function(e,n){const o=Mo(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:m=!1,barPadding:v=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,loadingContent:T,emptyContent:$,legendInteraction:B,legendPosition:H,color:I,stroke:R,strokeWidth:D,opacity:E,categoryFormat:N}=e,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=o,J=r(()=>F(a),[a]),ee=p||u,te=qo({data:J,rawData:a,colorBy:ee,colorScheme:y,legendInteraction:B,legendPosition:H,selection:S,linkedHover:j,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"GroupedBarChart",chartId:P,showLegend:V,userMargin:l,marginDefaults:o.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:W,height:z});if(te.earlyReturn)return te.earlyReturn;const ne=So(),oe=r(()=>new Map,[J]),ie=Yo({colorBy:ee,colorScale:te.colorScale,color:I,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:O.pieceStyle,stroke:R,strokeWidth:D,opacity:E,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=r(()=>$o({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),se=Go({componentName:"GroupedBarChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h},requiredProps:{groupBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=Vo({ref:n,frameRef:i,setup:te}),ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=a&&{data:J}),{oAccessor:d,rAccessor:h,groupBy:u,oSort:m,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q}),ae),Jn({title:X,description:Y,summary:Q,accessibleTable:Z,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:w,defaultTooltipContent:re})),eo({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 se?t(Bo,{componentName:"GroupedBarChart",message:se,width:W,height:z}):t(Fo,{componentName:"GroupedBarChart",width:W,height:z,children:t(Un,Object.assign({ref:i},ce))})});function Jo({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const i=(a="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof a?{name:a}:a:null;var a;const l=function(e){const{name:t,xField:n,yField:o}=e,{predicate:i,isActive:s,selectInterval:a,clear:l}=po({name:t}),c=n&&o?"xyBrush":n?"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)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&yo(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&yo(e)&&o&&(t[o]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,o,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 o?o:"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||n||t);return{hasBrush:h,handleBrush:d,brushStreamProps:h?{brush:{dimension:"r"},onBrush:d}:{}}}Uo.displayName="GroupedBarChart";const ei=g(function(e,n){const o=Mo(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:m,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:A={},selection:O,linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,chartId:C,loading:P,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:I,strokeWidth:R,opacity:D,categoryFormat:E,rTickValues:N,tickLabelEdgeAlign:W,showCategoryTicks:z,gradientFill:G,trackFill:q,roundedTop:V,valueExtent:X}=e,{width:Y,height:Q,enableHover:Z,showGrid:K,showLegend:U,title:J,description:ee,summary:te,accessibleTable:ne,categoryLabel:oe,valueLabel:ie}=o,re=r(()=>F(a),[a]),se=p||u,ae=r(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(re.map(e=>"function"==typeof d?d(e):e[d])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===g?Q:Y)-2*n)/(n-1))):1},[m,e.mode,re,d,g,Y,Q]),le=qo({data:re,rawData:a,colorBy:se,colorScheme:y,legendInteraction:$,legendPosition:B,selection:O,linkedHover:S,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:M,chartType:"SwimlaneChart",chartId:C,showLegend:U,userMargin:l,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:Y,height:Q}),ce=Jo({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:h});if(le.earlyReturn)return le.earlyReturn;const de=So(),ue=r(()=>new Map,[re]),he=Yo({colorBy:se,colorScale:le.colorScale,color:H,themeCategorical:de,colorScheme:y,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:I,strokeWidth:R,opacity:D,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,cycleByCategory:!0}),ge=r(()=>$o({categoryAccessor:u,valueAccessor:h,groupAccessor:d,valueFormat:f}),[u,d,h,f]),fe=Go({componentName:"SwimlaneChart",data:a,accessors:{categoryAccessor:d,valueAccessor:h,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:pe,effectiveMargin:ye}=Vo({ref:n,frameRef:i,setup:le}),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(Object.assign(Object.assign({chartType:"swimlane"},null!=a&&{data:re}),{oAccessor:d,rAccessor:h,stackBy:u,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:he,size:[Y,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:ae,enableHover:Z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:!1===z?void 0:oe,rLabel:ie,rFormat:f}),N&&{rTickValues:N}),null!=W&&{tickLabelEdgeAlign:W}),E&&{oFormat:E}),void 0!==z&&{showCategoryTicks:z}),{showGrid:K}),pe),Jn({title:J,description:ee,summary:te,accessibleTable:ne,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:v,defaultTooltipContent:ge})),eo({linkedHover:S,onObservation:j,onClick:_,hoverHighlight:M,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior})),b&&b.length>0&&{annotations:b}),G&&{gradientFill:!0===G?{topOpacity:.8,bottomOpacity:.05}:G}),null!=q&&{trackFill:q}),null!=V&&{roundedTop:V}),X&&{rExtent:X}),ce.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return fe?t(Bo,{componentName:"SwimlaneChart",message:fe,width:Y,height:Q}):t(Fo,{componentName:"SwimlaneChart",width:Y,height:Q,children:t(Un,Object.assign({ref:i},me))})});function ti(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;f(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}ei.displayName="SwimlaneChart";const ni=g(function(e,n){const o=Mo(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);ti(n,{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:m=[3,8],pointRadius:v=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:$,loading:B,loadingContent:H,emptyContent:I,legendInteraction:R,legendPosition:D,color:E,stroke:N,strokeWidth:W,opacity:z,showCategoryTicks:G,categoryFormat:q}=e,{width:V,height:X,enableHover:Y,showGrid:Q,showLegend:Z,title:K,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=o,oe=r(()=>F(a),[a]),ie=qo({data:oe,rawData:a,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:D,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:$,showLegend:Z,userMargin:l,marginDefaults:o.marginDefaults,loading:B,loadingContent:H,emptyContent:I,width:V,height:X}),re=Jo({brushProp:O,onBrushProp:S,linkedBrush:j,valueAccessor:u});if(ie.earlyReturn)return ie.earlyReturn;const se=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]),ae=So(),le=r(()=>new Map,[oe]),ce=Yo({colorBy:f,colorScale:ie.colorScale,color:E,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:null==_?void 0:_.pieceStyle,stroke:N,strokeWidth:W,opacity:z,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:y?ye(e,y,m,se):v})}),de=r(()=>$o({categoryAccessor:d,valueAccessor:u,groupAccessor:f||void 0,valueFormat:g}),[d,u,f,g]),ue=Go({componentName:"SwarmPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ue)return t(Bo,{componentName:"SwarmPlot",message:ue,width:V,height:X});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({chartType:"swarm"},null!=a&&{data:oe}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ce,size:[V,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,barPadding:x,enableHover:Y}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:te,rLabel:ne,rFormat:g}),q&&{oFormat:q}),{showGrid:Q,showCategoryTicks:G}),ie.legendBehaviorProps),Jn({title:K,description:U,summary:J,accessibleTable:ee,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:w,defaultTooltipContent:de})),eo({linkedHover:C,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),k&&k.length>0&&{annotations:k}),A&&{rExtent:A}),re.brushStreamProps),Object.fromEntries(Object.entries(_).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"SwarmPlot",width:V,height:X,children:t(Un,Object.assign({ref:i},he))})});function oi(n){return o=>{var i;const r=o.category||o.data&&(null===(i=o.data[0])||void 0===i?void 0:i.category)||"",s=o.stats||(o.data||o).stats;if(s&&null!=s.median)return e("div",{className:"semiotic-tooltip",style:Kt,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==n?void 0:n.valueAccessor){const i=n.valueAccessor,s=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof i?i(e):e[i])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),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:Kt,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:Kt,children:t("div",{style:{fontWeight:"bold"},children:r+""})})}}ni.displayName="SwarmPlot";const ii=g(function(e,n){const o=Mo(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);ti(n,{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:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,loadingContent:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:I,showCategoryTicks:R,categoryFormat:D}=e,{width:E,height:N,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=o,K=r(()=>F(a),[a]),U=qo({data:K,rawData:a,colorBy:f,colorScheme:p,legendInteraction:L,legendPosition:T,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:G,userMargin:l,marginDefaults:o.marginDefaults,loading:M,loadingContent:C,emptyContent:P,width:E,height:N});if(U.earlyReturn)return U.earlyReturn;const J=So(),ee=r(()=>new Map,[K]),te=Yo({colorBy:f,colorScale:U.colorScale,color:$,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:void 0,stroke:B,strokeWidth:H,opacity:I,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=r(()=>oi(),[]),oe=Go({componentName:"BoxPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(oe)return t(Bo,{componentName:"BoxPlot",message:oe,width:E,height:N});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=a&&{data:K}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:te,showOutliers:y,size:[E,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:m,enableHover:W}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:R}),U.legendBehaviorProps),Jn({title:q,description:V,summary:X,accessibleTable:Y,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:v,defaultTooltipContent:ne})),eo({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"BoxPlot",width:E,height:N,children:t(Un,Object.assign({ref:i},ie))})});ii.displayName="BoxPlot";const ri=g(function(n,o){const i=Mo(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),a=s(null);ti(o,{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:m,categoryPadding:v=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,loadingContent:$,emptyContent:B,legendInteraction:H,legendPosition:I,color:R,stroke:D,strokeWidth:E,opacity:N,showCategoryTicks:W,categoryFormat:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=r(()=>F(l),[l]),ne=qo({data:te,rawData:l,colorBy:y,colorScheme:m,legendInteraction:H,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:Y,userMargin:c,marginDefaults:i.marginDefaults,loading:T,loadingContent:$,emptyContent:B,width:G,height:q}),oe=Jo({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:h});if(ne.earlyReturn)return ne.earlyReturn;const ie=r(()=>{if(0===te.length)return;const e="function"==typeof h?h:e=>e[h];let t=1/0,n=-1/0;for(const o of te){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[te,h]),re=So(),se=r(()=>new Map,[te]),ae=Yo({colorBy:y,colorScale:ne.colorScale,color:R,themeCategorical:re,colorScheme:m,categoryIndexMap:se,userPieceStyle:void 0,stroke:D,strokeWidth:E,opacity:N,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),le=r(()=>n=>{const o=n.data||n,i=o.category||n.category||"",r=o.count,s=o.range;return e("div",{className:"semiotic-tooltip",style:Kt,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=Go({componentName:"Histogram",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(ce)return t(Bo,{componentName:"Histogram",message:ce,width:G,height:q});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:te}),{oAccessor:u,rAccessor:h,projection:"horizontal",summaryStyle:ae,bins:g,normalize:f}),w?{rExtent:w}:ie&&{rExtent:ie}),{size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:p}),z&&{oFormat:z}),{showGrid:X,showCategoryTicks:W}),ne.legendBehaviorProps),Jn({title:Q,description:Z,summary:K,accessibleTable:U,className:d,animate:n.animate,axisExtent:n.axisExtent})),to({tooltip:b,defaultTooltipContent:le})),eo({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),x&&x.length>0&&{annotations:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"Histogram",width:G,height:q,children:t(Un,Object.assign({ref:a},de))})});ri.displayName="Histogram";const si=g(function(e,n){const o=Mo(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);ti(n,{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:m,categoryPadding:v=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,loadingContent:$,emptyContent:B,legendInteraction:H,legendPosition:I,color:R,stroke:D,strokeWidth:E,opacity:N,showCategoryTicks:W,categoryFormat:z}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=o,te=r(()=>F(a),[a]),ne=qo({data:te,rawData:a,colorBy:y,colorScheme:m,legendInteraction:H,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:Y,userMargin:l,marginDefaults:o.marginDefaults,loading:T,loadingContent:$,emptyContent:B,width:G,height:q}),oe=Jo({brushProp:k,onBrushProp:A,linkedBrush:O,valueAccessor:u});if(ne.earlyReturn)return ne.earlyReturn;const ie=So(),re=r(()=>new Map,[te]),se=Yo({colorBy:y,colorScale:ne.colorScale,color:R,themeCategorical:ie,colorScheme:m,categoryIndexMap:re,userPieceStyle:void 0,stroke:D,strokeWidth:E,opacity:N,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ae=r(()=>oi({valueAccessor:u}),[u]),le=Go({componentName:"ViolinPlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(le)return t(Bo,{componentName:"ViolinPlot",message:le,width:G,height:q});const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=a&&{data:te}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:se,bins:g,showIQR:f,size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:v,enableHover:V}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:J,rLabel:ee,rFormat:p}),z&&{oFormat:z}),{showGrid:X,showCategoryTicks:W}),ne.legendBehaviorProps),Jn({title:Q,description:Z,summary:K,accessibleTable:U,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:b,defaultTooltipContent:ae})),eo({linkedHover:_,onObservation:M,onClick:C,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"ViolinPlot",width:G,height:q,children:t(Un,Object.assign({ref:i},ce))})});si.displayName="ViolinPlot";const ai=g(function(e,n){var o;const i=Mo(e.mode,{width:e.width,height:e.height,showGrid:null===(o=e.showGrid)||void 0===o||o,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);ti(n,{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:m="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:A,frameProps:O={},selection:S,linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:B,legendPosition:H,color:I,stroke:R,strokeWidth:D,opacity:E,categoryFormat:N}=e,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=r(()=>F(l),[l]),ee=qo({data:J,rawData:l,colorBy:p,colorScheme:y,legendInteraction:B,legendPosition:H,selection:S,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:_,onClick:M,hoverHighlight:C,chartType:"DotPlot",chartId:P,showLegend:V,userMargin:c,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:W,height:z});if(ee.earlyReturn)return ee.earlyReturn;const te=jo(J,m,h),ne=So(),oe=r(()=>new Map,[J]),ie=Yo({colorBy:p,colorScale:ee.colorScale,color:I,themeCategorical:ne,colorScheme:y,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:R,strokeWidth:D,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),re=r(()=>$o({categoryAccessor:u,valueAccessor:h,valueFormat:f}),[u,h,f]),se=Go({componentName:"DotPlot",data:l,accessors:{categoryAccessor:u,valueAccessor:h}});if(se)return t(Bo,{componentName:"DotPlot",message:se,width:W,height:z});const ae=Qo(k),le=ae?[ae,...w||[]]:w,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:"point"},null!=l&&{data:te}),{oAccessor:u,rAccessor:h,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:b,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q,oSort:m}),ee.legendBehaviorProps),Jn({title:X,description:Y,summary:Q,accessibleTable:Z,className:d,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:x,defaultTooltipContent:re})),eo({linkedHover:j,onObservation:_,onClick:M,hoverHighlight:C,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),le&&le.length>0&&{annotations:le}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"DotPlot",width:W,height:z,children:t(Un,Object.assign({ref:a},ce))})});ai.displayName="DotPlot";const li=g(function(e,n){var o,i;const a=Mo(e.mode,{width:null!==(o=e.width)&&void 0!==o?o: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:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,loadingContent:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:B,opacity:H}=e,{width:I,height:R,enableHover:D,showLegend:E,title:N,description:W,summary:z,accessibleTable:G}=a,q=r(()=>F(c),[c]),V=f||h,X=qo({data:q,rawData:c,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"PieChart",chartId:j,showLegend:E,userMargin:d,marginDefaults:a.marginDefaults,loading:_,loadingContent:M,emptyContent:C,width:I,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=So(),Q=r(()=>new Map,[q]),Z=Yo({colorBy:V,colorScale:X.colorScale,color:T,themeCategorical:Y,colorScheme:p,categoryIndexMap:Q,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),K=r(()=>$o({categoryAccessor:h,valueAccessor:g,groupAccessor:f&&f!==h?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[h,g,f]),U=Go({componentName:"PieChart",data:c,accessors:{categoryAccessor:h,valueAccessor:g}}),{effectiveLegendProps:J,effectiveMargin:ee}=Vo({ref:n,frameRef:l,setup:X}),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=c&&{data:q}),{oAccessor:h,rAccessor:g,projection:"radial",pieceStyle:Z,startAngle:y}),null!=m&&{cornerRadius:m}),{size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee,enableHover:D}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),J),Jn({title:N,description:W,summary:z,accessibleTable:G,className:u,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:v,defaultTooltipContent:K})),eo({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return U?t(Bo,{componentName:"PieChart",message:U,width:I,height:R}):t(Fo,{componentName:"PieChart",width:I,height:R,children:t(Un,Object.assign({ref:l},te))})});li.displayName="PieChart";const ci=g(function(e,n){const o=Mo(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:m,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,chartId:j,loading:_,loadingContent:M,emptyContent:C,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:B,opacity:H}=e,{width:I,height:R,enableHover:D,showLegend:E,title:N,description:W,summary:z,accessibleTable:G}=o,q=r(()=>F(a),[a]),V=f||d,X=qo({data:q,rawData:a,colorBy:V,colorScheme:p,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"DonutChart",chartId:j,showLegend:E,userMargin:l,marginDefaults:o.marginDefaults,loading:_,loadingContent:M,emptyContent:C,width:I,height:R});if(X.earlyReturn)return X.earlyReturn;const Y=null!=h?h:Math.max(2,.15*Math.min(I,R)),Q=So(),Z=r(()=>new Map,[q]),K=Yo({colorBy:V,colorScale:X.colorScale,color:T,themeCategorical:Q,colorScheme:p,categoryIndexMap:Z,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection,cycleByCategory:!0}),U=r(()=>$o({categoryAccessor:d,valueAccessor:u,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,u,f]),J=Go({componentName:"DonutChart",data:a,accessors:{categoryAccessor:d,valueAccessor:u}}),{effectiveLegendProps:ee,effectiveMargin:te}=Vo({ref:n,frameRef:i,setup:X}),ne=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:q}),{oAccessor:d,rAccessor:u,projection:"radial",pieceStyle:K,innerRadius:Y,startAngle:y}),null!=m&&{cornerRadius:m}),{centerContent:g,size:[I,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te,enableHover:D}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:!1}),ee),Jn({title:N,description:W,summary:z,accessibleTable:G,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:v,defaultTooltipContent:U})),eo({linkedHover:k,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return J?t(Bo,{componentName:"DonutChart",message:J,width:I,height:R}):t(Fo,{componentName:"DonutChart",width:I,height:R,children:t(Un,Object.assign({ref:i},ne))})});function di(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function ui(e){return Math.max(0,Math.min(1,e))}function hi(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function gi(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function fi(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:ui(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=ui(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=hi(t.color),l=hi(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,d,u]=a,[h,g,f]=l;return gi(c+(h-c)*s,d+(g-d)*s,u+(f-u)*s)}return n[n.length-1].color}function pi(e,t,n){return`${e}-${t}`}ci.displayName="DonutChart";const yi=g(function(n,o){const i=Mo(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),a=s(null),l="context"===n.mode,{compactMode:c}=i,{value:d,min:u=0,max:h=100,thresholds:g,gradientFill:f,color:p,backgroundColor:y="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:v,showNeedle:b=!0,needleColor:x="var(--semiotic-text, #333)",centerContent:w,valueFormat:k,showScaleLabels:A=!c,sweep:O=240,fillZones:S=!0,tooltip:j,annotations:_,frameProps:M={},className:C,stroke:P,strokeWidth:L,opacity:T}=n,{width:$,height:B,title:H,description:I,summary:R,accessibleTable:F}=i,D=f&&"object"==typeof f?f:void 0,E=Math.max(u,Math.min(h,d)),N=h-u||1,W=(E-u)/N,{gaugeData:z,pieceStyle:G,gaugeAnnotations:q}=r(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:d=240}=e,u=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/u;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>g[g.length-1].value&&g.push({value:n,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=a?h:1,t=pi("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(d)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(fi(c.colorStops,e*(t+.5)/n));const i=pi("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;g.length>n;n++){const o=g[n],i=(o.value-e)/u,r=(e-t)/u,l=(o.value-t)/u,c=Math.max(0,(a?Math.min(h,l):l)-r),d=a?Math.max(0,i-c):0;if(c>0){const e=pi("fill",n);p.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(d>0){const e=pi("bg",n);p.push({category:e,value:d,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:m}}({min:u,max:h,value:d,thresholds:g,fillColor:p,backgroundColor:y,fillZones:S,showScaleLabels:A,gradientFill:D}),[d,u,h,g,p,y,A,S,D]),V=r(()=>Xo(G,{stroke:P,strokeWidth:L,opacity:T}),[G,P,L,T]),{sweepRad:X,startAngleDeg:Y}=di(O),Q=function(e=240){const{sweepRad:t,offsetRad:n}=di(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(O),Z=Math.min(10,Math.max(1,Math.min($,B)/12)),K=Q.cx,U=Q.cy,J=Math.max(4,Math.min(($-2*Z)/Q.width,(B-2*Z)/Q.height)-2),ee=Math.max(0,Math.min(J-1.5,J*(1-m))),te=$/2-K*J,ne=B/2-U*J,oe=2*(J+4),ie=r(()=>{if(c&&null==w)return null;if(null!=w)return"function"==typeof w?w(E,u,h):w;const n=k?k(E):Math.round(E)+"";return e("div",{style:{textAlign:"center",lineHeight:1.2},children:[t("div",{style:{fontSize:Math.max(16,.3*J),fontWeight:700,color:"var(--semiotic-text, #333)"},children:n}),A&&e("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[u," – ",h]})]})},[w,E,u,h,k,A,J,c]),re=r(()=>l&&null==w?{type:"gauge-value",text:k?k(E):Math.round(E)+""}:null,[l,w,E,k]),se=r(()=>{if(!b)return null;const e=-Math.PI/2+Y*Math.PI/180+W*X,t=ee>20?ee-8:J-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:x}},[b,W,Y,X,ee,x]),ae=r(()=>(n,o,i)=>{if("gauge-needle"===n.type){const r=(i.width||$)/2,s=(i.height||B)/2,a=Math.max(1,J-ee),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:n.tipX,y2:n.tipY,stroke:n.color,strokeWidth:l,strokeLinecap:"round"}),t("circle",{cx:0,cy:0,r:c,fill:n.color})]},"gauge-needle-"+o)}if("gauge-label"===n.type){const r=-Math.PI/2+Y*Math.PI/180+(n.value-u)/N*X,s=(i.width||$)/2,a=(i.height||B)/2,l=ee-1,c=J+1,d=Math.cos(r)*l,h=Math.sin(r)*l,g=Math.cos(r)*c,f=Math.sin(r)*c,p=J+10,y=Math.cos(r)*p,m=Math.sin(r)*p,v=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let b="middle",x="middle";return v>=11||1>v?(b="middle",x="auto"):v>=1&&5>v?(b="start",x="middle"):v>=5&&7>v?(b="middle",x="hanging"):(b="end",x="middle"),e("g",{transform:`translate(${s},${a})`,children:[t("line",{x1:d,y1:h,x2:g,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),t("text",{x:y,y:m,textAnchor:b,dominantBaseline:x,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:n.label})]},"gauge-label-"+o)}return"gauge-value"===n.type?t("text",{x:(i.width||$)/2,y:(i.height||B)/2-.2*ee,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*J)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:n.text},"gauge-value-"+o):null},[$,B,u,N,Y,X,ee,J]),le=r(()=>{const e=[...q,..._||[]];return se&&e.push(se),re&&e.push(re),e},[q,_,se,re]),ce=r(()=>n=>{var o;const i=(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o[0])||(null==n?void 0:n.data)||n,r=null==i?void 0:i._isFill;return 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(E):"Remaining"})]})},[E]);if(0===z.length)return t(Bo,{componentName:"GaugeChart",message:"No data to display",width:$,height:B});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:V,innerRadius:ee,startAngle:Y,sweepAngle:O},null!=v&&{cornerRadius:v}),{centerContent:ie,size:[$,B],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ne-oe/2,bottom:B-ne-oe/2,left:te-oe/2,right:$-te-oe/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===j?()=>null:tn(j)||ce,svgAnnotationRules:ae}),le.length>0&&{annotations:le}),H&&{title:H}),I&&{description:I}),R&&{summary:R}),void 0!==F&&{accessibleTable:F}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),M);return t(Fo,{componentName:"GaugeChart",width:$,height:B,children:t(Un,Object.assign({ref:a},de))})});yi.displayName="GaugeChart";const mi=g(function(e,n){const o=Mo(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);ti(n,{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:m,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:A,linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,chartId:M,loading:C,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:I,opacity:R,showCategoryTicks:D,categoryFormat:E}=e,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=o,U=r(()=>F(a),[a]),J=qo({data:U,rawData:a,colorBy:y,colorScheme:m,legendInteraction:T,legendPosition:$,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:q,userMargin:l,marginDefaults:o.marginDefaults,loading:C,loadingContent:P,emptyContent:L,width:N,height:W});if(J.earlyReturn)return J.earlyReturn;const ee=So(),te=r(()=>new Map,[U]),ne=Yo({colorBy:y,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:m,categoryIndexMap:te,userPieceStyle:void 0,stroke:H,strokeWidth:I,opacity:R,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=r(()=>oi(),[]),ie=Go({componentName:"RidgelinePlot",data:a,accessors:{categoryAccessor:d,valueAccessor:u}});if(ie)return t(Bo,{componentName:"RidgelinePlot",message:ie,width:N,height:W});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=a&&{data:U}),{oAccessor:d,rAccessor:u,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:ne,bins:g,size:[N,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:o.showAxes,oLabel:Z,rLabel:K,rFormat:p}),E&&{oFormat:E}),{showGrid:G,showCategoryTicks:D,oSort:!1,amplitude:f}),J.legendBehaviorProps),Jn({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:e.animate,axisExtent:e.axisExtent})),to({tooltip:b,defaultTooltipContent:oe})),eo({linkedHover:O,onObservation:S,onClick:j,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"RidgelinePlot",width:N,height:W,children:t(Un,Object.assign({ref:i},re))})});mi.displayName="RidgelinePlot";const vi=g(function(n,o){const i=Mo(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),a=s(null);ti(o,{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:m=.3,showLabels:v=!0,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:j,chartId:_,loading:M,loadingContent:C,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:I,categoryFormat:R}=n,D="vertical"===y,{width:E,height:N,enableHover:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X}=i,Y=D?{top:G?60:40,right:20,bottom:60,left:60}:{top:G?40:10,right:10,bottom:10,left:10},Q=r(()=>F(l),[l]),Z=f||g,K=!Z,U=qo({data:Q,rawData:l,colorBy:Z,colorScheme:p,legendInteraction:L,legendPosition:T,selection:k,linkedHover:A,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:j,chartType:"FunnelChart",chartId:_,showLegend:z,userMargin:c,marginDefaults:Y,loading:M,loadingContent:C,emptyContent:P,width:E,height:N});if(U.earlyReturn)return U.earlyReturn;No("FunnelChart",Q,"stepAccessor",u),No("FunnelChart",Q,"valueAccessor",h);const J=So(),ee=r(()=>new Map,[Q]),te=r(()=>{if(K)return $||((null==J?void 0:J[0])?J[0]:Array.isArray(p)&&p[0]?p[0]:"#4e79a7")},[K,$,J,p]),ne=Yo({colorBy:te?void 0:Z,colorScale:U.colorScale,color:null!=te?te:$,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:B,strokeWidth:H,opacity:I,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=r(()=>n=>{var o,i,r,s,a,l;const c=(null==n?void 0:n.data)||n,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!==(o=null==c?void 0:c.__funnelValue)&&void 0!==o?o:null==c?void 0:c.__barFunnelValue)&&void 0!==i?i:null==c?void 0:c.value)&&void 0!==r?r:"",h=null!==(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:Kt,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]})]})},[]),ie=Go({componentName:"FunnelChart",data:l,accessors:{stepAccessor:u,valueAccessor:h}});if(ie)return t(Bo,{componentName:"FunnelChart",message:ie,width:E,height:N});const re=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:D?"bar-funnel":"funnel"},null!=l&&{data:Q}),{oAccessor:u,rAccessor:h}),g&&{stackBy:g}),{projection:D?"vertical":"horizontal",barPadding:D?40:0,pieceStyle:ne,size:[E,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:D,showCategoryTicks:D}),R&&{oFormat:R}),{showGrid:D}),!D&&{connectorOpacity:m}),{showLabels:v}),U.legendBehaviorProps),G&&{title:G}),q&&{description:q}),V&&{summary:V}),void 0!==X&&{accessibleTable:X}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===b?()=>null:!0===b||null==b?oe:tn(b)||oe}),(A||O||S||j)&&{customHoverBehavior:U.customHoverBehavior}),(O||S||A)&&{customClickBehavior:U.customClickBehavior}),x&&x.length>0&&{annotations:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return t(Fo,{componentName:"FunnelChart",width:E,height:N,children:t(Un,Object.assign({ref:a},re))})});vi.displayName="FunnelChart";const bi={RdBu:oe,PiYG:ie,PRGn:re,BrBG:se,RdYlBu:ae,RdYlGn:le,Spectral:ce},xi="__likert_neutral_neg",wi="__likert_neutral_pos";function ki(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Ai(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function Oi(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:xi,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:wi,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Si(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===xi?r=n:n.__likertLevel===wi?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const ji=new Map,_i=g(function(e,n){const i=Mo(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:m="count",levels:v,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:$,loadingContent:B,emptyContent:H,legendInteraction:I,legendPosition:R,categoryFormat:F,stroke:D,strokeWidth:E,opacity:N}=e,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J="horizontal"===b,ee=void 0===c,te=!y,ne=function(){var e;const t=ko();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),oe=r(()=>x&&Array.isArray(x)&&x.length>=v.length?x:function(e,t){if(0>=e)return[];if(t){const n=bi[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(v.length,ne),[x,v.length,ne]),ie=r(()=>{const e=new Map;for(let t=0;v.length>t;t++)e.set(v[t],oe[t]||"#888");return e},[v,oe]),{processedData:re,reAggregate:se,accumulatorRef:ae}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:i,countAccessor:a,isDiverging:l,frameRef:c}){const d=!i,h=r(()=>ki(n,"question"),[n]),g=r(()=>d?ki(o,"score"):null,[d,o]),f=r(()=>d?null:ki(i,"level"),[d,i]),p=r(()=>d?null:ki(a,"count"),[d,a]),y=e||[],m=s([]),v=r(()=>{if(0===y.length)return[];let e=Ai(y,t,h,g,f,p);return l&&(e=Oi(e,t),e=Si(e,t)),e},[y,t,h,g,f,p,l]),b=u(e=>{var n;let o=Ai(e,t,h,g,f,p);l&&(o=Oi(o,t),o=Si(o,t)),null===(n=c.current)||void 0===n||n.replace(o)},[t,h,g,f,p,l,c]);return{processedData:v,reAggregate:b,accumulatorRef:m}}({data:c,levels:v,categoryAccessor:g,valueAccessor:p,levelAccessor:y,countAccessor:m,isDiverging:J,frameRef:l}),le="__likertLevelLabel",ce=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:i="right"}){const l=s(new Set),c=s([]),[d,h]=a(0),g=oo(),f=So(),p=u(e=>{const n=e[t];return null!=n?n+"":null},[t]),y=u(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=p(e);null==t||l.current.has(t)||(l.current.add(t),c.current.push(t),o=!0)}o&&h(e=>e+1)},[e,t,p]),m=u(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),i=c.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(l.current=new Set(o),c.current=o,h(e=>e+1))},[e,t]),v=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)},[]);xo(e&&t?c.current:[]);const w=r(()=>{if(!e||!t||!1===o)return;const i=c.current;if(0===i.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:f&&f.length>0?f:he,s=t,a=i.map(e=>({[s]:e})),l=pe(a,s,r);return wo({data:a,colorBy:s,colorScale:e=>(null==g?void 0:g[e])||l(e)||"#999",getColor:fe})},[e,t,o,n,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:v,wrapPushMany:b,resetCategories:x,categories:c.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:m}:{},streamingLegend:w,streamingMarginAdjust:k}}({isPushMode:ee,colorBy:le,colorScheme:oe,showLegend:V,legendPosition:R}),de=u(ce.wrapPush(e=>{ae.current.push(e),se(ae.current)}),[ce.wrapPush,se,ae]),ue=u(ce.wrapPushMany(e=>{ae.current.push(...e),se(ae.current)}),[ce.wrapPushMany,se,ae]);f(n,()=>({push:de,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=l.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=l.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;ae.current=[],ce.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}}),[de,ue,ce.resetCategories,ae]);const ge=qo({data:re,rawData:c,colorBy:le,colorScheme:oe,legendInteraction:I,legendPosition:R,selection:j,linkedHover:_,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:P,chartType:"LikertChart",chartId:L,showLegend:V,userMargin:d,marginDefaults:i.marginDefaults,loading:$,loadingContent:B,emptyContent:H,width:W,height:z});if(ge.earlyReturn)return ge.earlyReturn;const ye=r(()=>{const e=v.length;return e%2!=0&&ie.get(v[Math.floor(e/2)])||"#888"},[v,ie]),me=Yo({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:ji,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:E,opacity:N,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===xi||i===wi)return{fill:ye};const r=o||i;return r&&ie.has(r)?{fill:ie.get(r)}:{fill:"#888"}}}),ve=r(()=>{const e=v.length;return e%2!=0?v[Math.floor(e/2)]:""},[v]),be=r(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",i=n===xi||n===wi?ve:n,r=t.__likertCategory||"",s=Math.abs(t.__likertPct||0),a=n===xi||n===wi?2*s:s,l=t.__likertCount||0;return o.createElement("div",{className:"semiotic-tooltip",style:Kt},o.createElement("div",{style:{fontWeight:"bold"}},r),o.createElement("div",{style:{marginTop:4}},`${i}: ${a.toFixed(1)}% (n=${l})`))},[ve]),xe=r(()=>{if(!v||2>v.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&&!m)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==c&&0===c.length)return null;const e={categoryAccessor:g};return te?p&&(e.valueAccessor=p):(y&&(e.levelAccessor=y),m&&(e.countAccessor=m)),Go({componentName:"LikertChart",data:c,accessors:e,requiredProps:{levels:v}})},[c,g,p,y,m,v,te]),we=r(()=>[{styleFn:e=>({fill:ie.get(e.label)||"#888"}),items:v.map(e=>({label:e})),label:""}],[v,ie]),ke=r(()=>!1!==V?Object.assign(Object.assign({},ge.legendBehaviorProps),{legend:{legendGroups:we},legendPosition:R||ge.legendPosition||"bottom"}):ge.legendBehaviorProps,[ge.legendBehaviorProps,ge.legendPosition,R,V,we]),Ae=r(()=>{const e=Object.assign({},ge.margin);if(ee&&!1!==V){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(ce.streamingMarginAdjust)for(const[t,n]of Object.entries(ce.streamingMarginAdjust))n>e[t]&&(e[t]=n);return J&&100>e.left&&(e.left=100),e},[ge.margin,ce.streamingMarginAdjust,J,ee,V,R]),Oe=r(()=>T||(J?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[J,T]),Se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=c&&{data:re}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:J?"horizontal":"vertical",pieceStyle:me,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ae,barPadding:w,enableHover:G}),e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U||(J?void 0:"Percentage"),rFormat:Oe}),F&&{oFormat:F}),{showGrid:q}),ke),X&&{title:X}),Y&&{description:Y}),Q&&{summary:Q}),void 0!==Z&&{accessibleTable:Z}),h&&{className:h}),null!=e.animate&&{animate:e.animate}),void 0!==e.axisExtent&&{axisExtent:e.axisExtent}),{tooltipContent:!1===k?()=>null:!0===k?be:tn(k)||be}),(_||M||C||P)&&{customHoverBehavior:ge.customHoverBehavior}),(M||C||_)&&{customClickBehavior:ge.customClickBehavior}),A&&A.length>0&&{annotations:A}),O&&{rExtent:O}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return xe?t(Bo,{componentName:"LikertChart",message:xe,width:W,height:z}):t(Fo,{componentName:"LikertChart",width:W,height:z,children:t(Un,Object.assign({ref:l},Se))})});_i.displayName="LikertChart";const Mi=g(function(e,n){const{data:o,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:m,onObservation:v,onClick:b,selection:x,linkedHover:w,chartId:k,loading:A,loadingContent:O,emptyContent:S,frameProps:j={}}=e,{frameRef:_,resolved:M,safeData:C,setup:P,earlyReturn:L}=function(e){var t;const n=function(e){const t=s(null);return ti(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Mo(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;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(e.margin),[e.margin])}}(e),{resolved:o,normalizedMargin:i}=n,a=qo({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:o.showLegend,userMargin:i,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return Object.assign(Object.assign({},n),{safeData:a.data,setup:a,earlyReturn:a.earlyReturn})}({imperativeRef:n,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorScheme:p,selection:x,linkedHover:w,onObservation:v,onClick:b,chartId:k,loading:A,loadingContent:O,emptyContent:S,margin:g,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode});if(L)return L;const{width:T,height:$,enableHover:B,showGrid:H,title:I,description:R,summary:F,accessibleTable:D}=M,E=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=o&&{data:C}),{customLayout:i,layoutConfig:a,oAccessor:l,rAccessor:c,oExtent:d,rExtent:u,projection:h,colorScheme:p,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,enableHover:B,showAxes:y,showGrid:H,annotations:m}),Jn({title:I,description:R,summary:F,accessibleTable:D,className:f,animate:e.animate,axisExtent:e.axisExtent})),eo({linkedHover:w,onObservation:v,onClick:b,hoverHighlight:!1,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior})),j);return t(Fo,{componentName:"OrdinalCustomChart",width:T,height:$,children:t(Un,Object.assign({ref:_},E))})});Mi.displayName="OrdinalCustomChart";export{Zo as BarChart,ii as BoxPlot,ci as DonutChart,ai as DotPlot,vi as FunnelChart,yi as GaugeChart,Uo as GroupedBarChart,ri as Histogram,_i as LikertChart,Mi as OrdinalCustomChart,li as PieChart,mi as RidgelinePlot,Ko as StackedBarChart,Un as StreamOrdinalFrame,ni as SwarmPlot,ei as SwimlaneChart,si as ViolinPlot,Nn as createHatchPattern};
|