semiotic 3.8.3 → 3.8.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 +9 -9
- package/README.md +40 -39
- package/ai/examples.md +1 -1
- package/ai/schema.json +2726 -300
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
- package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
- package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
- package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
- package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
- package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
- package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
- package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-FBGHXL72.module.min.js} +1 -1
- package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
- package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
- package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-KQ546MKE.module.min.js} +1 -1
- package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
- package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-N6VKKF3A.module.min.js} +1 -1
- package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
- package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
- package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
- package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
- package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
- package/dist/components/ChartContainer.d.ts +2 -2
- package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
- package/dist/components/charts/geo/FlowMap.d.ts +4 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
- package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
- package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
- package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
- package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
- package/dist/components/charts/shared/chartMode.d.ts +8 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
- package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
- package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
- package/dist/components/charts/shared/types.d.ts +2 -2
- package/dist/components/charts/shared/validateProps.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +10 -0
- package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
- package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
- package/dist/components/realtime/types.d.ts +5 -0
- package/dist/components/recipes/gridObservatory.d.ts +176 -0
- package/dist/components/recipes/recipeChrome.d.ts +24 -0
- package/dist/components/recipes/sequenceLayout.d.ts +139 -0
- package/dist/components/semiotic-recipes-core.d.ts +6 -2
- package/dist/components/server/staticAnnotations.d.ts +3 -1
- package/dist/components/stream/SceneToSVG.d.ts +6 -6
- package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
- package/dist/components/stream/networkFramePaint.d.ts +2 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
- package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
- package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
- package/dist/components/stream/types.d.ts +4 -0
- package/dist/components/stream/useHydration.d.ts +7 -1
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
- package/dist/forceLayoutWorker.js +1 -1
- 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/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -2
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- 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 +3 -2
- package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
- package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
- package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
- package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
- package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
- package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
- package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
- package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
- package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
- package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
- package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
- package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
- package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
- package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
- package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
- package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
- package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
- package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
- package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
- package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
- package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
- package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
- package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
- package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
- package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
- package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
package/dist/ordinal.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e,t,n,o,r,i,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,h=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))d.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},g=(e,t,n)=>(n=null!=e?s(u(e)):{},m(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),y=h({"src/components/stream/brushAccessibility.ts"(){e=g(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),p={};function b({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,onBrush:h}){const f=(0,n.useRef)(null),m=(0,n.useRef)(null),g=(0,n.useRef)(h);g.current=h;const y=(0,n.useRef)(d);y.current=d;const p=(0,n.useRef)(!1),b=(0,n.useRef)(null),v="horizontal"===d?.projection,x=(0,n.useRef)(v);x.current=v;const w=function({label:n="Data range brush",description:o=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:o,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+i,onKeyDown:e.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),s.current?.(t))},[])}}}({label:"Ordinal value range brush",onAction:e=>{const t=y.current,n=m.current;if(!t||!n||!f.current)return;const r=(0,o.select)(f.current).select(".brush-g");if("clear"===e.type)return p.current=!0,r.call(n.move,null),p.current=!1,b.current=null,void g.current(null);if(("left"===e.direction||"right"===e.direction)!=!!x.current)return;const i=t.r.domain(),[s,a]=[Math.min(...i),Math.max(...i)],l=(a-s)/20,c=b.current?.r??[s+.4*(a-s),s+.6*(a-s)],u="left"===e.direction||"down"===e.direction?-1:1;let[d,h]=c;if(e.resize)0>u?d=Math.max(s,d-l):h=Math.min(a,h+l);else{const e=h-d;d=Math.max(s,Math.min(a-e,d+u*l)),h=d+e}const v={r:[d,h]};p.current=!0,r.call(n.move,x.current?[t.r(d),t.r(h)]:[t.r(h),t.r(d)]),p.current=!1,b.current=v,g.current(v)}});return(0,n.useEffect)(()=>{if(!f.current)return;const e=(0,o.select)(f.current).select(".brush-g"),t=v?(0,r.brushX)():(0,r.brushY)();return t.extent([[0,0],[s,a]]),t.on("brush end",e=>{if(p.current)return;const t=y.current;if(!t)return;if(!e.selection)return b.current=null,void g.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};b.current=i,g.current(i)}),e.call(t),m.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),m.current=null}},[s,a,v]),(0,n.useEffect)(()=>{if(!d||!m.current||!b.current)return;if(!f.current)return;const e=b.current,t=(0,o.select)(f.current).select(".brush-g"),n=d.r(e.r[0]),r=d.r(e.r[1]);v?(p.current=!0,t.call(m.current.move,[n,r]),p.current=!1):(p.current=!0,t.call(m.current.move,[r,n]),p.current=!1)},[d,v]),(0,i.jsxs)("svg",{ref:f,width:l,height:c,...w.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,i.jsx)("title",{children:w.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:w.descriptionId,children:w.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`,style:{pointerEvents:"all"}})]})}f(p,{OrdinalBrushOverlay:()=>b});var v,x=h({"src/components/stream/OrdinalBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),y(),i=require("react/jsx-runtime")}}),w={};f(w,{AnnotationLabel:()=>$n,BarChart:()=>Va,BoxPlot:()=>fl,DEFAULT_HIT_RADIUS:()=>dc,DonutChart:()=>Rl,DotPlot:()=>Sl,FunnelChart:()=>ql,GaugeChart:()=>Fl,GroupedBarChart:()=>Za,Histogram:()=>pl,LikertChart:()=>ic,OrdinalCustomChart:()=>cc,PieChart:()=>Cl,RidgelinePlot:()=>Dl,StackedBarChart:()=>Ua,StreamOrdinalFrame:()=>ps,SwarmPlot:()=>ll,SwimlaneChart:()=>ol,ViolinPlot:()=>xl,composeStyleRules:()=>Da,createHatchPattern:()=>On,estimateLabelWidth:()=>Tn,glyphExtent:()=>pt,glyphPlacement:()=>yt,hatchFillId:()=>En,hatchPatternDef:()=>Wn,hitTargetPoint:()=>fc,hitTargetRect:()=>mc,isHatchFill:()=>Fn,makeNodeRuleContext:()=>Oa,makeRuleValueResolver:()=>$a,makeStyleRuleStyleFn:()=>Wa,makeXYRuleContext:()=>Ba,matchesThreshold:()=>Fa,resolveResponsiveRules:()=>Ks,resolveStyleRules:()=>Ea,resolveSvgFill:()=>zn,responsiveRuleMatches:()=>Us,ruleMatches:()=>Na,useCustomLayoutSelection:()=>ct}),module.exports=(v=w,m(a({},"__esModule",{value:!0}),v));var k=require("react"),S=Object.freeze([]);function A(e){if(!e)return S;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}var M=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??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=A(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=A(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}},C=require("d3-scale"),j=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const 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();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=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{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 R(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function P(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function L(e,t,n){return e+(t-e)*n}function I(e,t){return e===t}function T(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function B(e){return new Set(Array.isArray(e)?e:[e])}var O=require("d3-scale");function H(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function F(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function N(e){const t=e.map(H),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return F(e,n,o)}if(e>=1){const[e,o,r]=t[n];return F(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return F(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var E=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],D=N(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),W=N(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),z=N(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),q=N(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),G=N(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),V=N(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Y={blues:D,reds:W,greens:z,viridis:N(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:q,purples:G,greys:V,plasma:N(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:N(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:N(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:N(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:N(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},X=N(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),U=N(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),K=N(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Q=N(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Z=N(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),J=N(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ee=N(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),te={category10:E,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Y},ne=E,oe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],re=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 ie(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")||re.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):ne[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))%ne.length]}function se(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function ae(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>se(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,O.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=te[n]||te.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:ne;return(0,O.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function le(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}var ce=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,n){if(t&&"function"==typeof e.pieceStyle){const o=e.pieceStyle(t,n);return o&&!o.fill&&n?{...o,fill:this.getColorFromScheme(e,n)}:o}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&n?{fill:e.barColors[n]||"#007bff"}:{fill:n?this.getColorFromScheme(e,n):"#007bff"}}resolveSummaryStyle(e,t,n){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,n):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const n=this.colorSchemeMap.get(t);if(n)return n;const o=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||oe,r=o[this.colorSchemeIndex%o.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function ue(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}var de=require("d3-shape"),he={circle:de.symbolCircle,square:de.symbolSquare,triangle:de.symbolTriangle,diamond:de.symbolDiamond,star:de.symbolStar,cross:de.symbolCross,wye:de.symbolWye},fe=["circle","triangle","diamond","star","square","chevron","cross","wye"];function me(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*ge(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,de.symbol)(he[o]??de.symbolCircle,Math.max(1,t))()??""}function ge(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function ye(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let r=0;return e=>{const i=t(e)+"",s=n?.[i];if(s)return s;let a=o.get(i);return a||(a=fe[r%fe.length],r++,o.set(i,a)),a}}function pe(e,t,n,o,r,i,s){e.push(t?{type:"symbol",x:o,y:r,size:Math.PI*i*i,symbolType:t(n),style:s,datum:n}:{type:"point",x:o,y:r,r:i,style:s,datum:n})}function be(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI,u=null!=o.sweepAngle&&360>o.sweepAngle,d=Object.values(n),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(o.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],n=t.pieceData[0],u="number"==typeof n?._pctStart?n._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof n?._pct?n._pct:t.pct))*c,g=r(t.pieceData[0],t.name),y=0===e,p=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:m,...o.cornerRadius&&{cornerRadius:o.cornerRadius},style:g,datum:n?._nonInteractive?null:t.pieceData,category:t.name};n?._roundedEnds?b.roundedEnds=n._roundedEnds:f&&(b.roundedEnds={start:y,end:p}),n?._gradientBand&&(b._gradientBand=n._gradientBand),i.push(b)}return i}var ve=require("d3-array");function xe(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function we(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function ke(e){const t=e.length,n=e[0],o=e[t-1];return{n:t,min:n,q1:(0,ve.quantile)(e,.25)??n,median:(0,ve.quantile)(e,.5)??(n+o)/2,q3:(0,ve.quantile)(e,.75)??o,max:o,mean:e.reduce((e,t)=>e+t,0)/t}}var Se=require("d3-scale"),Ae={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(s){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&n>0&&(m/=n);const g=a(c.pieces[0],s?i:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:o+m),n=0>m?l(r+m)-l(r):l(o)-l(o+m);u.push(ue(e.x,t,e.width,Math.abs(n),g,y,i)),0>m?r+=m:o+=m}else if(h){const t=l(0>m?r+m:o),n=0>m?l(r)-l(r+m):l(o+m)-l(o);u.push(ue(t,e.x,Math.abs(n),e.width,g,y,i)),0>m?r+=m:o+=m}}}const g="vertical"===c,y=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=g?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const n=t.datum?.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=>(e.datum?.__aggregateValue??0)>=0),n=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),n.length>0&&(n.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return u},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(o)){const t=e.width/m,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ue(i,Math.min(a,d),o,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ue(Math.min(a,d),i,Math.abs(d-a),o,f,r,h[s]))}}}}const g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);g>0&&(e.roundedTop=g),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:n,columns:o,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=ye(e),m=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(o))for(const t of e.pieceData){const n=t.__rIndex??0,o=t.__rValue??r(t),l=h&&i[n]||a,y=s(t,e.name),p=y.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*m,n=l(o);b=Math.cos(t)*n,v=Math.sin(t)*n}else u?(b=e.middle,v=l(o)):(b=l(o),v=e.middle);pe(c,f,t,b,v,p,y)}return c},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a,u=ye(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),d=i(o,e.name),h=d.r||4,f=(7919*n%100/100-.5)*t*.8;pe(l,u,o,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:be,donut:be,boxplot:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(o)){const n=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===n.length)continue;const o=n[0],r=n[n.length-1],l=(0,ve.quantile)(n,.25)??o,h=(0,ve.quantile)(n,.5)??(o+r)/2,f=(0,ve.quantile)(n,.75)??r,m=f-l,g=l-1.5*m,y=f+1.5*m,p=n.find(e=>e>=g)??o,b=[...n].reverse().find(e=>y>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const n=i(e);if(g>n||n>y){const o=u?t.middle:a(n),r=u?a(n):t.middle;x.push({px:o,py:r,value:n,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(p),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:n.length,min:p,q1:l,median:h,q3:f,max:b,mean:n.reduce((e,t)=>e+t,0)/n.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-n)/r),d-1)]++;const f=we(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${a(n)}`;for(let t=0;d>t;t++){const o=a(n+(t+.5)*r);g+=` L ${e.middle+l[t]/f*m} ${o}`}g+=` L ${e.middle} ${a(o)}`;for(let t=d-1;t>=0;t--){const o=a(n+(t+.5)*r);g+=` L ${e.middle-l[t]/f*m} ${o}`}g+=" Z"}else{g=`M ${a(n)} ${e.middle}`;for(let t=0;d>t;t++)g+=` L ${a(n+(t+.5)*r)} ${e.middle-l[t]/f*m}`;g+=` L ${a(o)} ${e.middle}`;for(let t=d-1;t>=0;t--)g+=` L ${a(n+(t+.5)*r)} ${e.middle+l[t]/f*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let p;if(h&&t.length>=4){const r=(0,ve.quantile)(t,.25)??n,i=(0,ve.quantile)(t,.5)??(n+o)/2,s=(0,ve.quantile)(t,.75)??o;p={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))}:{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:b,iqrLine:p,stats:ke(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize,d=a.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=xe(t),r=null!=h&&isFinite(h)?h:n,d=null!=f&&isFinite(f)?f:o,m=(d-r)/c||1,g=Array(c).fill(0);for(const e of t)r>e||e>d||g[Math.min(Math.floor((e-r)/m),c-1)]++;const y=t.length,p=we(g,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===g[t])continue;const n=(u?g[t]/y:g[t]/p)*e.width*.9,o=a(r+t*m),i=a(r+(t+1)*m);l.push(ue(Math.min(o,i),e.x+e.width-n,Math.abs(i-o),n,b,{bin:t,count:g[t],range:[r+t*m,r+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/u||1,l=Array(u).fill(0);for(const e of t)n>e||e>o||l[Math.min(Math.floor((e-n)/r),u-1)]++;const f=we(l,1),m=s(e.pieceData[0],e.name),g=e.width*h;let y;if(d){const t=e.x+e.width;y=`M ${a(n)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(n+(e+.5)*r)} ${t-l[e]/f*g}`;y+=` L ${a(o)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(n)}`;for(let e=0;u>e;e++){const o=a(n+(e+.5)*r);y+=` L ${t+l[e]/f*g} ${o}`}y+=` L ${t} ${a(o)} Z`}const p=d?{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width}:{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:p,stats:ke(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=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=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(ue(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(ue(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>n[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let m=0;for(const e of c){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}f.push({col:e,groups:t,stepTotal:n}),h||n>m&&(m=n)}if(h)for(const e of f){let t=0,n=0;for(let o=0;u.length>o;o++){const r=e.groups.get(u[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>m&&(m=o)}if(0===m)return s;const g=new Map;for(const e of u){const t=f[0].groups.get(e);g.set(e,t?.total??0)}const y=f[0].stepTotal,p=h?.95*a:.9*t.width,b=(0,Se.scaleLinear)().domain([0,m]).range([0,p]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const n=f[t],o=n.col,r=0===t,c=o.width,d=.55*c,m=o.x+(c-d)/2,p=new Map;if(h){let e=0;for(const t of u){const o=n.groups.get(t);o&&(e+=b(o.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],y=n.groups.get(f);if(!y)continue;const v=b(y.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(y.pieces[0],f),S=g.get(f)??y.total,A={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),s.push(ue(w,m,v,d,k,A,f)),p.set(f,{x:w,y:m,w:v,h:d})}}else{const e=n.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,g=n.groups.get(h)?.pieces[0]??o.pieceData[0],v=f?h:o.name,x=i(g,v),w=y>0?e/y*100:0,k={...g,__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:r,category:f?h:o.name};l&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=m,k.__funnelBarW=t),s.push(ue(c,m,t,d,x,k,v)),p.set(h,{x:c,y:m,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),a=p.get(r);if(!t||!a)continue;const l=(()=>{const e=n.groups.get(r);return i(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:n.groups.get(r)?.pieces[0]??o.pieceData[0],category:"_default"===r?o.name:r};s.push(c)}}x=p}return s},"bar-funnel":function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>n[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}h.push({col:e,groups:t,stepTotal:n})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=s.r,g=d?c.length:1,y=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],n=t.col,o=0===e,r=e>0?h[e-1]:null,s=n.width/g,l=s*y,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const y=g.total,p=f.get(h)??y,b=p>0?y/p*100:0,v=r?.groups.get(h),x=o?0:Math.max(0,(v?.total??y)-y),w=n.x+e*s+l/2,k=m(y),S=m(0)-k,A=i(g.pieces[0],d?h:n.name),M={...g.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:m(y+x)};if(a.push(ue(w,k,u,S,A,M,d?h:n.name)),x>0){const e=m(y+x),t=k-e,o={...A},r={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:p>0?x/p*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name};a.push(ue(w,e,u,t,o,r,d?h:n.name))}}}return a},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[n,r]=a.range(),i=Math.min(n,r),s=Math.abs(r-n);for(const n of Object.values(o)){const o={fill:e,opacity:t},r=u?ue(i,n.x,s,n.width,o,null,"__track__"):ue(n.x,i,n.width,s,o,null,"__track__");c.push(r)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(o)){let t=0;const n=c.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,f=s(n,l);let m;if(u){const r=a(t),i=a(t+o);m=ue(r,e.x,i-r,e.width,f,n,l)}else{const r=a(t+o),i=a(t);m=ue(e.x,r,e.width,i-r,f,n,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=o}if(m>0&&c.length>n){const e=c.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return c}};function Me(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&se(n,e)||"#4e79a7":t=>{if(n){const e=se(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function Ce(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Ce))}function je(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function _e(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Re=new WeakMap;var Pe={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Le(e,t){const n={...e};for(const e of t)n[Pe[e]]++;return n}function Ie(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Le(n,o)}}var Te=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Ie({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Ie(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},$e=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Be=["scene-style","data-paint","accessibility","evidence"],Oe=(e,t)=>({retainedData:e,invalidations:t}),He=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Fe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ne=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ee=["scene-geometry","data-paint","accessibility","evidence"],De=["scene-style","data-paint","accessibility","evidence"],We=[],ze={chartType:Oe("rebuild",He),runtimeMode:Oe("rebuild",He),categoryAccessor:Oe("rebuild",He),valueAccessor:Oe("rebuild",He),oAccessor:Oe("rebuild",He),rAccessor:Oe("rebuild",He),stackBy:Oe("rebuild",He),groupBy:Oe("rebuild",He),timeAccessor:Oe("rebuild",He),accessorRevision:Oe("rebuild",He),colorAccessor:Oe("rebuild",De),symbolAccessor:Oe("rebuild",Ee),connectorAccessor:Oe("rebuild",Ee),dataIdAccessor:Oe("rebuild",Ee),projection:Oe("preserve",Fe),extentPadding:Oe("preserve",Fe),axisExtent:Oe("preserve",Fe),rExtent:Oe("preserve",Fe),oExtent:Oe("preserve",Fe),multiAxis:Oe("preserve",Fe),normalize:Oe("preserve",Fe),bins:Oe("preserve",Fe),oSort:Oe("preserve",Ne),barPadding:Oe("preserve",Ne),roundedTop:Oe("preserve",Ne),baselinePadding:Oe("preserve",Ne),innerRadius:Oe("preserve",Ne),cornerRadius:Oe("preserve",Ne),startAngle:Oe("preserve",Ne),sweepAngle:Oe("preserve",Ne),trackFill:Oe("preserve",Ne),showOutliers:Oe("preserve",Ne),showIQR:Oe("preserve",Ne),amplitude:Oe("preserve",Ne),connectorOpacity:Oe("preserve",Ne),showLabels:Oe("preserve",Ne),dynamicColumnWidth:Oe("rebuild",Ne),customLayout:Oe("preserve",Ne),layoutConfig:Oe("preserve",Ne),layoutMargin:Oe("preserve",Ne),symbolMap:Oe("preserve",Ee),pieceStyle:Oe("preserve",De),summaryStyle:Oe("preserve",De),connectorStyle:Oe("preserve",De),gradientFill:Oe("preserve",De),colorScheme:Oe("preserve",De),themeCategorical:Oe("preserve",De),themeSemantic:Oe("preserve",De),themeSequential:Oe("preserve",De),themeDiverging:Oe("preserve",De),barColors:Oe("preserve",De),decay:Oe("preserve",De),pulse:Oe("preserve",De),staleness:Oe("preserve",De),layoutSelection:Oe("preserve",De),windowSize:Oe("preserve",We),windowMode:Oe("preserve",We),clock:Oe("preserve",We),transition:Oe("preserve",We),introAnimation:Oe("preserve",We),onLayoutError:Oe("preserve",We)},qe=Oe("preserve",Ne),Ge=class{constructor(){this.tracker=new Te}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},$e)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Be):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=ze[o]??qe;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};var Ve=require("d3-quadtree"),Ye=class{constructor(e){this.rExtent=new _,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Ge,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new ce,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.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new j(e.windowSize),this.getO=$(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>T(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new _)):(this.getR=T(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=$(e.stackBy),this.getGroup=$(e.groupBy),this.getColor=$(e.colorAccessor),this.getSymbol=$(e.symbolAccessor),this.getConnector=$(e.connectorAccessor),this.getDataId=$(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new j(e.windowSize))}syncPulseTimestampBuffer(){var e,t,n,o;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,n=this.timestampBuffer,o=this.currentTime(),e?null!=n&&n.capacity===t.capacity&&n.size===t.size?n:function(e,t){const n=new j(e.capacity);return e.forEach(()=>n.push(t)),n}(t,o):null)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}ingest(e){const t=this.currentTime();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(),r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)_e(this.buffer,n,this.timestampBuffer,t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=_e(this.buffer,n,this.timestampBuffer,t);this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}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,o=this.scales,r=this.multiScales,i=this.columns;if(0===n.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,m;if(d){f=(0,C.scaleBand)().domain(l).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;m=(0,C.scaleLinear)().domain(c).range([o,n])}else u?(f=(0,C.scaleBand)().domain(l).range([0,e.height]).padding(h),m=(0,C.scaleLinear)().domain(c).range([0,e.width])):(f=(0,C.scaleBand)().domain(l).range([0,e.width]).padding(h),m=(0,C.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,C.scaleLinear)().domain([s,a]).range([0,e.width]):(0,C.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let g=s;this.rAccessors.length>1&&(g=s.flatMap(e=>this.rAccessors.map((t,n)=>({...e,__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(g,l,f,a,e),this._customLayoutFailedThisBuild=!1;const y=this.buildSceneNodes(g,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=y,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),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 r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===o)return i;if("function"==typeof o)return i.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 i.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){return function(e){const{data:t,chartType:n,projection:o,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===o&&("pie"===n||"donut"===n))return[0,1];let m=0,g=0;if("bar"===n&&d&&r)m=0,g=1;else if("bar"===n&&d){const e=new Map,n=new Map;for(const o of t){const t=c(o),r=u(o);0>r?n.set(t,(n.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t);for(const e of n.values())m>e&&(m=e)}else if("bar"===n){const e=new Map;for(const n of t){const t=c(n),o=u(n);e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t),m>t&&(m=t)}else if("swimlane"===n){const e=new Map;for(const n of t){const t=c(n),o=Math.abs(u(n));e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===n||"bar-funnel"===n)for(const e of t){const t=u(e);t>g&&(g=t),m>t&&(m=t)}else{const e=h[0],t=h[1];e!==1/0&&(m=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(m=i[0]),null!=i[1]&&(g=i[1]));const y="bar"===n||"clusterbar"===n||"bar-funnel"===n||"swimlane"===n;if(y&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>g&&(g=0)),"bar-funnel"!==n&&"exact"!==l){const e=g-m,t=e>0?e*f:1,o=y&&!a&&0===m,r=y&&!a&&0===g||"swimlane"===n;null!=i?.[0]||o||(m-=t),null!=i?.[1]||r||(g+=t)}return[m,g]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,n,o,r){return function(e){const{data:t,oExtent:n,oScale:o,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of n){const n=u.get(t)||[];let o;o="string"==typeof s?n.reduce((e,t)=>e+(Number(t[s])||0),0):s(n),h.set(t,o),e+=o}const t=("horizontal"===r?i.height:i.width)-o.padding()*o.step()*n.length;if(e>0)for(const[n,o]of h)h.set(n,o/e*t)}let f=0,m=0;for(const e of n){const t=u.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?n/d:0;let i,s;h?(i=m,s=h.get(e)||o.bandwidth(),m+=s+o.padding()*o.step()):(i=o(e)??0,s=o.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:o.padding()*o.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:n,projection:o,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const n=this.buildLayoutContext(e,t);let o;try{o=this.config.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,n=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null;const r=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;Ce(o)&&0===n.length&&je(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&je(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const n=this.getSceneContext(),o=Ae[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[t,n]of l)if(n.length>=2){n.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let o=0;n.length-1>o;o++){const r=n[o],i=n[o+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(n,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const n=this.config,o=n.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n=ne){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=te[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(n.colorScheme,n.themeCategorical,oe),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:o,plot:"radial"===i.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:n.themeSemantic??{},categorical:[...r]},resolveColor:Me(r,n.colorScheme),config:n.layoutConfig??{},selection:n.layoutSelection??null}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=function(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}(e);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=function(e,t){const n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=n?t(s):s[o],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,n=0;for(const o of e)"point"===o.type&&(t++,o.r>n&&(n=o.r));if(500>=t)return{quadtree:null,maxRadius:n};const o=Array(t);let r=0;for(const t of e)"point"===t.type&&(o[r++]=t);return{maxRadius:n,quadtree:(0,Ve.quadtree)().x(e=>e.x).y(e=>e.y).addAll(o)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const n=t.length;if(1>=n)return;const o=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=o.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,n);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,n=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let o=0;for(const s of r(t)??[]){const t=n.get(s);null!=t&&(o=Math.max(o,R(e,t,i)))}l=P(c,o,s)||l;continue}if(null==c.datum)continue;const t=o.get(c.datum);if(null==t)continue;const u=n.get(t);l=P(c,null==u?0:R(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),n)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,n="horizontal"!==this.scales?.projection;let o;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,n?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===o&&(o=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:o,endAngle:o,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){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||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(o,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:n.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const n=new Set,o=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,o);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)n.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,o]of this.prevPositionMap)if(!n.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:o.x,y:o.y,r:o.r??3,style:{opacity:o.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:o.x,y:o.y,w:o.w??0,h:o.h??0,style:{opacity:o.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((o.startAngle??0)+(o.endAngle??0))/2,n={type:"wedge",cx:o.x,cy:o.y,innerRadius:o.innerRadius??0,outerRadius:o.outerRadius??100,startAngle:o.startAngle??0,endAngle:o.endAngle??0,style:{opacity:o.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t,"linear"===this.config.transition?.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);e.style.opacity=L(o?o.opacity??1:0,e._targetOpacity,n)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=L(o.x,e._targetX,n),e.y=L(o.y,e._targetY,n)),void 0!==e._targetR&&void 0!==o?.r&&(e.r=L(o.r,e._targetR,n))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style.opacity=L(o?o.opacity??1:0,e._targetOpacity,n)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=L(o.x,e._targetX,n),e.y=L(o.y,e._targetY,n),void 0!==o.w&&(e.w=L(o.w,e._targetW,n),e.h=L(o.h,e._targetH,n))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style={...e.style,opacity:L(o?o.opacity??1:0,e._targetOpacity,n)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=L(o.startAngle,e._targetStartAngle,n),e.endAngle=L(o.endAngle,e._targetEndAngle,n))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...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}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}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=B(e),n=this.getDataId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=B(e),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}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.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!I(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!I(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!I(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let o=!1;("categoryAccessor"in e||"oAccessor"in e)&&(I(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=$(this.config.categoryAccessor||this.config.oAccessor,"category"),o=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,n=t.valueAccessor||t.rAccessor,o=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];if(r=o.length!==i.length||o.some((e,t)=>!I(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>T(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new _)):(this.getR=T(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!I(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?$(this.config.stackBy):void 0),"groupBy"in e&&!I(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?$(this.config.groupBy):void 0),"colorAccessor"in e&&!I(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?$(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!I(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?$(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!I(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?$(this.config.connectorAccessor):void 0),(o||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Object.assign(Ye.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Re.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Re.get(this);return Re.delete(this),e}});var Xe=require("react"),Ue={sceneGeometry:0,layout:0,domain:0};function Ke(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function Qe(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ze="production"!==process.env.NODE_ENV,Je={revisions:Ue,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},et=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Ue,this.lastObserved=Ue,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ze&&(this.lastObserved=Qe(this.lastObserved,Ke(e)))}beforeCompute(e,t){if(!Ze)return Je;const n=Qe(Ke(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(Ze){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},tt=(0,Xe.memo)(function({store:e,diagnostics:t}){return(0,Xe.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),nt=g(require("react"));function ot(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:nt.createElement(nt.Fragment,null,...t)}var rt=g(require("react")),it=require("react/jsx-runtime"),st={isActive:!1,predicate:()=>!0},at=rt.createContext(null);function lt({value:e,children:t}){return(0,it.jsx)(at.Provider,{value:e,children:t})}function ct(){return rt.useContext(at)??st}function ut(e,t){return null!=e?(0,it.jsx)(lt,{value:t,children:e}):e}var dt=require("react");function ht(e,t=30){return Math.max((e??4)+5,12,t)}function ft(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var mt=[40,40],gt=[.5,.5];function yt(e,t){const[n,o]=e.viewBox??mt,[r,i]=e.anchor??gt,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function pt(e,t){const n=yt(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function bt(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var vt=null;function xt(e){if("undefined"==typeof Path2D)return null;vt||(vt=new Map);const t=vt.get(e);if(t)return t;const n=new Path2D(e);return vt.size>1024&&vt.clear(),vt.set(e,n),n}function wt(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??mt,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function kt(e,t){const n=yt(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function St(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=xt(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:bt(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:bt(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function At(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,m=1/0;return e.visit((e,r,l,g,y)=>{if(r>u||c>g||l>h||d>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);ht(a(e),o)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}(r,t,n,o,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=Mt(i,t,n);break;case"point":if(r)break;e=Ct(i,t,n,o);break;case"symbol":e=jt(i,t,n,o);break;case"glyph":e=_t(i,t,n,o);break;case"wedge":if(null===i.datum)break;e=Rt(i,t,n);break;case"boxplot":e=Pt(i,t,n);break;case"violin":e=Lt(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Mt(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 Ct(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ht(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function jt(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ht(ge(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _t(e,t,n,o=30){if(null==e.datum)return null;const r=kt(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>ht(r.radius,o)?null:{datum:e.datum,x:i,y:s,distance:c}}function Rt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=ft(Math.atan2(r,o)),a=ft(e.startAngle),l=ft(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Pt(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Lt(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}var It=require("react"),Tt={fresh:1,aging:.7,stale:.45,expired:.25},$t={alpha:1,band:"fresh",isStale:!1};var Bt=require("react/jsx-runtime");function Ot({isStale:e,position:t}){return(0,Bt.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Ht=require("react"),Ft=g(require("react")),Nt=require("react/jsx-runtime"),Et={fill:(e,t)=>(0,Nt.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Nt.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Dt(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Et[n])(o(e,t),r),i}function Wt({swatchSize:e}){return(0,Nt.jsx)("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 zt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var qt=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let g=0;const y=!(!t&&!n),p="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Dt(e,c,d,h,b),w=zt(e,o,r),k=r&&r.size>0&&r.has(e.label);m.push((0,Nt.jsxs)("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?k||!1:void 0,"aria-current":y&&!p&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Nt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Nt.jsx)(Wt,{swatchSize:b}),(0,Nt.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),m};function Gt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ft.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Nt.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,Nt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Nt.jsx)("defs",{children:(0,Nt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Nt.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Nt.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Nt.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Nt.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Nt.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,Nt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Nt.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Nt.jsx)("defs",{children:(0,Nt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Nt.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Nt.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Nt.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Vt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,m]=Ft.useState(0),[g,y]=Ft.useState(0),p=Ft.useCallback((e,t)=>{m(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:o})=>{n+=5;const r=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=o*t+8,{lineY:r,labelY:i,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const m=h[f];d.push((0,Nt.jsx)("line",{stroke:"gray",x1:0,y1:m.lineY,x2:t,y2:m.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=m.labelY&&d.push((0,Nt.jsx)("text",{y:m.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,Nt.jsx)("g",{className:"legend-item",transform:`translate(0,${m.itemsY})`,children:qt(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const g=((e,t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,g=[],{swatchSize:y,labelGap:p,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=m.map(e=>y+p+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=n}),m.length>0&&A.push({start:M,end:m.length,width:C}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=m[d],x=Dt(e,d,h,f,y),A=zt(e,o,r),M=r&&r.size>0&&r.has(e.label);g.push((0,Nt.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+m.length)%m.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Nt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+p+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Nt.jsx)(Wt,{swatchSize:y}),(0,Nt.jsx)("text",{y:y/2,x:y+p,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:g,offset:j,totalRows:_,totalHeight:_*v}})(e,o,r,i,s,a,l,t,c,u,d,d.maxWidth??n);m+=g.offset+5,f.push({label:e.label,...g,offset:m,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=m+12});const m=d.maxWidth??n;let g=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const y=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(y.push((0,Nt.jsx)("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),g+=16),y.push((0,Nt.jsx)("g",{className:"legend-item",transform:`translate(${g},0)`,children:n.items},"legend-group-"+o)),g+=n.offset+5,e[o+1]&&y.push((0,Nt.jsx)("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),g+=12}),(0,Nt.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}),v=!(!n&&!o);return(0,Nt.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Nt.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Yt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}var Xt=require("react/jsx-runtime");function Ut(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,m=!!a,g=Math.max(0,n-r.left-r.right),y=Math.max(1,f?s?.maxWidth??g:100);let p,b;return"left"===i?(p=Math.max(4,r.left-y-10),b=r.top):"top"===i?(p=r.left,b=m?32:8):"bottom"===i?(p=r.left,b=o-r.bottom+38):(p=n-r.right+10,b=r.top),(0,Xt.jsx)("g",{transform:`translate(${p}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Xt.jsx)(Gt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Yt(t)?(0,Xt.jsx)(Vt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Kt=g(require("react")),Qt=require("react/jsx-runtime");function Zt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Jt(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 en(e,t,n,o){if(!e)return(0,Qt.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,Qt.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:Zt(i,l):[],g=r?c?[r]:Zt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let p=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Qt.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(m.length+g.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Qt.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Qt.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Qt.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push((0,Qt.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>(0,Qt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),p=m.length*f),g.length>0&&b.push((0,Qt.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:p,children:g.map((e,t)=>(0,Qt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Qt.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Qt.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,m.length+g.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(g.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Qt.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Qt.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function tn(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Qt.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,Qt.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,Qt.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,Qt.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Qt.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Qt.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,Qt.jsx)("path",{d:Jt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Qt.jsx)("g",{className:"annotation-subject",children:i})}function nn(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,m=o+d*f,g=i+h*f;s.push((0,Qt.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${m},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(g-l,m-a)}else s.push((0,Qt.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Qt.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,Qt.jsx)("g",{className:"annotation-connector",children:s})}function on(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:g,events:y={},"data-testid":p}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Qt.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":p,...null!=m&&{opacity:m},...g&&{strokeDasharray:g},...y,children:[!x.has("connector")&&nn(w,k,l,d,S,c),!x.has("subject")&&tn(S,c,d,b,v),!x.has("note")&&en(a,w,k,d)]})}function rn(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,Qt.jsx)(on,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,Qt.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Qt.jsx)(on,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var sn=require("d3-hierarchy"),an=require("d3-shape");function ln(e){return Math.round(100*e)/100}function cn(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(ln);return{points:e.map(([e])=>[ln(e),ln(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function un(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function dn(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function hn(e){return null==e?null:e+""}function fn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function mn(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return fn(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?fn(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return hn(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>hn(e.pointId)===o);if(r)return fn(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return hn(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=un(i,n),a=dn(i,n);return null==s||null==a?null:fn(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=un(e,n),i=dn(e,n)),null!=r&&null!=i)return fn(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function gn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var yn=require("react/jsx-runtime"),pn={secondary:0,primary:3};function bn(e){return!0===e?._annotationDeferred}function vn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function xn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function wn(e){return Math.max(.72,.95-.06*e)}var kn=g(require("react")),Sn=require("react"),An=require("react/jsx-runtime");function Mn(e){let t=null;const n=()=>(t||(t=(0,Sn.createContext)(null)),t),o=Cn(e);return[function({children:t,initialState:o}){const r=(0,Sn.useRef)(o),i=(0,Sn.useMemo)(()=>Cn(e,r.current),[]),s=n();return(0,An.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,Sn.useContext)(r)??o,s=(0,Sn.useRef)(e);s.current=e;const a=(0,Sn.useRef)({hasValue:!1,value:void 0}),l=(0,Sn.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Sn.useCallback)(()=>s.current(i.getState()),[i]);return(0,Sn.useSyncExternalStore)(i.subscribe,l,c)}]}function Cn(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}var[jn,_n]=Mn(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Rn(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Pn=require("react/jsx-runtime"),Ln="var(--semiotic-bg, #ffffff)",In=.85;function Tn(e,t){return(e+"").length*t*.6}function $n(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,Pn.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Ln,strokeWidth:h.haloWidth??3});const m=h.padding??{x:6,y:3},g="number"==typeof m?m:m.x,y="number"==typeof m?m:m.y,p=Tn(o,i),b=i+2*y;let v,x;return v="middle"===l?t-p/2-g:"end"===l?t-p-g:t-g,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,Pn.jsxs)("g",{className:d,children:[(0,Pn.jsx)("rect",{x:v,y:x,width:p+2*g,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Ln,fillOpacity:h.opacity??In,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var Bn=null;function On(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Bn||(Bn=document.createElement("canvas")),Bn.width=e,Bn.height=e,Bn)}(a)}catch{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=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)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(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var Hn=require("react/jsx-runtime");function Fn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function Nn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function En(e,t){let n=2166136261;const o=Nn(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Dn=new Map;function Wn(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,Hn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,Hn.jsx)("rect",{width:l,height:l,fill:n}),(0,Hn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,Hn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function zn(e,t,n="#4e79a7"){if(Fn(e)){const n=En(t,e);return{fill:`url(#${n})`,def:Wn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var qn=require("react/jsx-runtime"),Gn={linear:an.curveLinear,monotoneX:an.curveMonotoneX,monotoneY:an.curveMonotoneY,step:an.curveStep,stepAfter:an.curveStepAfter,stepBefore:an.curveStepBefore,basis:an.curveBasis,cardinal:an.curveCardinal,catmullRom:an.curveCatmullRom};var Vn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Yn(e){return!!e&&"object"==typeof e&&Vn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Xn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Un(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Kn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Qn=32,Zn=6,Jn=4,eo=8,to=72;var no={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function oo(e){if(!ro(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function ro(e){return Yn(e)}function io(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function so(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function ao(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function lo(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function co(e,t,n,o,r,i,s,a){const l=ao(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*lo(l,e);for(const e of o)c+=4*lo(l,e);return c}function uo(e){const{annotations:t,context:n,defaultOffset:o=Qn,notePadding:r=Zn,markPadding:i=Jn,edgePadding:s=eo,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=to,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:g,audience:y}=e,p=n.width||0,b=n.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,w=!!m&&x>=p,k=w&&!1!==v.preferShortText?t.map(oo):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!g?v.cohesion:g;if(0===k.length||0>=p||0>=b)return k.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=k.map((e,t)=>{if(!ro(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?mn(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...io("string"==typeof e.title?e.title:void 0,t),...io("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(ao(so(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=co(so(i.x,i.y,e.dx,e.dy,u),e,j,_,p,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const m=ao(so(i.x,i.y,h.dx,h.dy,u),r);j.push(m);const g=Math.hypot(h.dx,h.dy),y=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),L=R?P:k.slice();let I=L;if(h){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?no[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Un(p,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=Un(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Yn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Xn(e.annotation)),c=a.filter(e=>!Xn(e.annotation)).sort((e,t)=>Kn(t.annotation)-Kn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:p,height:b,...n});for(const e of o)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=p)for(const e of I)ro(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let $;return $=0===T.size?I:A?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>ro(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}($,C):$}function ho(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[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]=i?new Date(n):n}return c}(e,t):e.ticks(t)}var fo=require("react/jsx-runtime");function mo(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,m=(0,Ht.useMemo)(()=>!s||h?[]:(u||ho(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||go)(e)})),[s,c,h,u,d]),g=l&&s&&!h,y=a&&s&&!h;return g||y?(0,fo.jsx)("svg",{width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,fo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(0,fo.jsx)("g",{className:"ordinal-grid",children:m.map((e,o)=>(0,fo.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),y&&(0,fo.jsx)(fo.Fragment,{children:(0,fo.jsxs)(fo.Fragment,f?{children:[(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,fo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function go(e){return Math.round(100*e)/100+""}function yo(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:g,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j,autoPlaceAnnotations:_,svgAnnotationRules:R,xAccessor:P,yAccessor:L,annotationData:I,underlayRendered:T,canvasObscuresUnderlay:$=!0,children:B}=e,O=function(e){const t=_n(e=>e.pushObservation),n=kn.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return kn.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j}),H="radial"===s?.projection,F="horizontal"===s?.projection,N=!1!==l,E=!T||$,D=(0,Ht.useMemo)(()=>{if(!a||!N||!s||H)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,n)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,n):t}));if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e,o=t.map(e=>{return t=e.label,F?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=F?0:6;if(o.every((e,t)=>0===t||n>=(o[t-1]+e)/2+r))return t;const i=Math.max(...o)+r,l=Math.max(1,Math.ceil(i/n));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,N,s,d,H,F]),W=e.rTickValues,z=e.tickLabelEdgeAlign,q=e.axisExtent,G=(0,Ht.useMemo)(()=>a&&s&&!H?(W||ho(s.r,5,q)).map(e=>({value:e,pixel:s.r(e),label:(h||go)(e)})):[],[a,s,h,H,W,q]),V=(0,Ht.useRef)(new Map),Y=(0,Ht.useRef)(S?.length??0),X=S?.length??0;Y.current!==X&&(Y.current=X,V.current=new Map);const U=(0,Ht.useMemo)(()=>{if(!S||0===S.length)return null;const e=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=mn(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!gn(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,qn.jsx)(rn,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=un(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,qn.jsxs)("g",{opacity:e.opacity,children:[(0,qn.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,qn.jsx)($n,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=dn(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,qn.jsxs)("g",{opacity:e.opacity,children:[(0,qn.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,qn.jsx)($n,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:un({...e,type:"point"},o),y:dn({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,sn.packEnclose)(t),i=e.padding||10;return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,qn.jsx)($n,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:un({...e,type:"point"},o),y:dn({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=xe(i),[c,u]=xe(s),d=a-r,h=l+r,f=c-r;return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("rect",{x:d,y:f,width:h-d,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,qn.jsx)($n,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,qn.jsx)("g",{children:r.map((t,n)=>{const r=un(t,o),s=dn(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,qn.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=un(e,o),r=dn(e,o);return(0,qn.jsx)(rn,{noteData:{x:t??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=h.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,m=o.scales?.y??o.scales?.value;if(!f||!m)return null;const g=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(d.length-1,n+1),r=t-n,i=e(d[n]);return i+(e(d[o])-i)*r},y=f,p=m;let b;if(s)if(a){const e=g(p);b=(t,n)=>[y(n),e(t)]}else{const e=g(y);b=(t,n)=>[e(t),p(n)]}else b=(e,t)=>[y(e),p(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(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 u=0,d=0,h=0,f=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],m+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*m-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?cn(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:ln((n*t[3]-t[0]*t[1])/o),i=ln(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[ln(e),ln(r*e+i)]),equation:[r,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,qn.jsx)("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(o.height||0),l=zn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,qn.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,qn.jsx)("defs",{children:l.def}),(0,qn.jsx)("rect",{x:0,y:Math.min(s,a),width:o.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,qn.jsx)($n,{x:(o.width||0)-4,y:(r=s,i=a,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const s=zn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,qn.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,qn.jsx)("defs",{children:s.def}),(0,qn.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,qn.jsx)($n,{x:Math.min(r,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=Gn[o.curve||"linear"]||an.curveLinear,h=(0,an.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,qn.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",g=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",p=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,qn.jsxs)("g",{children:[f&&(0,qn.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:m,fillOpacity:g}),x.map((e,t)=>{const n=un(e,o),r=dn(e,o);return null==n||null==r?null:(0,qn.jsx)("circle",{cx:n,cy:r,r:p,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,qn.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=cn(l,e.order||2).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),m=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+(t[0]-m)**2,0),y=e.confidence??.95,p=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(g>0?(e-m)**2/g:0))*p;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,A=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,qn.jsxs)("g",{children:[(0,qn.jsx)("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,qn.jsx)("polyline",{points:`${M} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,qn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=mn(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!gn(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,qn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,qn.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,qn.jsx)("div",{...Rn(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=mn(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,qn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Kt.cloneElement(c,{key:"ann-text-"+n}):(0,qn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,qn.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Kt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,qn.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,qn.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&(0,qn.jsx)($n,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,qn.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,qn.jsx)($n,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,O),o="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:o?s.r:r||s.r,y:o&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:t,height:n,data:I,frameType:"ordinal",projection:o?"horizontal":"vertical",stickyPositionCache:V.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:xn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>bn(e.annotation)),r=e.some(e=>null!=vn(e.annotation)),i=e.some(e=>"layer"===vn(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=pn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=bn(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,yn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:wn(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=vn(t.annotation);return a&&(s=(0,yn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,yn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,yn.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,yn.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(_?uo({annotations:S,context:i,..."object"==typeof _?_:{}}):S,e,R,i)},[S,_,R,t,n,s,P,L,I,O]);return a||m||g||k||U&&U.length>0||f||B?(0,fo.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,fo.jsx)("title",{children:"string"==typeof m?m:"Ordinal Chart"}),(0,fo.jsx)("desc",{children:"string"==typeof m?m+" (ordinal data visualization)":"Ordinal data visualization"}),(0,fo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!H&&E&&(0,fo.jsx)("g",{className:"ordinal-grid",children:G.map((e,o)=>(0,fo.jsx)("line",{x1:F?e.pixel:0,y1:F?0:e.pixel,x2:F?e.pixel:t,y2:F?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),a&&s&&!H&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,fo.jsx)("g",{className:"ordinal-axes",children:(0,fo.jsxs)(fo.Fragment,F?{children:[(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[E&&(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((t,n)=>(0,fo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,fo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,fo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,fo.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,fo.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,fo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[E&&(0,fo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,fo.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((t,o)=>{const r=z?0===o?"start":o===G.length-1?"end":"middle":"middle";return(0,fo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,fo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)}),u&&(0,fo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]}:{children:[(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[E&&(()=>{const e=s?.r?s.r(0):n,o=0>e||e>n?n:e;return(0,fo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((t,o)=>(0,fo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,fo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,fo.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,fo.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,fo.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,fo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,fo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[E&&(0,fo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((t,n)=>(0,fo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,fo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,fo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)),u&&(0,fo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]})})})(),U,k,B]}),m&&"string"==typeof m?(0,fo.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,fo.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,Ut({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:w,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function po(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var bo=g(require("react")),vo=require("react/jsx-runtime"),xo=null,wo=null;function ko(e){const[t,n]=bo.useState(()=>xo);return bo.useEffect(()=>{if(t)return;let e=!1;return(xo?Promise.resolve(xo):(wo||(wo=Promise.resolve().then(()=>(x(),p)).then(e=>xo=e.OrdinalBrushOverlay)),wo)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,vo.jsx)(t,{...e}):null}var So=g(require("react")),Ao=require("d3-shape"),Mo=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Co=new WeakMap,jo=0,_o=!1,Ro=null,Po=null;function Lo(e,t){if(!t)return t;const n=Mo.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(_o)return;if("undefined"==typeof window||"undefined"==typeof document)return;_o=!0;const e=()=>{jo++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{Ro=window.matchMedia("(prefers-color-scheme: dark)"),Po=e,"function"==typeof Ro.addEventListener?Ro.addEventListener("change",Po):"function"==typeof Ro.addListener&&Ro.addListener(Po)}catch{}}();let r=Co.get(o);r&&r.version===jo||(r={version:jo,map:new Map},Co.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}function Io(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}function To(e,t,n){if(null==t)return n;if(Fn(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${Nn(e)}@${n}`,r=Dn.get(o);if(void 0!==r)return r;const i=On({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Dn.set(o,i),i}(t,e);return o||t.background&&Lo(e,t.background)||n}return"string"!=typeof t?t:Lo(e,t)||n}function $o(e,t){if(null==t)return;const n=To(e,t,"");return""===n?void 0:n}function Bo(e,t,n,o,r,i,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,r,i,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)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,r,i,s),[h,f,m]=Io(e,n);return d.addColorStop(0,`rgba(${h},${f},${m},${c})`),d.addColorStop(1,`rgba(${h},${f},${m},${u})`),d}function Oo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Ho(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(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}require("d3-shape");var Fo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function No(e){const{innerRadius:t,outerRadius:n,startAngle:o,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=Fo(n,o),t=Fo(n,r);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${r-o>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Fo(n,o),s=Fo(n,r),a=Fo(t,r),l=Fo(t,o),c=r-o>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===s)return No({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,n-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-o,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return No({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=o+(d?a:0),m=r-(h?a:0),g=o+(d?l:0),y=r-(h?l:0),p=Fo(n,f),b=Fo(n,m),v=(n-s)*Math.cos(a),x=Fo(v,o),w=Fo(v,r),k=i?null:Fo(t,y),S=i?null:Fo(t,g),A=i?0:(t+s)*Math.cos(l),M=i?null:Fo(A,o),C=i?null:Fo(A,r),j=m-f>Math.PI?1:0,_=i?0:y-g>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${p.x},${p.y}`;else{const e=Fo(n,o);R+=`M${e.x},${e.y}`}if(h)R+=` A${n},${n} 0 ${j} 1 ${b.x},${b.y}`,R+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=Fo(n,r);R+=` A${n},${n} 0 ${j} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${C.x},${C.y}`,R+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=Fo(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,R+=` A${s},${s} 0 0 1 ${M.x},${M.y}`;else{const e=Fo(t,o);R+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return R+=" Z",R}function Eo(e){const t=No({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 r=0;o.length>r;r++)n.push({d:No({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:o[r]})}return{clipPath:t,slices:n}}var Do=require("react/jsx-runtime"),Wo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function zo(e,t="#4e79a7"){return Fn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function qo(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Go=require("react/jsx-runtime");function Vo(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 Yo(e,t){const n=e.datum;if(!n)return null;const o=[],r=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),s=Number(n.__funnelStepLabelY),a=Number(n.__funnelRowWidth);"string"!=typeof r||!Number.isFinite(i)||!Number.isFinite(s)||Number.isFinite(a)&&8.4*r.length+16>a||o.push((0,Go.jsx)("text",{x:i,y:s+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:r},t+"-funnel-step"));const l=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),u=Number(n.__funnelValueLabelY),d=Number(n.__funnelBarW);if(Number.isFinite(l)&&0!==l&&Number.isFinite(c)&&Number.isFinite(u)&&d>=60){const e=Number(n.__funnelPercent);let r=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${Vo(l)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:Vo(l);7.8*r.length+16>d&&(r=Vo(l)),7.8*r.length+16>d||o.push((0,Go.jsx)("text",{x:c,y:u+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:r},t+"-funnel-value"))}return o.length?(0,Go.jsx)("g",{children:o},t+"-funnel-labels"):null}function Xo(e,t,n){const o=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=n=>`ord-${e.type}-${o}-${t}-${n}`,i=`ord-${e.type}-${o}-${t}`;switch(e.type){case"rect":{const t=e,n=qo(i)+"-grad",o=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(o=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(o=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in n){const e=function(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>(0,Go.jsx)("stop",{offset:e.offset,stopColor:e.color},t))}(n.colorStops);if(!e)return null;a.push(...e)}else{const t=zo(e.style.fill);a.push((0,Go.jsx)("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),a.push((0,Go.jsx)("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return(0,Go.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:o,y1:r,x2:i,y2:s,children:a})}(t,n);let r,s;if(o)s=`url(#${n})`;else if(Fn(t.style.fill)){const e=qo(i)+"-hatch";r=Wn(t.style.fill,e),s=`url(#${e})`}else s=zo(t.style.fill);const a=o||r?(0,Go.jsxs)("defs",{children:[o,r]}):null;if(t.cornerRadii&&Oo(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:o,h:r}=e,{tl:i,tr:s,br:a,bl:l}=Ho(e);let c=`M${t+i},${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+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+r}`),c+=` L${t+l},${n+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+r-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return(0,Go.jsxs)(So.Fragment,{children:[a,(0,Go.jsx)("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:o,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n},${o+l} Z`;break;case"left":c=`M${n+r},${o} L${n+e},${o} A${e},${e} 0 0 0 ${n},${o+e} L${n},${o+l-e} A${e},${e} 0 0 0 ${n+e},${o+l} L${n+r},${o+l} Z`;break;case"bottom":c=`M${n},${o} L${n+r},${o} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n+e},${o+l} A${e},${e} 0 0 1 ${n},${o+l-e} Z`;break;default:c=`M${n},${o+l} L${n},${o+e} A${e},${e} 0 0 1 ${n+e},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l} Z`}return(0,Go.jsxs)(So.Fragment,{children:[a,(0,Go.jsx)("path",{d:c,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,Go.jsxs)(So.Fragment,{children:[a,(0,Go.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),Yo(t,i)]},i)}case"point":{const t=e;return(0,Go.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:zo(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,n){const o=me(e.symbolType,e.size,e.path);return(0,Go.jsx)("path",{d:o,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?zo(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}(e,t,n);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=yt(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=wt(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?qo(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:bt(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:bt(n.stroke??"none",a,e.accent);return r||i?(0,Do.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,Do.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Do.jsx)("clipPath",{id:c,children:(0,Do.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Do.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Do.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},o)}(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const o=e;if(o._gradientBand&&o._gradientBand.colors.length>0){const e=qo(`${n?n+"-":""}gauge-grad-${o.category||i}-${t}`),{clipPath:r,slices:s}=Eo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds?.start??!0,roundEnd:o.roundedEnds?.end??!0,colors:o._gradientBand.colors});return(0,Go.jsxs)("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[(0,Go.jsx)("defs",{children:(0,Go.jsx)("clipPath",{id:e,children:(0,Go.jsx)("path",{d:r})})}),(0,Go.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,Go.jsx)("path",{d:e.d,fill:zo(e.color)},t))}),o.style.stroke&&"none"!==o.style.stroke&&(0,Go.jsx)("path",{d:r,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},i)}let r;if(o.roundedEnds)r=No({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=(0,Ao.arc)().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),r=e(Wo)||""}return(0,Go.jsx)("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:zo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return(0,Go.jsxs)("g","vertical"===t.projection?{children:[(0,Go.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:zo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Go.jsx)("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,Go.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:zo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Go.jsx)("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[(0,Go.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:zo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?n.push((0,Go.jsx)("line",{x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Go.jsx)("circle",{cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):n.push((0,Go.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Go.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,Go.jsx)("g",{children:n},i)}case"connector":return(0,Go.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,Go.jsx)("polygon",{points:n,fill:zo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}var Uo="undefined"==typeof window||"undefined"==typeof document,Ko=require("react"),Qo="undefined"!=typeof window?Ko.useLayoutEffect:Ko.useEffect,Zo=()=>()=>{},Jo=()=>!1,er=()=>!0,tr=require("react");function nr(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.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 or(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 rr(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}var ir=g(require("react")),sr=g(require("react")),ar=(require("react/jsx-runtime"),sr.createContext(null)),lr=require("react/jsx-runtime"),cr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ur({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,lr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:cr,children:t})}function dr(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function hr(e){return e&&"object"==typeof e?e:{}}function fr(e){return hr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var mr=require("react/jsx-runtime");function gr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var yr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},pr="semiotic-accessible-data-table",br=pr+" semiotic-accessible-data-table-hidden",vr=pr+" semiotic-accessible-data-table-visible",xr={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"},wr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},kr={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Sr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ar={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))"},Mr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Cr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},jr={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function _r({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=ir.useState(!1),[s,a]=ir.useState(5),l=sr.useContext(ar),c=l?.visible??!1,u=r||c,d=ir.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;ir.useEffect(()=>{u||a(5)},[u]);const f=ir.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=ir.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,mr.jsx)("span",{id:n,tabIndex:-1,style:cr}):null;if(!u)return(0,mr.jsx)("div",{id:n,className:br,tabIndex:-1,onFocus:f,style:cr,role:"region","aria-label":h,children:(0,mr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:dr(fr(o))});break;case"line":case"area":{const e=fr(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:dr(e)});break}case"rect":{const e=fr(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=dr(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=dr(fr(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=fr(o),n=dr(e);if(null==n.category){const t=hr(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:dr(fr(o))});break;case"arc":t.push({label:"Arc",values:dr(fr(o))});break;case"candlestick":t.push({label:"Candlestick",values:dr(fr(o))});break;case"geoarea":{const e=hr(fr(o)),n=dr(e);if(null==n.name){const t=hr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=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=[],r=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&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(g),p=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${yr(e.min)} to ${yr(e.max)}, mean ${yr(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(" ")}(g.length,y),b=Math.min(s,g.length),v=g.slice(0,b),x=g.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,mr.jsxs)("div",{ref:d,id:n,className:vr,tabIndex:-1,onBlur:m,style:xr,role:"region","aria-label":h,children:[(0,mr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:kr,children:"×"}),(0,mr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:wr,children:p}),(0,mr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Sr,children:[(0,mr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Cr,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),(0,mr.jsx)("thead",{children:(0,mr.jsxs)("tr",{children:[(0,mr.jsx)("th",{style:Ar,children:"type"}),k.map(e=>(0,mr.jsx)("th",{style:Ar,children:e},e))]})}),(0,mr.jsx)("tbody",{children:v.map((e,t)=>(0,mr.jsxs)("tr",{children:[(0,mr.jsx)("td",{style:Mr,children:e.label}),k.map(t=>{return(0,mr.jsx)("td",{style:Mr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":yr(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,mr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:jr,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Rr({summary:e}){return e?(0,mr.jsx)("div",{role:"note",style:cr,children:e}):null}function Pr({tableId:e}){return(0,mr.jsx)("a",{href:"#"+e,style:cr,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,cr)},children:"Skip to data table"})}var Lr=require("react/jsx-runtime"),Ir="var(--semiotic-focus, #005fcc)";function Tr({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Lr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ir,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Lr.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ir,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ir,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Lr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Lr.jsx)("path",{d:a,fill:"none",stroke:Ir,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Lr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var $r=g(require("react"));function Br(e){return Array.isArray(e)?e[0]:e}function Or(e,t,n,o){return{data:Br(e),x:t,y:n,__semioticHoverData:!0,...o}}var Hr=["name","label","title"],Fr=["type","kind","category","group","class","status","role","shape"],Nr=["value","amount","total","count","weight","score"],Er=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Dr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var Wr=require("react/jsx-runtime"),zr={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 qr(e,t){return"function"==typeof t?t(e):e[t]}function Gr(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 Vr(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=qr(e,n);s=Gr(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=qr(e,r);a.push({label:n,value:Gr(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Gr(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Gr(e[t[0]],o))}}const l={...zr,...r};return(0,Wr.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Wr.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Wr.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Wr.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Yr(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Br(!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)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,Wr.jsx)("div",{className:"semiotic-tooltip",style:zr,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Vr(e):Vr())}}var Xr=require("react/jsx-runtime");function Ur({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=$r.useRef(null),[u,d]=$r.useState(null);$r.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!$r.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),m=f?null:zr;return l?(0,Xr.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Kr=g(require("react")),Qr=require("react");function Zr(e){if(!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 Jr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:ei}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var ei=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ti={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ni={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},oi={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ei,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 ri(e,t){if("light"===t)return ti;if("dark"===t)return ni;if("high-contrast"===t)return oi;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?ni:ti;return Jr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return Jr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[ii,si]=Mn(e=>({theme:ti,setTheme(t){e(e=>({theme:ri(e.theme,t)}))}})),ai=require("react");var li=require("react"),ci=()=>"undefined"!=typeof performance?performance.now():Date.now();function ui(e,t){const n=e();return Number.isFinite(n)?n:t}var di=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ci,this.lastWallTime=ui(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=ui(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ci;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=ui(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},hi="undefined"==typeof window?Qr.useEffect:Qr.useLayoutEffect,fi={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function mi(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function gi(e){const t=function(){const[e,t]=(0,ai.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ai.useEffect)(()=>{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=(0,Qr.useRef)(t);n.current=t;const[o,r]=function(e,t,n){const o=(0,li.useRef)(null),[r,i]=(0,li.useState)(null);return(0,li.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Qr.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=mi(e.foregroundGraphics,r,a),d=mi(e.backgroundGraphics,r,a),h=si(e=>e.theme),{transition:f,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+Kr.useId(),y=(0,Qr.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new di({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const p=y.current;p.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Qr.useRef)(null),v=(0,Qr.useRef)(e.frameScheduler??fi);v.current=e.frameScheduler??fi;const x=(0,Qr.useRef)(null),w=(0,Qr.useRef)(!1),k=(0,Qr.useRef)(()=>{}),S=(0,Qr.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=o,x.current=e)},[]),A=(0,Qr.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);hi(()=>{p.setPaused(!0===e.paused)},[p,e.paused]),(0,Qr.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void p.setVisible(!0);const t=()=>p.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[p,e.suspendWhenHidden]),(0,Qr.useEffect)(()=>()=>{A()},[A]);const M=(0,Qr.useRef)(()=>{}),C=(0,Qr.useRef)(()=>{}),j=(0,Qr.useRef)(null),_=(0,Qr.useRef)(null),R=(0,Qr.useRef)(null),P=(0,Qr.useCallback)(()=>{const e=j.current;j.current=null,e&&M.current(e)},[]),L=(0,Qr.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,Qr.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),C.current()},[]);(0,Qr.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return hi(()=>{T&&(jo++,T.current=!0,S())},[h,S,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:m,tableId:g,frameRuntime:p,rafRef:b,renderFnRef:k,scheduleRender:S,cancelRender:A,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:I}}var yi=require("react"),pi=require("react/jsx-runtime");function bi({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,pi.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,pi.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var vi=require("react");function xi(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function wi(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function ki(e,t,n=.3){wi(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 Si(e,t,n=.6){if(!wi(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,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 Ai(e,t,n,o=.35){wi(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Mi(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=Ho(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Ci(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}}}function ji(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}var _i=new Map;function Ri(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=_i.get(t);return n||(n=new Path2D(me(e.symbolType,e.size)),_i.size>256&&_i.clear(),_i.set(t,n)),n}catch{return null}}function Pi(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=yt(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=To(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=wt(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&St(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),St(e,i,c,t.accent,void 0,l),e.restore()}var Li=require("d3-shape");function Ii(e,t){const n=t._gradientBand.colors;if(0===n.length)return;const{clipPath:o,slices:r}=Eo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:n}),i=new Path2D(o);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=Lo(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=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Ti(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 $i(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=(0,Li.arc)().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Bi=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Ii(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Ti(e,t),Ai(e,t)),e.globalAlpha=1;else{if(e.fillStyle=To(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=No({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=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),$i(e,t)):(Ti(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Ti(e,t),Ai(e,t)),e.globalAlpha=1}},Oi=(e,t,n,o)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const n=t.columnWidth/2,o="vertical"===t.projection,r=Lo(e,"var(--semiotic-primary, #007bff)"),i=Lo(e,"var(--semiotic-text, #333)"),s=To(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?Lo(e,a)||a:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,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=u,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Hi=(e,t,n,o)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=To(e,t.style.fill,"#007bff"),e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Lo(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()}},Fi=(e,t,n,o)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){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=n.fillOpacity??n.opacity??.3,e.fillStyle=$o(e,n.fill)??"#999",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=Lo(e,n.style.stroke)||To(e,n.style.fill,"")||Lo(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=n.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Ni=(e,t,n,o)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const n=t.points;if(n.length>=4){e.globalAlpha=t.style?.opacity??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=$o(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Ei(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 Di(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Wi=new Map;function zi(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Wi.get(n);if(void 0!==o)return o;const r=On({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Wi.set(n,r),r}function qi(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Gi(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 Vi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function Yi(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function Xi(e){return(t,n,o,r)=>{e(t,n.filter(Yi),{x:o.r,y:o.r},r)}}var Ui=Xi((e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)ji(e,t);else if(t.cornerRadii&&Oo(t.cornerRadii)){const n=To(e,t.style.fill,Lo(e,"var(--semiotic-primary, #007bff)")),o=Ci(t),r=t.fillGradient&&"string"==typeof n?Bo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,Mi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=To(e,t.style.fill,Lo(e,"var(--semiotic-primary, #007bff)")),o=Ci(t),r=t.fillGradient&&"string"==typeof n?Bo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=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-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=To(e,t.style.fill,Lo(e,"var(--semiotic-primary, #007bff)")),o=Ci(t),r=t.fillGradient&&"string"==typeof n?Bo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Lo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}ki(e,t),e.globalAlpha=1}}),Ki=Xi((e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=To(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=To(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Si(e,n)}finally{e.restore()}}}),Qi=Xi((e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=Ri(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=To(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=To(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n}),Zi=Xi((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Pi(e,o,o.x,o.y,n);e.globalAlpha=n}),Ji=e=>[Fi,...e],es={bar:Ji([Ui]),clusterbar:Ji([Ui]),point:Ji([Ki,Qi]),swarm:Ji([Ki,Qi]),pie:[Bi],donut:[Bi],boxplot:Ji([Oi,Ki]),violin:Ji([Hi]),histogram:Ji([Ui]),ridgeline:Ji([Hi]),timeline:Ji([Ui]),funnel:[Ui,Ni,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(n.__funnelRowWidth??n.__funnelBarW??0))continue;const r=n.__funnelStepLabelX,i=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,r,i),e.fillStyle="#fff",e.fillText(o,r,i)}e.font="bold 13px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=n.__funnelBarW??0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,s=!0===n.__funnelIsFirstStep;let a;if(a=s?Ei(r):null!=i?`${Ei(r)} (${Di(i)})`:Ei(r),e.measureText(a).width+16>o){if(s||null==i)continue;if(a=Ei(r),e.measureText(a).width+16>o)continue}const l=n.__funnelValueLabelX,c=(n.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ui,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const n=("string"==typeof t.style.fill?t.style.fill:null)||Lo(e,"var(--semiotic-border, #999)"),o=zi(n,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[n,o,r]=Io(e,t);return(.2126*n+.7152*o+.0722*r)/255>.6}(e,Lo(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,u=i?Vi(r):"",d=Gi(o);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,m=Math.max(h,f)+12,g=i?32:17,y=n.__barFunnelLabelX,p=y-m/2,b=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),qi(e,p,b,m,g,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),qi(e,p,b,m,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,b+3))}e.lineWidth=1}],swimlane:Ji([Ui]),custom:Ji([Ui,Ki,Qi,Zi,Bi,Oi,Hi,Ni])},ts=new Set;function ns(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function os(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;ts.has(n)||(ts.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var rs=require("react/jsx-runtime");function is(e){const t=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&Er.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Hr.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Dr(l,Fr),u=Dr(l,Nr),d=new Set(Fr),h=new Set(Nr),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,rs.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[null!=t.title&&(0,rs.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,rs.jsxs)("div",{children:[(0,rs.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function ss({hover:e}){const t=e.data||{},n=e.stats,o=e.category;if(Array.isArray(t)){const e=o||t[0]?.category||"";if(n)return(0,rs.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[e&&(0,rs.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,rs.jsxs)("div",{children:["n = ",n.n]}),(0,rs.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),(0,rs.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,rs.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),(0,rs.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),(0,rs.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),(0,rs.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,rs.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[e&&(0,rs.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,rs.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,rs.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[t.category&&(0,rs.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,rs.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,rs.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return is(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,rs.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[a&&(0,rs.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,rs.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):is(t)}function as(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function ls(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}ss.ownsChrome=!0;var cs=require("react"),us=require("react");function ds(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function hs(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=kt(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function fs(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var ms=require("react/jsx-runtime"),gs={top:50,right:40,bottom:60,left:70},ys=(0,k.memo)((0,k.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:f,valueAccessor:m,categoryAccessor:g,accessorRevision:y,projection:p="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:w,barPadding:S,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:O,showOutliers:H,showIQR:F,amplitude:N,connectorOpacity:E,showLabels:D,connectorAccessor:W,connectorStyle:z,dataIdAccessor:q,rExtent:G,oExtent:V,extentPadding:Y=.05,oSort:X,windowMode:U="sliding",windowSize:K=200,pieceStyle:Q,summaryStyle:Z,renderMode:J,colorScheme:ee,barColors:te,showAxes:ne=!0,showCategoryTicks:oe,categoryLabel:re,valueLabel:ie,categoryFormat:se,valueFormat:ae,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:me,enableHover:ge=!0,hoverAnnotation:ye,tooltipContent:pe,customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,annotationObservationCallback:we,chartId:ke,annotations:Se,onAnnotationActivate:Ae,autoPlaceAnnotations:Me,svgAnnotationRules:Ce,showGrid:je=!1,legend:_e,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Ie,legendPosition:Te,legendLayout:$e,legendCategoryAccessor:Be,onCategoriesChange:Oe,backgroundGraphics:He,foregroundGraphics:Fe,title:Ne,className:Ee,background:De,centerContent:We,decay:ze,pulse:qe,transition:Ge,animate:Ve,staleness:Ue,frameScheduler:Ke,clock:Qe,random:Ze,seed:Je,paused:nt=!1,suspendWhenHidden:rt=!0,brush:it,onBrush:st,accessibleTable:at=!0,description:lt,summary:ct,customLayout:ht,onLayoutError:ft,layoutConfig:mt,layoutSelection:gt}=e,{customHoverBehavior:yt,customClickBehavior:pt,hasClickBehavior:bt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,cs.useCallback)((t,i)=>{e?.(t,i),as({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,cs.useCallback)((e,i)=>{t?.(e,i),ls({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,chartId:ke,chartType:"StreamOrdinalFrame"}),vt=g??i,xt=m??s,wt=(0,k.useRef)(!0),kt=gi({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:w,marginDefault:gs,title:Ne,legend:_e,legendPosition:Te,animate:Ve,transitionProp:Ge,frameScheduler:Ke,clock:Qe,random:Ze,seed:Je,paused:nt,suspendWhenHidden:rt,themeDirtyRef:wt}),{reducedMotionRef:St,responsiveRef:Mt,size:Ct,margin:jt,adjustedWidth:_t,adjustedHeight:Rt,currentTheme:Pt,transition:Lt,introEnabled:Bt,tableId:Ht,rafRef:Ft,renderFnRef:Nt,scheduleRender:Et,frameRuntime:Dt}=kt,Wt=function(){const[e,t]=(0,Ko.useState)(!1);return Qo(()=>{t(!0)},[]),e}(),zt=function(){const e=(0,Ko.useSyncExternalStore)(Zo,Jo,er);return(0,Ko.useRef)(e).current}(),qt=(0,k.useMemo)(()=>A(r),[r]),Gt=re??le,Vt=ie??ce,Yt=se??ue,Xt=ae??de,Ut=(0,k.useRef)(null),[Kt,Qt]=(0,k.useState)(null),[Zt,Jt]=(0,k.useState)(null),en=xi(Fe,Ct,jt,Zt),tn=xi(He,Ct,jt,Zt),nn=He||"transparent"===De?null:(0,ms.jsx)("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-jt.left,y:-jt.top,width:Ct[0],height:Ct[1],fill:De||"var(--semiotic-bg, transparent)"}),[on,rn]=(0,k.useState)(0),sn=(0,k.useRef)(0),[an,ln]=(0,k.useState)(!1),cn=(0,k.useRef)({w:-1,h:-1}),un=(0,k.useRef)(!1),dn=(0,Xe.useRef)(new et("StreamOrdinalFrame")),hn=ge||ye,fn="streaming"===o,mn=function(e){const t=(0,tr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return or(e,t);if(!rr(e)||!rr(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!or(n,r))return!1}else{if(!rr(n)||!rr(r))return!1;if(!nr(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,k.useMemo)(()=>({chartType:n,runtimeMode:fn?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:Y,projection:p,oAccessor:fn?void 0:vt,rAccessor:fn?void 0:xt,accessorRevision:y,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:fn?f:void 0,valueAccessor:fn?m||("string"==typeof xt||"function"==typeof xt?xt:void 0):void 0,categoryAccessor:fn?vt:void 0,rExtent:G,oExtent:V,axisExtent:me,barPadding:S,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:O,showOutliers:H,showIQR:F,amplitude:N,connectorOpacity:E,showLabels:D,connectorAccessor:W,connectorStyle:z,dataIdAccessor:q,oSort:X,pieceStyle:Q,summaryStyle:Z,colorScheme:ee,themeCategorical:Pt?.colors?.categorical,themeSemantic:Zr(Pt),themeSequential:Pt?.colors?.sequential,themeDiverging:Pt?.colors?.diverging,barColors:te,decay:ze,pulse:qe,transition:Lt,introAnimation:Bt,staleness:Ue,clock:Dt.now,customLayout:ht,onLayoutError:ft,layoutConfig:mt,layoutMargin:jt}),[n,fn,K,U,Y,p,vt,xt,y,a,l,c,u,d,h,f,m,G,V,me,S,C,j,_,R,P,L,I,T,$,B,O,H,F,N,E,D,W,z,q,X,Q,Z,ee,Pt,te,ze,qe,Lt,Bt,Ue,Dt.now,ht,ft,mt,jt])),gn=(0,k.useRef)(null);gn.current||(gn.current=new Ye(mn));const yn=function(e,t,n,o){const r=(0,vi.useRef)({accessor:t,onChange:n,readData:o}),i=(0,vi.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,vi.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(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})(s,i.current)||(i.current=s,n(s))},[e])}(gn,Be,Oe,e=>e.getData());!function(e,t,n,o){(0,dt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(gn,mn,wt,Et),function(e,t,n,o){const r=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(gn,gt,wt,Et);const pn=(0,k.useRef)(null);pn.current||(pn.current=new M(e=>{const t=gn.current;t&&t.ingest(e)&&(wt.current=!0,Et())}));const bn=(0,k.useCallback)(e=>{pn.current?.push(e)},[]),vn=(0,k.useCallback)(e=>{pn.current?.pushMany(e)},[]),xn=(0,k.useCallback)(()=>{pn.current?.clear(),gn.current?.clear(),wt.current=!0,Et()},[Et]),wn=(0,k.useCallback)(e=>{pn.current?.clearLastData(),pn.current?.setReplacementData(e)},[]);(0,k.useImperativeHandle)(t,()=>({push:bn,pushMany:vn,replace:wn,remove:e=>{pn.current?.flush();const t=gn.current?.remove(e)??[];if(t.length>0){const e=Ut.current?.data;!!Ut.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ut.current=null,Qt(null)),wt.current=!0,Et()}return t},update:(e,t)=>{pn.current?.flush();const n=gn.current?.update(e,t)??[];return n.length>0&&(wt.current=!0,Et()),n},clear:xn,getData:()=>(pn.current?.flush(),gn.current?.getData()??[]),getScales:()=>gn.current?.scales??null,getCustomLayout:()=>gn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>gn.current?.lastCustomLayoutFailure??null}),[bn,vn,wn,xn,Et]),(0,k.useEffect)(()=>{r&&pn.current?.setBoundedData(qt)},[r,qt]);const{canvasRef:kn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,yi.useRef)(null),a=(0,yi.useRef)(null),l=(0,yi.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Qo(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,Ko.useRef)(a);l.current=a,(0,Ko.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,yi.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,yi.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(kt,{storeRef:gn,dirtyRef:wt,hydrated:Wt,wasHydratingFromSSR:zt,cleanup:()=>pn.current?.clear(),canvasPaintDependencies:[n,_t,Rt,ne,De,He,J,Et]}),{hoverHandlerRef:Sn,hoverLeaveRef:An,onPointerMove:Mn,onPointerLeave:Cn}=kt;Sn.current=e=>{if(!hn)return;const t=kn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-jt.left,i=e.clientY-o.top-jt.top;if(0>r||r>_t||0>i||i>Rt)return void(Ut.current&&(Ut.current=null,Qt(null),yt&&yt(null),Et()));const s=gn.current;if(!s||0===s.scene.length)return;const a="radial"===p,l=At(s.scene,a?r-_t/2:r,a?i-Rt/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Ut.current&&(Ut.current=null,Qt(null),yt&&yt(null),Et()));const c=Or(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof vt?vt:void 0,__rAccessor:"string"==typeof xt?xt:void 0,__chartType:n});Ut.current=c,Qt(c),yt&&(yt(c),wt.current=!0),Et()},An.current=()=>{Ut.current&&(Ut.current=null,Qt(null),yt&&(yt(null),wt.current=!0),Et())};const jn=(0,k.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!pt)return;const o=kn.current;if(!o)return pt(null),wt.current=!0,void Et();const r=o.getBoundingClientRect(),i=e.clientX-r.left-jt.left,s=e.clientY-r.top-jt.top;if(0>i||i>_t||0>s||s>Rt)return pt(null),wt.current=!0,void Et();const a=gn.current;if(!a||0===a.scene.length)return pt(null),wt.current=!0,void Et();const l="radial"===p,c=At(a.scene,l?i-_t/2:i,l?s-Rt/2:s,30,a.pointQuadtree,a.maxPointRadius);if(!c)return pt(null),wt.current=!0,void Et();var u;pt(Or(c.datum||{},c.x,c.y,{...c.stats&&{stats:c.stats},...c.category&&{category:c.category},__oAccessor:"string"==typeof vt?vt:void 0,__rAccessor:"string"==typeof xt?xt:void 0,__chartType:n}),{type:"activate",inputType:(u=e.nativeEvent.pointerType,"touch"===u?"touch":"pointer")}),wt.current=!0,Et()},[pt,kn,jt.left,jt.top,_t,Rt,p,vt,xt,n,Et]),{kbFocusIndexRef:_n,focusedNavPointRef:Rn,onKeyDown:Pn}=function({chartType:e,oAccessor:t,rAccessor:n,...o}){return function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,us.useRef)(-1),u=(0,us.useRef)(null),d=(0,us.useRef)(null),h=(0,us.useCallback)(h=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(h))return;const f=e.current;if(!f)return;const m=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||m());let g;if(d.current?.version===f.version)g=d.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||m());g=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.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 n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),d.current={version:f.version,graph:g}}let y=c.current;if(g.flat.length>y||(m(),y=-1),("Enter"===h.key||" "===h.key)&&y>=0)return h.preventDefault(),void i(l(g.flat[y],f),{type:"activate",inputType:"keyboard"});if(0>y){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=g.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const p=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?ds(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ds(n,n.groups[e-1],i[r]):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}}(h.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(g,y),g);if(null===p)return;if(h.preventDefault(),0>p)return void m();c.current=p;const b=g.flat[p];u.current=b;const v=l(b,f);t.current=v,o(v),r(v,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}({...o,extractPoints:hs,toHover:o=>({...fs(o),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:e})})}({storeRef:gn,hoverRef:Ut,setHoverPoint:Qt,customHoverBehavior:yt,customClickBehavior:pt,scheduleRender:Et,chartType:n,oAccessor:vt,rAccessor:xt}),Ln=(0,k.useCallback)(e=>{_n.current=-1,Rn.current=null,Mn(e)},[Rn,_n,Mn]);Nt.current=()=>{if(Ft.current=null,!Dt.isActive)return;const e=kn.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const o=gn.current;if(!o)return;const r=Dt.now(),i=o.advanceTransition(St.current?r+1e6:r),s=!St.current&&i,a=cn.current.w!==_t||cn.current.h!==Rt,l=wt.current;let c=!1;const u=dn.current.beforeCompute(o.getLastUpdateResult(),s);!l&&!a||s&&!a||(o.computeScene({width:_t,height:Rt}),cn.current={w:_t,h:Rt},c=!0,yn()),dn.current.afterCompute(u,c,a),wt.current=l&&s&&!c;const d=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,c,un);(c||s)&&e.setAttribute("aria-label",gr(o.scene,n+" chart"));const h=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),f=Ct[0]*h,m=Ct[1]*h;e.width===f&&e.height===m||(e.width=f,e.height=m,e.style.width=Ct[0]+"px",e.style.height=Ct[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,Ct[0],Ct[1]);const g=Ue&&o.lastIngestTime>0&&r-o.lastIngestTime>(Ue?.threshold??5e3);g&&(t.globalAlpha=Ue?.dimOpacity??.5);const y="radial"===p;t.save(),t.beginPath(),t.rect(jt.left,jt.top,_t,Rt),t.clip(),y?(t.save(),t.translate(jt.left+_t/2,jt.top+Rt/2)):t.translate(jt.left,jt.top);const b=ht?es.custom:es[n]||[],v={width:_t,height:Rt},x=o.scales;x&&function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=ns(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(os(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:J,pixelRatio:h,paintBuiltIn:e=>{for(const n of b)n(t,e,x,v)}}),y&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&o.scales?(Jt(o.scales),rn(e=>e+1),sn.current=r):s&&o.scales&&r-sn.current>=33&&(rn(e=>e+1),sn.current=r),Ue?.showBadge&&ln(!!g),(s||null!=o.activeTransition||d.pending)&&Et()},function(e,t,n,o,r,i){const s=(0,It.useRef)("fresh");(0,It.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return $t;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...Tt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:$t}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(Ue,gn,wt,Et,an,ln);const In=hn&&Kt?pe?pe(Kt):(0,ms.jsx)(ss,{hover:Kt}):null,Tn="radial"===p,$n=In?(0,ms.jsx)(Ur,{x:Kt?Tn?Kt.x+_t/2:Kt.x:0,y:Kt?Tn?Kt.y+Rt/2:Kt.y:0,containerWidth:_t,containerHeight:Rt,margin:jt,className:"stream-ordinal-tooltip",children:In}):null,Bn="horizontal"===p?vt:xt,On=po("horizontal"===p?xt:vt,void 0,"__semiotic_resolvedO",""),Hn=po(Bn,void 0,"__semiotic_resolvedR",""),Fn=On.key,Nn=Hn.key,En=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(On,Hn,Se&&Se.length>0||!1);if(Uo||!Wt&&zt){const e=gn.current;e&&r&&(e.ingest({inserts:qt,bounded:!0}),e.computeScene({width:_t,height:Rt}));const t=e?.scene??[],n=e?.scales??null,o=xi(Fe,Ct,jt,n),i=xi(He,Ct,jt,n),s="radial"===p,a=s?jt.left+_t/2:jt.left,l=s?jt.top+Rt/2:jt.top;return(0,ms.jsxs)("div",{ref:Mt,className:"stream-ordinal-frame"+(Ee?" "+Ee:""),role:"img","aria-label":lt||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:v?"100%":Ct[0],height:x?"100%":Ct[1]},children:[(0,ms.jsx)(Rr,{summary:ct}),(0,ms.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ct[0],height:Ct[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,ms.jsx)("g",{transform:`translate(${jt.left},${jt.top})`,children:i}),(0,ms.jsxs)("g",{transform:`translate(${a},${l})`,children:[De&&(0,ms.jsx)("rect",{x:0,y:0,width:_t,height:Rt,fill:De}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=ns(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(os(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:J,fallback:()=>Xo(e,t,Ht)})).filter(Boolean)]})]}),(0,ms.jsx)(yo,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:n,showAxes:ne,showCategoryTicks:oe,oLabel:Gt,rLabel:Vt,oFormat:Yt,rFormat:Xt,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:me,showGrid:je,title:Ne,legend:_e,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Ie,legendPosition:Te,legendLayout:$e,foregroundGraphics:ot(o,ut(gn.current?.customLayoutOverlays,gt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:we??xe,chartId:ke,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Me,svgAnnotationRules:Ce,annotationFrame:0,xAccessor:Fn,yAccessor:Nn,annotationData:En(e?.getData())}),We&&"radial"===p&&(0,ms.jsx)("div",{style:{position:"absolute",left:jt.left+_t/2,top:jt.top+Rt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:We})]})}return(0,ms.jsxs)("div",{ref:Mt,className:"stream-ordinal-frame"+(Ee?" "+Ee:""),role:"group","aria-label":lt||("string"==typeof Ne?Ne:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":Ct[0],height:x?"100%":Ct[1],overflow:"visible"},onKeyDown:Pn,children:["production"!==process.env.NODE_ENV&&gn.current&&(0,ms.jsx)(tt,{store:gn.current,diagnostics:dn.current}),at&&(0,ms.jsx)(Pr,{tableId:Ht}),at&&(0,ms.jsx)(_r,{scene:gn.current?.scene??[],chartType:n+" chart",tableId:Ht,chartTitle:"string"==typeof Ne?Ne:void 0}),(0,ms.jsx)(Rr,{summary:ct}),(0,ms.jsx)(ur,{hoverPoint:Kt}),(0,ms.jsxs)("div",{role:"img","aria-label":lt||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:hn?Ln:void 0,onMouseLeave:hn?Cn:void 0,onClick:bt?jn:void 0,children:[(0,ms.jsxs)(bi,{size:Ct,margin:jt,children:[nn,tn]}),(0,ms.jsx)(mo,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:Zt,showAxes:ne,showGrid:je,rFormat:Xt,rTickValues:he,axisExtent:me}),(0,ms.jsx)("canvas",{ref:kn,"aria-label":gr(gn.current?.scene??[],n+" chart"),style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1]}}),(0,ms.jsx)(yo,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:Zt,showAxes:ne,showCategoryTicks:oe,oLabel:Gt,rLabel:Vt,oFormat:Yt,rFormat:Xt,rTickValues:he,axisExtent:me,showGrid:je,title:Ne,legend:_e,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Ie,legendPosition:Te,legendLayout:$e,foregroundGraphics:ot(en,ut(gn.current?.customLayoutOverlays,gt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:we??xe,chartId:ke,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Me,svgAnnotationRules:Ce,annotationFrame:on,xAccessor:Fn,yAccessor:Nn,annotationData:En(gn.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(it||st)&&"radial"!==p&&(0,ms.jsx)(ko,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:Zt,onBrush:st||(()=>{})}),We&&"radial"===p&&(0,ms.jsx)("div",{style:{position:"absolute",left:jt.left+_t/2,top:jt.top+Rt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:We}),Ue?.showBadge&&(0,ms.jsx)(Ot,{isStale:an,position:Ue.badgePosition}),(0,ms.jsx)(Tr,{active:_n.current>=0,hoverPoint:Kt,margin:jt,size:Ct,shape:Rn.current?.shape,width:Rn.current?.w,height:Rn.current?.h}),$n]})]})}));ys.displayName="StreamOrdinalFrame";var ps=ys;function bs(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function vs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};o&&(f.annotationObservationCallback=o);const m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function xs(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Yr(t)||n}}var ws=require("react"),ks=require("react"),Ss=require("react"),As=(require("react/jsx-runtime"),(0,Ss.createContext)(null));function Ms(){return(0,Ss.useContext)(As)}var Cs=require("react");function js(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function _s(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Rs(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Ps,Ls]=Mn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Rs(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=_s(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=_s(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),Is=require("react"),Ts=(require("react"),{positions:new Map}),$s=new Set;function Bs(){for(const e of $s)e()}function Os(e,t){const n=Ts.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Ts.positions);o.delete(e),Ts={positions:o},Bs()}function Hs(e,t){const n=Ts.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Ts.positions);o.delete(e),Ts={positions:o},Bs()}function Fs(e){const t=(0,Is.useId)(),n=e.clientId||t,{name:o}=e,r=Ls(e=>e.selections.get(o)),i=Ls(e=>e.setClause),s=Ls(e=>e.clearClause),a=(0,Is.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Is.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(js(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,Is.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,Is.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,Is.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Ns(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Es(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime");var Ds=(0,Cs.createContext)(!1);(0,Cs.createContext)(!1);var Ws=(0,Cs.createContext)(null),zs="undefined"==typeof window?Cs.useEffect:Cs.useLayoutEffect;function qs(e){const t=(0,Cs.useContext)(Ws),n=(0,Cs.useId)(),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),r=(0,Cs.useRef)([]);(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})(r.current,o)||(r.current=o);const i=r.current;zs(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),zs(()=>{t&&t.registerCategories(n,i)},[t,n,i])}function Gs({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):oe[i%oe.length];return{label:r+"",color:a}}),label:""}]}}var Vs=g(require("react"));function Ys(){return si(e=>e.theme)}function Xs(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Us(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Ks(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>Us(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Xs(e[o])&&Xs(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}require("react/jsx-runtime"),Vs.createContext(void 0);var Qs={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Zs(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Qs;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}var Js={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}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function ea(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function ta(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function na(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?{...t,xValue:e.xValue}:t||{}}function oa(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ra=[];function ia(){const e=Ys(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function sa(e,t,n){return(0,ks.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}function aa(e,t,n){return function(e,t,n){const o=Js[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Ks({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=Js[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:ea(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Zs(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var la=require("react/jsx-runtime");function ca(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function ua(e,t){if(!t)return ca(e);try{const n=t(e);return null==n?ca(e):n}catch{return ca(e)}}function da(e,t){return"function"==typeof t?t(e):e[t]}function ha({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=da(a,e),c=da(a,t),u=n?da(a,n):void 0;return(0,la.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[(0,la.jsx)("div",{style:{fontWeight:"bold"},children:ca(l)}),(0,la.jsx)("div",{style:{marginTop:4},children:ua(c,i)}),null!=u&&(0,la.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[o||(d=n,"string"==typeof d?d:"value"),": ",ca(u)]})]});var d}}var fa=require("react/jsx-runtime");function ma({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,fa.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,fa.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,fa.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,fa.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,fa.jsx)("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:n})]})})}var ga=g(require("react")),ya=require("react/jsx-runtime"),pa=class extends ga.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,ya.jsx)(ma,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},ba=require("react/jsx-runtime"),va="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function xa({componentName:e,width:t,height:n,children:o}){return(0,ba.jsx)(pa,{fallback:o=>(0,ba.jsx)(ma,{componentName:e,message:o.message,width:t,height:n}),children:o})}var wa={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},ka={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Sa(e,t,n,o){if(!va)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Aa(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Ma(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=Aa(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function Ca({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=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[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Ma(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var ja=require("react"),_a=require("react");function Ra(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:m,legend:g,userMargin:y,marginDefaults:p,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:M,width:C,height:j}=e,_=void 0===n,R=(0,ja.useMemo)(()=>A(t),[t]),[P,L]=(0,ja.useState)([]),I=(0,ja.useCallback)(e=>{L(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,$=(0,ja.useMemo)(()=>Zs(x,{width:C,mobileSemantics:w}),[x,C,w]),{activeSelectionHook:B,hoverSelectionHook:O,customHoverBehavior:H,customClickBehavior:F,crosshairSourceId:N}=function({selection:e,linkedHover:t,fallbackFields:n=ra,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,ks.useId)(),h=(0,ks.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,ks.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),m=Fs({name:e?.name||"__unused__",fields:f}),g=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Fs({name:t,fields:n});return{onHover:(0,Is.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Es(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:h?.name||"hover",fields:f}),y=_n(e=>e.pushObservation),p=(0,ks.useCallback)(e=>{r?.(e),y?.(e)},[r,y]),b=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,x]=(0,ks.useState)(null),w=(0,ks.useRef)(!1),k=c||n[0],S=(0,ks.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),A=(0,ks.useCallback)((e,n)=>{const o=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=ta(e,t,h.xField);null!=n&&function(e,t,n){const o=Ts.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Ts={positions:new Map(Ts.positions).set(e,{xValue:t,sourceId:n})},Bs())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Os(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else o||x(null);(r||y)&&as({onObservation:p,datum:e?na(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,g,h,d,r,i,s,y,p,l,k,u]),M=(0,ks.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&l&&x(null),"x-position"===h?.mode&&(Hs(h.name||"hover",d),Os(h.name||"hover",d))},[t,h,g,e,u,m,l,d]),C=(0,ks.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=ta(n,e,h.xField);null!=t&&function(e,t,n){const o=Ts.positions.get(e);if(o?.locked){const t=new Map(Ts.positions);return t.delete(e),Ts={positions:t},Bs(),!1}Ts={positions:new Map(Ts.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Bs()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const o=na(n);if(t&&"x-position"!==h?.mode&&g.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}oa(e)&&m.selectPoints(e)}if(l&&k){const e=o?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||y)&&ls({onObservation:p,datum:n?na(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,y,p,i,s,h,d,u,t,g,e,m,f,l,k,M]);return(0,ks.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,ks.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,ks.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Hs(e,d),Os(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:d}}({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:b,hoverHighlight:v,colorByField:T,mobileInteraction:$}),E=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,N),D=function(e,t,n){const o=Ms(),r=ia();return(0,ks.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&oa(i)){const e=ae(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return ae(n.map(e=>({_cat:e})),"_cat",s)}if(i&&oa(i)){const n=ae(e,t,s);return e=>i[e]||n(e)}return ae(e,t,s)}if(i&&oa(i)){const e=ae([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}(R,o,r),W=(0,ja.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of R){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[R,o]),z=(0,ja.useMemo)(()=>_&&P.length>0?P:W,[_,P,W]),q=function(e,t,n){const[o,r]=(0,ks.useState)(null),[i,s]=(0,ks.useState)(new Set),a=(0,ks.useMemo)(()=>new Set,[]),l=(0,ks.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,ks.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,ks.useMemo)(()=>{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&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,z),G=(0,ja.useMemo)(()=>O||(q.legendSelectionHook?q.legendSelectionHook:B),[O,q.legendSelectionHook,B]),V=function(e){const t=si(e=>e.theme.colors.selectionOpacity);return(0,_a.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(a),Y=ia(),X=Ms(),U=(0,ja.useMemo)(()=>{if(D)return D;if(!o||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:oe,t="__streamCat",n=ae(z.map(e=>({[t]:e})),t,e);return e=>X?.[e]||n(e)||"#999"},[D,o,z,r,Y,X]),{legend:K,margin:Q,legendPosition:Z}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l}){const c=(0,Cs.useContext)(Ds),u=null!==(0,Cs.useContext)(Ws),d=void 0!==o?o:!c&&!!t,h=!!t&&(d||u),f=(0,ks.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;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)},[a,t,e,h]);qs(u&&t?f:[]);const m=(0,ks.useMemo)(()=>{if(!d||!t)return;const o=Gs({data:e,colorBy:t,colorScale:n,getColor:ie,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,f]),g=(0,ks.useMemo)(()=>function(...e){let t;for(const n of e)n&&(t=Yt(t)&&Yt(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}(m,l),[m,l]),y=(0,ks.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return g&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,g,r]);return{legend:g,margin:y,legendPosition:r}}({data:R,colorBy:o,colorScale:U,showLegend:m,legendPosition:s,userMargin:y,defaults:p,categories:z,additionalLegend:g}),J=(0,ja.useMemo)(()=>{const e={};return K&&(e.legend=K,e.legendPosition=Z),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),_&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=I),e},[K,Z,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,_,o,I]),ee=Array.isArray(n)?A(n):n,te=function(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,ba.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,ba.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,ba.jsx)("div",{className:"semiotic-loading-bar",style:{...ka,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}(k,C,j,S),ne=te?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,ba.jsx)("div",{style:{...wa,width:t,height:n},children:o||"No data available"}):null}(ee,C,j,M);return{data:R,colorScale:D,allCategories:z,legendState:q,effectiveSelectionHook:G,activeSelectionHook:B,customHoverBehavior:H,customClickBehavior:F,mobileInteraction:$,legend:K,margin:Q,legendPosition:Z,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:E,resolvedSelection:V}}var Pa=require("react");function La({ref:e,frameRef:t,setup:n}){return(0,Pa.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,n)=>t.current?.update(e,n)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}var Ia=require("react");function Ta(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return 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)=>({...e(...t)||{},...n}):(...e)=>({...n})}function $a(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Ha(t(e))}function Ba(e,t){const n=$a(e),o=$a(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function Oa(e,t){const n=$a(t??"value"),o=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=o?o(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function Ha(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Fa(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=Ha(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function Na(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):Fa(o,t,n))}function Ea(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!Na(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function Da(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,Ea(s,t,n(s,i))),a}:r}function Wa(e,t,n){return e&&0!==e.length?(o,r)=>{const i=Ea(o,e,t(o,r)),s=n?n(o,r):void 0;return s?{...i,...s}:i}:n}function za(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:g=!1,styleRules:y,resolveRuleValue:p}=e,b=(0,Ia.useMemo)(()=>(e,a)=>{const l="function"==typeof m?m(e,a):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=ie(e,t,n)}else c.fill=function(e,t,n,o,r){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=se(n,o);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=te[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}(o,r,i,f?a:void 0,s);if(y&&y.length>0){const t=Ea(e,y,{value:p?p(e):void 0,category:a});Object.assign(c,t)}return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,r,i,s,f,m,g,y,p]),v=(0,Ia.useMemo)(()=>Ta(a?"function"==typeof a?(e,t)=>({...b(e,t),...a(e,t)||{}}):(e,t)=>({...b(e,t),...a}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,a,l,c,u]);return(0,Ia.useMemo)(()=>{return e=v,n=h,(t=d??null)?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e;var e,t,n},[v,d,h])}function qa(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Ga=require("react/jsx-runtime"),Va=(0,ws.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,ws.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:f=!1,barPadding:m=40,roundedTop:g,gradientFill:y=!1,styleRules:p,baselinePadding:b=!1,tooltip:v,annotations:x,regression:w,valueExtent:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:O,stroke:H,strokeWidth:F,opacity:N,showCategoryTicks:E,categoryFormat:D,dataIdAccessor:W}=e,{width:z,height:q,enableHover:G,showGrid:V,showLegend:Y,title:X,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=(0,ws.useMemo)(()=>A(r),[r]),te=Ra({data:ee,rawData:r,colorBy:d,colorScheme:h,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:Y,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:z,height:q}),{effectiveLegendProps:ne,effectiveMargin:oe}=La({ref:t,frameRef:o,setup:te});Sa("BarChart",ee,"categoryAccessor",a),Sa("BarChart",ee,"valueAccessor",l);const re=sa(ee,f,l),ie=ia(),se=(0,ws.useMemo)(()=>new Map,[]),ae=(0,ws.useMemo)(()=>$a(l),[l]),le=za({colorBy:d,colorScale:te.colorScale,color:O,themeCategorical:ie,colorScheme:h,categoryIndexMap:se,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:F,opacity:N,styleRules:p,resolveRuleValue:ae,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=(0,ws.useMemo)(()=>ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(te.earlyReturn)return te.earlyReturn;const ue=Ca({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,Ga.jsx)(ma,{componentName:"BarChart",message:ue,width:z,height:q});const de=qa(w),he=de?[de,...x||[]]:x,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[z,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:m,...null!=g&&{roundedTop:g},...y&&{gradientFill:!0===y?{topOpacity:.8,bottomOpacity:.05}:y},...W&&{dataIdAccessor:W},baselinePadding:b,enableHover:G,showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:u,...D&&{oFormat:D},showGrid:V,showCategoryTicks:E,oSort:f,...ne,...bs({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:v,defaultTooltipContent:ce}),...vs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,Ga.jsx)(xa,{componentName:"BarChart",width:z,height:q,children:(0,Ga.jsx)(ps,{ref:o,...fe})})});Va.displayName="BarChart";var Ya=require("react"),Xa=require("react/jsx-runtime"),Ua=(0,Ya.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Ya.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,normalize:m=!1,sort:g=!1,barPadding:y=40,roundedTop:p,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:O,stroke:H,strokeWidth:F,opacity:N,categoryFormat:E}=e,{width:D,height:W,enableHover:z,showGrid:q,showLegend:G,title:V,description:Y,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=(0,Ya.useMemo)(()=>A(r),[r]),J=h||l,ee=Ra({data:Z,rawData:r,colorBy:J,colorScheme:f,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:D,height:W}),te=ia(),ne=(0,Ya.useMemo)(()=>new Map,[]),oe=(0,Ya.useMemo)(()=>$a(c),[c]),re=za({colorBy:J,colorScale:ee.colorScale,color:O,themeCategorical:te,colorScheme:f,categoryIndexMap:ne,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:F,opacity:N,styleRules:b,resolveRuleValue:oe,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=(0,Ya.useMemo)(()=>ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),se=Ca({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ae,effectiveMargin:le}=La({ref:t,frameRef:o,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,stackBy:l,normalize:m,oSort:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[D,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:y,...null!=p&&{roundedTop:p},baselinePadding:v,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:d,...E&&{oFormat:E},showGrid:q,...ae,...bs({title:V,description:Y,summary:X,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:x,defaultTooltipContent:ie}),...vs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return se?(0,Xa.jsx)(ma,{componentName:"StackedBarChart",message:se,width:D,height:W}):(0,Xa.jsx)(xa,{componentName:"StackedBarChart",width:D,height:W,children:(0,Xa.jsx)(ps,{ref:o,...ce})})});Ua.displayName="StackedBarChart";var Ka=require("react"),Qa=require("react/jsx-runtime"),Za=(0,Ka.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Ka.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:m=!1,barPadding:g=60,roundedTop:y,styleRules:p,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:O,strokeWidth:H,opacity:F,categoryFormat:N}=e,{width:E,height:D,enableHover:W,showGrid:z,showLegend:q,title:G,description:V,summary:Y,accessibleTable:X,categoryLabel:U,valueLabel:K}=n,Q=(0,Ka.useMemo)(()=>A(r),[r]),Z=h||l,J=Ra({data:Q,rawData:r,colorBy:Z,colorScheme:f,legendInteraction:T,legendPosition:$,selection:S,linkedHover:M,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GroupedBarChart",chartId:R,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:P,loadingContent:L,emptyContent:I,width:E,height:D}),ee=ia(),te=(0,Ka.useMemo)(()=>new Map,[]),ne=(0,Ka.useMemo)(()=>$a(c),[c]),oe=za({colorBy:Z,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:k.pieceStyle,stroke:O,strokeWidth:H,opacity:F,styleRules:p,resolveRuleValue:ne,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Ka.useMemo)(()=>ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ie=Ca({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:se,effectiveMargin:ae}=La({ref:t,frameRef:o,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,groupBy:l,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:g,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...N&&{oFormat:N},showGrid:z,...se,...bs({title:G,description:V,summary:Y,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:v,defaultTooltipContent:re}),...vs({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:J.mobileInteraction,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 ie?(0,Qa.jsx)(ma,{componentName:"GroupedBarChart",message:ie,width:E,height:D}):(0,Qa.jsx)(xa,{componentName:"GroupedBarChart",width:E,height:D,children:(0,Qa.jsx)(ps,{ref:o,...le})})});Za.displayName="GroupedBarChart";var Ja=require("react"),el=require("react");function tl({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=(i="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const s="string"==typeof o?o:"value",a=function(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Fs({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,Is.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&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"===l&&Ns(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Ns(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Es(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,Is.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||s}),l=(0,el.useRef)(a.brushInteraction);l.current=a.brushInteraction;const c=(0,el.useCallback)(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}var nl=require("react/jsx-runtime"),ol=(0,Ja.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Ja.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,barPadding:m,tooltip:g,annotations:y,brush:p,onBrush:b,linkedBrush:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:O,categoryFormat:H,rTickValues:F,tickLabelEdgeAlign:N,showCategoryTicks:E,gradientFill:D,trackFill:W,roundedTop:z,valueExtent:q}=e,{width:G,height:V,enableHover:Y,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,Ja.useMemo)(()=>A(r),[r]),oe=h||l,re=(0,Ja.useMemo)(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(ne.map(e=>"function"==typeof a?a(e):e[a])),n=Math.max(1,t.size);return n>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*n)/(n-1))):1},[m,e.mode,ne,a,u,G,V]),ie=Ra({data:ne,rawData:r,colorBy:oe,colorScheme:f,legendInteraction:L,legendPosition:I,selection:w,linkedHover:k,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwimlaneChart",chartId:j,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:G,height:V}),se=tl({brushProp:p,onBrushProp:b,linkedBrush:v,valueAccessor:c}),ae=ia(),le=(0,Ja.useMemo)(()=>new Map,[]),ce=za({colorBy:oe,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:$,strokeWidth:B,opacity:O,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,Ja.useMemo)(()=>ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=Ca({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=La({ref:t,frameRef:o,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:ne},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:!1===E?void 0:ee,rLabel:te,rFormat:d,...F&&{rTickValues:F},...null!=N&&{tickLabelEdgeAlign:N},...H&&{oFormat:H},...void 0!==E&&{showCategoryTicks:E},showGrid:X,...he,...bs({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:g,defaultTooltipContent:ue}),...vs({linkedHover:k,selection:w,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...y&&y.length>0&&{annotations:y},...D&&{gradientFill:!0===D?{topOpacity:.8,bottomOpacity:.05}:D},...null!=W&&{trackFill:W},...null!=z&&{roundedTop:z},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?(0,nl.jsx)(ma,{componentName:"SwimlaneChart",message:de,width:G,height:V}):(0,nl.jsx)(xa,{componentName:"SwimlaneChart",width:G,height:V,children:(0,nl.jsx)(ps,{ref:o,...me})})});ol.displayName="SwimlaneChart";var rl=require("react"),il=require("react");function sl(e,t){const{variant:n,frameRef:o,overrides:r}=t;(0,il.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},[o,r,n])}var al=require("react/jsx-runtime"),ll=(0,rl.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,rl.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sizeBy:f,sizeRange:m=[3,8],symbolBy:g,symbolMap:y,pointRadius:p=4,pointOpacity:b=.7,categoryPadding:v=20,tooltip:x,annotations:w,valueExtent:k,brush:S,onBrush:M,linkedBrush:C,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:$,loadingContent:B,emptyContent:O,legendInteraction:H,legendPosition:F,color:N,stroke:E,strokeWidth:D,opacity:W,showCategoryTicks:z,categoryFormat:q}=e,{width:G,height:V,enableHover:Y,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,rl.useMemo)(()=>A(r),[r]),oe=Ra({data:ne,rawData:r,colorBy:d,colorScheme:h,legendInteraction:H,legendPosition:F,selection:_,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwarmPlot",chartId:T,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:B,emptyContent:O,width:G,height:V}),re=tl({brushProp:S,onBrushProp:M,linkedBrush:C,valueAccessor:l}),ie=(0,rl.useMemo)(()=>{if(f)return xe(ne.map(e=>"function"==typeof f?f(e):e[f]))},[ne,f]),se=ia(),ae=(0,rl.useMemo)(()=>new Map,[]),ce=za({colorBy:d,colorScale:oe.colorScale,color:N,themeCategorical:se,colorScheme:h,categoryIndexMap:ae,userPieceStyle:j?.pieceStyle,stroke:E,strokeWidth:D,opacity:W,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:f?le(e,f,m,ie):p})}),ue=(0,rl.useMemo)(()=>ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(oe.earlyReturn)return oe.earlyReturn;const de=Ca({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(de)return(0,al.jsx)(ma,{componentName:"SwarmPlot",message:de,width:G,height:V});const he={chartType:"swarm",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,...g&&{symbolAccessor:g},...y&&{symbolMap:y},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,barPadding:v,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:ee,rLabel:te,rFormat:u,...q&&{oFormat:q},showGrid:X,showCategoryTicks:z,...oe.legendBehaviorProps,...bs({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:x,defaultTooltipContent:ue}),...vs({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...re.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,al.jsx)(xa,{componentName:"SwarmPlot",width:G,height:V,children:(0,al.jsx)(ps,{ref:o,...he})})});ll.displayName="SwarmPlot";var cl=require("react"),ul=require("react/jsx-runtime");function dl(e){return t=>{const n=t.category||t.data&&t.data[0]?.category||"",o=t.stats||(t.data||t).stats;if(o&&null!=o.median)return(0,ul.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[n&&(0,ul.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o.n&&(0,ul.jsxs)("div",{children:["n = ",o.n]}),null!=o.min&&(0,ul.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),null!=o.q1&&(0,ul.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,ul.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),null!=o.q3&&(0,ul.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),null!=o.max&&(0,ul.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),null!=o.mean&&(0,ul.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const o=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,ul.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[n&&(0,ul.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),i>0&&(0,ul.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,ul.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,ul.jsx)("div",{className:"semiotic-tooltip",style:zr,children:(0,ul.jsx)("div",{style:{fontWeight:"bold"},children:n+""})})}}var hl=require("react/jsx-runtime"),fl=(0,cl.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,cl.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:f=!0,outlierRadius:m=3,categoryPadding:g=20,tooltip:y,annotations:p,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:O,categoryFormat:H}=e,{width:F,height:N,enableHover:E,showGrid:D,showLegend:W,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:Y,valueLabel:X}=n,U=(0,cl.useMemo)(()=>A(r),[r]),K=Ra({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:W,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:N}),Q=ia(),Z=(0,cl.useMemo)(()=>new Map,[]),J=za({colorBy:d,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,cl.useMemo)(()=>dl(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Ca({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,hl.jsx)(ma,{componentName:"BoxPlot",message:te,width:F,height:N});const ne={chartType:"boxplot",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Y,rLabel:X,rFormat:u,...H&&{oFormat:H},showGrid:D,showCategoryTicks:O,...K.legendBehaviorProps,...bs({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:y,defaultTooltipContent:ee}),...vs({linkedHover:w,selection:x,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...p&&p.length>0&&{annotations:p},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,hl.jsx)(xa,{componentName:"BoxPlot",width:F,height:N,children:(0,hl.jsx)(ps,{ref:o,...ne})})});fl.displayName="BoxPlot";var ml=require("react"),gl=require("react/jsx-runtime"),yl=e=>{const t=e?.category;return null==t?"All":t+""},pl=(0,ml.forwardRef)(function(e,t){const n=aa(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:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,ml.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a=yl,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:f,categoryPadding:m=20,tooltip:g,annotations:y,valueExtent:p,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:R,loadingContent:P,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:O,opacity:H,showCategoryTicks:F,categoryFormat:N}=e,{width:E,height:D,enableHover:W,showGrid:z,showLegend:q,title:G,description:V,summary:Y,accessibleTable:X,categoryLabel:U,valueLabel:K}=n,Q=(0,ml.useMemo)(()=>A(r),[r]),Z=Ra({data:Q,rawData:r,colorBy:h,colorScheme:f,legendInteraction:I,legendPosition:T,selection:k,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:R,loadingContent:P,emptyContent:L,width:E,height:D}),J=tl({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=(0,ml.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,n=-1/0;for(const o of Q){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Q,l]),te=ia(),ne=(0,ml.useMemo)(()=>new Map,[]),oe=za({colorBy:h,colorScale:Z.colorScale,color:$,themeCategorical:te,colorScheme:f,categoryIndexMap:ne,userPieceStyle:void 0,stroke:B,strokeWidth:O,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,ml.useMemo)(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return(0,gl.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[n&&(0,gl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o&&(0,gl.jsxs)("div",{children:["Count: ",o]}),r&&2===r.length&&(0,gl.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=Ca({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,gl.jsx)(ma,{componentName:"Histogram",message:ie,width:E,height:D});const se={chartType:"histogram",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:oe,bins:c,normalize:u,...p?{rExtent:p}:ee&&{rExtent:ee},size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...N&&{oFormat:N},showGrid:z,showCategoryTicks:F,...Z.legendBehaviorProps,...bs({title:G,description:V,summary:Y,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:g,defaultTooltipContent:re}),...vs({linkedHover:S,selection:k,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...y&&y.length>0&&{annotations:y},...J.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,gl.jsx)(xa,{componentName:"Histogram",width:E,height:D,children:(0,gl.jsx)(ps,{ref:o,...se})})});pl.displayName="Histogram";var bl=require("react"),vl=require("react/jsx-runtime"),xl=(0,bl.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,bl.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:f,colorBy:m,colorScheme:g,categoryPadding:y=20,tooltip:p,annotations:b,valueExtent:v,brush:x,onBrush:w,linkedBrush:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:O,stroke:H,strokeWidth:F,opacity:N,showCategoryTicks:E,categoryFormat:D}=e,{width:W,height:z,enableHover:q,showGrid:G,showLegend:V,title:Y,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=(0,bl.useMemo)(()=>A(r),[r]),ee=Ra({data:J,rawData:r,colorBy:m,colorScheme:g,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ViolinPlot",chartId:P,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:W,height:z}),te=tl({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:l}),ne=ia(),oe=(0,bl.useMemo)(()=>new Map,[]),re=za({colorBy:m,colorScale:ee.colorScale,color:O,themeCategorical:ne,colorScheme:g,categoryIndexMap:oe,userPieceStyle:void 0,stroke:H,strokeWidth:F,opacity:N,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,bl.useMemo)(()=>dl({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=Ca({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,vl.jsx)(ma,{componentName:"ViolinPlot",message:se,width:W,height:z});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:h,size:[W,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:f,...D&&{oFormat:D},showGrid:G,showCategoryTicks:E,...ee.legendBehaviorProps,...bs({title:Y,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:p,defaultTooltipContent:ie}),...vs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,vl.jsx)(xa,{componentName:"ViolinPlot",width:W,height:z,children:(0,vl.jsx)(ps,{ref:o,...ae})})});xl.displayName="ViolinPlot";var wl=require("react"),kl=require("react/jsx-runtime"),Sl=(0,wl.forwardRef)(function(e,t){const n=aa(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,wl.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:f="auto",dotRadius:m=5,categoryPadding:g=10,tooltip:y,annotations:p,regression:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:O,categoryFormat:H}=e,{width:F,height:N,enableHover:E,showGrid:D,showLegend:W,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:Y,valueLabel:X}=n,U=(0,wl.useMemo)(()=>A(r),[r]),K=Ra({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:I,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DotPlot",chartId:j,showLegend:W,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:F,height:N}),Q=sa(U,f,l),Z=ia(),J=(0,wl.useMemo)(()=>new Map,[]),ee=za({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:$,strokeWidth:B,opacity:O,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),te=(0,wl.useMemo)(()=>ha({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const ne=Ca({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ne)return(0,kl.jsx)(ma,{componentName:"DotPlot",message:ne,width:F,height:N});const oe=qa(b),re=oe?[oe,...p||[]]:p,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Y,rLabel:X,rFormat:u,...H&&{oFormat:H},showGrid:D,oSort:f,...K.legendBehaviorProps,...bs({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:y,defaultTooltipContent:te}),...vs({linkedHover:k,selection:w,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,kl.jsx)(xa,{componentName:"DotPlot",width:F,height:N,children:(0,kl.jsx)(ps,{ref:o,...ie})})});Sl.displayName="DotPlot";var Al=require("react"),Ml=require("react/jsx-runtime"),Cl=(0,Al.forwardRef)(function(e,t){const n=aa(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Al.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:f,annotations:m,frameProps:g={},selection:y,linkedHover:p,onObservation:b,onClick:v,hoverHighlight:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,legendInteraction:C,legendPosition:j,color:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:$,showLegend:B,title:O,description:H,summary:F,accessibleTable:N}=n,E=(0,Al.useMemo)(()=>A(r),[r]),D=c||a,W=Ra({data:E,rawData:r,colorBy:D,colorScheme:u,legendInteraction:C,legendPosition:j,selection:y,linkedHover:p,fallbackFields:D?["string"==typeof D?D:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"PieChart",chartId:w,showLegend:B,userMargin:i,marginDefaults:n.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:I,height:T}),z=ia(),q=(0,Al.useMemo)(()=>new Map,[]),G=za({colorBy:D,colorScale:W.colorScale,color:_,themeCategorical:z,colorScheme:u,categoryIndexMap:q,userPieceStyle:g?.pieceStyle,stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:W.effectiveSelectionHook,resolvedSelection:W.resolvedSelection,cycleByCategory:!0}),V=(0,Al.useMemo)(()=>ha({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),Y=Ca({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:X,effectiveMargin:U}=La({ref:t,frameRef:o,setup:W});if(W.earlyReturn)return W.earlyReturn;const K={chartType:"pie",...null!=r&&{data:E},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=h&&{cornerRadius:h},size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...X,...bs({title:O,description:H,summary:F,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:f,defaultTooltipContent:V}),...vs({linkedHover:p,selection:y,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(g).filter(([e])=>"pieceStyle"!==e))};return Y?(0,Ml.jsx)(ma,{componentName:"PieChart",message:Y,width:I,height:T}):(0,Ml.jsx)(xa,{componentName:"PieChart",width:I,height:T,children:(0,Ml.jsx)(ps,{ref:o,...K})})});Cl.displayName="PieChart";var jl=require("react"),_l=require("react/jsx-runtime"),Rl=(0,jl.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),o=(0,jl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:f=0,cornerRadius:m,tooltip:g,annotations:y,frameProps:p={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T}=e,{width:$,height:B,enableHover:O,showLegend:H,title:F,description:N,summary:E,accessibleTable:D}=n,W=(0,jl.useMemo)(()=>A(r),[r]),z=d||a,q=Ra({data:W,rawData:r,colorBy:z,colorScheme:h,legendInteraction:_,legendPosition:R,selection:b,linkedHover:v,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:H,userMargin:i,marginDefaults:n.marginDefaults,loading:M,loadingContent:C,emptyContent:j,width:$,height:B}),G=c??Math.max(2,.15*Math.min($,B)),V=ia(),Y=(0,jl.useMemo)(()=>new Map,[]),X=za({colorBy:z,colorScale:q.colorScale,color:P,themeCategorical:V,colorScheme:h,categoryIndexMap:Y,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,jl.useMemo)(()=>ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=Ca({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=La({ref:t,frameRef:o,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:W},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:X,innerRadius:G,startAngle:f,...null!=m&&{cornerRadius:m},centerContent:u,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...bs({title:F,description:N,summary:E,accessibleTable:D,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:g,defaultTooltipContent:U}),...vs({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return K?(0,_l.jsx)(ma,{componentName:"DonutChart",message:K,width:$,height:B}):(0,_l.jsx)(xa,{componentName:"DonutChart",width:$,height:B,children:(0,_l.jsx)(ps,{ref:o,...J})})});Rl.displayName="DonutChart";var Pl=require("react");function Ll(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 Il(e){return Math.max(0,Math.min(1,e))}function Tl(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 $l(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 Bl(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Il(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=Il(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],r=n[e+1];if(t.offset>o||o>r.offset)continue;const i=r.offset-t.offset,s=i>0?(o-t.offset)/i:0,a=Tl(t.color),l=Tl(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,m]=l;return $l(c+(h-c)*s,u+(f-u)*s,d+(m-d)*s)}return n[n.length-1].color}function Ol(e,t,n){return null==n?`${e}-${t}`:`${e}-${t}-${n}`}var Hl=require("react/jsx-runtime"),Fl=(0,Pl.forwardRef)(function(e,t){const n=aa(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),o=(0,Pl.useRef)(null),r="context"===e.mode,{compactMode:i}=n,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:g=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:p,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:j,opacity:_}=e,{width:R,height:P,title:L,description:I,summary:T,accessibleTable:$}=n,B=u&&"object"==typeof u?u:void 0,O=Math.max(a,Math.min(l,s)),H=l-a||1,F=(O-a)/H,{gaugeData:N,pieceStyle:E,gaugeAnnotations:D}=(0,Pl.useMemo)(()=>function(e){const{min:t,max:n,value:o,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:n,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const m=!!c&&c.colorStops.length>=2,g=[],y=new Map,p=[];if(m){const e=a?h:1,t=Ol("bg",0);if(g.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(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Bl(c.colorStops,e*(t+.5)/n));const r=Ol("fill",0);g.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(r,{fill:o[0]||s})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],r=(o.value-e)/d,i=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=Ol("fill",n);g.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=Ol("bg",n);g.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&n>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:B}),[s,a,l,c,d,h,v,w,B]),W=(0,Pl.useMemo)(()=>Ta(E,{stroke:C,strokeWidth:j,opacity:_}),[E,C,j,_]),{sweepRad:z,startAngleDeg:q}=Ll(x),G=function(e=240){const{sweepRad:t,offsetRad:n}=Ll(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 r=o.map(e=>e[0]),i=o.map(e=>e[1]),[s,a]=xe(r),[l,c]=xe(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(R,P)/12)),Y=G.cx,X=G.cy,U=Math.max(4,Math.min((R-2*V)/G.width,(P-2*V)/G.height)-2),K=Math.max(0,Math.min(U-1.5,U*(1-f))),Q=R/2-Y*U,Z=P/2-X*U,J=2*(U+4),ee=(0,Pl.useMemo)(()=>{if(i&&null==p)return null;if(null!=p)return"function"==typeof p?p(O,a,l):p;const e=b?b(O):Math.round(O)+"";return(0,Hl.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,Hl.jsx)("div",{style:{fontSize:Math.max(16,.3*U),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,Hl.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[p,O,a,l,b,v,U,i]),te=(0,Pl.useMemo)(()=>r&&null==p?{type:"gauge-value",text:b?b(O):Math.round(O)+""}:null,[r,p,O,b]),ne=(0,Pl.useMemo)(()=>{if(!g)return null;const e=-Math.PI/2+q*Math.PI/180+F*z,t=K>20?K-8:U-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,q,F,z,K,U,y]),oe=(0,Pl.useMemo)(()=>(e,t,n)=>{if("gauge-needle"===e.type){const o=(n.width||R)/2,r=(n.height||P)/2,i=Math.max(1,U-K),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,Hl.jsxs)("g",{transform:`translate(${o},${r})`,children:[(0,Hl.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,Hl.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const o=-Math.PI/2+q*Math.PI/180+(e.value-a)/H*z,r=(n.width||R)/2,i=(n.height||P)/2,s=K-1,l=U+1,c=Math.cos(o)*s,u=Math.sin(o)*s,d=Math.cos(o)*l,h=Math.sin(o)*l,f=U+10,m=Math.cos(o)*f,g=Math.sin(o)*f,y=((o+Math.PI/2)/(2*Math.PI)*12+12)%12;let p,b;return y>=11||1>y?(p="middle",b="auto"):y>=1&&5>y?(p="start",b="middle"):y>=5&&7>y?(p="middle",b="hanging"):(p="end",b="middle"),(0,Hl.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,Hl.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border, #ccc)",strokeWidth:2,strokeLinecap:"round"}),(0,Hl.jsx)("text",{x:m,y:g,textAnchor:p,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,Hl.jsx)("text",{x:(n.width||R)/2,y:(n.height||P)/2-.2*K,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*U)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[R,P,a,H,q,z,K,U]),re=(0,Pl.useMemo)(()=>{const e=[...D,...S||[]];return ne&&e.push(ne),te&&e.push(te),e},[D,S,ne,te]),ie=(0,Pl.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,n=t?._zone||"",o=t?._isFill;return(0,Hl.jsxs)("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:[(0,Hl.jsx)("div",{style:{fontWeight:600},children:n}),(0,Hl.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:o?"Current: "+Math.round(O):"Remaining"})]})},[O]);if(0===N.length)return(0,Hl.jsx)(ma,{componentName:"GaugeChart",message:"No data to display",width:R,height:P});const se={chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:K,startAngle:q,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:ee,size:[R,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:Z-J/2,bottom:P-Z-J/2,left:Q-J/2,right:R-Q-J/2},enableHover:n.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:Yr(k)||ie,svgAnnotationRules:oe,...re.length>0&&{annotations:re},...L&&{title:L},...I&&{description:I},...T&&{summary:T},...void 0!==$&&{accessibleTable:$},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return(0,Hl.jsx)(xa,{componentName:"GaugeChart",width:R,height:P,children:(0,Hl.jsx)(ps,{ref:o,...se})})});Fl.displayName="GaugeChart";var Nl=require("react"),El=require("react/jsx-runtime"),Dl=(0,Nl.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Nl.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:f,colorScheme:m,categoryPadding:g=5,tooltip:y,annotations:p,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:O,categoryFormat:H}=e,{width:F,height:N,enableHover:E,showGrid:D,showLegend:W,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:Y,valueLabel:X}=n,U=(0,Nl.useMemo)(()=>A(r),[r]),K=Ra({data:U,rawData:r,colorBy:f,colorScheme:m,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:W,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:N}),Q=ia(),Z=(0,Nl.useMemo)(()=>new Map,[]),J=za({colorBy:f,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:m,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,Nl.useMemo)(()=>dl(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Ca({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,El.jsx)(ma,{componentName:"RidgelinePlot",message:te,width:F,height:N});const ne={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Y,rLabel:X,rFormat:h,...H&&{oFormat:H},showGrid:D,showCategoryTicks:O,oSort:!1,amplitude:d,...K.legendBehaviorProps,...bs({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({tooltip:y,defaultTooltipContent:ee}),...vs({linkedHover:w,selection:x,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...p&&p.length>0&&{annotations:p},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,El.jsx)(xa,{componentName:"RidgelinePlot",width:F,height:N,children:(0,El.jsx)(ps,{ref:o,...ne})})});Dl.displayName="RidgelinePlot";var Wl=require("react"),zl=require("react/jsx-runtime"),ql=(0,Wl.forwardRef)(function(e,t){const n=aa(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Wl.useRef)(null);sl(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:f=.3,showLabels:m=!0,tooltip:g,annotations:y,frameProps:p={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T,categoryFormat:$}=e,B="vertical"===h,{width:O,height:H,enableHover:F,showLegend:N,title:E,description:D,summary:W,accessibleTable:z}=n,q=B?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},G=(0,Wl.useMemo)(()=>A(r),[r]),V=u||c,Y=!V,X=Ra({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:R,selection:b,linkedHover:v,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:N,userMargin:i,marginDefaults:q,loading:M,loadingContent:C,emptyContent:j,width:O,height:H});Sa("FunnelChart",G,"stepAccessor",a),Sa("FunnelChart",G,"valueAccessor",l);const U=ia(),K=(0,Wl.useMemo)(()=>new Map,[]),Q=(0,Wl.useMemo)(()=>{if(Y)return P||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[Y,P,U,d]),Z=za({colorBy:Q?void 0:V,colorScale:X.colorScale,color:Q??P,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection}),J=(0,Wl.useMemo)(()=>e=>{const t=e?.data||e,n=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",o=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,zl.jsxs)("div",{className:"semiotic-tooltip",style:zr,children:[n&&(0,zl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),a&&a!==n&&(0,zl.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,zl.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,zl.jsxs)("div",{style:{marginTop:4},children:[o+"",l]})]})},[]);if(X.earlyReturn)return X.earlyReturn;const ee=Ca({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,zl.jsx)(ma,{componentName:"FunnelChart",message:ee,width:O,height:H});const te={chartType:B?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:Z,size:[O,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:B,showCategoryTicks:B,...$&&{oFormat:$},showGrid:B,...!B&&{connectorOpacity:f},showLabels:m,...X.legendBehaviorProps,...E&&{title:E},...D&&{description:D},...W&&{summary:W},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===g?()=>null:!0===g||null==g?J:Yr(g)||J,...vs({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return(0,zl.jsx)(xa,{componentName:"FunnelChart",width:O,height:H,children:(0,zl.jsx)(ps,{ref:o,...te})})});ql.displayName="FunnelChart";var Gl=g(require("react")),Vl=require("react"),Yl=require("react"),Xl=require("react"),Ul={RdBu:X,PiYG:U,PRGn:K,BrBG:Q,RdYlBu:Z,RdYlGn:J,Spectral:ee},Kl="__likert_neutral_neg",Ql="__likert_neutral_pos";function Zl(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Jl(e,t,n,o,r,i){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 r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(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 r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function ec(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:Kl,__likertPct:-e}),i.push({...t,__likertLevel:Ql,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function tc(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===Kl?i=n:n.__likertLevel===Ql?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}var nc=["Very Low","Low","Neutral","High","Very High"],oc=require("react/jsx-runtime"),rc=new Map,ic=(0,Vl.forwardRef)(function(e,t){const n=aa(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Vl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=nc,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:g,annotations:y,valueExtent:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:j,emptyContent:_,legendInteraction:R,legendPosition:P,categoryFormat:L,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:O,enableHover:H,showGrid:F,showLegend:N,title:E,description:D,summary:W,accessibleTable:z,categoryLabel:q,valueLabel:G}=n,V="horizontal"===h,Y=void 0===r,X=!c,U=function(){const e=Ys();return e?.colors?.diverging||void 0}(),K=(0,Vl.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const n=Ul[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"],r="#a8a8a8";if(1===e)return[r];const i=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)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(d.length,U),[f,d.length,U]),Q=(0,Vl.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Z,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,Xl.useMemo)(()=>Zl(n,"question"),[n]),u=(0,Xl.useMemo)(()=>l?Zl(o,"score"):null,[l,o]),d=(0,Xl.useMemo)(()=>l?null:Zl(r,"level"),[l,r]),h=(0,Xl.useMemo)(()=>l?null:Zl(i,"count"),[l,i]),f=(0,Xl.useRef)([]);return{processedData:(0,Xl.useMemo)(()=>{const n=e||[];if(0===n.length)return[];let o=Jl(n,t,c,u,d,h);return s&&(o=ec(o,t),o=tc(o,t)),o},[e,t,c,u,d,h,s]),reAggregate:(0,Xl.useCallback)(e=>{let n=Jl(e,t,c,u,d,h);s&&(n=ec(n,t),n=tc(n,t)),a.current?.replace(n)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:V,frameRef:o}),te="__likertLevelLabel",ne=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:r="right"}){const i=(0,Yl.useRef)(new Set),s=(0,Yl.useRef)([]),[a,l]=(0,Yl.useState)(0),c=Ms(),u=ia(),d=(0,Yl.useCallback)(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),h=(0,Yl.useCallback)(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),o=!0)}o&&l(e=>e+1)},[e,t,d]),f=(0,Yl.useCallback)(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),r=s.current;r.length===o.length&&r.every((e,t)=>e===o[t])||(i.current=new Set(o),s.current=o,l(e=>e+1))},[e,t]),m=(0,Yl.useCallback)(e=>t=>{h([t]),e(t)},[h]),g=(0,Yl.useCallback)(e=>t=>{h(t),e(t)},[h]),y=(0,Yl.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);qs(e&&t?s.current:[]);const p=(0,Yl.useMemo)(()=>{if(!e||!t||!1===o)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:u&&u.length>0?u:oe,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=ae(l,a,i);return Gs({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:ie})},[e,t,o,n,c,u,a]),b=(0,Yl.useMemo)(()=>{if(p)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[p,r]);return{wrapPush:m,wrapPushMany:g,resetCategories:y,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:p,streamingMarginAdjust:b}}({isPushMode:Y,colorBy:te,colorScheme:K,showLegend:N,legendPosition:P}),{wrapPush:re,wrapPushMany:se}=ne,le=(0,Vl.useCallback)(e=>re(e=>{ee.current.push(e),J(ee.current)})(e),[re,J,ee]),ce=(0,Vl.useCallback)(e=>se(e=>{ee.current.push(...e),J(ee.current)})(e),[se,J,ee]);(0,Vl.useImperativeHandle)(t,()=>({push:le,pushMany:ce,remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>{ee.current=[],ne.resetCategories(),o.current?.clear()},getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}),[le,ce,ee,ne]);const ue=Ra({data:Z,rawData:r,colorBy:te,colorScheme:K,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:C,loadingContent:j,emptyContent:_,width:B,height:O}),de=(0,Vl.useMemo)(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),he=za({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:rc,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,n=e.__likertLevel||e.data?.__likertLevel;if(n===Kl||n===Ql)return{fill:de};const o=t||n;return o&&Q.has(o)?{fill:Q.get(o)}:{fill:"#888"}}}),fe=(0,Vl.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),me=(0,Vl.useMemo)(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Kl||n===Ql?fe:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===Kl||n===Ql?2*i:i,a=t.__likertCount||0;return Gl.createElement("div",{className:"semiotic-tooltip",style:zr},Gl.createElement("div",{style:{fontWeight:"bold"}},r),Gl.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[fe]),ge=(0,Vl.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Ca({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,X]),ye=(0,Vl.useMemo)(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),pe=(0,Vl.useMemo)(()=>!1!==N?{...ue.legendBehaviorProps,legend:{legendGroups:ye},legendPosition:P||ue.legendPosition||"bottom"}:ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,P,N,ye]),be=(0,Vl.useMemo)(()=>{const e={...ue.margin};if(Y&&!1!==N){const t=P||"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(ne.streamingMarginAdjust)for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return V&&100>e.left&&(e.left=100),e},[ue.margin,ne.streamingMarginAdjust,V,Y,N,P]),ve=(0,Vl.useMemo)(()=>M||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,M]);if(ue.earlyReturn)return ue.earlyReturn;const xe={chartType:"bar",...null!=r&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:he,size:[B,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:m,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:q,rLabel:G||(V?void 0:"Percentage"),rFormat:ve,...L&&{oFormat:L},showGrid:F,...pe,...E&&{title:E},...D&&{description:D},...W&&{summary:W},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?me:Yr(g)||me,...vs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...y&&y.length>0&&{annotations:y},...p&&{rExtent:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ge?(0,oc.jsx)(ma,{componentName:"LikertChart",message:ge,width:B,height:O}):(0,oc.jsx)(xa,{componentName:"LikertChart",width:B,height:O,children:(0,oc.jsx)(ps,{ref:o,...xe})})});ic.displayName="LikertChart";var sc=require("react"),ac=require("react");var lc=require("react/jsx-runtime"),cc=(0,sc.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:g=!1,annotations:y,onObservation:p,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:j,safeData:_,setup:R,earlyReturn:P}=function(e){const t=function(e){const t=(0,ac.useRef)(null);return sl(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:aa(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,ac.useMemo)(()=>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:n,normalizedMargin:o}=t,r=Ra({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,legend:e.legend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:p,onClick:b,chartId:w,loading:k,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=R.effectiveSelectionHook,I=(0,sc.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(P)return P;const{width:T,height:$,enableHover:B,showGrid:O,title:H,description:F,summary:N,accessibleTable:E}=j,D={chartType:"custom",...null!=n&&{data:_},customLayout:o,layoutConfig:r,onLayoutError:i,...I&&{layoutSelection:I},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:B,showAxes:g,showGrid:O,annotations:y,...bs({title:H,description:F,summary:N,accessibleTable:E,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...vs({linkedHover:x,selection:v,onObservation:p,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...M};return(0,lc.jsx)(xa,{componentName:"OrdinalCustomChart",width:T,height:$,children:(0,lc.jsx)(ps,{ref:C,...D})})});cc.displayName="OrdinalCustomChart";var uc={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},dc=8;function hc(e){return null==e?void 0:e+""}function fc(e){const t=hc(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??dc,style:{...uc},datum:e.datum,pointId:t,_transitionKey:t}}function mc(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...uc},datum:e.datum,group:e.group,_transitionKey:hc(e.id)}}
|
|
2
|
+
var e,t,n,o,r,i,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,h=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))d.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},g=(e,t,n)=>(n=null!=e?s(u(e)):{},m(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),y=h({"src/components/stream/brushAccessibility.ts"(){e=g(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),p={};function b({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,scales:d,onBrush:h}){const f=(0,n.useRef)(null),m=(0,n.useRef)(null),g=(0,n.useRef)(h);g.current=h;const y=(0,n.useRef)(d);y.current=d;const p=(0,n.useRef)(!1),b=(0,n.useRef)(null),v="horizontal"===d?.projection,x=(0,n.useRef)(v);x.current=v;const w=function({label:n="Data range brush",description:o=t,onAction:r}={}){const i=e.useId().replace(/:/g,""),s=e.useRef(r);return s.current=r,{description:o,descriptionId:"semiotic-brush-description-"+i,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+i,onKeyDown:e.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),s.current?.(t))},[])}}}({label:"Ordinal value range brush",onAction:e=>{const t=y.current,n=m.current;if(!t||!n||!f.current)return;const r=(0,o.select)(f.current).select(".brush-g");if("clear"===e.type)return p.current=!0,r.call(n.move,null),p.current=!1,b.current=null,void g.current(null);if(("left"===e.direction||"right"===e.direction)!=!!x.current)return;const i=t.r.domain(),[s,a]=[Math.min(...i),Math.max(...i)],l=(a-s)/20,c=b.current?.r??[s+.4*(a-s),s+.6*(a-s)],u="left"===e.direction||"down"===e.direction?-1:1;let[d,h]=c;if(e.resize)0>u?d=Math.max(s,d-l):h=Math.min(a,h+l);else{const e=h-d;d=Math.max(s,Math.min(a-e,d+u*l)),h=d+e}const v={r:[d,h]};p.current=!0,r.call(n.move,x.current?[t.r(d),t.r(h)]:[t.r(h),t.r(d)]),p.current=!1,b.current=v,g.current(v)}});return(0,n.useEffect)(()=>{if(!f.current)return;const e=(0,o.select)(f.current).select(".brush-g"),t=v?(0,r.brushX)():(0,r.brushY)();return t.extent([[0,0],[s,a]]),t.on("brush end",e=>{if(p.current)return;const t=y.current;if(!t)return;if(!e.selection)return b.current=null,void g.current(null);const[n,o]=e.selection;let r;r=x.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const i={r:r};b.current=i,g.current(i)}),e.call(t),m.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),m.current=null}},[s,a,v]),(0,n.useEffect)(()=>{if(!d||!m.current||!b.current)return;if(!f.current)return;const e=b.current,t=(0,o.select)(f.current).select(".brush-g"),n=d.r(e.r[0]),r=d.r(e.r[1]);v?(p.current=!0,t.call(m.current.move,[n,r]),p.current=!1):(p.current=!0,t.call(m.current.move,[r,n]),p.current=!1)},[d,v]),(0,i.jsxs)("svg",{ref:f,width:l,height:c,...w.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,i.jsx)("title",{children:w.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:w.descriptionId,children:w.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`,style:{pointerEvents:"all"}})]})}f(p,{OrdinalBrushOverlay:()=>b});var v,x=h({"src/components/stream/OrdinalBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),y(),i=require("react/jsx-runtime")}}),w={};f(w,{AnnotationLabel:()=>$n,BarChart:()=>Ya,BoxPlot:()=>ml,DEFAULT_HIT_RADIUS:()=>hc,DonutChart:()=>Pl,DotPlot:()=>Al,FunnelChart:()=>Gl,GaugeChart:()=>Nl,GroupedBarChart:()=>Ja,Histogram:()=>bl,LikertChart:()=>sc,OrdinalCustomChart:()=>uc,PieChart:()=>jl,RidgelinePlot:()=>Dl,StackedBarChart:()=>Ka,StreamOrdinalFrame:()=>bs,SwarmPlot:()=>cl,SwimlaneChart:()=>rl,ViolinPlot:()=>wl,composeStyleRules:()=>Da,createHatchPattern:()=>Hn,estimateLabelWidth:()=>Tn,glyphExtent:()=>pt,glyphPlacement:()=>yt,hatchFillId:()=>En,hatchPatternDef:()=>zn,hitTargetPoint:()=>mc,hitTargetRect:()=>gc,isHatchFill:()=>Nn,makeNodeRuleContext:()=>Ha,makeRuleValueResolver:()=>Ba,makeStyleRuleStyleFn:()=>za,makeXYRuleContext:()=>Oa,matchesThreshold:()=>Na,resolveResponsiveRules:()=>Qs,resolveStyleRules:()=>Ea,resolveSvgFill:()=>qn,responsiveRuleMatches:()=>Ks,ruleMatches:()=>Wa,useCustomLayoutSelection:()=>ct}),module.exports=(v=w,m(a({},"__esModule",{value:!0}),v));var k=require("react"),S=Object.freeze([]);function A(e){if(!e)return S;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}var M=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??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=A(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=A(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}},C=require("d3-scale"),j=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const 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();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=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{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 R(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function P(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function L(e,t,n){return e+(t-e)*n}function I(e,t){return e===t}function T(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function B(e){return new Set(Array.isArray(e)?e:[e])}var O=require("d3-scale");function H(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function F(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function N(e){const t=e.map(H),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return F(e,n,o)}if(e>=1){const[e,o,r]=t[n];return F(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return F(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var W=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],E=N(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),D=N(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),z=N(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),q=N(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),G=N(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),V=N(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Y={blues:E,reds:D,greens:z,viridis:N(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:q,purples:G,greys:V,plasma:N(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:N(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:N(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:N(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:N(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},X=N(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),U=N(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),K=N(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Q=N(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Z=N(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),J=N(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ee=N(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),te={category10:W,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Y},ne=W,oe=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],re=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 ie(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")||re.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):ne[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))%ne.length]}function se(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function ae(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>se(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,O.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=te[n]||te.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:ne;return(0,O.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function le(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}var ce=class{constructor(){this.colorSchemeMap=new Map,this.colorSchemeIndex=0}resetColors(){this.colorSchemeMap.clear(),this.colorSchemeIndex=0}resolvePieceStyle(e,t,n){if(t&&"function"==typeof e.pieceStyle){const o=e.pieceStyle(t,n);return o&&!o.fill&&n?{...o,fill:this.getColorFromScheme(e,n)}:o}return e.pieceStyle&&"object"==typeof e.pieceStyle?e.pieceStyle:e.barColors&&n?{fill:e.barColors[n]||"#007bff"}:{fill:n?this.getColorFromScheme(e,n):"#007bff"}}resolveSummaryStyle(e,t,n){return t&&"function"==typeof e.summaryStyle?e.summaryStyle(t,n):e.summaryStyle&&"object"==typeof e.summaryStyle?e.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}getColorFromScheme(e,t){const n=this.colorSchemeMap.get(t);if(n)return n;const o=Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical||oe,r=o[this.colorSchemeIndex%o.length];return this.colorSchemeIndex++,this.colorSchemeMap.set(t,r),r}};function ue(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}var de=require("d3-shape"),he={circle:de.symbolCircle,square:de.symbolSquare,triangle:de.symbolTriangle,diamond:de.symbolDiamond,star:de.symbolStar,cross:de.symbolCross,wye:de.symbolWye},fe=["circle","triangle","diamond","star","square","chevron","cross","wye"];function me(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*ge(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,de.symbol)(he[o]??de.symbolCircle,Math.max(1,t))()??""}function ge(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function ye(e){const t=e.getSymbol;if(!t)return null;const n=e.config.symbolMap,o=new Map;let r=0;return e=>{const i=t(e)+"",s=n?.[i];if(s)return s;let a=o.get(i);return a||(a=fe[r%fe.length],r++,o.set(i,a)),a}}function pe(e,t,n,o,r,i,s){e.push(t?{type:"symbol",x:o,y:r,size:Math.PI*i*i,symbolType:t(n),style:s,datum:n}:{type:"point",x:o,y:r,r:i,style:s,datum:n})}function be(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=null!=o.sweepAngle?o.sweepAngle*Math.PI/180:2*Math.PI,u=null!=o.sweepAngle&&360>o.sweepAngle,d=Object.values(n),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(o.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],n=t.pieceData[0],u="number"==typeof n?._pctStart?n._pctStart:t.pctStart,h=l+u*c,m=l+(u+("number"==typeof n?._pct?n._pct:t.pct))*c,g=r(t.pieceData[0],t.name),y=0===e,p=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:m,...o.cornerRadius&&{cornerRadius:o.cornerRadius},style:g,datum:n?._nonInteractive?null:t.pieceData,category:t.name};n?._roundedEnds?b.roundedEnds=n._roundedEnds:f&&(b.roundedEnds={start:y,end:p}),n?._gradientBand&&(b._gradientBand=n._gradientBand),i.push(b)}return i}var ve=require("d3-array");function xe(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function we(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function ke(e){const t=e.length,n=e[0],o=e[t-1];return{n:t,min:n,q1:(0,ve.quantile)(e,.25)??n,median:(0,ve.quantile)(e,.5)??(n+o)/2,q3:(0,ve.quantile)(e,.75)??o,max:o,mean:e.reduce((e,t)=>e+t,0)/t}}var Se=require("d3-scale"),Ae={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,m=[];if(s){const e=new Set;for(const t of Object.values(o))for(const n of t.pieceData){const t=s(n);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(f)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const i of m){const c=t.get(i);if(!c)continue;let m=c.total;f&&n>0&&(m/=n);const g=a(c.pieces[0],s?i:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>m?r:o+m),n=0>m?l(r+m)-l(r):l(o)-l(o+m);u.push(ue(e.x,t,e.width,Math.abs(n),g,y,i)),0>m?r+=m:o+=m}else if(h){const t=l(0>m?r+m:o),n=0>m?l(r)-l(r+m):l(o+m)-l(o);u.push(ue(t,e.x,Math.abs(n),e.width,g,y,i)),0>m?r+=m:o+=m}}}const g="vertical"===c,y=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=g?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const n=t.datum?.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=>(e.datum?.__aggregateValue??0)>=0),n=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),n.length>0&&(n.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return u},clusterbar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(o)){const t=e.width/m,n=.2*t,o=t-n,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ue(i,Math.min(a,d),o,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+n/2,a=l(0),d=l(c);u.push(ue(Math.min(a,d),i,Math.abs(d-a),o,f,r,h[s]))}}}}const g=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);g>0&&(e.roundedTop=g),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:n,columns:o,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=ye(e),m=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(o))for(const t of e.pieceData){const n=t.__rIndex??0,o=t.__rValue??r(t),l=h&&i[n]||a,y=s(t,e.name),p=y.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*m,n=l(o);b=Math.cos(t)*n,v=Math.sin(t)*n}else u?(b=e.middle,v=l(o)):(b=l(o),v=e.middle);pe(c,f,t,b,v,p,y)}return c},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a,u=ye(e);for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),d=i(o,e.name),h=d.r||4,f=(7919*n%100/100-.5)*t*.8;pe(l,u,o,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:be,donut:be,boxplot:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(o)){const n=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===n.length)continue;const o=n[0],r=n[n.length-1],l=(0,ve.quantile)(n,.25)??o,h=(0,ve.quantile)(n,.5)??(o+r)/2,f=(0,ve.quantile)(n,.75)??r,m=f-l,g=l-1.5*m,y=f+1.5*m,p=n.find(e=>e>=g)??o,b=[...n].reverse().find(e=>y>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const n=i(e);if(g>n||n>y){const o=u?t.middle:a(n),r=u?a(n):t.middle;x.push({px:o,py:r,value:n,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(p),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:n.length,min:p,q1:l,median:h,q3:f,max:b,mean:n.reduce((e,t)=>e+t,0)/n.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-n)/r),d-1)]++;const f=we(l,1),m=e.width/2*.9;let g;if(u){g=`M ${e.middle} ${a(n)}`;for(let t=0;d>t;t++){const o=a(n+(t+.5)*r);g+=` L ${e.middle+l[t]/f*m} ${o}`}g+=` L ${e.middle} ${a(o)}`;for(let t=d-1;t>=0;t--){const o=a(n+(t+.5)*r);g+=` L ${e.middle-l[t]/f*m} ${o}`}g+=" Z"}else{g=`M ${a(n)} ${e.middle}`;for(let t=0;d>t;t++)g+=` L ${a(n+(t+.5)*r)} ${e.middle-l[t]/f*m}`;g+=` L ${a(o)} ${e.middle}`;for(let t=d-1;t>=0;t--)g+=` L ${a(n+(t+.5)*r)} ${e.middle+l[t]/f*m}`;g+=" Z"}const y=s(e.pieceData[0],e.name);let p;if(h&&t.length>=4){const r=(0,ve.quantile)(t,.25)??n,i=(0,ve.quantile)(t,.5)??(n+o)/2,s=(0,ve.quantile)(t,.75)??o;p={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))}:{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width};c.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:b,iqrLine:p,stats:ke(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize,d=a.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[n,o]=xe(t),r=null!=h&&isFinite(h)?h:n,d=null!=f&&isFinite(f)?f:o,m=(d-r)/c||1,g=Array(c).fill(0);for(const e of t)r>e||e>d||g[Math.min(Math.floor((e-r)/m),c-1)]++;const y=t.length,p=we(g,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===g[t])continue;const n=(u?g[t]/y:g[t]/p)*e.width*.9,o=a(r+t*m),i=a(r+(t+1)*m);l.push(ue(Math.min(o,i),e.x+e.width-n,Math.abs(i-o),n,b,{bin:t,count:g[t],range:[r+t*m,r+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=n,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const n=t[0],o=t[t.length-1],r=(o-n)/u||1,l=Array(u).fill(0);for(const e of t)n>e||e>o||l[Math.min(Math.floor((e-n)/r),u-1)]++;const f=we(l,1),m=s(e.pieceData[0],e.name),g=e.width*h;let y;if(d){const t=e.x+e.width;y=`M ${a(n)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(n+(e+.5)*r)} ${t-l[e]/f*g}`;y+=` L ${a(o)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(n)}`;for(let e=0;u>e;e++){const o=a(n+(e+.5)*r);y+=` L ${t+l[e]/f*g} ${o}`}y+=` L ${t} ${a(o)} Z`}const p=d?{x:Math.min(a(n),a(o)),y:e.x,width:Math.abs(a(o)-a(n)),height:e.width}:{x:e.x,y:Math.min(a(o),a(n)),width:e.width,height:Math.abs(a(o)-a(n))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:p,stats:ke(t),style:{...m,fillOpacity:m.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=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=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(ue(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(ue(e.x,n,e.width,r-n,u,t,e.name))}}return l},funnel:function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>n[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let m=0;for(const e of c){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}f.push({col:e,groups:t,stepTotal:n}),h||n>m&&(m=n)}if(h)for(const e of f){let t=0,n=0;for(let o=0;u.length>o;o++){const r=e.groups.get(u[o]);r&&(o%2==0?t+=r.total:n+=r.total)}const o=Math.max(t,n);o>m&&(m=o)}if(0===m)return s;const g=new Map;for(const e of u){const t=f[0].groups.get(e);g.set(e,t?.total??0)}const y=f[0].stepTotal,p=h?.95*a:.9*t.width,b=(0,Se.scaleLinear)().domain([0,m]).range([0,p]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const n=f[t],o=n.col,r=0===t,c=o.width,d=.55*c,m=o.x+(c-d)/2,p=new Map;if(h){let e=0;for(const t of u){const o=n.groups.get(t);o&&(e+=b(o.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],y=n.groups.get(f);if(!y)continue;const v=b(y.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(y.pieces[0],f),S=g.get(f)??y.total,A={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:o.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=o.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=m,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=m,A.__funnelBarW=v),s.push(ue(w,m,v,d,k,A,f)),p.set(f,{x:w,y:m,w:v,h:d})}}else{const e=n.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,g=n.groups.get(h)?.pieces[0]??o.pieceData[0],v=f?h:o.name,x=i(g,v),w=y>0?e/y*100:0,k={...g,__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:r,category:f?h:o.name};l&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=m,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=m,k.__funnelBarW=t),s.push(ue(c,m,t,d,x,k,v)),p.set(h,{x:c,y:m,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),a=p.get(r);if(!t||!a)continue;const l=(()=>{const e=n.groups.get(r);return i(e?e.pieces[0]:o.pieceData[0],"_default"===r?o.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:n.groups.get(r)?.pieces[0]??o.pieceData[0],category:"_default"===r?o.name:r};s.push(c)}}x=p}return s},"bar-funnel":function(e,t){const{columns:n,getR:o,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>n[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let n=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=o(i);s.total+=a,s.pieces.push(i),n+=a}h.push({col:e,groups:t,stepTotal:n})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const m=s.r,g=d?c.length:1,y=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],n=t.col,o=0===e,r=e>0?h[e-1]:null,s=n.width/g,l=s*y,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const y=g.total,p=f.get(h)??y,b=p>0?y/p*100:0,v=r?.groups.get(h),x=o?0:Math.max(0,(v?.total??y)-y),w=n.x+e*s+l/2,k=m(y),S=m(0)-k,A=i(g.pieces[0],d?h:n.name),M={...g.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:m(y+x)};if(a.push(ue(w,k,u,S,A,M,d?h:n.name)),x>0){const e=m(y+x),t=k-e,o={...A},r={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:p>0?x/p*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:n.name};a.push(ue(w,e,u,t,o,r,d?h:n.name))}}}return a},swimlane:function(e,t){const{scales:n,columns:o,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[n,r]=a.range(),i=Math.min(n,r),s=Math.abs(r-n);for(const n of Object.values(o)){const o={fill:e,opacity:t},r=u?ue(i,n.x,s,n.width,o,null,"__track__"):ue(n.x,i,n.width,s,o,null,"__track__");c.push(r)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(o)){let t=0;const n=c.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const l=i?i(n):e.name,f=s(n,l);let m;if(u){const r=a(t),i=a(t+o);m=ue(r,e.x,i-r,e.width,f,n,l)}else{const r=a(t+o),i=a(t);m=ue(e.x,r,e.width,i-r,f,n,l)}d&&(m.fillGradient=d,m.roundedEdge=h),c.push(m),t+=o}if(m>0&&c.length>n){const e=c.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:u?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return c}};function Me(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&se(n,e)||"#4e79a7":t=>{if(n){const e=se(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function Ce(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Ce))}function je(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function _e(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Re=new WeakMap;var Pe={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Le(e,t){const n={...e};for(const e of t)n[Pe[e]]++;return n}function Ie(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Le(n,o)}}var Te=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Ie({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Ie(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},$e=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Be=["scene-style","data-paint","accessibility","evidence"],Oe=(e,t)=>({retainedData:e,invalidations:t}),He=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Fe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ne=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],We=["scene-geometry","data-paint","accessibility","evidence"],Ee=["scene-style","data-paint","accessibility","evidence"],De=[],ze={chartType:Oe("rebuild",He),runtimeMode:Oe("rebuild",He),categoryAccessor:Oe("rebuild",He),valueAccessor:Oe("rebuild",He),oAccessor:Oe("rebuild",He),rAccessor:Oe("rebuild",He),stackBy:Oe("rebuild",He),groupBy:Oe("rebuild",He),timeAccessor:Oe("rebuild",He),accessorRevision:Oe("rebuild",He),colorAccessor:Oe("rebuild",Ee),symbolAccessor:Oe("rebuild",We),connectorAccessor:Oe("rebuild",We),dataIdAccessor:Oe("rebuild",We),projection:Oe("preserve",Fe),extentPadding:Oe("preserve",Fe),axisExtent:Oe("preserve",Fe),rExtent:Oe("preserve",Fe),oExtent:Oe("preserve",Fe),multiAxis:Oe("preserve",Fe),normalize:Oe("preserve",Fe),bins:Oe("preserve",Fe),oSort:Oe("preserve",Ne),barPadding:Oe("preserve",Ne),roundedTop:Oe("preserve",Ne),baselinePadding:Oe("preserve",Ne),innerRadius:Oe("preserve",Ne),cornerRadius:Oe("preserve",Ne),startAngle:Oe("preserve",Ne),sweepAngle:Oe("preserve",Ne),trackFill:Oe("preserve",Ne),showOutliers:Oe("preserve",Ne),showIQR:Oe("preserve",Ne),amplitude:Oe("preserve",Ne),connectorOpacity:Oe("preserve",Ne),showLabels:Oe("preserve",Ne),dynamicColumnWidth:Oe("rebuild",Ne),customLayout:Oe("preserve",Ne),layoutConfig:Oe("preserve",Ne),layoutMargin:Oe("preserve",Ne),symbolMap:Oe("preserve",We),pieceStyle:Oe("preserve",Ee),summaryStyle:Oe("preserve",Ee),connectorStyle:Oe("preserve",Ee),gradientFill:Oe("preserve",Ee),colorScheme:Oe("preserve",Ee),themeCategorical:Oe("preserve",Ee),themeSemantic:Oe("preserve",Ee),themeSequential:Oe("preserve",Ee),themeDiverging:Oe("preserve",Ee),barColors:Oe("preserve",Ee),decay:Oe("preserve",Ee),pulse:Oe("preserve",Ee),staleness:Oe("preserve",Ee),layoutSelection:Oe("preserve",Ee),windowSize:Oe("preserve",De),windowMode:Oe("preserve",De),clock:Oe("preserve",De),transition:Oe("preserve",De),introAnimation:Oe("preserve",De),onLayoutError:Oe("preserve",De)},qe=Oe("preserve",Ne),Ge=class{constructor(){this.tracker=new Te}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},$e)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Be):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=ze[o]??qe;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};var Ve=require("d3-quadtree"),Ye=class{constructor(e){this.rExtent=new _,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Ge,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this.styleResolver=new ce,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.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new j(e.windowSize),this.getO=$(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>T(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new _)):(this.getR=T(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=$(e.stackBy),this.getGroup=$(e.groupBy),this.getColor=$(e.colorAccessor),this.getSymbol=$(e.symbolAccessor),this.getConnector=$(e.connectorAccessor),this.getDataId=$(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new j(e.windowSize))}syncPulseTimestampBuffer(){var e,t,n,o;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,n=this.timestampBuffer,o=this.currentTime(),e?null!=n&&n.capacity===t.capacity&&n.size===t.size?n:function(e,t){const n=new j(e.capacity);return e.forEach(()=>n.push(t)),n}(t,o):null)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}ingest(e){const t=this.currentTime();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(),r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)_e(this.buffer,n,this.timestampBuffer,t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=_e(this.buffer,n,this.timestampBuffer,t);this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}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,o=this.scales,r=this.multiScales,i=this.columns;if(0===n.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,m;if(d){f=(0,C.scaleBand)().domain(l).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;m=(0,C.scaleLinear)().domain(c).range([o,n])}else u?(f=(0,C.scaleBand)().domain(l).range([0,e.height]).padding(h),m=(0,C.scaleLinear)().domain(c).range([0,e.width])):(f=(0,C.scaleBand)().domain(l).range([0,e.width]).padding(h),m=(0,C.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,C.scaleLinear)().domain([s,a]).range([0,e.width]):(0,C.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let g=s;this.rAccessors.length>1&&(g=s.flatMap(e=>this.rAccessors.map((t,n)=>({...e,__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(g,l,f,a,e),this._customLayoutFailedThisBuild=!1;const y=this.buildSceneNodes(g,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=y,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),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 r=null;if(n){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===o)return i;if("function"==typeof o)return i.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 i.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){return function(e){const{data:t,chartType:n,projection:o,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===o&&("pie"===n||"donut"===n))return[0,1];let m=0,g=0;if("bar"===n&&d&&r)m=0,g=1;else if("bar"===n&&d){const e=new Map,n=new Map;for(const o of t){const t=c(o),r=u(o);0>r?n.set(t,(n.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t);for(const e of n.values())m>e&&(m=e)}else if("bar"===n){const e=new Map;for(const n of t){const t=c(n),o=u(n);e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t),m>t&&(m=t)}else if("swimlane"===n){const e=new Map;for(const n of t){const t=c(n),o=Math.abs(u(n));e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===n||"bar-funnel"===n)for(const e of t){const t=u(e);t>g&&(g=t),m>t&&(m=t)}else{const e=h[0],t=h[1];e!==1/0&&(m=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(m=i[0]),null!=i[1]&&(g=i[1]));const y="bar"===n||"clusterbar"===n||"bar-funnel"===n||"swimlane"===n;if(y&&null==i?.[0]&&null==i?.[1]&&(m>0&&(m=0),0>g&&(g=0)),"bar-funnel"!==n&&"exact"!==l){const e=g-m,t=e>0?e*f:1,o=y&&!a&&0===m,r=y&&!a&&0===g||"swimlane"===n;null!=i?.[0]||o||(m-=t),null!=i?.[1]||r||(g+=t)}return[m,g]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,n,o,r){return function(e){const{data:t,oExtent:n,oScale:o,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of n){const n=u.get(t)||[];let o;o="string"==typeof s?n.reduce((e,t)=>e+(Number(t[s])||0),0):s(n),h.set(t,o),e+=o}const t=("horizontal"===r?i.height:i.width)-o.padding()*o.step()*n.length;if(e>0)for(const[n,o]of h)h.set(n,o/e*t)}let f=0,m=0;for(const e of n){const t=u.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?n/d:0;let i,s;h?(i=m,s=h.get(e)||o.bandwidth(),m+=s+o.padding()*o.step()):(i=o(e)??0,s=o.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:o.padding()*o.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:n,projection:o,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.styleResolver.resolvePieceStyle(this.config,e,t),resolveSummaryStyle:(e,t)=>this.styleResolver.resolveSummaryStyle(this.config,e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const n=this.buildLayoutContext(e,t);let o;try{o=this.config.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,n=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=n,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null;const r=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;Ce(o)&&0===n.length&&je(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&je(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const n=this.getSceneContext(),o=Ae[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[t,n]of l)if(n.length>=2){n.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let o=0;n.length-1>o;o++){const r=n[o],i=n[o+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(n,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const n=this.config,o=n.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,n=ne){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=te[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(n.colorScheme,n.themeCategorical,oe),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:o,plot:"radial"===i.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:n.themeSemantic??{},categorical:[...r]},resolveColor:Me(r,n.colorScheme),config:n.layoutConfig??{},selection:n.layoutSelection??null}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=function(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}(e);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=function(e,t){const n="function"==typeof t,o=n?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=n?t(s):s[o],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,n=0;for(const o of e)"point"===o.type&&(t++,o.r>n&&(n=o.r));if(500>=t)return{quadtree:null,maxRadius:n};const o=Array(t);let r=0;for(const t of e)"point"===t.type&&(o[r++]=t);return{maxRadius:n,quadtree:(0,Ve.quadtree)().x(e=>e.x).y(e=>e.y).addAll(o)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const n=t.length;if(1>=n)return;const o=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;if(!t.datum)continue;const e=o.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,n);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,n=this.currentTime()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let o=0;for(const s of r(t)??[]){const t=n.get(s);null!=t&&(o=Math.max(o,R(e,t,i)))}l=P(c,o,s)||l;continue}if(null==c.datum)continue;const t=o.get(c.datum);if(null==t)continue;const u=n.get(t);l=P(c,null==u?0:R(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),n)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,n="horizontal"!==this.scales?.projection;let o;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,n?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===o&&(o=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:o,endAngle:o,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){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||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=this.getNodeKey(n,e);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(o,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:n.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const n=new Set,o=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,o);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(n.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)n.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,o]of this.prevPositionMap)if(!n.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:o.x,y:o.y,r:o.r??3,style:{opacity:o.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:o.x,y:o.y,w:o.w??0,h:o.h??0,style:{opacity:o.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((o.startAngle??0)+(o.endAngle??0))/2,n={type:"wedge",cx:o.x,cy:o.y,innerRadius:o.innerRadius??0,outerRadius:o.outerRadius??100,startAngle:o.startAngle??0,endAngle:o.endAngle??0,style:{opacity:o.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:this.currentTime(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t,"linear"===this.config.transition?.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);e.style.opacity=L(o?o.opacity??1:0,e._targetOpacity,n)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=L(o.x,e._targetX,n),e.y=L(o.y,e._targetY,n)),void 0!==e._targetR&&void 0!==o?.r&&(e.r=L(o.r,e._targetR,n))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style.opacity=L(o?o.opacity??1:0,e._targetOpacity,n)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=L(o.x,e._targetX,n),e.y=L(o.y,e._targetY,n),void 0!==o.w&&(e.w=L(o.w,e._targetW,n),e.h=L(o.h,e._targetH,n))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t);e.style={...e.style,opacity:L(o?o.opacity??1:0,e._targetOpacity,n)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=L(o.startAngle,e._targetStartAngle,n),e.endAngle=L(o.endAngle,e._targetEndAngle,n))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...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}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}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=B(e),n=this.getDataId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=B(e),o=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}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.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this.styleResolver.resetColors(),this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!I(e.colorAccessor,t.colorAccessor))&&this.styleResolver.resetColors(),("categoryAccessor"in e&&!I(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!I(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let o=!1;("categoryAccessor"in e||"oAccessor"in e)&&(I(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=$(this.config.categoryAccessor||this.config.oAccessor,"category"),o=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,n=t.valueAccessor||t.rAccessor,o=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];if(r=o.length!==i.length||o.some((e,t)=>!I(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>T(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new _)):(this.getR=T(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!I(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?$(this.config.stackBy):void 0),"groupBy"in e&&!I(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?$(this.config.groupBy):void 0),"colorAccessor"in e&&!I(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?$(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!I(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?$(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!I(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?$(this.config.connectorAccessor):void 0),(o||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Object.assign(Ye.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){Re.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Re.get(this);return Re.delete(this),e}});var Xe=require("react"),Ue={sceneGeometry:0,layout:0,domain:0};function Ke(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function Qe(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ze="production"!==process.env.NODE_ENV,Je={revisions:Ue,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},et=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Ue,this.lastObserved=Ue,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ze&&(this.lastObserved=Qe(this.lastObserved,Ke(e)))}beforeCompute(e,t){if(!Ze)return Je;const n=Qe(Ke(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(Ze){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},tt=(0,Xe.memo)(function({store:e,diagnostics:t}){return(0,Xe.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),nt=g(require("react"));function ot(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:nt.createElement(nt.Fragment,null,...t)}var rt=g(require("react")),it=require("react/jsx-runtime"),st={isActive:!1,predicate:()=>!0},at=rt.createContext(null);function lt({value:e,children:t}){return(0,it.jsx)(at.Provider,{value:e,children:t})}function ct(){return rt.useContext(at)??st}function ut(e,t){return null!=e?(0,it.jsx)(lt,{value:t,children:e}):e}var dt=require("react");function ht(e,t=30){return Math.max((e??4)+5,12,t)}function ft(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var mt=[40,40],gt=[.5,.5];function yt(e,t){const[n,o]=e.viewBox??mt,[r,i]=e.anchor??gt,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function pt(e,t){const n=yt(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function bt(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var vt=null;function xt(e){if("undefined"==typeof Path2D)return null;vt||(vt=new Map);const t=vt.get(e);if(t)return t;const n=new Path2D(e);return vt.size>1024&&vt.clear(),vt.set(e,n),n}function wt(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??mt,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function kt(e,t){const n=yt(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function St(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=xt(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:bt(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:bt(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function At(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,m=1/0;return e.visit((e,r,l,g,y)=>{if(r>u||c>g||l>h||d>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);ht(a(e),o)>=u&&m>u&&(f=e,m=u),r=r.next}while(r)}return!1}),f?{node:f,distance:m}:null}(r,t,n,o,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=Mt(i,t,n);break;case"point":if(r)break;e=Ct(i,t,n,o);break;case"symbol":e=jt(i,t,n,o);break;case"glyph":e=_t(i,t,n,o);break;case"wedge":if(null===i.datum)break;e=Rt(i,t,n);break;case"boxplot":e=Pt(i,t,n);break;case"violin":e=Lt(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Mt(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 Ct(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ht(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function jt(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>ht(ge(e.size),o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function _t(e,t,n,o=30){if(null==e.datum)return null;const r=kt(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>ht(r.radius,o)?null:{datum:e.datum,x:i,y:s,distance:c}}function Rt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=ft(Math.atan2(r,o)),a=ft(e.startAngle),l=ft(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function Pt(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Lt(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}var It=require("react"),Tt={fresh:1,aging:.7,stale:.45,expired:.25},$t={alpha:1,band:"fresh",isStale:!1};var Bt=require("react/jsx-runtime");function Ot({isStale:e,position:t}){return(0,Bt.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Ht=require("react"),Ft=g(require("react")),Nt=require("react/jsx-runtime"),Wt={fill:(e,t)=>(0,Nt.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Nt.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Et(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Wt[n])(o(e,t),r),i}function Dt({swatchSize:e}){return(0,Nt.jsx)("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 zt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var qt=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,m=[];let g=0;const y=!(!t&&!n),p="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=Et(e,c,d,h,b),w=zt(e,o,r),k=r&&r.size>0&&r.has(e.label);m.push((0,Nt.jsxs)("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?k||!1:void 0,"aria-current":y&&!p&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Nt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Nt.jsx)(Dt,{swatchSize:b}),(0,Nt.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),m};function Gt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ft.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Nt.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,Nt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Nt.jsx)("defs",{children:(0,Nt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Nt.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Nt.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Nt.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Nt.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Nt.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,Nt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Nt.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Nt.jsx)("defs",{children:(0,Nt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Nt.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Nt.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Nt.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Vt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,m]=Ft.useState(0),[g,y]=Ft.useState(0),p=Ft.useCallback((e,t)=>{m(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const d=[],h=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:o})=>{n+=5;const r=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=o*t+8,{lineY:r,labelY:i,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const m=h[f];d.push((0,Nt.jsx)("line",{stroke:"gray",x1:0,y1:m.lineY,x2:t,y2:m.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=m.labelY&&d.push((0,Nt.jsx)("text",{y:m.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d.push((0,Nt.jsx)("g",{className:"legend-item",transform:`translate(0,${m.itemsY})`,children:qt(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const g=((e,t,n,o,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:m}=e,g=[],{swatchSize:y,labelGap:p,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=m.map(e=>y+p+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=n}),m.length>0&&A.push({start:M,end:m.length,width:C}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=m[d],x=Et(e,d,h,f,y),A=zt(e,o,r),M=r&&r.size>0&&r.has(e.label);g.push((0,Nt.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+m.length)%m.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Nt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+p+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Nt.jsx)(Dt,{swatchSize:y}),(0,Nt.jsx)("text",{y:y/2,x:y+p,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:g,offset:j,totalRows:_,totalHeight:_*v}})(e,o,r,i,s,a,l,t,c,u,d,d.maxWidth??n);m+=g.offset+5,f.push({label:e.label,...g,offset:m,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=m+12});const m=d.maxWidth??n;let g=h>m?0:"center"===d.align?Math.max(0,(m-h)/2):"end"===d.align?Math.max(0,m-h):0;const y=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(y.push((0,Nt.jsx)("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),g+=16),y.push((0,Nt.jsx)("g",{className:"legend-item",transform:`translate(${g},0)`,children:n.items},"legend-group-"+o)),g+=n.offset+5,e[o+1]&&y.push((0,Nt.jsx)("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),g+=12}),(0,Nt.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:g,onFocusedIndexChange:p,legendInteraction:s,metrics:h}),v=!(!n&&!o);return(0,Nt.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Nt.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Yt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}var Xt=require("react/jsx-runtime");function Ut(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,m=!!a,g=Math.max(0,n-r.left-r.right),y=Math.max(1,f?s?.maxWidth??g:100);let p,b;return"left"===i?(p=Math.max(4,r.left-y-10),b=r.top):"top"===i?(p=r.left,b=m?32:8):"bottom"===i?(p=r.left,b=o-r.bottom+38):(p=n-r.right+10,b=r.top),(0,Xt.jsx)("g",{transform:`translate(${p}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Xt.jsx)(Gt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Yt(t)?(0,Xt.jsx)(Vt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Kt=g(require("react")),Qt=require("react/jsx-runtime");function Zt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Jt(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 en(e,t,n,o){if(!e)return(0,Qt.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,Qt.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,m=i?c?[i]:Zt(i,l):[],g=r?c?[r]:Zt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let p=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Qt.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(m.length+g.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Qt.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Qt.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Qt.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(m.length>0&&(b.push((0,Qt.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:m.map((e,t)=>(0,Qt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),p=m.length*f),g.length>0&&b.push((0,Qt.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:p,children:g.map((e,t)=>(0,Qt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Qt.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(m.length+g.length)*f+(g.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Qt.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,m.length+g.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(g.length>0&&m.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Qt.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Qt.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function tn(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Qt.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,Qt.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,Qt.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,Qt.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Qt.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Qt.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,Qt.jsx)("path",{d:Jt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Qt.jsx)("g",{className:"annotation-subject",children:i})}function nn(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=o/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,m=o+d*f,g=i+h*f;s.push((0,Qt.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${m},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(g-l,m-a)}else s.push((0,Qt.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Qt.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,Qt.jsx)("g",{className:"annotation-connector",children:s})}function on(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:g,events:y={},"data-testid":p}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Qt.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":p,...null!=m&&{opacity:m},...g&&{strokeDasharray:g},...y,children:[!x.has("connector")&&nn(w,k,l,d,S,c),!x.has("subject")&&tn(S,c,d,b,v),!x.has("note")&&en(a,w,k,d)]})}function rn(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,Qt.jsx)(on,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,Qt.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Qt.jsx)(on,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var sn=require("d3-hierarchy"),an=require("d3-shape");function ln(e){return Math.round(100*e)/100}function cn(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(ln);return{points:e.map(([e])=>[ln(e),ln(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function un(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function dn(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function hn(e){return null==e?null:e+""}function fn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function mn(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return fn(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?fn(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return hn(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>hn(e.pointId)===o);if(r)return fn(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return hn(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=un(i,n),a=dn(i,n);return null==s||null==a?null:fn(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=un(e,n),i=dn(e,n)),null!=r&&null!=i)return fn(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function gn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var yn=require("react/jsx-runtime"),pn={secondary:0,primary:3};function bn(e){return!0===e?._annotationDeferred}function vn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function xn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function wn(e){return Math.max(.72,.95-.06*e)}var kn=g(require("react")),Sn=require("react"),An=require("react/jsx-runtime");function Mn(e){let t=null;const n=()=>(t||(t=(0,Sn.createContext)(null)),t),o=Cn(e);return[function({children:t,initialState:o}){const r=(0,Sn.useRef)(o),i=(0,Sn.useMemo)(()=>Cn(e,r.current),[]),s=n();return(0,An.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,Sn.useContext)(r)??o,s=(0,Sn.useRef)(e);s.current=e;const a=(0,Sn.useRef)({hasValue:!1,value:void 0}),l=(0,Sn.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Sn.useCallback)(()=>s.current(i.getState()),[i]);return(0,Sn.useSyncExternalStore)(i.subscribe,l,c)}]}function Cn(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}var[jn,_n]=Mn(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Rn(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Pn=require("react/jsx-runtime"),Ln="var(--semiotic-bg, #ffffff)",In=.85;function Tn(e,t){return(e+"").length*t*.6}function $n(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,Pn.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Ln,strokeWidth:h.haloWidth??3});const m=h.padding??{x:6,y:3},g="number"==typeof m?m:m.x,y="number"==typeof m?m:m.y,p=Tn(o,i),b=i+2*y;let v,x;return v="middle"===l?t-p/2-g:"end"===l?t-p-g:t-g,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,Pn.jsxs)("g",{className:d,children:[(0,Pn.jsx)("rect",{x:v,y:x,width:p+2*g,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Ln,fillOpacity:h.opacity??In,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}function Bn(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var On=null;function Hn(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a={background:n,stroke:o,lineWidth:r,spacing:i,angle:s},l=Math.max(8,Math.ceil(2*i));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(On||(On=document.createElement("canvas")),On.width=e,On.height=e,On)}(l)}catch{return Bn(a)}const u=c.getContext("2d");if(!u)return Bn(a);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=o,u.lineWidth=r,u.lineCap="square";const d=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=i)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(d);const e=2*l;for(let t=-e;e>=t;t+=i)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}var Fn=require("react/jsx-runtime");function Nn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function Wn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function En(e,t){let n=2166136261;const o=Wn(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Dn=new Map;function zn(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,Fn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,Fn.jsx)("rect",{width:l,height:l,fill:n}),(0,Fn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,Fn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function qn(e,t,n="#4e79a7"){if(Nn(e)){const n=En(t,e);return{fill:`url(#${n})`,def:zn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var Gn=require("react/jsx-runtime"),Vn={linear:an.curveLinear,monotoneX:an.curveMonotoneX,monotoneY:an.curveMonotoneY,step:an.curveStep,stepAfter:an.curveStepAfter,stepBefore:an.curveStepBefore,basis:an.curveBasis,cardinal:an.curveCardinal,catmullRom:an.curveCatmullRom};var Yn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Xn(e){return!!e&&"object"==typeof e&&Yn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Un(e){return"primary"===e?.emphasis||!0===e?.defensive}function Kn(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Qn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Zn=32,Jn=6,eo=4,to=8,no=72;var oo={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function ro(e){if(!io(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function io(e){return Xn(e)}function so(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function ao(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function lo(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function co(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function uo(e,t,n,o,r,i,s,a){const l=lo(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*co(l,e);for(const e of o)c+=4*co(l,e);return c}function ho(e){const{annotations:t,context:n,defaultOffset:o=Zn,notePadding:r=Jn,markPadding:i=eo,edgePadding:s=to,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=no,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:g,audience:y}=e,p=n.width||0,b=n.height||0,v="object"==typeof m?m:{},x=v.breakpoint??480,w=!!m&&x>=p,k=w&&!1!==v.preferShortText?t.map(ro):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!g?v.cohesion:g;if(0===k.length||0>=p||0>=b)return k.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=k.map((e,t)=>{if(!io(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?mn(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...so("string"==typeof e.title?e.title:void 0,t),...so("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(lo(ao(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=uo(ao(i.x,i.y,e.dx,e.dy,u),e,j,_,p,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const m=lo(ao(i.x,i.y,h.dx,h.dy,u),r);j.push(m);const g=Math.hypot(h.dx,h.dy),y=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),L=R?P:k.slice();let I=L;if(h){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?oo[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Kn(p,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=Kn(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Xn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Un(e.annotation)),c=a.filter(e=>!Un(e.annotation)).sort((e,t)=>Qn(t.annotation)-Qn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:p,height:b,...n});for(const e of o)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=p)for(const e of I)io(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let $;return $=0===T.size?I:A?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>io(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}($,C):$}function fo(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[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]=i?new Date(n):n}return c}(e,t):e.ticks(t)}var mo=require("react/jsx-runtime");function go(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,m=(0,Ht.useMemo)(()=>!s||h?[]:(u||fo(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||yo)(e)})),[s,c,h,u,d]),g=l&&s&&!h,y=a&&s&&!h;return g||y?(0,mo.jsx)("svg",{width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,mo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(0,mo.jsx)("g",{className:"ordinal-grid",children:m.map((e,o)=>(0,mo.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),y&&(0,mo.jsx)(mo.Fragment,{children:(0,mo.jsxs)(mo.Fragment,f?{children:[(0,mo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,mo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,mo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,mo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function yo(e){return Math.round(100*e)/100+""}function po(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:m,legend:g,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j,autoPlaceAnnotations:_,svgAnnotationRules:R,xAccessor:P,yAccessor:L,annotationData:I,underlayRendered:T,canvasObscuresUnderlay:$=!0,children:B}=e,O=function(e){const t=_n(e=>e.pushObservation),n=kn.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return kn.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:A,onObservation:M,chartId:C,chartType:j}),H="radial"===s?.projection,F="horizontal"===s?.projection,N=!1!==l,W=!T||$,E=(0,Ht.useMemo)(()=>{if(!a||!N||!s||H)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,n)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,n):t}));if(2>=t.length)return t;const n=Math.abs(t[1].pixel-t[0].pixel)||e,o=t.map(e=>{return t=e.label,F?"string"==typeof t||"number"==typeof t?16:24:"string"==typeof t||"number"==typeof t?6.5*(t+"").length:60;var t}),r=F?0:6;if(o.every((e,t)=>0===t||n>=(o[t-1]+e)/2+r))return t;const i=Math.max(...o)+r,l=Math.max(1,Math.ceil(i/n));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,N,s,d,H,F]),D=e.rTickValues,z=e.tickLabelEdgeAlign,q=e.axisExtent,G=(0,Ht.useMemo)(()=>a&&s&&!H?(D||fo(s.r,5,q)).map(e=>({value:e,pixel:s.r(e),label:(h||yo)(e)})):[],[a,s,h,H,D,q]),V=(0,Ht.useRef)(new Map),Y=(0,Ht.useRef)(S?.length??0),X=S?.length??0;Y.current!==X&&(Y.current=X,V.current=new Map);const U=(0,Ht.useMemo)(()=>{if(!S||0===S.length)return null;const e=function(e,t={}){const n=!0===t.showRetractedAnnotations,o=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!o)})}(S),o=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=mn(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!gn(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,Gn.jsx)(rn,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=un(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,Gn.jsxs)("g",{opacity:e.opacity,children:[(0,Gn.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Gn.jsx)($n,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=dn(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,Gn.jsxs)("g",{opacity:e.opacity,children:[(0,Gn.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Gn.jsx)($n,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:un({...e,type:"point"},o),y:dn({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,sn.packEnclose)(t),i=e.padding||10;return(0,Gn.jsxs)("g",{children:[(0,Gn.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Gn.jsx)($n,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:un({...e,type:"point"},o),y:dn({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=xe(i),[c,u]=xe(s),d=a-r,h=l+r,f=c-r;return(0,Gn.jsxs)("g",{children:[(0,Gn.jsx)("rect",{x:d,y:f,width:h-d,height:u+r-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Gn.jsx)($n,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,Gn.jsx)("g",{children:r.map((t,n)=>{const r=un(t,o),s=dn(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,Gn.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=un(e,o),r=dn(e,o);return(0,Gn.jsx)(rn,{noteData:{x:t??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=h.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,m=o.scales?.y??o.scales?.value;if(!f||!m)return null;const g=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(d.length-1,n+1),r=t-n,i=e(d[n]);return i+(e(d[o])-i)*r},y=f,p=m;let b;if(s)if(a){const e=g(p);b=(t,n)=>[y(n),e(t)]}else{const e=g(y);b=(t,n)=>[e(t),p(n)]}else b=(e,t)=>[y(e),p(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(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 u=0,d=0,h=0,f=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],m+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*m-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?cn(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:ln((n*t[3]-t[0]*t[1])/o),i=ln(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[ln(e),ln(r*e+i)]),equation:[r,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return(0,Gn.jsxs)("g",{children:[(0,Gn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Gn.jsx)("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.domain?.(),a=e.y0??s?.[0],l=e.y1??s?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):o.height||0,d=qn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Gn.jsxs)("g",{opacity:e.opacity,children:[d.def&&(0,Gn.jsx)("defs",{children:d.def}),(0,Gn.jsx)("rect",{x:0,y:Math.min(c,u),width:o.width||0,height:Math.abs(u-c),fill:d.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,Gn.jsx)($n,{x:(o.width||0)-4,y:(r=c,i=u,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=t?.domain?.(),i=e.x0??r?.[0],s=e.x1??r?.[1],a=null!=i&&t?t(i):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=qn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Gn.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,Gn.jsx)("defs",{children:c.def}),(0,Gn.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:o.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,Gn.jsx)($n,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const d=Vn[o.curve||"linear"]||an.curveLinear,h=(0,an.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,Gn.jsxs)("g",{children:[(0,Gn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Gn.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,m=e.fill||"#6366f1",g=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",p=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,Gn.jsxs)("g",{children:[f&&(0,Gn.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:m,fillOpacity:g}),x.map((e,t)=>{const n=un(e,o),r=dn(e,o);return null==n||null==r?null:(0,Gn.jsx)("circle",{cx:n,cy:r,r:p,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Gn.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:m,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=cn(l,e.order||2).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),m=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+(t[0]-m)**2,0),y=e.confidence??.95,p=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(g>0?(e-m)**2/g:0))*p;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,A=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,Gn.jsxs)("g",{children:[(0,Gn.jsx)("path",{d:S,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Gn.jsx)("polyline",{points:`${M} ${A}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,Gn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=mn(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!gn(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,Gn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,Gn.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Gn.jsx)("div",{...Rn(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=mn(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Gn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Kt.cloneElement(c,{key:"ann-text-"+n}):(0,Gn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Gn.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Kt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,Gn.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,Gn.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&(0,Gn.jsx)($n,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,Gn.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,Gn.jsx)($n,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,O),r="horizontal"===s?.projection,i=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,a={scales:s?{x:r?s.r:i||s.r,y:r&&i||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:t,height:n,data:I,frameType:"ordinal",projection:r?"horizontal":"vertical",stickyPositionCache:V.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:xn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>bn(e.annotation)),r=e.some(e=>null!=vn(e.annotation)),i=e.some(e=>"layer"===vn(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=pn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=bn(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,yn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:wn(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=vn(t.annotation);return a&&(s=(0,yn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,yn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,yn.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,yn.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(_?ho({annotations:e,context:a,..."object"==typeof _?_:{}}):e,o,R,a)},[S,_,R,t,n,s,P,L,I,O]);return a||m||g||k||U&&U.length>0||f||B?(0,mo.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,mo.jsx)("title",{children:"string"==typeof m?m:"Ordinal Chart"}),(0,mo.jsx)("desc",{children:"string"==typeof m?m+" (ordinal data visualization)":"Ordinal data visualization"}),(0,mo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!H&&W&&(0,mo.jsx)("g",{className:"ordinal-grid",children:G.map((e,o)=>(0,mo.jsx)("line",{x1:F?e.pixel:0,y1:F?0:e.pixel,x2:F?e.pixel:t,y2:F?n:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),a&&s&&!H&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,mo.jsx)("g",{className:"ordinal-axes",children:(0,mo.jsxs)(mo.Fragment,F?{children:[(0,mo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[W&&(0,mo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((t,n)=>(0,mo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,mo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,mo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,mo.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,mo.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,mo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,mo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[W&&(0,mo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,mo.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),G.map((t,o)=>{const r=z?0===o?"start":o===G.length-1?"end":"middle":"middle";return(0,mo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,mo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,mo.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)}),u&&(0,mo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]}:{children:[(0,mo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[W&&(()=>{const e=s?.r?s.r(0):n,o=0>e||e>n?n:e;return(0,mo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),E.map((t,o)=>(0,mo.jsxs)("g",{transform:`translate(${t.pixel},${n})`,children:[(0,mo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,mo.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,mo.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,mo.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,mo.jsx)("text",{x:t/2,y:n+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...o},children:c})]}),(0,mo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[W&&(0,mo.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),G.map((t,n)=>(0,mo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,mo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,mo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)),u&&(0,mo.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...o},children:u})]})]})})})(),U,k,B]}),m&&"string"==typeof m?(0,mo.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?(0,mo.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,Ut({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:x,title:m,legendLayout:w,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function bo(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var vo=g(require("react")),xo=require("react/jsx-runtime"),wo=null,ko=null;function So(e){const[t,n]=vo.useState(()=>wo);return vo.useEffect(()=>{if(t)return;let e=!1;return(wo?Promise.resolve(wo):(ko||(ko=Promise.resolve().then(()=>(x(),p)).then(e=>wo=e.OrdinalBrushOverlay).catch(e=>{throw ko=null,e})),ko)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,xo.jsx)(t,{...e}):null}g(require("react")),require("d3-shape");var Ao=new WeakMap,Mo=0,Co=!1,jo=null,_o=null;function Ro(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),o=n.indexOf(",");if(-1===o){const e=n.trim();return e.startsWith("--")?{name:e}:null}const r=n.slice(0,o).trim(),i=n.slice(o+1).trim();return r.startsWith("--")?{name:r,fallback:i||void 0}:null}(t);if(!n)return t;const o=()=>n.fallback?Ro(e,n.fallback):t,r=e.canvas;if(!r)return o();!function(){if(Co)return;if("undefined"==typeof window||"undefined"==typeof document)return;Co=!0;const e=()=>{Mo++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{jo=window.matchMedia("(prefers-color-scheme: dark)"),_o=e,"function"==typeof jo.addEventListener?jo.addEventListener("change",_o):"function"==typeof jo.addListener&&jo.addListener(_o)}catch{}}();let i=Ao.get(r);i&&i.version===Mo||(i={version:Mo,map:new Map},Ao.set(r,i));const s=i.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(r).getPropertyValue(n.name).trim()||o()||t;return i.map.set(t,a),a}function Po(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}function Lo(e,t,n){if(null==t)return n;if(Nn(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${Wn(e)}@${n}`,r=Dn.get(o);if(void 0!==r)return r;const i=Hn({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=Nn(i)?null:i;return Dn.set(o,s),s}(t,e);return o||t.background&&Ro(e,t.background)||n}return"string"!=typeof t?t:Ro(e,t)||n}function Io(e,t){if(null==t)return;const n=Lo(e,t,"");return""===n?void 0:n}function To(e,t,n,o,r,i,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,r,i,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)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(o,r,i,s),[h,f,m]=Po(e,n);return d.addColorStop(0,`rgba(${h},${f},${m},${c})`),d.addColorStop(1,`rgba(${h},${f},${m},${u})`),d}function $o(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Bo(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(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}require("d3-shape");var Oo=require("react/jsx-runtime"),Ho={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Fo(e,t="#4e79a7"){return Nn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function No(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Wo=g(require("react")),Eo=require("d3-shape"),Do=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function zo(e){const{innerRadius:t,outerRadius:n,startAngle:o,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=Do(n,o),t=Do(n,r);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${r-o>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Do(n,o),s=Do(n,r),a=Do(t,r),l=Do(t,o),c=r-o>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===s)return zo({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,n-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-o,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return zo({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=o+(d?a:0),m=r-(h?a:0),g=o+(d?l:0),y=r-(h?l:0),p=Do(n,f),b=Do(n,m),v=(n-s)*Math.cos(a),x=Do(v,o),w=Do(v,r),k=i?null:Do(t,y),S=i?null:Do(t,g),A=i?0:(t+s)*Math.cos(l),M=i?null:Do(A,o),C=i?null:Do(A,r),j=m-f>Math.PI?1:0,_=i?0:y-g>Math.PI?1:0;let R="";if(d)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${p.x},${p.y}`;else{const e=Do(n,o);R+=`M${e.x},${e.y}`}if(h)R+=` A${n},${n} 0 ${j} 1 ${b.x},${b.y}`,R+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=Do(n,r);R+=` A${n},${n} 0 ${j} 1 ${e.x},${e.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${C.x},${C.y}`,R+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=Do(t,r);R+=` L${e.x},${e.y}`}if(d)R+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,R+=` A${s},${s} 0 0 1 ${M.x},${M.y}`;else{const e=Do(t,o);R+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return R+=" Z",R}function qo(e){const t=zo({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 r=0;o.length>r;r++)n.push({d:zo({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:o[r]})}return{clipPath:t,slices:n}}var Go=require("react/jsx-runtime");function Vo(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 Yo(e,t){const n=e.datum;if(!n)return null;const o=[],r=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),s=Number(n.__funnelStepLabelY),a=Number(n.__funnelRowWidth);"string"!=typeof r||!Number.isFinite(i)||!Number.isFinite(s)||Number.isFinite(a)&&8.4*r.length+16>a||o.push((0,Go.jsx)("text",{x:i,y:s+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:r},t+"-funnel-step"));const l=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),u=Number(n.__funnelValueLabelY),d=Number(n.__funnelBarW);if(Number.isFinite(l)&&0!==l&&Number.isFinite(c)&&Number.isFinite(u)&&d>=60){const e=Number(n.__funnelPercent);let r=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${Vo(l)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:Vo(l);7.8*r.length+16>d&&(r=Vo(l)),7.8*r.length+16>d||o.push((0,Go.jsx)("text",{x:c,y:u+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:r},t+"-funnel-value"))}return o.length?(0,Go.jsx)("g",{children:o},t+"-funnel-labels"):null}function Xo(e,t,n){const o=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=n=>`ord-${e.type}-${o}-${t}-${n}`,i=`ord-${e.type}-${o}-${t}`;switch(e.type){case"rect":{const t=e,n=No(i)+"-grad",o=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(o=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(o=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in n){const e=function(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>(0,Oo.jsx)("stop",{offset:e.offset,stopColor:e.color},t))}(n.colorStops);if(!e)return null;a.push(...e)}else{const t=Fo(e.style.fill);a.push((0,Oo.jsx)("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),a.push((0,Oo.jsx)("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return(0,Oo.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:o,y1:r,x2:i,y2:s,children:a})}(t,n);let r,s;if(o)s=`url(#${n})`;else if(Nn(t.style.fill)){const e=No(i)+"-hatch";r=zn(t.style.fill,e),s=`url(#${e})`}else s=Fo(t.style.fill);const a=o||r?(0,Go.jsxs)("defs",{children:[o,r]}):null;if(t.cornerRadii&&$o(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:o,h:r}=e,{tl:i,tr:s,br:a,bl:l}=Bo(e);let c=`M${t+i},${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+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+r}`),c+=` L${t+l},${n+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+r-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return(0,Go.jsxs)(Wo.Fragment,{children:[a,(0,Go.jsx)("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:o,w:r,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n},${o+l} Z`;break;case"left":c=`M${n+r},${o} L${n+e},${o} A${e},${e} 0 0 0 ${n},${o+e} L${n},${o+l-e} A${e},${e} 0 0 0 ${n+e},${o+l} L${n+r},${o+l} Z`;break;case"bottom":c=`M${n},${o} L${n+r},${o} L${n+r},${o+l-e} A${e},${e} 0 0 1 ${n+r-e},${o+l} L${n+e},${o+l} A${e},${e} 0 0 1 ${n},${o+l-e} Z`;break;default:c=`M${n},${o+l} L${n},${o+e} A${e},${e} 0 0 1 ${n+e},${o} L${n+r-e},${o} A${e},${e} 0 0 1 ${n+r},${o+e} L${n+r},${o+l} Z`}return(0,Go.jsxs)(Wo.Fragment,{children:[a,(0,Go.jsx)("path",{d:c,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,Go.jsxs)(Wo.Fragment,{children:[a,(0,Go.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),Yo(t,i)]},i)}case"point":{const t=e;return(0,Go.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:Fo(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,n){const o=me(e.symbolType,e.size,e.path);return(0,Oo.jsx)("path",{d:o,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Fo(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}(e,t,n);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=yt(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=wt(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?No(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:bt(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:bt(n.stroke??"none",a,e.accent);return r||i?(0,Oo.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,Oo.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Oo.jsx)("clipPath",{id:c,children:(0,Oo.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Oo.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Oo.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},o)}(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const o=e;if(o._gradientBand&&o._gradientBand.colors.length>0){const e=No(`${n?n+"-":""}gauge-grad-${o.category||i}-${t}`),{clipPath:r,slices:s}=qo({innerRadius:o.innerRadius,outerRadius:o.outerRadius,startAngle:o.startAngle,endAngle:o.endAngle,cornerRadius:o.cornerRadius,roundStart:o.roundedEnds?.start??!0,roundEnd:o.roundedEnds?.end??!0,colors:o._gradientBand.colors});return(0,Go.jsxs)("g",{transform:`translate(${o.cx},${o.cy})`,opacity:o.style.opacity,fillOpacity:o.style.fillOpacity,children:[(0,Go.jsx)("defs",{children:(0,Go.jsx)("clipPath",{id:e,children:(0,Go.jsx)("path",{d:r})})}),(0,Go.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,Go.jsx)("path",{d:e.d,fill:Fo(e.color)},t))}),o.style.stroke&&"none"!==o.style.stroke&&(0,Go.jsx)("path",{d:r,fill:"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},i)}let r;if(o.roundedEnds)r=zo({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=(0,Eo.arc)().innerRadius(o.innerRadius).outerRadius(o.outerRadius).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2);o.cornerRadius&&e.cornerRadius(o.cornerRadius),r=e(Ho)||""}return(0,Go.jsx)("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:Fo(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return(0,Go.jsxs)("g","vertical"===t.projection?{children:[(0,Go.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:Fo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Go.jsx)("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,Go.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:Fo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Go.jsx)("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Go.jsx)("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[(0,Go.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Fo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,o=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?n.push((0,Go.jsx)("line",{x1:o,y1:t.iqrLine.q1Pos,x2:o,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Go.jsx)("circle",{cx:o,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):n.push((0,Go.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Go.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,Go.jsx)("g",{children:n},i)}case"connector":return(0,Go.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,Go.jsx)("polygon",{points:n,fill:Fo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}require("react/jsx-runtime");var Uo="undefined"==typeof window||"undefined"==typeof document,Ko=require("react"),Qo="undefined"!=typeof window?Ko.useLayoutEffect:Ko.useEffect,Zo=()=>()=>{},Jo=()=>!1,er=()=>!0,tr=require("react");function nr(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.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 or(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 rr(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}var ir=g(require("react")),sr=g(require("react")),ar=(require("react/jsx-runtime"),sr.createContext(null)),lr=require("react/jsx-runtime"),cr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ur({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,lr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:cr,children:t})}function dr(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function hr(e){return e&&"object"==typeof e?e:{}}function fr(e){return hr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var mr=require("react/jsx-runtime");function gr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var yr=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},pr="semiotic-accessible-data-table",br=pr+" semiotic-accessible-data-table-hidden",vr=pr+" semiotic-accessible-data-table-visible",xr={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"},wr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},kr={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Sr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ar={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))"},Mr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Cr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},jr={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function _r({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=ir.useState(!1),[s,a]=ir.useState(5),l=sr.useContext(ar),c=l?.visible??!1,u=r||c,d=ir.useRef(null),h=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;ir.useEffect(()=>{u||a(5)},[u]);const f=ir.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),m=ir.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,mr.jsx)("span",{id:n,tabIndex:-1,style:cr}):null;if(!u)return(0,mr.jsx)("div",{id:n,className:br,tabIndex:-1,onFocus:f,style:cr,role:"region","aria-label":h,children:(0,mr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:dr(fr(o))});break;case"line":case"area":{const e=fr(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:dr(e)});break}case"rect":{const e=fr(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=dr(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=dr(fr(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=fr(o),n=dr(e);if(null==n.category){const t=hr(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:dr(fr(o))});break;case"arc":t.push({label:"Arc",values:dr(fr(o))});break;case"candlestick":t.push({label:"Candlestick",values:dr(fr(o))});break;case"geoarea":{const e=hr(fr(o)),n=dr(e);if(null==n.name){const t=hr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=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=[],r=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&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(g),p=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${yr(e.min)} to ${yr(e.max)}, mean ${yr(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(" ")}(g.length,y),b=Math.min(s,g.length),v=g.slice(0,b),x=g.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,mr.jsxs)("div",{ref:d,id:n,className:vr,tabIndex:-1,onBlur:m,style:xr,role:"region","aria-label":h,children:[(0,mr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:kr,children:"×"}),(0,mr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:wr,children:p}),(0,mr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Sr,children:[(0,mr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Cr,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),(0,mr.jsx)("thead",{children:(0,mr.jsxs)("tr",{children:[(0,mr.jsx)("th",{style:Ar,children:"type"}),k.map(e=>(0,mr.jsx)("th",{style:Ar,children:e},e))]})}),(0,mr.jsx)("tbody",{children:v.map((e,t)=>(0,mr.jsxs)("tr",{children:[(0,mr.jsx)("td",{style:Mr,children:e.label}),k.map(t=>{return(0,mr.jsx)("td",{style:Mr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":yr(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,mr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:jr,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Rr({summary:e}){return e?(0,mr.jsx)("div",{role:"note",style:cr,children:e}):null}function Pr({tableId:e}){return(0,mr.jsx)("a",{href:"#"+e,style:cr,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,cr)},children:"Skip to data table"})}var Lr=require("react/jsx-runtime"),Ir="var(--semiotic-focus, #005fcc)";function Tr({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Lr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ir,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Lr.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ir,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ir,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Lr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Lr.jsx)("path",{d:a,fill:"none",stroke:Ir,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Lr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var $r=g(require("react"));function Br(e){return Array.isArray(e)?e[0]:e}function Or(e,t,n,o){return{data:Br(e),x:t,y:n,__semioticHoverData:!0,...o}}var Hr=["name","label","title"],Fr=["type","kind","category","group","class","status","role","shape"],Nr=["value","amount","total","count","weight","score"],Wr=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Er(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Dr(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&Wr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Hr.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Er(l,Fr),u=Er(l,Nr),d=new Set(Fr),h=new Set(Nr),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var zr=require("react/jsx-runtime"),qr={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 Gr(e,t){return"function"==typeof t?t(e):e[t]}function Vr(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 Yr(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=Gr(e,n);s=Vr(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=Gr(e,r);a.push({label:n,value:Vr(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Vr(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Vr(e[t[0]],o))}}const l={...qr,...r};return(0,zr.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,zr.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,zr.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,zr.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Xr(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Br(!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)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,zr.jsx)("div",{className:"semiotic-tooltip",style:qr,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Yr(e):"multi"===e?("undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip — prefer charts that set tooltipMode (LineChart, AreaChart, StackedAreaChart, DifferenceChart). Rendering MultiLineTooltip content as a fallback.'),function(e={}){const{fields:t=[],title:n,format:o,style:r={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=Gr(e,n);l.push({value:Vr(t,o)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const a=Vr(Gr(e,r),i);l.push({label:s?n:void 0,value:a})});else{const t=Dr(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:Vr(t.title,o),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:Vr(e.value,o)})})}const c={...qr,...r};return Array.isArray(l)&&0!==l.length?(0,zr.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,zr.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,zr.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}()):Yr())}}var Ur=require("react/jsx-runtime");function Kr({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=$r.useRef(null),[u,d]=$r.useState(null);$r.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!$r.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),m=f?null:qr;return l?(0,Ur.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Qr=g(require("react")),Zr=require("react");function Jr(e){if(!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 ei(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:ti}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var ti=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ni={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},oi={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},ri={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ti,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 ii(e,t){if("light"===t)return ni;if("dark"===t)return oi;if("high-contrast"===t)return ri;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?oi:ni;return ei({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return ei({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[si,ai]=Mn(e=>({theme:ni,setTheme(t){e(e=>({theme:ii(e.theme,t)}))}})),li=require("react");var ci=require("react"),ui=()=>"undefined"!=typeof performance?performance.now():Date.now();function di(e,t){const n=e();return Number.isFinite(n)?n:t}var hi=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ui,this.lastWallTime=di(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=di(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ui;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=di(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},fi="undefined"==typeof window?Zr.useEffect:Zr.useLayoutEffect,mi={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function gi(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function yi(e){const t=function(){const[e,t]=(0,li.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,li.useEffect)(()=>{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=(0,Zr.useRef)(t);n.current=t;const[o,r]=function(e,t,n){const o=(0,ci.useRef)(null),[r,i]=(0,ci.useState)(null);return(0,ci.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Zr.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=gi(e.foregroundGraphics,r,a),d=gi(e.backgroundGraphics,r,a),h=ai(e=>e.theme),{transition:f,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+Qr.useId(),y=(0,Zr.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new hi({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const p=y.current;p.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Zr.useRef)(null),v=(0,Zr.useRef)(e.frameScheduler??mi);v.current=e.frameScheduler??mi;const x=(0,Zr.useRef)(null),w=(0,Zr.useRef)(!1),k=(0,Zr.useRef)(()=>{}),S=(0,Zr.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=o,x.current=e)},[]),A=(0,Zr.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);fi(()=>{p.setPaused(!0===e.paused)},[p,e.paused]),(0,Zr.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void p.setVisible(!0);const t=()=>p.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[p,e.suspendWhenHidden]),(0,Zr.useEffect)(()=>()=>{A()},[A]);const M=(0,Zr.useRef)(()=>{}),C=(0,Zr.useRef)(()=>{}),j=(0,Zr.useRef)(null),_=(0,Zr.useRef)(null),R=(0,Zr.useRef)(null),P=(0,Zr.useCallback)(()=>{const e=j.current;j.current=null,e&&M.current(e)},[]),L=(0,Zr.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,Zr.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),C.current()},[]);(0,Zr.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??v.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return fi(()=>{T&&(Mo++,T.current=!0,S())},[h,S,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:m,tableId:g,frameRuntime:p,rafRef:b,renderFnRef:k,scheduleRender:S,cancelRender:A,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:I}}var pi=require("react"),bi=require("react/jsx-runtime");function vi({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,bi.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,bi.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var xi=require("react");function wi(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function ki(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Si(e,t,n=.3){ki(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 Ai(e,t,n=.6){if(!ki(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,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 Mi(e,t,n,o=.35){ki(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Ci(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=Bo(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function ji(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}}}function _i(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}var Ri=new Map;function Pi(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=Ri.get(t);return n||(n=new Path2D(me(e.symbolType,e.size)),Ri.size>256&&Ri.clear(),Ri.set(t,n)),n}catch{return null}}function Li(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=yt(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=Lo(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=wt(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&St(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),St(e,i,c,t.accent,void 0,l),e.restore()}var Ii=require("d3-shape");function Ti(e,t){const n=t._gradientBand.colors;if(0===n.length)return;const{clipPath:o,slices:r}=qo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:n}),i=new Path2D(o);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=Ro(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=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function $i(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 Bi(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=(0,Ii.arc)().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Oi=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Ti(e,t),t._pulseIntensity&&t._pulseIntensity>0&&($i(e,t),Mi(e,t)),e.globalAlpha=1;else{if(e.fillStyle=Lo(e,t.style.fill,"#007bff"),t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=zo({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=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Bi(e,t)):($i(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&($i(e,t),Mi(e,t)),e.globalAlpha=1}},Hi=(e,t,n,o)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const n=t.columnWidth/2,o="vertical"===t.projection,r=Ro(e,"var(--semiotic-primary, #007bff)"),i=Ro(e,"var(--semiotic-text, #333)"),s=Lo(e,t.style.fill,r),a=t.style.stroke,l="string"==typeof a?Ro(e,a)||a:i,c=t.style.strokeWidth||1,u=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=l,e.lineWidth=c,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=u,e.fillStyle=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Fi=(e,t,n,o)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=Lo(e,t.style.fill,"#007bff"),e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ro(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()}},Ni=(e,t,n,o)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){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=n.fillOpacity??n.opacity??.3,e.fillStyle=Io(e,n.fill)??"#999",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=Ro(e,n.style.stroke)||Lo(e,n.style.fill,"")||Ro(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=n.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Wi=(e,t,n,o)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const n=t.points;if(n.length>=4){e.globalAlpha=t.style?.opacity??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=Io(e,t.style?.fill)||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Ei(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 Di(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var zi=new Map;function qi(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=zi.get(n);if(void 0!==o)return o;const r=Hn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t),i=Nn(r)?null:r;return zi.set(n,i),i}function Gi(e,t,n,o,r,i){e.moveTo(t+i,n),e.lineTo(t+o-i,n),e.quadraticCurveTo(t+o,n,t+o,n+i),e.lineTo(t+o,n+r-i),e.quadraticCurveTo(t+o,n+r,t+o-i,n+r),e.lineTo(t+i,n+r),e.quadraticCurveTo(t,n+r,t,n+r-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}function Vi(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 Yi(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}function Xi(e){return"rect"===e.type||"point"===e.type||"symbol"===e.type||"glyph"===e.type}function Ui(e){return(t,n,o,r)=>{e(t,n.filter(Xi),{x:o.r,y:o.r},r)}}var Ki=Ui((e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)_i(e,t);else if(t.cornerRadii&&$o(t.cornerRadii)){const n=Lo(e,t.style.fill,Ro(e,"var(--semiotic-primary, #007bff)")),o=ji(t),r=t.fillGradient&&"string"==typeof n?To(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,Ci(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Lo(e,t.style.fill,Ro(e,"var(--semiotic-primary, #007bff)")),o=ji(t),r=t.fillGradient&&"string"==typeof n?To(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=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-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Lo(e,t.style.fill,Ro(e,"var(--semiotic-primary, #007bff)")),o=ji(t),r=t.fillGradient&&"string"==typeof n?To(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Ro(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Si(e,t),e.globalAlpha=1}}),Qi=Ui((e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=Lo(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=Lo(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Ai(e,n)}finally{e.restore()}}}),Zi=Ui((e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=Pi(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=Lo(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=Lo(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n}),Ji=Ui((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Li(e,o,o.x,o.y,n);e.globalAlpha=n}),es=e=>[Ni,...e],ts={bar:es([Ki]),clusterbar:es([Ki]),point:es([Qi,Zi]),swarm:es([Qi,Zi]),pie:[Oi],donut:[Oi],boxplot:es([Hi,Qi]),violin:es([Fi]),histogram:es([Ki]),ridgeline:es([Fi]),timeline:es([Ki]),funnel:[Ki,Wi,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(n.__funnelRowWidth??n.__funnelBarW??0))continue;const r=n.__funnelStepLabelX,i=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,r,i),e.fillStyle="#fff",e.fillText(o,r,i)}e.font="bold 13px sans-serif";for(const t of r){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=n.__funnelBarW??0;if(60>o)continue;const r=n.__funnelValue;if(null==r||0===r)continue;const i=n.__funnelPercent,s=!0===n.__funnelIsFirstStep;let a;if(a=s?Ei(r):null!=i?`${Ei(r)} (${Di(i)})`:Ei(r),e.measureText(a).width+16>o){if(s||null==i)continue;if(a=Ei(r),e.measureText(a).width+16>o)continue}const l=n.__funnelValueLabelX,c=(n.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ki,(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const n=("string"==typeof t.style.fill?t.style.fill:null)||Ro(e,"var(--semiotic-border, #999)"),o=qi(n,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[n,o,r]=Po(e,t);return(.2126*n+.7152*o+.0722*r)/255>.6}(e,Ro(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const r=n.__barFunnelPercent,i=!(!0===n.__barFunnelIsFirstStep)&&null!=r,u=i?Yi(r):"",d=Vi(o);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,m=Math.max(h,f)+12,g=i?32:17,y=n.__barFunnelLabelX,p=y-m/2,b=n.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Gi(e,p,b,m,g,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Gi(e,p,b,m,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,b+3))}e.lineWidth=1}],swimlane:es([Ki]),custom:es([Ki,Qi,Zi,Ji,Oi,Hi,Fi,Wi])},ns=new Set;function os(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function rs(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;ns.has(n)||(ns.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var is=require("react/jsx-runtime");function ss(e){const t=Dr(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,is.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[null!=t.title&&(0,is.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,is.jsxs)("div",{children:[(0,is.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function as({hover:e}){const t=e.data||{},n=e.stats,o=e.category;if(Array.isArray(t)){const e=o||t[0]?.category||"";if(n)return(0,is.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[e&&(0,is.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,is.jsxs)("div",{children:["n = ",n.n]}),(0,is.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),(0,is.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,is.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),(0,is.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),(0,is.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),(0,is.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,is.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[e&&(0,is.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,is.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,is.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[t.category&&(0,is.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,is.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,is.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return ss(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,is.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[a&&(0,is.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,is.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):ss(t)}function ls(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function cs(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}as.ownsChrome=!0;var us=require("react"),ds=require("react");function hs(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function fs(e){const t=[];for(const n of e)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=kt(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const e=((n.startAngle||0)+(n.endAngle||0))/2,o=((n.innerRadius||0)+(n.outerRadius||50))/2;t.push({x:n.cx+Math.cos(e)*o,y:n.cy+Math.sin(e)*o,datum:n.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function ms(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var gs=require("react/jsx-runtime"),ys={top:50,right:40,bottom:60,left:70},ps=(0,k.memo)((0,k.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:f,valueAccessor:m,categoryAccessor:g,accessorRevision:y,projection:p="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:w,barPadding:S,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:O,showOutliers:H,showIQR:F,amplitude:N,connectorOpacity:W,showLabels:E,connectorAccessor:D,connectorStyle:z,dataIdAccessor:q,rExtent:G,oExtent:V,extentPadding:Y=.05,oSort:X,windowMode:U="sliding",windowSize:K=200,pieceStyle:Q,summaryStyle:Z,renderMode:J,colorScheme:ee,barColors:te,showAxes:ne=!0,showCategoryTicks:oe,categoryLabel:re,valueLabel:ie,categoryFormat:se,valueFormat:ae,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:me,enableHover:ge=!0,hoverAnnotation:ye,tooltipContent:pe,customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,annotationObservationCallback:we,chartId:ke,annotations:Se,onAnnotationActivate:Ae,autoPlaceAnnotations:Me,svgAnnotationRules:Ce,showGrid:je=!1,legend:_e,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Ie,legendPosition:Te,legendLayout:$e,legendCategoryAccessor:Be,onCategoriesChange:Oe,backgroundGraphics:He,foregroundGraphics:Fe,title:Ne,className:We,background:Ee,centerContent:De,decay:ze,pulse:qe,transition:Ge,animate:Ve,staleness:Ue,frameScheduler:Ke,clock:Qe,random:Ze,seed:Je,paused:nt=!1,suspendWhenHidden:rt=!0,brush:it,onBrush:st,accessibleTable:at=!0,description:lt,summary:ct,customLayout:ht,onLayoutError:ft,layoutConfig:mt,layoutSelection:gt}=e,{customHoverBehavior:yt,customClickBehavior:pt,hasClickBehavior:bt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,us.useCallback)((t,i)=>{e?.(t,i),ls({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,us.useCallback)((e,i)=>{t?.(e,i),cs({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:be,customClickBehavior:ve,onObservation:xe,chartId:ke,chartType:"StreamOrdinalFrame"}),vt=g??i,xt=m??s,wt=(0,k.useRef)(!0),kt=yi({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:w,marginDefault:ys,title:Ne,legend:_e,legendPosition:Te,animate:Ve,transitionProp:Ge,frameScheduler:Ke,clock:Qe,random:Ze,seed:Je,paused:nt,suspendWhenHidden:rt,themeDirtyRef:wt}),{reducedMotionRef:St,responsiveRef:Mt,size:Ct,margin:jt,adjustedWidth:_t,adjustedHeight:Rt,currentTheme:Pt,transition:Lt,introEnabled:Bt,tableId:Ht,rafRef:Ft,renderFnRef:Nt,scheduleRender:Wt,frameRuntime:Et}=kt,Dt=function(){const[e,t]=(0,Ko.useState)(!1);return Qo(()=>{t(!0)},[]),e}(),zt=function(){const e=(0,Ko.useSyncExternalStore)(Zo,Jo,er);return(0,Ko.useRef)(e).current}(),qt=(0,k.useMemo)(()=>A(r),[r]),Gt=re??le,Vt=ie??ce,Yt=se??ue,Xt=ae??de,Ut=(0,k.useRef)(null),[Kt,Qt]=(0,k.useState)(null),[Zt,Jt]=(0,k.useState)(null),en=wi(Fe,Ct,jt,Zt),tn=wi(He,Ct,jt,Zt),nn=He||"transparent"===Ee?null:(0,gs.jsx)("rect",{className:"semiotic-canvas-background","data-semiotic-layer":"canvas-background",x:-jt.left,y:-jt.top,width:Ct[0],height:Ct[1],fill:Ee||"var(--semiotic-bg, transparent)"}),[on,rn]=(0,k.useState)(0),sn=(0,k.useRef)(0),[an,ln]=(0,k.useState)(!1),cn=(0,k.useRef)({w:-1,h:-1}),un=(0,k.useRef)(!1),dn=(0,Xe.useRef)(new et("StreamOrdinalFrame")),hn=ge||ye,fn="streaming"===o,mn=function(e){const t=(0,tr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return or(e,t);if(!rr(e)||!rr(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!or(n,r))return!1}else{if(!rr(n)||!rr(r))return!1;if(!nr(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,k.useMemo)(()=>({chartType:n,runtimeMode:fn?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:Y,projection:p,oAccessor:fn?void 0:vt,rAccessor:fn?void 0:xt,accessorRevision:y,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:fn?f:void 0,valueAccessor:fn?m||("string"==typeof xt||"function"==typeof xt?xt:void 0):void 0,categoryAccessor:fn?vt:void 0,rExtent:G,oExtent:V,axisExtent:me,barPadding:S,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:R,innerRadius:P,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:O,showOutliers:H,showIQR:F,amplitude:N,connectorOpacity:W,showLabels:E,connectorAccessor:D,connectorStyle:z,dataIdAccessor:q,oSort:X,pieceStyle:Q,summaryStyle:Z,colorScheme:ee,themeCategorical:Pt?.colors?.categorical,themeSemantic:Jr(Pt),themeSequential:Pt?.colors?.sequential,themeDiverging:Pt?.colors?.diverging,barColors:te,decay:ze,pulse:qe,transition:Lt,introAnimation:Bt,staleness:Ue,clock:Et.now,customLayout:ht,onLayoutError:ft,layoutConfig:mt,layoutMargin:jt}),[n,fn,K,U,Y,p,vt,xt,y,a,l,c,u,d,h,f,m,G,V,me,S,C,j,_,R,P,L,I,T,$,B,O,H,F,N,W,E,D,z,q,X,Q,Z,ee,Pt,te,ze,qe,Lt,Bt,Ue,Et.now,ht,ft,mt,jt])),gn=(0,k.useRef)(null);gn.current||(gn.current=new Ye(mn));const yn=function(e,t,n,o){const r=(0,xi.useRef)({accessor:t,onChange:n,readData:o}),i=(0,xi.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,xi.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(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})(s,i.current)||(i.current=s,n(s))},[e])}(gn,Be,Oe,e=>e.getData());!function(e,t,n,o){(0,dt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(gn,mn,wt,Wt),function(e,t,n,o){const r=(0,dt.useRef)(null);(0,dt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(gn,gt,wt,Wt);const pn=(0,k.useRef)(null);pn.current||(pn.current=new M(e=>{const t=gn.current;t&&t.ingest(e)&&(wt.current=!0,Wt())}));const bn=(0,k.useCallback)(e=>{pn.current?.push(e)},[]),vn=(0,k.useCallback)(e=>{pn.current?.pushMany(e)},[]),xn=(0,k.useCallback)(()=>{pn.current?.clear(),gn.current?.clear(),wt.current=!0,Wt()},[Wt]),wn=(0,k.useCallback)(e=>{pn.current?.clearLastData(),pn.current?.setReplacementData(e)},[]);(0,k.useImperativeHandle)(t,()=>({push:bn,pushMany:vn,replace:wn,remove:e=>{pn.current?.flush();const t=gn.current?.remove(e)??[];if(t.length>0){const e=Ut.current?.data;!!Ut.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Ut.current=null,Qt(null)),wt.current=!0,Wt()}return t},update:(e,t)=>{pn.current?.flush();const n=gn.current?.update(e,t)??[];return n.length>0&&(wt.current=!0,Wt()),n},clear:xn,getData:()=>(pn.current?.flush(),gn.current?.getData()??[]),getScales:()=>gn.current?.scales??null,getCustomLayout:()=>gn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>gn.current?.lastCustomLayoutFailure??null}),[bn,vn,wn,xn,Wt]),(0,k.useEffect)(()=>{r&&pn.current?.setBoundedData(qt)},[r,qt]);const{canvasRef:kn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,pi.useRef)(null),a=(0,pi.useRef)(null),l=(0,pi.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Qo(()=>{const e=o.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():r.current=!0,s?.(),i.current()},[t,n]);const l=(0,Ko.useRef)(a);l.current=a,(0,Ko.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,pi.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,pi.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(kt,{storeRef:gn,dirtyRef:wt,hydrated:Dt,wasHydratingFromSSR:zt,cleanup:()=>pn.current?.clear(),canvasPaintDependencies:[n,_t,Rt,ne,Ee,He,J,Wt]}),{hoverHandlerRef:Sn,hoverLeaveRef:An,onPointerMove:Mn,onPointerLeave:Cn}=kt;Sn.current=e=>{if(!hn)return;const t=kn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-jt.left,i=e.clientY-o.top-jt.top;if(0>r||r>_t||0>i||i>Rt)return void(Ut.current&&(Ut.current=null,Qt(null),yt&&yt(null),Wt()));const s=gn.current;if(!s||0===s.scene.length)return;const a="radial"===p,l=At(s.scene,a?r-_t/2:r,a?i-Rt/2:i,30,s.pointQuadtree,s.maxPointRadius);if(!l)return void(Ut.current&&(Ut.current=null,Qt(null),yt&&yt(null),Wt()));const c=Or(l.datum||{},l.x,l.y,{...l.stats&&{stats:l.stats},...l.category&&{category:l.category},__oAccessor:"string"==typeof vt?vt:void 0,__rAccessor:"string"==typeof xt?xt:void 0,__chartType:n});Ut.current=c,Qt(c),yt&&(yt(c),wt.current=!0),Wt()},An.current=()=>{Ut.current&&(Ut.current=null,Qt(null),yt&&(yt(null),wt.current=!0),Wt())};const jn=(0,k.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!pt)return;const o=kn.current;if(!o)return pt(null),wt.current=!0,void Wt();const r=o.getBoundingClientRect(),i=e.clientX-r.left-jt.left,s=e.clientY-r.top-jt.top;if(0>i||i>_t||0>s||s>Rt)return pt(null),wt.current=!0,void Wt();const a=gn.current;if(!a||0===a.scene.length)return pt(null),wt.current=!0,void Wt();const l="radial"===p,c=At(a.scene,l?i-_t/2:i,l?s-Rt/2:s,30,a.pointQuadtree,a.maxPointRadius);if(!c)return pt(null),wt.current=!0,void Wt();var u;pt(Or(c.datum||{},c.x,c.y,{...c.stats&&{stats:c.stats},...c.category&&{category:c.category},__oAccessor:"string"==typeof vt?vt:void 0,__rAccessor:"string"==typeof xt?xt:void 0,__chartType:n}),{type:"activate",inputType:(u=e.nativeEvent.pointerType,"touch"===u?"touch":"pointer")}),wt.current=!0,Wt()},[pt,kn,jt.left,jt.top,_t,Rt,p,vt,xt,n,Wt]),{kbFocusIndexRef:_n,focusedNavPointRef:Rn,onKeyDown:Pn}=function({chartType:e,oAccessor:t,rAccessor:n,...o}){return function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,ds.useRef)(-1),u=(0,ds.useRef)(null),d=(0,ds.useRef)(null),h=(0,ds.useCallback)(h=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(h))return;const f=e.current;if(!f)return;const m=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||m());let g;if(d.current?.version===f.version)g=d.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||m());g=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.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 n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),d.current={version:f.version,graph:g}}let y=c.current;if(g.flat.length>y||(m(),y=-1),("Enter"===h.key||" "===h.key)&&y>=0)return h.preventDefault(),void i(l(g.flat[y],f),{type:"activate",inputType:"keyboard"});if(0>y){if("Escape"===h.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(h.key))return;h.preventDefault(),c.current=0;const e=g.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const p=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?hs(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?hs(n,n.groups[e-1],i[r]):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}}(h.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(g,y),g);if(null===p)return;if(h.preventDefault(),0>p)return void m();c.current=p;const b=g.flat[p];u.current=b;const v=l(b,f);t.current=v,o(v),r(v,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:h}}({...o,extractPoints:fs,toHover:o=>({...ms(o),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof n?n:void 0,__chartType:e})})}({storeRef:gn,hoverRef:Ut,setHoverPoint:Qt,customHoverBehavior:yt,customClickBehavior:pt,scheduleRender:Wt,chartType:n,oAccessor:vt,rAccessor:xt}),Ln=(0,k.useCallback)(e=>{_n.current=-1,Rn.current=null,Mn(e)},[Rn,_n,Mn]);Nt.current=()=>{if(Ft.current=null,!Et.isActive)return;const e=kn.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const o=gn.current;if(!o)return;const r=Et.now(),i=o.advanceTransition(St.current?r+1e6:r),s=!St.current&&i,a=cn.current.w!==_t||cn.current.h!==Rt,l=wt.current;let c=!1;const u=dn.current.beforeCompute(o.getLastUpdateResult(),s);!l&&!a||s&&!a||(o.computeScene({width:_t,height:Rt}),cn.current={w:_t,h:Rt},c=!0,yn()),dn.current.afterCompute(u,c,a),wt.current=l&&s&&!c;const d=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,c,un);(c||s)&&e.setAttribute("aria-label",gr(o.scene,n+" chart"));const h=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),f=Ct[0]*h,m=Ct[1]*h;e.width===f&&e.height===m||(e.width=f,e.height=m,e.style.width=Ct[0]+"px",e.style.height=Ct[1]+"px"),t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,Ct[0],Ct[1]);const g=Ue&&o.lastIngestTime>0&&r-o.lastIngestTime>(Ue?.threshold??5e3);g&&(t.globalAlpha=Ue?.dimOpacity??.5);const y="radial"===p;t.save(),t.beginPath(),t.rect(jt.left,jt.top,_t,Rt),t.clip(),y?(t.save(),t.translate(jt.left+_t/2,jt.top+Rt/2)):t.translate(jt.left,jt.top);const b=ht?ts.custom:ts[n]||[],v={width:_t,height:Rt},x=o.scales;x&&function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=os(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(rs(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:J,pixelRatio:h,paintBuiltIn:e=>{for(const n of b)n(t,e,x,v)}}),y&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&o.scales?(Jt(o.scales),rn(e=>e+1),sn.current=r):s&&o.scales&&r-sn.current>=33&&(rn(e=>e+1),sn.current=r),Ue?.showBadge&&ln(!!g),(s||null!=o.activeTransition||d.pending)&&Wt()},function(e,t,n,o,r,i){const s=(0,It.useRef)("fresh");(0,It.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return $t;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...Tt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:$t}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(Ue,gn,wt,Wt,an,ln);const In=hn&&Kt?pe?pe(Kt):(0,gs.jsx)(as,{hover:Kt}):null,Tn="radial"===p,$n=In?(0,gs.jsx)(Kr,{x:Kt?Tn?Kt.x+_t/2:Kt.x:0,y:Kt?Tn?Kt.y+Rt/2:Kt.y:0,containerWidth:_t,containerHeight:Rt,margin:jt,className:"stream-ordinal-tooltip",children:In}):null,Bn="horizontal"===p?vt:xt,On=bo("horizontal"===p?xt:vt,void 0,"__semiotic_resolvedO",""),Hn=bo(Bn,void 0,"__semiotic_resolvedR",""),Fn=On.key,Nn=Hn.key,Wn=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(On,Hn,Se&&Se.length>0||!1);if(Uo||!Dt&&zt){const e=gn.current;e&&r&&(e.ingest({inserts:qt,bounded:!0}),e.computeScene({width:_t,height:Rt}));const t=e?.scene??[],n=e?.scales??null,o=wi(Fe,Ct,jt,n),i=wi(He,Ct,jt,n),s="radial"===p,a=s?jt.left+_t/2:jt.left,l=s?jt.top+Rt/2:jt.top;return(0,gs.jsxs)("div",{ref:Mt,className:"stream-ordinal-frame"+(We?" "+We:""),role:"img","aria-label":lt||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:v?"100%":Ct[0],height:x?"100%":Ct[1]},children:[(0,gs.jsx)(Rr,{summary:ct}),(0,gs.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ct[0],height:Ct[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,gs.jsx)("g",{transform:`translate(${jt.left},${jt.top})`,children:i}),(0,gs.jsxs)("g",{transform:`translate(${a},${l})`,children:[Ee&&(0,gs.jsx)("rect",{x:0,y:0,width:_t,height:Rt,fill:Ee}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=os(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(rs(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:J,fallback:()=>Xo(e,t,Ht)})).filter(Boolean)]})]}),(0,gs.jsx)(po,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:n,showAxes:ne,showCategoryTicks:oe,oLabel:Gt,rLabel:Vt,oFormat:Yt,rFormat:Xt,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:me,showGrid:je,title:Ne,legend:_e,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Ie,legendPosition:Te,legendLayout:$e,foregroundGraphics:ot(o,ut(gn.current?.customLayoutOverlays,gt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:we??xe,chartId:ke,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Me,svgAnnotationRules:Ce,annotationFrame:0,xAccessor:Fn,yAccessor:Nn,annotationData:Wn(e?.getData())}),De&&"radial"===p&&(0,gs.jsx)("div",{style:{position:"absolute",left:jt.left+_t/2,top:jt.top+Rt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:De})]})}return(0,gs.jsxs)("div",{ref:Mt,className:"stream-ordinal-frame"+(We?" "+We:""),role:"group","aria-label":lt||("string"==typeof Ne?Ne:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":Ct[0],height:x?"100%":Ct[1],overflow:"visible"},onKeyDown:Pn,children:["production"!==process.env.NODE_ENV&&gn.current&&(0,gs.jsx)(tt,{store:gn.current,diagnostics:dn.current}),at&&(0,gs.jsx)(Pr,{tableId:Ht}),at&&(0,gs.jsx)(_r,{scene:gn.current?.scene??[],chartType:n+" chart",tableId:Ht,chartTitle:"string"==typeof Ne?Ne:void 0}),(0,gs.jsx)(Rr,{summary:ct}),(0,gs.jsx)(ur,{hoverPoint:Kt}),(0,gs.jsxs)("div",{role:"img","aria-label":lt||("string"==typeof Ne?Ne:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:hn?Ln:void 0,onMouseLeave:hn?Cn:void 0,onClick:bt?jn:void 0,children:[(0,gs.jsxs)(vi,{size:Ct,margin:jt,children:[nn,tn]}),(0,gs.jsx)(go,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:Zt,showAxes:ne,showGrid:je,rFormat:Xt,rTickValues:he,axisExtent:me}),(0,gs.jsx)("canvas",{ref:kn,"aria-label":gr(gn.current?.scene??[],n+" chart"),style:{position:"absolute",top:0,left:0,width:Ct[0],height:Ct[1]}}),(0,gs.jsx)(po,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:Zt,showAxes:ne,showCategoryTicks:oe,oLabel:Gt,rLabel:Vt,oFormat:Yt,rFormat:Xt,rTickValues:he,axisExtent:me,showGrid:je,title:Ne,legend:_e,legendHoverBehavior:Re,legendClickBehavior:Pe,legendHighlightedCategory:Le,legendIsolatedCategories:Ie,legendPosition:Te,legendLayout:$e,foregroundGraphics:ot(en,ut(gn.current?.customLayoutOverlays,gt??null)),annotations:Se,onAnnotationActivate:Ae,onObservation:we??xe,chartId:ke,chartType:"StreamOrdinalFrame",autoPlaceAnnotations:Me,svgAnnotationRules:Ce,annotationFrame:on,xAccessor:Fn,yAccessor:Nn,annotationData:Wn(gn.current?.getData()),underlayRendered:!0,canvasObscuresUnderlay:!1}),(it||st)&&"radial"!==p&&(0,gs.jsx)(So,{width:_t,height:Rt,totalWidth:Ct[0],totalHeight:Ct[1],margin:jt,scales:Zt,onBrush:st||(()=>{})}),De&&"radial"===p&&(0,gs.jsx)("div",{style:{position:"absolute",left:jt.left+_t/2,top:jt.top+Rt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:De}),Ue?.showBadge&&(0,gs.jsx)(Ot,{isStale:an,position:Ue.badgePosition}),(0,gs.jsx)(Tr,{active:_n.current>=0,hoverPoint:Kt,margin:jt,size:Ct,shape:Rn.current?.shape,width:Rn.current?.w,height:Rn.current?.h}),$n]})]})}));ps.displayName="StreamOrdinalFrame";var bs=ps;function vs(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function xs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};o&&(f.annotationObservationCallback=o);const m=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=m&&(f.hoverRadius=m),f}function ws(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Xr(t)||n}}var ks=require("react"),Ss=require("react"),As=require("react"),Ms=(require("react/jsx-runtime"),(0,As.createContext)(null));function Cs(){return(0,As.useContext)(Ms)}var js=require("react");function _s(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Rs(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ps(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Ls,Is]=Mn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Ps(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=Rs(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=Rs(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),Ts=require("react"),$s=(require("react"),{positions:new Map}),Bs=new Set;function Os(){for(const e of Bs)e()}function Hs(e,t){const n=$s.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map($s.positions);o.delete(e),$s={positions:o},Os()}function Fs(e,t){const n=$s.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map($s.positions);o.delete(e),$s={positions:o},Os()}function Ns(e){const t=(0,Ts.useId)(),n=e.clientId||t,{name:o}=e,r=Is(e=>e.selections.get(o)),i=Is(e=>e.setClause),s=Is(e=>e.clearClause),a=(0,Ts.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Ts.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(_s(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,Ts.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,Ts.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,Ts.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Ws(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Es(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime");var Ds=(0,js.createContext)(!1);(0,js.createContext)(!1);var zs=(0,js.createContext)(null),qs="undefined"==typeof window?js.useEffect:js.useLayoutEffect;function Gs(e){const t=(0,js.useContext)(zs),n=(0,js.useId)(),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),r=(0,js.useRef)([]);(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})(r.current,o)||(r.current=o);const i=r.current;qs(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),qs(()=>{t&&t.registerCategories(n,i)},[t,n,i])}function Vs({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):oe[i%oe.length];return{label:r+"",color:a}}),label:""}]}}var Ys=g(require("react"));function Xs(){return ai(e=>e.theme)}function Us(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ks(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Qs(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>Ks(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Us(e[o])&&Us(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}require("react/jsx-runtime"),Ys.createContext(void 0);var Zs={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Js(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return Zs;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}var ea={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}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function ta(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function na(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function oa(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?{...t,xValue:e.xValue}:t||{}}function ra(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ia=[];function sa(){const e=Xs(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function aa(e,t,n){return(0,Ss.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const o=[...e],r="function"==typeof(i=n)?i:e=>e[i];var i;return o.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,n])}function la(e,t,n){return function(e,t,n){const o=ea[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Qs({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e||"primary",l=ea[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&n?.height?n.height:l.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:ta(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Js(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var ca=require("react/jsx-runtime");function ua(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function da(e,t){if(!t)return ua(e);try{const n=t(e);return null==n?ua(e):n}catch{return ua(e)}}function ha(e,t){return"function"==typeof t?t(e):e[t]}function fa({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=ha(a,e),c=ha(a,t),u=n?ha(a,n):void 0;return(0,ca.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[(0,ca.jsx)("div",{style:{fontWeight:"bold"},children:ua(l)}),(0,ca.jsx)("div",{style:{marginTop:4},children:da(c,i)}),null!=u&&(0,ca.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[o||(d=n,"string"==typeof d?d:"value"),": ",ua(u)]})]});var d}}var ma=require("react/jsx-runtime");function ga({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,ma.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,ma.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,ma.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,ma.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,ma.jsx)("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:n})]})})}var ya=g(require("react")),pa=require("react/jsx-runtime"),ba=class extends ya.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,pa.jsx)(ga,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},va=require("react/jsx-runtime"),xa="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function wa({componentName:e,width:t,height:n,children:o}){return(0,va.jsx)(ba,{fallback:o=>(0,va.jsx)(ga,{componentName:e,message:o.message,width:t,height:n}),children:o})}var ka={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Sa={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Aa(e,t,n,o){if(!xa)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function Ma(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Ca(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=Ma(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function ja({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=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[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Ca(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var _a=require("react"),Ra=require("react");function Pa(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:m,legend:g,userMargin:y,marginDefaults:p,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:M,width:C,height:j}=e,_=void 0===n,R=(0,_a.useMemo)(()=>A(t),[t]),[P,L]=(0,_a.useState)([]),I=(0,_a.useCallback)(e=>{L(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),T="string"==typeof e.colorBy?e.colorBy:void 0,$=(0,_a.useMemo)(()=>Js(x,{width:C,mobileSemantics:w}),[x,C,w]),{activeSelectionHook:B,hoverSelectionHook:O,customHoverBehavior:H,customClickBehavior:F,crosshairSourceId:N}=function({selection:e,linkedHover:t,fallbackFields:n=ia,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,Ss.useId)(),h=(0,Ss.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,Ss.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),m=Ns({name:e?.name||"__unused__",fields:f}),g=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Ns({name:t,fields:n});return{onHover:(0,Ts.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Es(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:h?.name||"hover",fields:f}),y=_n(e=>e.pushObservation),p=(0,Ss.useCallback)(e=>{r?.(e),y?.(e)},[r,y]),b=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,x]=(0,Ss.useState)(null),w=(0,Ss.useRef)(!1),k=c||n[0],S=(0,Ss.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),A=(0,Ss.useCallback)((e,n)=>{const o=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=na(e,t,h.xField);null!=n&&function(e,t,n){const o=$s.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||($s={positions:new Map($s.positions).set(e,{xValue:t,sourceId:n})},Os())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Hs(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else o||x(null);(r||y)&&ls({onObservation:p,datum:e?oa(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,g,h,d,r,i,s,y,p,l,k,u]),M=(0,Ss.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&l&&x(null),"x-position"===h?.mode&&(Fs(h.name||"hover",d),Hs(h.name||"hover",d))},[t,h,g,e,u,m,l,d]),C=(0,Ss.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=na(n,e,h.xField);null!=t&&function(e,t,n){const o=$s.positions.get(e);if(o?.locked){const t=new Map($s.positions);return t.delete(e),$s={positions:t},Os(),!1}$s={positions:new Map($s.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Os()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const o=oa(n);if(t&&"x-position"!==h?.mode&&g.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}ra(e)&&m.selectPoints(e)}if(l&&k){const e=o?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||y)&&cs({onObservation:p,datum:n?oa(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,y,p,i,s,h,d,u,t,g,e,m,f,l,k,M]);return(0,Ss.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,Ss.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,Ss.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Fs(e,d),Hs(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:S,customHoverBehavior:A,customClickBehavior:C,crosshairSourceId:d}}({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:b,hoverHighlight:v,colorByField:T,mobileInteraction:$}),W=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,N),E=function(e,t,n){const o=Cs(),r=sa();return(0,Ss.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&ra(i)){const e=ae(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return ae(n.map(e=>({_cat:e})),"_cat",s)}if(i&&ra(i)){const n=ae(e,t,s);return e=>i[e]||n(e)}return ae(e,t,s)}if(i&&ra(i)){const e=ae([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}(R,o,r),D=(0,_a.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of R){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[R,o]),z=(0,_a.useMemo)(()=>_&&P.length>0?P:D,[_,P,D]),q=function(e,t,n){const[o,r]=(0,Ss.useState)(null),[i,s]=(0,Ss.useState)(new Set),a=(0,Ss.useMemo)(()=>new Set,[]),l=(0,Ss.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,Ss.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,Ss.useMemo)(()=>{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&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,z),G=(0,_a.useMemo)(()=>O||(q.legendSelectionHook?q.legendSelectionHook:B),[O,q.legendSelectionHook,B]),V=function(e){const t=ai(e=>e.theme.colors.selectionOpacity);return(0,Ra.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(a),Y=sa(),X=Cs(),U=(0,_a.useMemo)(()=>{if(E)return E;if(!o||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:oe,t="__streamCat",n=ae(z.map(e=>({[t]:e})),t,e);return e=>X?.[e]||n(e)||"#999"},[E,o,z,r,Y,X]),{legend:K,margin:Q,legendPosition:Z}=function({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l}){const c=(0,js.useContext)(Ds),u=null!==(0,js.useContext)(zs),d=void 0!==o?o:!c&&!!t,h=!!t&&(d||u),f=(0,Ss.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;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)},[a,t,e,h]);Gs(u&&t?f:[]);const m=(0,Ss.useMemo)(()=>{if(!d||!t)return;const o=Vs({data:e,colorBy:t,colorScale:n,getColor:ie,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[d,t,e,n,f]),g=(0,Ss.useMemo)(()=>function(...e){let t;for(const n of e)n&&(t=Yt(t)&&Yt(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}(m,l),[m,l]),y=(0,Ss.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return g&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,g,r]);return{legend:g,margin:y,legendPosition:r}}({data:R,colorBy:o,colorScale:U,showLegend:m,legendPosition:s,userMargin:y,defaults:p,categories:z,additionalLegend:g}),J=(0,_a.useMemo)(()=>{const e={};return K&&(e.legend=K,e.legendPosition=Z),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),_&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=I),e},[K,Z,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,_,o,I]),ee=Array.isArray(n)?A(n):n,te=function(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,va.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,va.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,va.jsx)("div",{className:"semiotic-loading-bar",style:{...Sa,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}(k,C,j,S),ne=te?null:function(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,va.jsx)("div",{style:{...ka,width:t,height:n},children:o||"No data available"}):null}(ee,C,j,M);return{data:R,colorScale:E,allCategories:z,legendState:q,effectiveSelectionHook:G,activeSelectionHook:B,customHoverBehavior:H,customClickBehavior:F,mobileInteraction:$,legend:K,margin:Q,legendPosition:Z,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:W,resolvedSelection:V}}var La=require("react");function Ia({ref:e,frameRef:t,setup:n}){return(0,La.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,n)=>t.current?.update(e,n)??[],replace:e=>t.current?.replace(e),clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}var Ta=require("react");function $a(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return 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)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Ba(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Fa(t(e))}function Oa(e,t){const n=Ba(e),o=Ba(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function Ha(e,t){const n=Ba(t??"value"),o=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=o?o(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function Fa(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Na(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=Fa(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function Wa(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):Na(o,t,n))}function Ea(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!Wa(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function Da(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,Ea(s,t,n(s,i))),a}:r}function za(e,t,n){return e&&0!==e.length?(o,r)=>{const i=Ea(o,e,t(o,r)),s=n?n(o,r):void 0;return s?{...i,...s}:i}:n}function qa(e){const{colorBy:t,colorScale:n,color:o,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:m,linkStrokeToFill:g=!1,styleRules:y,resolveRuleValue:p}=e,b=(0,Ta.useMemo)(()=>(e,a)=>{const l="function"==typeof m?m(e,a):m,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!n)return c;c.fill=ie(e,t,n)}else c.fill=function(e,t,n,o,r){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=se(n,o);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=te[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=o?(r.has(o)||r.set(o,r.size),i[r.get(o)%i.length]):i[0]:"#007bff"}(o,r,i,f?a:void 0,s);if(y&&y.length>0){const t=Ea(e,y,{value:p?p(e):void 0,category:a});Object.assign(c,t)}return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,n,o,r,i,s,f,m,g,y,p]),v=(0,Ta.useMemo)(()=>$a(a?"function"==typeof a?(e,t)=>({...b(e,t),...a(e,t)||{}}):(e,t)=>({...b(e,t),...a}):b,{stroke:l,strokeWidth:c,opacity:u}),[b,a,l,c,u]);return(0,Ta.useMemo)(()=>{return e=v,n=h,(t=d??null)?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e;var e,t,n},[v,d,h])}function Ga(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Va=require("react/jsx-runtime"),Ya=(0,ks.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,ks.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:f=!1,barPadding:m=40,roundedTop:g,gradientFill:y=!1,styleRules:p,baselinePadding:b=!1,tooltip:v,annotations:x,regression:w,valueExtent:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:O,stroke:H,strokeWidth:F,opacity:N,showCategoryTicks:W,categoryFormat:E,dataIdAccessor:D}=e,{width:z,height:q,enableHover:G,showGrid:V,showLegend:Y,title:X,description:U,summary:K,accessibleTable:Q,categoryLabel:Z,valueLabel:J}=n,ee=(0,ks.useMemo)(()=>A(r),[r]),te=Pa({data:ee,rawData:r,colorBy:d,colorScheme:h,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:Y,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:z,height:q}),{effectiveLegendProps:ne,effectiveMargin:oe}=Ia({ref:t,frameRef:o,setup:te});Aa("BarChart",ee,"categoryAccessor",a),Aa("BarChart",ee,"valueAccessor",l);const re=aa(ee,f,l),ie=sa(),se=(0,ks.useMemo)(()=>new Map,[]),ae=(0,ks.useMemo)(()=>Ba(l),[l]),le=qa({colorBy:d,colorScale:te.colorScale,color:O,themeCategorical:ie,colorScheme:h,categoryIndexMap:se,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:F,opacity:N,styleRules:p,resolveRuleValue:ae,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ce=(0,ks.useMemo)(()=>fa({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(te.earlyReturn)return te.earlyReturn;const ue=ja({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ue)return(0,Va.jsx)(ga,{componentName:"BarChart",message:ue,width:z,height:q});const de=Ga(w),he=de?[de,...x||[]]:x,fe={chartType:"bar",...null!=r&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:le,size:[z,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:m,...null!=g&&{roundedTop:g},...y&&{gradientFill:!0===y?{topOpacity:.8,bottomOpacity:.05}:y},...D&&{dataIdAccessor:D},baselinePadding:b,enableHover:G,showAxes:n.showAxes,oLabel:Z,rLabel:J,rFormat:u,...E&&{oFormat:E},showGrid:V,showCategoryTicks:W,oSort:f,...ne,...vs({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:v,defaultTooltipContent:ce}),...xs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...he&&he.length>0&&{annotations:he},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,Va.jsx)(wa,{componentName:"BarChart",width:z,height:q,children:(0,Va.jsx)(bs,{ref:o,...fe})})});Ya.displayName="BarChart";var Xa=require("react"),Ua=require("react/jsx-runtime"),Ka=(0,Xa.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Xa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,normalize:m=!1,sort:g=!1,barPadding:y=40,roundedTop:p,styleRules:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:O,stroke:H,strokeWidth:F,opacity:N,categoryFormat:W}=e,{width:E,height:D,enableHover:z,showGrid:q,showLegend:G,title:V,description:Y,summary:X,accessibleTable:U,categoryLabel:K,valueLabel:Q}=n,Z=(0,Xa.useMemo)(()=>A(r),[r]),J=h||l,ee=Pa({data:Z,rawData:r,colorBy:J,colorScheme:f,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:E,height:D}),te=sa(),ne=(0,Xa.useMemo)(()=>new Map,[]),oe=(0,Xa.useMemo)(()=>Ba(c),[c]),re=qa({colorBy:J,colorScale:ee.colorScale,color:O,themeCategorical:te,colorScheme:f,categoryIndexMap:ne,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:F,opacity:N,styleRules:b,resolveRuleValue:oe,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=(0,Xa.useMemo)(()=>fa({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),se=ja({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ae,effectiveMargin:le}=Ia({ref:t,frameRef:o,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const ce={chartType:"bar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,stackBy:l,normalize:m,oSort:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:re,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:le,barPadding:y,...null!=p&&{roundedTop:p},baselinePadding:v,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:K,rLabel:Q,rFormat:d,...W&&{oFormat:W},showGrid:q,...ae,...vs({title:V,description:Y,summary:X,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:x,defaultTooltipContent:ie}),...xs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return se?(0,Ua.jsx)(ga,{componentName:"StackedBarChart",message:se,width:E,height:D}):(0,Ua.jsx)(wa,{componentName:"StackedBarChart",width:E,height:D,children:(0,Ua.jsx)(bs,{ref:o,...ce})})});Ka.displayName="StackedBarChart";var Qa=require("react"),Za=require("react/jsx-runtime"),Ja=(0,Qa.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Qa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:f,sort:m=!1,barPadding:g=60,roundedTop:y,styleRules:p,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:O,strokeWidth:H,opacity:F,categoryFormat:N}=e,{width:W,height:E,enableHover:D,showGrid:z,showLegend:q,title:G,description:V,summary:Y,accessibleTable:X,categoryLabel:U,valueLabel:K}=n,Q=(0,Qa.useMemo)(()=>A(r),[r]),Z=h||l,J=Pa({data:Q,rawData:r,colorBy:Z,colorScheme:f,legendInteraction:T,legendPosition:$,selection:S,linkedHover:M,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GroupedBarChart",chartId:R,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:P,loadingContent:L,emptyContent:I,width:W,height:E}),ee=sa(),te=(0,Qa.useMemo)(()=>new Map,[]),ne=(0,Qa.useMemo)(()=>Ba(c),[c]),oe=qa({colorBy:Z,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:f,categoryIndexMap:te,userPieceStyle:k.pieceStyle,stroke:O,strokeWidth:H,opacity:F,styleRules:p,resolveRuleValue:ne,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Qa.useMemo)(()=>fa({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ie=ja({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:se,effectiveMargin:ae}=Ia({ref:t,frameRef:o,setup:J});if(J.earlyReturn)return J.earlyReturn;const le={chartType:"clusterbar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,groupBy:l,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[W,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ae,barPadding:g,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...N&&{oFormat:N},showGrid:z,...se,...vs({title:G,description:V,summary:Y,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:v,defaultTooltipContent:re}),...xs({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:J.mobileInteraction,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 ie?(0,Za.jsx)(ga,{componentName:"GroupedBarChart",message:ie,width:W,height:E}):(0,Za.jsx)(wa,{componentName:"GroupedBarChart",width:W,height:E,children:(0,Za.jsx)(bs,{ref:o,...le})})});Ja.displayName="GroupedBarChart";var el=require("react"),tl=require("react");function nl({brushProp:e,onBrushProp:t,linkedBrush:n,valueAccessor:o}){const r=(i="string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const s="string"==typeof o?o:"value",a=function(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ns({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,Ts.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&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"===l&&Ws(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Ws(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Es(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,Ts.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||s}),l=(0,tl.useRef)(a.brushInteraction);l.current=a.brushInteraction;const c=(0,tl.useCallback)(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||n||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}var ol=require("react/jsx-runtime"),rl=(0,el.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,el.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:f,barPadding:m,tooltip:g,annotations:y,brush:p,onBrush:b,linkedBrush:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:O,categoryFormat:H,rTickValues:F,tickLabelEdgeAlign:N,showCategoryTicks:W,gradientFill:E,trackFill:D,roundedTop:z,valueExtent:q}=e,{width:G,height:V,enableHover:Y,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,el.useMemo)(()=>A(r),[r]),oe=h||l,re=(0,el.useMemo)(()=>{if(null!=m)return m;if("sparkline"!==n.mode)return 40;const e=new Set(ne.map(e=>"function"==typeof a?a(e):e[a])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*t)/(t-1))):1},[m,n.mode,ne,a,u,G,V]),ie=Pa({data:ne,rawData:r,colorBy:oe,colorScheme:f,legendInteraction:L,legendPosition:I,selection:w,linkedHover:k,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwimlaneChart",chartId:j,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:G,height:V}),se=nl({brushProp:p,onBrushProp:b,linkedBrush:v,valueAccessor:c}),ae=sa(),le=(0,el.useMemo)(()=>new Map,[]),ce=qa({colorBy:oe,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:f,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:$,strokeWidth:B,opacity:O,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,el.useMemo)(()=>fa({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=ja({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=Ia({ref:t,frameRef:o,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const me={chartType:"swimlane",...null!=r&&{data:ne},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:!1===W?void 0:ee,rLabel:te,rFormat:d,...F&&{rTickValues:F},...null!=N&&{tickLabelEdgeAlign:N},...H&&{oFormat:H},...void 0!==W&&{showCategoryTicks:W},showGrid:X,...he,...vs({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:g,defaultTooltipContent:ue}),...xs({linkedHover:k,selection:w,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...y&&y.length>0&&{annotations:y},...E&&{gradientFill:!0===E?{topOpacity:.8,bottomOpacity:.05}:E},...null!=D&&{trackFill:D},...null!=z&&{roundedTop:z},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?(0,ol.jsx)(ga,{componentName:"SwimlaneChart",message:de,width:G,height:V}):(0,ol.jsx)(wa,{componentName:"SwimlaneChart",width:G,height:V,children:(0,ol.jsx)(bs,{ref:o,...me})})});rl.displayName="SwimlaneChart";var il=require("react"),sl=require("react");function al(e,t){const{variant:n,frameRef:o,overrides:r}=t,i=(0,sl.useRef)(r);i.current=r,(0,sl.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=i.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!i.current||!(t in i.current))||Reflect.has(e,t)})},[])}var ll=require("react/jsx-runtime"),cl=(0,il.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,il.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sizeBy:f,sizeRange:m=[3,8],symbolBy:g,symbolMap:y,pointRadius:p=4,pointOpacity:b=.7,categoryPadding:v=20,tooltip:x,annotations:w,valueExtent:k,brush:S,onBrush:M,linkedBrush:C,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:$,loadingContent:B,emptyContent:O,legendInteraction:H,legendPosition:F,color:N,stroke:W,strokeWidth:E,opacity:D,showCategoryTicks:z,categoryFormat:q}=e,{width:G,height:V,enableHover:Y,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=n,ne=(0,il.useMemo)(()=>A(r),[r]),oe=Pa({data:ne,rawData:r,colorBy:d,colorScheme:h,legendInteraction:H,legendPosition:F,selection:_,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SwarmPlot",chartId:T,showLegend:U,userMargin:i,marginDefaults:n.marginDefaults,loading:$,loadingContent:B,emptyContent:O,width:G,height:V}),re=nl({brushProp:S,onBrushProp:M,linkedBrush:C,valueAccessor:l}),ie=(0,il.useMemo)(()=>{if(f)return xe(ne.map(e=>"function"==typeof f?f(e):e[f]))},[ne,f]),se=sa(),ae=(0,il.useMemo)(()=>new Map,[]),ce=qa({colorBy:d,colorScale:oe.colorScale,color:N,themeCategorical:se,colorScheme:h,categoryIndexMap:ae,userPieceStyle:j?.pieceStyle,stroke:W,strokeWidth:E,opacity:D,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:f?le(e,f,m,ie):p})}),ue=(0,il.useMemo)(()=>fa({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(oe.earlyReturn)return oe.earlyReturn;const de=ja({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(de)return(0,ll.jsx)(ga,{componentName:"SwarmPlot",message:de,width:G,height:V});const he={chartType:"swarm",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,...g&&{symbolAccessor:g},...y&&{symbolMap:y},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,barPadding:v,enableHover:Y,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:ee,rLabel:te,rFormat:u,...q&&{oFormat:q},showGrid:X,showCategoryTicks:z,...oe.legendBehaviorProps,...vs({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:x,defaultTooltipContent:ue}),...xs({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...re.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,ll.jsx)(wa,{componentName:"SwarmPlot",width:G,height:V,children:(0,ll.jsx)(bs,{ref:o,...he})})});cl.displayName="SwarmPlot";var ul=require("react"),dl=require("react/jsx-runtime");function hl(e){return t=>{const n=t.category||t.data&&t.data[0]?.category||"",o=t.stats||(t.data||t).stats;if(o&&null!=o.median)return(0,dl.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[n&&(0,dl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o.n&&(0,dl.jsxs)("div",{children:["n = ",o.n]}),null!=o.min&&(0,dl.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),null!=o.q1&&(0,dl.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,dl.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),null!=o.q3&&(0,dl.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),null!=o.max&&(0,dl.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),null!=o.mean&&(0,dl.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const o=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,dl.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[n&&(0,dl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),i>0&&(0,dl.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,dl.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,dl.jsx)("div",{className:"semiotic-tooltip",style:qr,children:(0,dl.jsx)("div",{style:{fontWeight:"bold"},children:n+""})})}}var fl=require("react/jsx-runtime"),ml=(0,ul.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,ul.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:f=!0,outlierRadius:m=3,categoryPadding:g=20,tooltip:y,annotations:p,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:O,categoryFormat:H}=e,{width:F,height:N,enableHover:W,showGrid:E,showLegend:D,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:Y,valueLabel:X}=n,U=(0,ul.useMemo)(()=>A(r),[r]),K=Pa({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:D,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:N}),Q=sa(),Z=(0,ul.useMemo)(()=>new Map,[]),J=qa({colorBy:d,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,ul.useMemo)(()=>hl(),[]);if(K.earlyReturn)return K.earlyReturn;const te=ja({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,fl.jsx)(ga,{componentName:"BoxPlot",message:te,width:F,height:N});const ne={chartType:"boxplot",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:f,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Y,rLabel:X,rFormat:u,...H&&{oFormat:H},showGrid:E,showCategoryTicks:O,...K.legendBehaviorProps,...vs({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:y,defaultTooltipContent:ee}),...xs({linkedHover:w,selection:x,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...p&&p.length>0&&{annotations:p},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,fl.jsx)(wa,{componentName:"BoxPlot",width:F,height:N,children:(0,fl.jsx)(bs,{ref:o,...ne})})});ml.displayName="BoxPlot";var gl=require("react"),yl=require("react/jsx-runtime"),pl=e=>{const t=e?.category;return null==t?"All":t+""},bl=(0,gl.forwardRef)(function(e,t){const n=la(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:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,gl.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a=pl,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:f,categoryPadding:m=("sparkline"===n.mode?0:20),tooltip:g,annotations:y,valueExtent:p,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:R,loadingContent:P,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:O,opacity:H,showCategoryTicks:F,categoryFormat:N}=e,{width:W,height:E,enableHover:D,showGrid:z,showLegend:q,title:G,description:V,summary:Y,accessibleTable:X,categoryLabel:U,valueLabel:K}=n,Q=(0,gl.useMemo)(()=>A(r),[r]),Z=Pa({data:Q,rawData:r,colorBy:h,colorScheme:f,legendInteraction:I,legendPosition:T,selection:k,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:n.marginDefaults,loading:R,loadingContent:P,emptyContent:L,width:W,height:E}),J=nl({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=(0,gl.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,n=-1/0;for(const o of Q){const r=e(o);null!=r&&isFinite(r)&&(t>r&&(t=r),r>n&&(n=r))}return t>n?void 0:[t,n]},[Q,l]),te=sa(),ne=(0,gl.useMemo)(()=>new Map,[]),oe=qa({colorBy:h,colorScale:Z.colorScale,color:$,themeCategorical:te,colorScheme:f,categoryIndexMap:ne,userPieceStyle:void 0,stroke:B,strokeWidth:O,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,gl.useMemo)(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return(0,yl.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[n&&(0,yl.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),null!=o&&(0,yl.jsxs)("div",{children:["Count: ",o]}),r&&2===r.length&&(0,yl.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=ja({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,yl.jsx)(ga,{componentName:"Histogram",message:ie,width:W,height:E});const se={chartType:"histogram",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:oe,bins:c,normalize:u,...p?{rExtent:p}:ee&&{rExtent:ee},size:[W,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:D,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:U,rLabel:K,rFormat:d,...N&&{oFormat:N},showGrid:z,showCategoryTicks:F,...Z.legendBehaviorProps,...vs({title:G,description:V,summary:Y,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:g,defaultTooltipContent:re}),...xs({linkedHover:S,selection:k,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...y&&y.length>0&&{annotations:y},...J.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,yl.jsx)(wa,{componentName:"Histogram",width:W,height:E,children:(0,yl.jsx)(bs,{ref:o,...se})})});bl.displayName="Histogram";var vl=require("react"),xl=require("react/jsx-runtime"),wl=(0,vl.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,vl.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:f,colorBy:m,colorScheme:g,categoryPadding:y=20,tooltip:p,annotations:b,valueExtent:v,brush:x,onBrush:w,linkedBrush:k,frameProps:S={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:R,chartId:P,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:O,stroke:H,strokeWidth:F,opacity:N,showCategoryTicks:W,categoryFormat:E}=e,{width:D,height:z,enableHover:q,showGrid:G,showLegend:V,title:Y,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=n,J=(0,vl.useMemo)(()=>A(r),[r]),ee=Pa({data:J,rawData:r,colorBy:m,colorScheme:g,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ViolinPlot",chartId:P,showLegend:V,userMargin:i,marginDefaults:n.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:D,height:z}),te=nl({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:l}),ne=sa(),oe=(0,vl.useMemo)(()=>new Map,[]),re=qa({colorBy:m,colorScale:ee.colorScale,color:O,themeCategorical:ne,colorScheme:g,categoryIndexMap:oe,userPieceStyle:void 0,stroke:H,strokeWidth:F,opacity:N,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,vl.useMemo)(()=>hl({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=ja({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,xl.jsx)(ga,{componentName:"ViolinPlot",message:se,width:D,height:z});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:h,size:[D,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Q,rLabel:Z,rFormat:f,...E&&{oFormat:E},showGrid:G,showCategoryTicks:W,...ee.legendBehaviorProps,...vs({title:Y,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:p,defaultTooltipContent:ie}),...xs({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:R,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,xl.jsx)(wa,{componentName:"ViolinPlot",width:D,height:z,children:(0,xl.jsx)(bs,{ref:o,...ae})})});wl.displayName="ViolinPlot";var kl=require("react"),Sl=require("react/jsx-runtime"),Al=(0,kl.forwardRef)(function(e,t){const n=la(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,kl.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:f="auto",dotRadius:m=5,categoryPadding:g=10,tooltip:y,annotations:p,regression:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:R,emptyContent:P,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:O,categoryFormat:H}=e,{width:F,height:N,enableHover:W,showGrid:E,showLegend:D,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:Y,valueLabel:X}=n,U=(0,kl.useMemo)(()=>A(r),[r]),K=Pa({data:U,rawData:r,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:I,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DotPlot",chartId:j,showLegend:D,userMargin:i,marginDefaults:n.marginDefaults,loading:_,loadingContent:R,emptyContent:P,width:F,height:N}),Q=aa(U,f,l),Z=sa(),J=(0,kl.useMemo)(()=>new Map,[]),ee=qa({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:$,strokeWidth:B,opacity:O,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),te=(0,kl.useMemo)(()=>fa({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const ne=ja({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ne)return(0,Sl.jsx)(ga,{componentName:"DotPlot",message:ne,width:F,height:N});const oe=Ga(b),re=oe?[oe,...p||[]]:p,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Y,rLabel:X,rFormat:u,...H&&{oFormat:H},showGrid:E,oSort:f,...K.legendBehaviorProps,...vs({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:y,defaultTooltipContent:te}),...xs({linkedHover:k,selection:w,onObservation:S,onClick:M,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...re&&re.length>0&&{annotations:re},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,Sl.jsx)(wa,{componentName:"DotPlot",width:F,height:N,children:(0,Sl.jsx)(bs,{ref:o,...ie})})});Al.displayName="DotPlot";var Ml=require("react"),Cl=require("react/jsx-runtime"),jl=(0,Ml.forwardRef)(function(e,t){const n=la(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Ml.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:f,annotations:m,frameProps:g={},selection:y,linkedHover:p,onObservation:b,onClick:v,hoverHighlight:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,legendInteraction:C,legendPosition:j,color:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:$,showLegend:B,title:O,description:H,summary:F,accessibleTable:N}=n,W=(0,Ml.useMemo)(()=>A(r),[r]),E=c||a,D=Pa({data:W,rawData:r,colorBy:E,colorScheme:u,legendInteraction:C,legendPosition:j,selection:y,linkedHover:p,fallbackFields:E?["string"==typeof E?E:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"PieChart",chartId:w,showLegend:B,userMargin:i,marginDefaults:n.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:I,height:T}),z=sa(),q=(0,Ml.useMemo)(()=>new Map,[]),G=qa({colorBy:E,colorScale:D.colorScale,color:_,themeCategorical:z,colorScheme:u,categoryIndexMap:q,userPieceStyle:g?.pieceStyle,stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:D.effectiveSelectionHook,resolvedSelection:D.resolvedSelection,cycleByCategory:!0}),V=(0,Ml.useMemo)(()=>fa({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),Y=ja({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:X,effectiveMargin:U}=Ia({ref:t,frameRef:o,setup:D});if(D.earlyReturn)return D.earlyReturn;const K={chartType:"pie",...null!=r&&{data:W},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=h&&{cornerRadius:h},size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...X,...vs({title:O,description:H,summary:F,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:f,defaultTooltipContent:V}),...xs({linkedHover:p,selection:y,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:D.mobileInteraction,customHoverBehavior:D.customHoverBehavior,customClickBehavior:D.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(g).filter(([e])=>"pieceStyle"!==e))};return Y?(0,Cl.jsx)(ga,{componentName:"PieChart",message:Y,width:I,height:T}):(0,Cl.jsx)(wa,{componentName:"PieChart",width:I,height:T,children:(0,Cl.jsx)(bs,{ref:o,...K})})});jl.displayName="PieChart";var _l=require("react"),Rl=require("react/jsx-runtime"),Pl=(0,_l.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),o=(0,_l.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:f=0,cornerRadius:m,tooltip:g,annotations:y,frameProps:p={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T}=e,{width:$,height:B,enableHover:O,showLegend:H,title:F,description:N,summary:W,accessibleTable:E}=n,D=(0,_l.useMemo)(()=>A(r),[r]),z=d||a,q=Pa({data:D,rawData:r,colorBy:z,colorScheme:h,legendInteraction:_,legendPosition:R,selection:b,linkedHover:v,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:H,userMargin:i,marginDefaults:n.marginDefaults,loading:M,loadingContent:C,emptyContent:j,width:$,height:B}),G=c??Math.max(2,.15*Math.min($,B)),V=sa(),Y=(0,_l.useMemo)(()=>new Map,[]),X=qa({colorBy:z,colorScale:q.colorScale,color:P,themeCategorical:V,colorScheme:h,categoryIndexMap:Y,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,_l.useMemo)(()=>fa({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=ja({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=Ia({ref:t,frameRef:o,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:D},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:X,innerRadius:G,startAngle:f,...null!=m&&{cornerRadius:m},centerContent:u,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...vs({title:F,description:N,summary:W,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:g,defaultTooltipContent:U}),...xs({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return K?(0,Rl.jsx)(ga,{componentName:"DonutChart",message:K,width:$,height:B}):(0,Rl.jsx)(wa,{componentName:"DonutChart",width:$,height:B,children:(0,Rl.jsx)(bs,{ref:o,...J})})});Pl.displayName="DonutChart";var Ll=require("react");function Il(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 Tl(e){return Math.max(0,Math.min(1,e))}function $l(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 Bl(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 Ol(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Tl(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=Tl(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],r=n[e+1];if(t.offset>o||o>r.offset)continue;const i=r.offset-t.offset,s=i>0?(o-t.offset)/i:0,a=$l(t.color),l=$l(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,m]=l;return Bl(c+(h-c)*s,u+(f-u)*s,d+(m-d)*s)}return n[n.length-1].color}function Hl(e,t,n){return null==n?`${e}-${t}`:`${e}-${t}-${n}`}var Fl=require("react/jsx-runtime"),Nl=(0,Ll.forwardRef)(function(e,t){const n=la(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),o=(0,Ll.useRef)(null),r="context"===n.mode,{compactMode:i}=n,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:m,showNeedle:g=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:p,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:j,opacity:_}=e,{width:R,height:P,title:L,description:I,summary:T,accessibleTable:$}=n,B=u&&"object"==typeof u?u:void 0,O=Math.max(a,Math.min(l,s)),H=l-a||1,F=(O-a)/H,{gaugeData:N,pieceStyle:W,gaugeAnnotations:E}=(0,Ll.useMemo)(()=>function(e){const{min:t,max:n,value:o,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:n,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const m=!!c&&c.colorStops.length>=2,g=[],y=new Map,p=[];if(m){const e=a?h:1,t=Hl("bg",0);if(g.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(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(Ol(c.colorStops,e*(t+.5)/n));const r=Hl("fill",0);g.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),y.set(r,{fill:o[0]||s})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],r=(o.value-e)/d,i=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=Hl("fill",n);g.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),y.set(e,{fill:o.color})}if(u>0){const e=Hl("bg",n);g.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&n>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:B}),[s,a,l,c,d,h,v,w,B]),D=(0,Ll.useMemo)(()=>$a(W,{stroke:C,strokeWidth:j,opacity:_}),[W,C,j,_]),{sweepRad:z,startAngleDeg:q}=Il(x),G=function(e=240){const{sweepRad:t,offsetRad:n}=Il(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 r=o.map(e=>e[0]),i=o.map(e=>e[1]),[s,a]=xe(r),[l,c]=xe(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(R,P)/12)),Y=G.cx,X=G.cy,U=Math.max(4,Math.min((R-2*V)/G.width,(P-2*V)/G.height)-2),K=Math.max(0,Math.min(U-1.5,U*(1-f))),Q=R/2-Y*U,Z=P/2-X*U,J=2*(U+4),ee=(0,Ll.useMemo)(()=>{if(i&&null==p)return null;if(null!=p)return"function"==typeof p?p(O,a,l):p;const e=b?b(O):Math.round(O)+"";return(0,Fl.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,Fl.jsx)("div",{style:{fontSize:Math.max(16,.3*U),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,Fl.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[p,O,a,l,b,v,U,i]),te=(0,Ll.useMemo)(()=>r&&null==p?{type:"gauge-value",text:b?b(O):Math.round(O)+""}:null,[r,p,O,b]),ne=(0,Ll.useMemo)(()=>{if(!g)return null;const e=-Math.PI/2+q*Math.PI/180+F*z,t=K>20?K-8:U-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[g,q,F,z,K,U,y]),oe=(0,Ll.useMemo)(()=>(e,t,n)=>{if("gauge-needle"===e.type){const o=(n.width||R)/2,r=(n.height||P)/2,i=Math.max(1,U-K),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,Fl.jsxs)("g",{transform:`translate(${o},${r})`,children:[(0,Fl.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,Fl.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const o=-Math.PI/2+q*Math.PI/180+(e.value-a)/H*z,r=(n.width||R)/2,i=(n.height||P)/2,s=K-1,l=U+1,c=Math.cos(o)*s,u=Math.sin(o)*s,d=Math.cos(o)*l,h=Math.sin(o)*l,f=U+10,m=Math.cos(o)*f,g=Math.sin(o)*f,y=((o+Math.PI/2)/(2*Math.PI)*12+12)%12;let p,b;return y>=11||1>y?(p="middle",b="auto"):y>=1&&5>y?(p="start",b="middle"):y>=5&&7>y?(p="middle",b="hanging"):(p="end",b="middle"),(0,Fl.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,Fl.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border, #ccc)",strokeWidth:2,strokeLinecap:"round"}),(0,Fl.jsx)("text",{x:m,y:g,textAnchor:p,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,Fl.jsx)("text",{x:(n.width||R)/2,y:(n.height||P)/2-.2*K,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*U)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[R,P,a,H,q,z,K,U]),re=(0,Ll.useMemo)(()=>{const e=[...E,...S||[]];return ne&&e.push(ne),te&&e.push(te),e},[E,S,ne,te]),ie=(0,Ll.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,n=t?._zone||"",o=t?._isFill;return(0,Fl.jsxs)("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:[(0,Fl.jsx)("div",{style:{fontWeight:600},children:n}),(0,Fl.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:o?"Current: "+Math.round(O):"Remaining"})]})},[O]);if(0===N.length)return(0,Fl.jsx)(ga,{componentName:"GaugeChart",message:"No data to display",width:R,height:P});const se={chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:D,innerRadius:K,startAngle:q,sweepAngle:x,...null!=m&&{cornerRadius:m},centerContent:ee,size:[R,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:Z-J/2,bottom:P-Z-J/2,left:Q-J/2,right:R-Q-J/2},enableHover:n.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:Xr(k)||ie,svgAnnotationRules:oe,...re.length>0&&{annotations:re},...L&&{title:L},...I&&{description:I},...T&&{summary:T},...void 0!==$&&{accessibleTable:$},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return(0,Fl.jsx)(wa,{componentName:"GaugeChart",width:R,height:P,children:(0,Fl.jsx)(bs,{ref:o,...se})})});Nl.displayName="GaugeChart";var Wl=require("react"),El=require("react/jsx-runtime"),Dl=(0,Wl.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Wl.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:f,colorScheme:m,categoryPadding:g=5,tooltip:y,annotations:p,valueExtent:b,frameProps:v={},selection:x,linkedHover:w,onObservation:k,onClick:S,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:R,legendInteraction:P,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:O,categoryFormat:H}=e,{width:F,height:N,enableHover:W,showGrid:E,showLegend:D,title:z,description:q,summary:G,accessibleTable:V,categoryLabel:Y,valueLabel:X}=n,U=(0,Wl.useMemo)(()=>A(r),[r]),K=Pa({data:U,rawData:r,colorBy:f,colorScheme:m,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:D,userMargin:i,marginDefaults:n.marginDefaults,loading:j,loadingContent:_,emptyContent:R,width:F,height:N}),Q=sa(),Z=(0,Wl.useMemo)(()=>new Map,[]),J=qa({colorBy:f,colorScale:K.colorScale,color:I,themeCategorical:Q,colorScheme:m,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,Wl.useMemo)(()=>hl(),[]);if(K.earlyReturn)return K.earlyReturn;const te=ja({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,El.jsx)(ga,{componentName:"RidgelinePlot",message:te,width:F,height:N});const ne={chartType:"ridgeline",...null!=r&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:W,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:Y,rLabel:X,rFormat:h,...H&&{oFormat:H},showGrid:E,showCategoryTicks:O,oSort:!1,amplitude:d,...K.legendBehaviorProps,...vs({title:z,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ws({tooltip:y,defaultTooltipContent:ee}),...xs({linkedHover:w,selection:x,onObservation:k,onClick:S,hoverHighlight:M,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...p&&p.length>0&&{annotations:p},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,El.jsx)(wa,{componentName:"RidgelinePlot",width:F,height:N,children:(0,El.jsx)(bs,{ref:o,...ne})})});Dl.displayName="RidgelinePlot";var zl=require("react"),ql=require("react/jsx-runtime"),Gl=(0,zl.forwardRef)(function(e,t){const n=la(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,zl.useRef)(null);al(t,{variant:"xy",frameRef:o});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:f=.3,showLabels:m=!0,tooltip:g,annotations:y,frameProps:p={},selection:b,linkedHover:v,onObservation:x,onClick:w,hoverHighlight:k,chartId:S,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:R,color:P,stroke:L,strokeWidth:I,opacity:T,categoryFormat:$}=e,B="vertical"===h,{width:O,height:H,enableHover:F,showLegend:N,title:W,description:E,summary:D,accessibleTable:z}=n,q=B?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},G=(0,zl.useMemo)(()=>A(r),[r]),V=u||c,Y=!V,X=Pa({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:R,selection:b,linkedHover:v,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:N,userMargin:i,marginDefaults:q,loading:M,loadingContent:C,emptyContent:j,width:O,height:H});Aa("FunnelChart",G,"stepAccessor",a),Aa("FunnelChart",G,"valueAccessor",l);const U=sa(),K=(0,zl.useMemo)(()=>new Map,[]),Q=(0,zl.useMemo)(()=>{if(Y)return P||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[Y,P,U,d]),Z=qa({colorBy:Q?void 0:V,colorScale:X.colorScale,color:Q??P,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:p?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection}),J=(0,zl.useMemo)(()=>e=>{const t=e?.data||e,n=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",o=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,ql.jsxs)("div",{className:"semiotic-tooltip",style:qr,children:[n&&(0,ql.jsx)("div",{style:{fontWeight:"bold"},children:n+""}),a&&a!==n&&(0,ql.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,ql.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,ql.jsxs)("div",{style:{marginTop:4},children:[o+"",l]})]})},[]);if(X.earlyReturn)return X.earlyReturn;const ee=ja({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,ql.jsx)(ga,{componentName:"FunnelChart",message:ee,width:O,height:H});const te={chartType:B?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:Z,size:[O,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:B,showCategoryTicks:B,...$&&{oFormat:$},showGrid:B,...!B&&{connectorOpacity:f},showLabels:m,...X.legendBehaviorProps,...W&&{title:W},...E&&{description:E},...D&&{summary:D},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===g?()=>null:!0===g||null==g?J:Xr(g)||J,...xs({linkedHover:v,selection:b,onObservation:x,onClick:w,hoverHighlight:k,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...y&&y.length>0&&{annotations:y},...Object.fromEntries(Object.entries(p).filter(([e])=>"pieceStyle"!==e))};return(0,ql.jsx)(wa,{componentName:"FunnelChart",width:O,height:H,children:(0,ql.jsx)(bs,{ref:o,...te})})});Gl.displayName="FunnelChart";var Vl=g(require("react")),Yl=require("react"),Xl=require("react"),Ul=require("react"),Kl={RdBu:X,PiYG:U,PRGn:K,BrBG:Q,RdYlBu:Z,RdYlGn:J,Spectral:ee},Ql="__likert_neutral_neg",Zl="__likert_neutral_pos";function Jl(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ec(e,t,n,o,r,i){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 r=t[n];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(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 r=0;t.length>r;r++){const i=t[r],s=n.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:r})}}return l}function tc(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:Ql,__likertPct:-e}),i.push({...t,__likertLevel:Zl,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function nc(e,t){const n=t.length,o=n%2!=0,r=Math.floor(n/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const n of e)n.__likertLevel===Ql?i=n:n.__likertLevel===Zl?a=n:t.set(n.__likertLevelIndex,n);o&&i&&s.push(i);for(let e=r-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?r+1:r;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}var oc=["Very Low","Low","Neutral","High","Very High"],rc=require("react/jsx-runtime"),ic=new Map,sc=(0,Yl.forwardRef)(function(e,t){const n=la(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,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=(0,Yl.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=oc,orientation:h="horizontal",colorScheme:f,barPadding:m=20,tooltip:g,annotations:y,valueExtent:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:j,emptyContent:_,legendInteraction:R,legendPosition:P,categoryFormat:L,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:O,enableHover:H,showGrid:F,showLegend:N,title:W,description:E,summary:D,accessibleTable:z,categoryLabel:q,valueLabel:G}=n,V="horizontal"===h,Y=void 0===r,X=!c,U=function(){const e=Xs();return e?.colors?.diverging||void 0}(),K=(0,Yl.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const n=Kl[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"],r="#a8a8a8";if(1===e)return[r];const i=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)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(d.length,U),[f,d.length,U]),Q=(0,Yl.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Z,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:n,valueAccessor:o,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,Ul.useMemo)(()=>Jl(n,"question"),[n]),u=(0,Ul.useMemo)(()=>l?Jl(o,"score"):null,[l,o]),d=(0,Ul.useMemo)(()=>l?null:Jl(r,"level"),[l,r]),h=(0,Ul.useMemo)(()=>l?null:Jl(i,"count"),[l,i]),f=(0,Ul.useRef)([]);return{processedData:(0,Ul.useMemo)(()=>{const n=e||[];if(0===n.length)return[];let o=ec(n,t,c,u,d,h);return s&&(o=tc(o,t),o=nc(o,t)),o},[e,t,c,u,d,h,s]),reAggregate:(0,Ul.useCallback)(e=>{let n=ec(e,t,c,u,d,h);s&&(n=tc(n,t),n=nc(n,t)),a.current?.replace(n)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:V,frameRef:o}),te="__likertLevelLabel",ne=function({isPushMode:e,colorBy:t,colorScheme:n,showLegend:o,legendPosition:r="right"}){const i=(0,Xl.useRef)(new Set),s=(0,Xl.useRef)([]),[a,l]=(0,Xl.useState)(0),c=Cs(),u=sa(),d=(0,Xl.useCallback)(e=>{if(!t)return null;const n="function"==typeof t?t(e):e[t];return null!=n?n+"":null},[t]),h=(0,Xl.useCallback)(n=>{if(!e||!t)return;let o=!1;for(const e of n){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),o=!0)}o&&l(e=>e+1)},[e,t,d]),f=(0,Xl.useCallback)(n=>{if(!e||!t)return;const o=Array.from(new Set(n.map(String))),r=s.current;r.length===o.length&&r.every((e,t)=>e===o[t])||(i.current=new Set(o),s.current=o,l(e=>e+1))},[e,t]),m=(0,Xl.useCallback)(e=>t=>{h([t]),e(t)},[h]),g=(0,Xl.useCallback)(e=>t=>{h(t),e(t)},[h]),y=(0,Xl.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);Gs(e&&t?s.current:[]);const p=(0,Xl.useMemo)(()=>{if(!e||!t||!1===o)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:u&&u.length>0?u:oe,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=ae(l,a,i);return Vs({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:ie})},[e,t,o,n,c,u,a]),b=(0,Xl.useMemo)(()=>{if(p)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[p,r]);return{wrapPush:m,wrapPushMany:g,resetCategories:y,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:p,streamingMarginAdjust:b}}({isPushMode:Y,colorBy:te,colorScheme:K,showLegend:N,legendPosition:P}),{wrapPush:re,wrapPushMany:se}=ne,le=(0,Yl.useCallback)(e=>re(e=>{ee.current.push(e),J(ee.current)})(e),[re,J,ee]),ce=(0,Yl.useCallback)(e=>se(e=>{ee.current.push(...e),J(ee.current)})(e),[se,J,ee]);(0,Yl.useImperativeHandle)(t,()=>({push:le,pushMany:ce,remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],replace:e=>o.current?.replace(e),clear:()=>{ee.current=[],ne.resetCategories(),o.current?.clear()},getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}),[le,ce,ee,ne]);const ue=Pa({data:Z,rawData:r,colorBy:te,colorScheme:K,legendInteraction:R,legendPosition:P,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:N,userMargin:i,marginDefaults:n.marginDefaults,loading:C,loadingContent:j,emptyContent:_,width:B,height:O}),de=(0,Yl.useMemo)(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),he=qa({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:ic,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,n=e.__likertLevel||e.data?.__likertLevel;if(n===Ql||n===Zl)return{fill:de};const o=t||n;return o&&Q.has(o)?{fill:Q.get(o)}:{fill:"#888"}}}),fe=(0,Yl.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),me=(0,Yl.useMemo)(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Ql||n===Zl?fe:n,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=n===Ql||n===Zl?2*i:i,a=t.__likertCount||0;return Vl.createElement("div",{className:"semiotic-tooltip",style:qr},Vl.createElement("div",{style:{fontWeight:"bold"}},r),Vl.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[fe]),ge=(0,Yl.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),ja({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,X]),ye=(0,Yl.useMemo)(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),pe=(0,Yl.useMemo)(()=>!1!==N?{...ue.legendBehaviorProps,legend:{legendGroups:ye},legendPosition:P||ue.legendPosition||"bottom"}:ue.legendBehaviorProps,[ue.legendBehaviorProps,ue.legendPosition,P,N,ye]),be=(0,Yl.useMemo)(()=>{const e={...ue.margin};if(Y&&!1!==N){const t=P||"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(ne.streamingMarginAdjust)for(const[t,n]of Object.entries(ne.streamingMarginAdjust))n>e[t]&&(e[t]=n);return V&&100>e.left&&(e.left=100),e},[ue.margin,ne.streamingMarginAdjust,V,Y,N,P]),ve=(0,Yl.useMemo)(()=>M||(V?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[V,M]);if(ue.earlyReturn)return ue.earlyReturn;const xe={chartType:"bar",...null!=r&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:V?"horizontal":"vertical",pieceStyle:he,size:[B,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:be,barPadding:m,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:n.showAxes,oLabel:q,rLabel:G||(V?void 0:"Percentage"),rFormat:ve,...L&&{oFormat:L},showGrid:F,...pe,...W&&{title:W},...E&&{description:E},...D&&{summary:D},...void 0!==z&&{accessibleTable:z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?me:Xr(g)||me,...xs({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...y&&y.length>0&&{annotations:y},...p&&{rExtent:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ge?(0,rc.jsx)(ga,{componentName:"LikertChart",message:ge,width:B,height:O}):(0,rc.jsx)(wa,{componentName:"LikertChart",width:B,height:O,children:(0,rc.jsx)(bs,{ref:o,...xe})})});sc.displayName="LikertChart";var ac=require("react"),lc=require("react");var cc=require("react/jsx-runtime"),uc=(0,ac.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:m,showAxes:g=!1,annotations:y,onObservation:p,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:j,safeData:_,setup:R,earlyReturn:P}=function(e){const t=function(e){const t=(0,lc.useRef)(null);return al(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:la(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,lc.useMemo)(()=>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:n,normalizedMargin:o}=t,r=Pa({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,legend:e.legend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorBy:f,colorScheme:m,selection:v,linkedHover:x,onObservation:p,onClick:b,chartId:w,loading:k,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=R.effectiveSelectionHook,I=(0,ac.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(P)return P;const{width:T,height:$,enableHover:B,showGrid:O,title:H,description:F,summary:N,accessibleTable:W}=j,E={chartType:"custom",...null!=n&&{data:_},customLayout:o,layoutConfig:r,onLayoutError:i,...I&&{layoutSelection:I},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:m,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:R.margin,enableHover:B,showAxes:g,showGrid:O,annotations:y,...vs({title:H,description:F,summary:N,accessibleTable:W,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...xs({linkedHover:x,selection:v,onObservation:p,onClick:b,hoverHighlight:!1,mobileInteraction:R.mobileInteraction,customHoverBehavior:R.customHoverBehavior,customClickBehavior:R.customClickBehavior}),...M};return(0,cc.jsx)(wa,{componentName:"OrdinalCustomChart",width:T,height:$,children:(0,cc.jsx)(bs,{ref:C,...E})})});uc.displayName="OrdinalCustomChart";var dc={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},hc=8;function fc(e){return null==e?void 0:e+""}function mc(e){const t=fc(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??hc,style:{...dc},datum:e.datum,pointId:t,_transitionKey:t}}function gc(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...dc},datum:e.datum,group:e.group,_transitionKey:fc(e.id)}}
|