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/xy.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,h=Object.prototype.hasOwnProperty,d=(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})},p=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))h.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},y=(e,t,n)=>(n=null!=e?s(u(e)):{},p(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),m=d({"src/components/stream/brushAccessibility.ts"(){e=y(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),g={};function x(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function b(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function v(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function k({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,dimension:h,scales:d,onBrush:f,binSize:p,snap:y,binBoundaries:m,snapDuring:g,streaming:k}){const w=(0,n.useRef)(null),A=(0,n.useRef)(null),S=(0,n.useRef)(f);S.current=f;const C=(0,n.useRef)(d);C.current=d;const M=(0,n.useMemo)(()=>m?[...m].sort((e,t)=>e-t):void 0,[m]),j=(0,n.useRef)(M);j.current=M;const _=(0,n.useRef)(!1),R=(0,n.useRef)(null),P=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:"xy"===h?"Two-dimensional data range brush":h.toUpperCase()+" data range brush",onAction:e=>{const t=C.current,n=A.current;if(!t||!n||!w.current)return;const r=(0,o.select)(w.current).select(".brush-g");if("clear"===e.type)return _.current=!0,r.call(n.move,null),_.current=!1,R.current=null,void S.current(null);const i=t.x.domain(),s=t.y.domain(),a=R.current;let l=a?.x??[i[0]+.4*(i[1]-i[0]),i[0]+.6*(i[1]-i[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==h&&(l=x(l,i,d,e.resize)),u||"x"===h||(c=x(c,s,d,e.resize)),u&&"y"===h||!u&&"x"===h)return;const f={x:l,y:c};_.current=!0,r.call(n.move,"x"===h?[t.x(l[0]),t.x(l[1])]:"y"===h?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),_.current=!1,R.current=f,S.current(f)}});return(0,n.useEffect)(()=>{if(!w.current)return;const e=(0,o.select)(w.current).select(".brush-g"),t="x"===h?(0,r.brushX)():"y"===h?(0,r.brushY)():(0,r.brush)();return t.extent([[0,0],[s,a]]),t.on("brush end",n=>{if(_.current)return;const o=C.current;if(!o)return;if(!n.selection)return R.current=null,void S.current(null);let r,i;if("x"===h){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],i=[o.y.invert(a),o.y.invert(0)]}else if("y"===h){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(s)],i=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[s,a]]=n.selection;r=[o.x.invert(e),o.x.invert(s)],i=[o.y.invert(a),o.y.invert(t)]}if("bin"===y&&"y"!==h&&("end"===n.type||"brush"===n.type&&g)){const i=j.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[b(e[0],t),v(e[1],t)]}(r,i):p&&p>0&&(r=[Math.floor(r[0]/p)*p,Math.ceil(r[1]/p)*p]);const s=o.x(r[0]),a=o.x(r[1]);if(_.current=!0,"x"===h)e.call(t.move,[s,a]);else if("xy"===h){const o=n.selection;e.call(t.move,[[s,o[0][1]],[a,o[1][1]]])}_.current=!1}const l={x:r,y:i};R.current=l,S.current(l)}),e.call(t),A.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),A.current=null}},[s,a,h,y,p,g]),(0,n.useEffect)(()=>{if(!(k&&d&&A.current&&R.current))return;if(!w.current)return;if("y"===h)return;const e=R.current,t=d.x.domain()[0],n=(0,o.select)(w.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);let r=e.x[0],i=!1;if(t>e.x[0]){if(r=t,"bin"===y){const e=j.current;e&&e.length>0?r=v(t,e):p&&p>0&&(r=Math.ceil(t/p)*p)}if(r>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);i=!0}const s=d.x(r),a=d.x(e.x[1]);if(_.current=!0,"x"===h)n.call(A.current.move,[s,a]);else{const t=d.y(e.y[1]),o=d.y(e.y[0]);n.call(A.current.move,[[s,t],[a,o]])}if(_.current=!1,i){const t={x:[r,e.x[1]],y:e.y};R.current=t,S.current(t)}},[d,k,h,y,p]),(0,i.jsxs)("svg",{ref:w,width:l,height:c,...P.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,i.jsx)("title",{children:P.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:P.descriptionId,children:P.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`})]})}f(g,{XYBrushOverlay:()=>k});var w=d({"src/components/stream/XYBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),m(),i=require("react/jsx-runtime")}});function A(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 S(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var C=d({"src/components/charts/shared/minMax.ts"(){}});function M(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function j(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var _,R,P=d({"src/components/charts/shared/colorManipulation.ts"(){}}),L={};function I(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[R]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),u=c.filter(e=>Number.isFinite(e));if(0===u.length)return;const[h,d]=A(u),f=d-h;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[R]=l-(f>0?(n-h)/f:0)*(l-a))})}function T(e,t){return"function"==typeof t?t(e):!!e[t]}function N(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function F(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,y=e.map(e=>{let t="observed";return s&&T(e,s)?t="forecast":i&&T(e,i)&&(t="training"),{...e,[_]:t}}),m=o._groupBy,g=[];if(m){const e=new Map;for(const t of y){const n=t[m]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][_]!==n[e+1][_]&&(t.push({...n[e+1],[_]:n[e][_]}),t.push({...n[e],[_]:n[e+1][_]}));g.push(...y,...t)}else for(let e=0;y.length>e;e++)g.push(y[e]),y.length-1>e&&y[e][_]!==y[e+1][_]&&(g.push({...y[e+1],[_]:y[e][_]}),g.push({...y[e],[_]:y[e+1][_]}));if(o.trainUnderline){const e=[];for(const t of g)"training"===t[_]&&e.push({...t,[_]:"training-base"});g.unshift(...e)}const x=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of g)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));x.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};I(g.filter(e=>"forecast"===e[_]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>T(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),x.push(t)}return r&&x.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:g,annotations:x}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const h=[],d=[];for(const n of e)n[t]>i?d.push({...n,[_]:"observed"}):h.push({...n,[_]:"training"});const f=h.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),p=[],y=[];if(f.length>=3){const r=f.length;let i=0,h=0,d=0,m=0;for(const[e,t]of f)i+=e,h+=t,d+=e*e,m+=e*t;const g=r*d-i*i;if(Math.abs(g)>1e-12){const d=(r*m-i*h)/g,x=(h-d*i)/r,b=e=>x+d*e,v=f.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(v/Math.max(r-2,1)),w=f.reduce((e,t)=>e+t[0],0)/r,A=f.reduce((e,t)=>e+(t[0]-w)**2,0),C=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,M=S(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),j=f.length>1?(f[r-1][0]-f[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=M+e*j,i=b(o),s=k*Math.sqrt(1+1/r+(A>0?(o-w)**2/A:0))*C;y.push({[t]:o,[n]:i,[_]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}I(y,o,e=>e.__forecastUpper,e=>e.__forecastLower),p.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}p.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&p.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const m=[];if(m.push(...h),h.length>0&&d.length>0&&m.push({...h[h.length-1],[_]:"observed"}),m.push(...d),y.length>0){const e=d.length>0?d[d.length-1]:h[h.length-1];e&&m.push({...e,[_]:"forecast"}),m.push(...y)}return{processedData:m,annotations:p}}(e,t,n,o,r);var i}function O(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[_];if("training"===h){let e=u.stroke;return"darken"===a?e=M(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=j(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[R],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}f(L,{FORECAST_OPACITY_FIELD:()=>R,SEGMENT_FIELD:()=>_,buildAnomalyAnnotations:()=>N,buildForecast:()=>F,createSegmentLineStyle:()=>O,darkenColor:()=>M,lightenColor:()=>j,stampForecastOpacity:()=>I});var B,D=d({"src/components/charts/shared/statisticalOverlays.ts"(){C(),P(),P(),_="__forecastSegment",R="__forecastOpacity"}}),W={};f(W,{AreaChart:()=>Ec,BubbleChart:()=>hu,CandlestickChart:()=>th,ConnectedScatterplot:()=>lu,DEFAULT_HIT_RADIUS:()=>ah,DifferenceChart:()=>qc,Heatmap:()=>yu,LineChart:()=>Oc,MinimapChart:()=>Fu,MultiAxisLineChart:()=>Qu,QuadrantChart:()=>$u,Scatterplot:()=>ru,ScatterplotMatrix:()=>Ru,StackedAreaChart:()=>Uc,StreamXYFrame:()=>qa,XYCustomChart:()=>ih,composeStyleRules:()=>vc,glyphExtent:()=>Mn,glyphPlacement:()=>Cn,hatchFillId:()=>Yn,hatchPatternDef:()=>qn,hitTargetPoint:()=>ch,hitTargetRect:()=>uh,isHatchFill:()=>En,makeRuleValueResolver:()=>pc,makeXYRuleContext:()=>yc,matchesThreshold:()=>gc,resolveResponsiveRules:()=>Rl,resolveStyleRules:()=>bc,resolveSvgFill:()=>Vn,responsiveRuleMatches:()=>_l,ruleMatches:()=>xc,useCustomLayoutSelection:()=>mn}),module.exports=(B=W,p(a({},"__esModule",{value:!0}),B));var z=y(require("react")),H=require("react"),E=y(require("react")),$=require("react/jsx-runtime"),Y=null,G=null;function q(e){const[t,n]=E.useState(()=>Y);return E.useEffect(()=>{if(t)return;let e=!1;return(Y?Promise.resolve(Y):(G||(G=Promise.resolve().then(()=>(w(),g)).then(e=>Y=e.XYBrushOverlay)),G)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,$.jsx)(t,{...e}):null}var V=Object.freeze([]);function X(e){if(!e)return V;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 U=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=X(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=X(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}},K=require("react"),Q=require("react/jsx-runtime");function Z(e){let t=null;const n=()=>(t||(t=(0,K.createContext)(null)),t),o=J(e);return[function({children:t,initialState:o}){const r=(0,K.useRef)(o),i=(0,K.useMemo)(()=>J(e,r.current),[]),s=n();return(0,Q.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,K.useContext)(r)??o,s=(0,K.useRef)(e);s.current=e;const a=(0,K.useRef)({hasValue:!1,value:void 0}),l=(0,K.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,K.useCallback)(()=>s.current(i.getState()),[i]);return(0,K.useSyncExternalStore)(i.subscribe,l,c)}]}function J(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)}}}}function ee(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 te(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:ne}}),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 ne=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],oe={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}},re={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}},ie={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ne,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 se(e,t){if("light"===t)return oe;if("dark"===t)return re;if("high-contrast"===t)return ie;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?re:oe;return te({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return te({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[ae,le]=Z(e=>({theme:oe,setTheme(t){e(e=>({theme:se(e.theme,t)}))}})),ce=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}},ue=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 he(e,t){return e===t}function de(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function fe(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var ye=/^\d{4}-\d{1,2}$/;function me(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=ye.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function ge(e){return e instanceof Date?e.getTime():"string"==typeof e?me(e):+e}function xe(e){return new Set(Array.isArray(e)?e:[e])}var be=require("d3-scale");function ve(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function ke(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function we(e){const t=e.map(ve),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return ke(e,n,o)}if(e>=1){const[e,o,r]=t[n];return ke(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return ke(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var Ae=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Se=we(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Ce=we(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Me=we(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),je=we(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),_e=we(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Re=we(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Pe=we(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Le=we(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ie=we(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Te=we(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ne=we(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Fe=we(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Oe={blues:Se,reds:Ce,greens:Me,viridis:Pe,oranges:je,purples:_e,greys:Re,plasma:Le,inferno:Ie,magma:Te,cividis:Ne,turbo:Fe};function Be(e){return e&&Oe[e]||Se}we(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),we(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),we(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),we(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),we(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),we(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),we(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var De={category10:Ae,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Oe},We=Ae,ze="#007bff",He=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ee=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 $e(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")||Ee.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):We[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))%We.length]}function Ye(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 Ge(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Ye(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,be.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=De[n]||De.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:We;return(0,be.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function qe(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)}function Ve(e,t,n){return e+(t-e)*n}function Xe(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ue(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})}function Ke(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function Qe(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function Ze(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 Je(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function et(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function tt(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function nt(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function ot(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function rt(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function it(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function st(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function at(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function lt(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,style:at(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function ct(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function ut(e,t,n){const o=[];for(const r of n){const n=lt(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function ht(e,t,n,o){const r=[];for(const i of o){const o=lt(e,t,n,i);o&&r.push(o)}return r}function dt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function ft(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=ot(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}function pt(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var yt={topOpacity:.8,bottomOpacity:.05};function mt(e){if(e)return!0===e?yt:"colorStops"in e?e:{topOpacity:e.topOpacity??yt.topOpacity,bottomOpacity:e.bottomOpacity??yt.bottomOpacity}}var gt=require("d3-shape"),xt={circle:gt.symbolCircle,square:gt.symbolSquare,triangle:gt.symbolTriangle,diamond:gt.symbolDiamond,star:gt.symbolStar,cross:gt.symbolCross,wye:gt.symbolWye},bt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function vt(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*kt(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,gt.symbol)(xt[o]??gt.symbolCircle,Math.max(1,t))()??""}function kt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var wt=new Map;function At(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function St(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(St))}function Ct(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Mt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function jt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=Mt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=de(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:Mt(e.y1Accessor,"y1"),getBottom:Mt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var _t=require("d3-scale");function Rt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Pt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,_t.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,_t.scaleSymlog)().domain(t).range(n):"time"===e?(0,_t.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,_t.scaleLinear)().domain(t).range(n)}function Lt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var It=new WeakMap;var Tt={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 Nt(e,t){const n={...e};for(const e of t)n[Tt[e]]++;return n}function Ft(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Nt(n,o)}}var Ot=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=Ft({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=Ft(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},Bt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Dt=["scene-style","data-paint","accessibility","evidence"],Wt=(e,t)=>({retainedData:e,invalidations:t}),zt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ht=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Et=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],$t=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Yt=["scene-geometry","data-paint","accessibility","evidence"],Gt=["scene-style","data-paint","accessibility","evidence"],qt=[],Vt={chartType:Wt("rebuild",zt),runtimeMode:Wt("rebuild",zt),xAccessor:Wt("rebuild",zt),yAccessor:Wt("rebuild",zt),timeAccessor:Wt("rebuild",zt),valueAccessor:Wt("rebuild",zt),y0Accessor:Wt("rebuild",zt),boundsAccessor:Wt("rebuild",zt),band:Wt("rebuild",zt),openAccessor:Wt("rebuild",zt),highAccessor:Wt("rebuild",zt),lowAccessor:Wt("rebuild",zt),closeAccessor:Wt("rebuild",zt),candlestickRangeMode:Wt("rebuild",zt),accessorRevision:Wt("rebuild",zt),groupAccessor:Wt("rebuild",Ht),categoryAccessor:Wt("rebuild",Ht),lineDataAccessor:Wt("rebuild",Ht),colorAccessor:Wt("rebuild",Gt),sizeAccessor:Wt("rebuild",Yt),symbolAccessor:Wt("rebuild",Yt),pointIdAccessor:Wt("rebuild",Yt),xScaleType:Wt("preserve",Et),yScaleType:Wt("preserve",Et),xExtent:Wt("preserve",Et),yExtent:Wt("preserve",Et),extentPadding:Wt("preserve",Et),scalePadding:Wt("preserve",Et),axisExtent:Wt("preserve",Et),binSize:Wt("preserve",Et),normalize:Wt("preserve",Et),heatmapAggregation:Wt("preserve",Et),heatmapXBins:Wt("preserve",Et),heatmapYBins:Wt("preserve",Et),arrowOfTime:Wt("preserve",$t),baseline:Wt("preserve",$t),stackOrder:Wt("preserve",$t),sizeRange:Wt("preserve",$t),curve:Wt("preserve",$t),areaGroups:Wt("preserve",$t),customLayout:Wt("preserve",$t),layoutConfig:Wt("preserve",$t),layoutMargin:Wt("preserve",$t),symbolMap:Wt("preserve",Yt),showValues:Wt("preserve",Yt),heatmapValueFormat:Wt("preserve",Yt),lineStyle:Wt("preserve",Gt),pointStyle:Wt("preserve",Gt),areaStyle:Wt("preserve",Gt),barStyle:Wt("preserve",Gt),swarmStyle:Wt("preserve",Gt),waterfallStyle:Wt("preserve",Gt),candlestickStyle:Wt("preserve",Gt),boundsStyle:Wt("preserve",Gt),gradientFill:Wt("preserve",Gt),lineGradient:Wt("preserve",Gt),colorScheme:Wt("preserve",Gt),themeCategorical:Wt("preserve",Gt),themeSemantic:Wt("preserve",Gt),themeSequential:Wt("preserve",Gt),themeDiverging:Wt("preserve",Gt),barColors:Wt("preserve",Gt),decay:Wt("preserve",Gt),pulse:Wt("preserve",Gt),staleness:Wt("preserve",Gt),layoutSelection:Wt("preserve",Gt),annotations:Wt("preserve",["overlay","accessibility","evidence"]),windowSize:Wt("preserve",qt),windowMode:Wt("preserve",qt),maxCapacity:Wt("preserve",qt),clock:Wt("preserve",qt),transition:Wt("preserve",qt),introAnimation:Wt("preserve",qt),onLayoutError:Wt("preserve",qt)},Xt=Wt("preserve",$t),Ut=class{constructor(){this.tracker=new Ot}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}},Bt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Dt):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=Vt[o]??Xt;"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)}},Kt=require("d3-quadtree"),Qt=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,Kt.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},Zt=class e{constructor(e){if(this.xExtent=new ue,this.yExtent=new ue,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new Ut,this.scales=null,this.scene=[],this.version=0,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.xIsDate=!1,this.spatialIndex=new Qt,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=Qe(e,s,i);l>r&&(r=l)}a&&(l=Ze(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=Ze(n,null==r?0:Qe(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new ce(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=de(e.timeAccessor||e.xAccessor,"time"),this.getY=de(e.valueAccessor||e.yAccessor,"value")):(this.getX=de(e.xAccessor,"x"),this.getY=de(e.yAccessor,"y")),this.getGroup=pe(e.groupAccessor),this.getCategory=pe(e.categoryAccessor),this.getSize=e.sizeAccessor?de(e.sizeAccessor,"size"):void 0,this.getColor=pe(e.colorAccessor),this.getSymbol=pe(e.symbolAccessor),this.getY0=e.y0Accessor?de(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=jt(e),this.getPointId=pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?de(e.openAccessor,"open"):void 0,this.getHigh=de(e.highAccessor,"high"),this.getLow=de(e.lowAccessor,"low"),this.getClose=n?de(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new ce(e.windowSize))}currentTime(){return this.config.clock?.()??Xe()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new ce(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?de(this.config.timeAccessor||this.config.xAccessor,"time"):de(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(me(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>ge(t[e]):e=>ge(n(e))}}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)Lt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Lt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(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}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=Rt(this.xExtent.extent,t.xExtent),l=Rt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=nt(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=At(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,_t.scaleLinear)().domain(o).range(e),y:Pt(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:Pt(t.yScaleType,r,[s,n.width-s]),y:(0,_t.scaleLinear)().domain(o).range(e)}}var a;return{x:Pt(t.xScaleType,o,[s,n.width-s]),y:Pt(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Pt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??He},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,o=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}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}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=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;St(o)&&0===n.length&&Ct(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)&&Ct(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:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(pt).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=ct(e.ribbons);if(i.length>0&&o.push(...ut(e,t,i)),r.length>0)for(const t of n)o.push(...ht(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=et(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return ft(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=ct(e.ribbons);if(i.length>0&&o.push(...ut(e,t,i)),r.length>0)for(const t of n)o.push(...ht(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=tt(t.data,e.scales,e.getX,e.getY,r,n,t.key,i),a=mt(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ft(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=ct(e.ribbons);if(i.length>0&&o.push(...ut(e,t,i)),r.length>0)for(const t of n)o.push(...ht(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=tt(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=mt(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=et(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return ft(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=nt(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,m=new Map,g=new Map,x=new Map;for(const e of c)m.set(e,d.get(e)??0),g.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=g.get(n),c=s+u,g.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=m.get(n),c=s+u,m.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);ft(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=bt[h%bt.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=rt(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=ot(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=de(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),m=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>m)continue;const g=m*o+f;p[g]++;const x=s(i);y[g]+=isFinite(x)?x:0}let m=1/0,g=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}m>t&&(m=t),t>g&&(g=t)}if(!isFinite(m))return[];const x=g-m||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let e=0;r>e;e++){const t=e*o;for(let n=0;o>n;n++){const o=t+n;if(0===p[o])continue;let s;switch(i){case"sum":s=y[o];break;case"mean":s=y[o]/p[o];break;default:s=p[o]}const l=(s-m)/x;A.push(st(n*b,(r-1-e)*v,b,v,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:n,yi:e,value:s,count:p[o],sum:y[o],xCenter:a+(n+.5)*h,yCenter:c+(e+.5)*d,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return A}(e,t,n);if(0===t.length)return[];const o=de(e.config.valueAccessor,"value"),r=fe(e.config.xAccessor,"x"),i=fe(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const m=new Float64Array(t.length),g=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),m[p]=d,g[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=g[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Oe?e:"blues";let n=wt.get(t);if(n)return n;n=Array(256);const o=Be(t);for(let e=0;256>e;e++)n[e]=o(e/255);return wt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),C=n.width/u,M=n.height/h,j=e.config.showValues,_=e.config.heatmapValueFormat,R=[];for(let e=0;v>e;e++){const t=g[e];if(!isFinite(t))continue;const n=m[e],o=n%u;R.push(st(o*C,(h-1-(n-o)/u)*M,C,M,A[Math.min((t-k)*S+.5|0,255)],x[e],j?{value:t,showValues:!0,valueFormat:_}:void 0))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=At(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),m=y>h+1?h:0,g=Math.min(f,p)+m/2,x=Math.max(y-m,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(it(g,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(it(g,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),m=e.getY(p),g=f+m;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=g;continue}const A=r.y(f),S=r.y(g),C=Math.min(A,S),M=Math.abs(A-S),j={fill:0>m?l:a,stroke:u,strokeWidth:h};null!=d&&(j.opacity=d),o.push(it(k,C,w,M,j,{...p,baseline:f,cumEnd:g,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=g}return o}(r,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const n=e.config.candlestickRangeMode??!1;if(!(n||e.getOpen&&e.getClose))return[];const o=[],r=e.config.candlestickStyle||{},i=r.rangeColor||"#6366f1",s=n?i:r.upColor||"#28a745",a=n?i:r.downColor||"#dc3545",l=n?i:r.wickColor||"#333",c=r.wickWidth||(n?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let h=r.bodyWidth??0;if(null==r.bodyWidth)if(u.length>1){let t=1/0;for(let n=1;u.length>n;n++){const o=Math.abs(e.scales.x(u[n])-e.scales.x(u[n-1]));o>0&&t>o&&(t=o)}h=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else h=6;for(const r of t){const t=e.getX(r);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(r),u=e.getLow(r);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const d=n?i:e.getOpen(r),f=n?u:e.getClose(r);if(!n&&[d,f].some(e=>null==e||Number.isNaN(e)))continue;const p=f>=d,y={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(d),closeY:e.scales.y(f),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:h,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:p,datum:r};n&&(y.isRange=!0),o.push(y)}return o}(r,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?Ue(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=Ke(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=Ke(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=Ue(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=Ue(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=Ue(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=Ue(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}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())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=Je(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=Je(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r,i=Xe()){if(0===o.size&&0===r.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],s=Je(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},a=!0;continue}const u=o.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(s);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}for(const[e,t]of o)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:i,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Ve(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ve(n.x,e._targetX,i),e.y=Ve(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=Ve(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Ve(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ve(n.x,e._targetX,i),e.y=Ve(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=Ve(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Ve(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ve(n.x,e._targetX,i),e.y=Ve(n.y,e._targetY,i),void 0!==n.w&&(e.w=Ve(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Ve(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Ve(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ve(n.x,e._targetX,i),e.y=Ve(n.y,e._targetY,i),void 0!==n.w&&(e.w=Ve(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Ve(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Ve(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Ve(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=Ve(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=Ve(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=Ve(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=Ve(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ve(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Ve(t[o][0],n[o][0],i),e.path[o][1]=Ve(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Ve(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Ve(t[n][0],o[n][0],i),e.topPath[n][1]=Ve(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Ve(n[t][0],r[t][0],i),e.bottomPath[t][1]=Ve(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||He,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||He;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=xe(e),n=this.getPointId,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.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=xe(e),o=this.getPointId,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.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}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.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}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||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!he(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!he(n,s);(a||l)&&(e?(this.getX=de(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=de(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=de(this.config.xAccessor,"x"),this.getY=de(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=jt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!he(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?pe(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!he(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?pe(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!he(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?de(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!he(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?pe(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!he(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?pe(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!he(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?de(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!he(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=jt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!he(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?pe(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!he(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!he(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!he(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!he(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?de(this.config.openAccessor,"open"):void 0,this.getHigh=de(this.config.highAccessor,"high"),this.getLow=de(this.config.lowAccessor,"low"),this.getClose=t?de(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Zt.GROUP_COLOR_MAP_CAP=1e3;var Jt=Zt;Object.assign(Jt.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(){It.set(this,!0)},consumeStylePaintPending:function(){const e=!0===It.get(this);return It.delete(this),e}});var en=require("react"),tn={sceneGeometry:0,layout:0,domain:0};function nn(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function on(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 rn="production"!==process.env.NODE_ENV,sn={revisions:tn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},an=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=tn,this.lastObserved=tn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){rn&&(this.lastObserved=on(this.lastObserved,nn(e)))}beforeCompute(e,t){if(!rn)return sn;const n=on(nn(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(rn){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="")}}},ln=(0,en.memo)(function({store:e,diagnostics:t}){return(0,en.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),cn=y(require("react"));function un(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:cn.createElement(cn.Fragment,null,...t)}var hn=y(require("react")),dn=require("react/jsx-runtime"),fn={isActive:!1,predicate:()=>!0},pn=hn.createContext(null);function yn({value:e,children:t}){return(0,dn.jsx)(pn.Provider,{value:e,children:t})}function mn(){return hn.useContext(pn)??fn}function gn(e,t){return null!=e?(0,dn.jsx)(yn,{value:t,children:e}):e}var xn=require("react");function bn(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function vn(e,t=30){return Math.max((e??4)+5,12,t)}function kn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function wn(e,t){const n=kn(e);if(!n)return!1;const o=kn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var An=[40,40],Sn=[.5,.5];function Cn(e,t){const[n,o]=e.viewBox??An,[r,i]=e.anchor??Sn,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 Mn(e,t){const n=Cn(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 jn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var _n=null;function Rn(e){if("undefined"==typeof Path2D)return null;_n||(_n=new Map);const t=_n.get(e);if(t)return t;const n=new Path2D(e);return _n.size>1024&&_n.clear(),_n.set(e,n),n}function Pn(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??An,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 Ln(e,t){const n=Cn(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 In(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=Rn(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:jn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:jn(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)}}var Tn=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Nn=new WeakMap,Fn=0,On=!1,Bn=null,Dn=null;function Wn(e,t){if(!t)return t;const n=Tn.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(On)return;if("undefined"==typeof window||"undefined"==typeof document)return;On=!0;const e=()=>{Fn++};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{Bn=window.matchMedia("(prefers-color-scheme: dark)"),Dn=e,"function"==typeof Bn.addEventListener?Bn.addEventListener("change",Dn):"function"==typeof Bn.addListener&&Bn.addListener(Dn)}catch{}}();let r=Nn.get(o);r&&r.version===Fn||(r={version:Fn,map:new Map},Nn.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}var zn=null;var Hn=require("react/jsx-runtime");function En(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function $n(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function Yn(e,t){let n=2166136261;const o=$n(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 Gn=new Map;function qn(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 Vn(e,t,n="#4e79a7"){if(En(e)){const n=Yn(t,e);return{fill:`url(#${n})`,def:qn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var Xn=require("d3-shape");function Un(e){switch(e){case"monotoneX":return Xn.curveMonotoneX;case"monotoneY":return Xn.curveMonotoneY;case"cardinal":return Xn.curveCardinal;case"catmullRom":return Xn.curveCatmullRom;case"step":return Xn.curveStep;case"stepBefore":return Xn.curveStepBefore;case"stepAfter":return Xn.curveStepAfter;case"basis":return Xn.curveBasis;case"natural":return Xn.curveNatural;default:return null}}function Kn(e,t,n){if(null==t)return n;if(En(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${$n(e)}@${n}`,r=Gn.get(o);if(void 0!==r)return r;const i=function(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):(zn||(zn=document.createElement("canvas")),zn.width=e,zn.height=e,zn)}(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")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Gn.set(o,i),i}(t,e);return o||t.background&&Wn(e,t.background)||n}return"string"!=typeof t?t:Wn(e,t)||n}function Qn(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)),h=e.createLinearGradient(o,r,i,s),[d,f,p]=function(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]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${p},${c})`),h.addColorStop(1,`rgba(${d},${f},${p},${u})`),h}function Zn(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var Jn=require("d3-shape"),eo=new WeakMap;function to(e,t){const n=Un(t);if(!n)return e;const o=eo.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,Jn.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return eo.set(e,r),r}function no(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,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,m)=>{if(r>u||c>y||l>d||h>m)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);vn(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,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"point":if(r)break;e=ro(i,t,n,o);break;case"symbol":e=io(i,t,n,o);break;case"glyph":e=so(i,t,n,o);break;case"line":e=ao(i,t,n,o);break;case"rect":if(null==i.datum)break;e=co(i,t,n);break;case"heatcell":e=uo(i,t,n);break;case"area":if(!1===i.interactive)break;e=fo(i,t,n);break;case"candlestick":e=ho(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function oo(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=po(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function ro(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>vn(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function io(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>vn(kt(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function so(e,t,n,o=30){if(null==e.datum)return null;const r=Ln(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>vn(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function ao(e,t,n,o=30){if(0===e.path.length)return null;const r=po(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=lo(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function lo(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function co(e,t,n){const o=bn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function uo(e,t,n){const o=bn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function ho(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function fo(e,t,n){if(0===e.topPath.length)return null;const o=po(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function po(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var yo=require("react"),mo={fresh:1,aging:.7,stale:.45,expired:.25},go={alpha:1,band:"fresh",isStale:!1};function xo(e,t){if(!e||0>=t)return go;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:{...mo,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:go}var bo=require("react/jsx-runtime");function vo({isStale:e,position:t}){return(0,bo.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 ko=require("react"),wo=y(require("react")),Ao=16,So=6,Co=10,Mo=22,jo=require("react/jsx-runtime"),_o={fill:(e,t)=>(0,jo.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,jo.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Ro(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,_o[n])(o(e,t),r),i}function Po({swatchSize:e}){return(0,jo.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 Lo(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Io=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=Ro(e,c,h,d,x),k=Lo(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,jo.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?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:m?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,jo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,jo.jsx)(Po,{swatchSize:x}),(0,jo.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},To=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=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 p=d[f];h.push((0,jo.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&h.push((0,jo.jsx)("text",{y:p.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h.push((0,jo.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:Io(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),h},No=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>m+g+7*e.label.length),S=[];let C=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+x+e;h&&h>0&&M>0&&n>h?(S.push({start:C,end:t,width:M}),C=t,M=e):M=n}),p.length>0&&S.push({start:C,end:p.length,width:M}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=Ro(e,h,d,f,m),S=Lo(e,o,r),C=r&&r.size>0&&r.has(e.label);y.push((0,jo.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,jo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,C&&(0,jo.jsx)(Po,{swatchSize:m}),(0,jo.jsx)("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const j=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:j,totalRows:_,totalHeight:_*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const m=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(m.push((0,jo.jsx)("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),y+=16),m.push((0,jo.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&m.push((0,jo.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,jo.jsx)("g",{children:m})};function Fo({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-"+wo.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,jo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,jo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,jo.jsx)("defs",{children:(0,jo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,jo.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,jo.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,jo.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,jo.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,jo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,jo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,jo.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,jo.jsx)("defs",{children:(0,jo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,jo.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,jo.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,jo.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Oo(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:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??Ao),n=Math.max(t,e?.rowHeight??Mo);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??So),itemGap:Math.max(0,e?.itemGap??Co),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=wo.useState(0),[y,m]=wo.useState(0),g=wo.useCallback((e,t)=>{p(e),m(t)},[]),x="vertical"===u?To({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):No({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,jo.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"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,jo.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}),x]})}function Bo(...e){let t;for(const n of e)n&&(t=Do(t)&&Do(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function Do(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}var Wo=require("react/jsx-runtime");function zo(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,y=Math.max(0,n-r.left-r.right),m=Math.max(1,f?s?.maxWidth??y:100);let g,x;return"left"===i?(g=Math.max(4,r.left-m-10),x=r.top):"top"===i?(g=r.left,x=p?32:8):"bottom"===i?(g=r.left,x=o-r.bottom+38):(g=n-r.right+10,x=r.top),(0,Wo.jsx)("g",{transform:`translate(${g}, ${x})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?(0,Wo.jsx)(Fo,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):Do(t)?(0,Wo.jsx)(Oo,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var b}var Ho=require("react"),Eo=require("d3-array");C();var $o=require("react/jsx-runtime");function Yo(e){return"string"==typeof e?{type:e}:e}function Go({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,Ho.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,m=0;return(0,$o.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,$o.jsx)("line",{x1:l,y1:m+y*(f+d/2),x2:p,y2:m+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,$o.jsx)("line",{x1:l,y1:m+y*f,x2:l,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,$o.jsx)("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,$o.jsx)("rect",{x:Math.min(t,n),y:"top"===e?m-f-d:m+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,$o.jsx)("line",{x1:a,y1:"top"===e?m-f-d:m+f,x2:a,y2:"top"===e?m-f:m+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,m=0;return(0,$o.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,$o.jsx)("line",{x1:m+y*(f+d/2),y1:l,x2:m+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,$o.jsx)("line",{x1:m+y*f,y1:l,x2:m+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,$o.jsx)("line",{x1:m+y*f,y1:p,x2:m+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,$o.jsx)("rect",{x:"left"===e?m-f-d:m+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,$o.jsx)("line",{x1:"left"===e?m-f-d:m+f,y1:a,x2:"left"===e?m-f:m+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,Eo.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=S(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,$o.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,$o.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,$o.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,$o.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,$o.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,$o.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,$o.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,$o.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var qo=y(require("react")),Vo=require("react/jsx-runtime");function Xo(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 Uo(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 Ko(e,t,n,o){if(!e)return(0,Vo.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,Vo.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:Xo(i,l):[],y=r?c?[r]:Xo(r,l):[],m="leftRight"===u?"end"===d?-4:4:0;let g=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,Vo.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?m-l:"middle"===d?m-l/2:m,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Vo.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Vo.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Vo.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,Vo.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,Vo.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),y.length>0&&x.push((0,Vo.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:g,children:y.map((e,t)=>(0,Vo.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=(0,Vo.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,Vo.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,Vo.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Vo.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function Qo(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,Vo.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,Vo.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,Vo.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,Vo.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,Vo.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,Vo.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,Vo.jsx)("path",{d:Uo(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Vo.jsx)("g",{className:"annotation-subject",children:i})}function Zo(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,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}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,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,Vo.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,Vo.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,Vo.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,Vo.jsx)("g",{className:"annotation-connector",children:s})}function Jo(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:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,Vo.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...m,children:[!v.has("connector")&&Zo(k,w,l,h,A,c),!v.has("subject")&&Qo(A,c,h,x,b),!v.has("note")&&Ko(a,k,w,h)]})}function er(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,Vo.jsx)(Jo,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,Vo.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Vo.jsx)(Jo,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var tr=require("d3-hierarchy"),nr=require("d3-shape");function or(e){return Math.round(100*e)/100}function rr(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(or);return{points:e.map(([e])=>[or(e),or(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function ir(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 sr(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 ar(e){return null==e?null:e+""}function lr(e,t,n){return t.stickyPositionCache?.set(e,n),n}function cr(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 lr(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?lr(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return ar(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>ar(e.pointId)===o);if(r)return lr(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return ar(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=ir(i,n),a=sr(i,n);return null==s||null==a?null:lr(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=ir(e,n),i=sr(e,n)),null!=r&&null!=i)return lr(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function ur(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var hr=require("react/jsx-runtime"),dr={secondary:0,primary:3};function fr(e){return!0===e?._annotationDeferred}function pr(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function yr(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function mr(e){return Math.max(.72,.95-.06*e)}C();var gr=y(require("react")),[xr,br]=Z(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 vr(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 kr=require("react/jsx-runtime"),wr="var(--semiotic-bg, #ffffff)";function Ar(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:h}=e,d=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,kr.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??wr,strokeWidth:d.haloWidth??3});const p=d.padding??{x:6,y:3},y="number"==typeof p?p:p.x,m="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(o,i),x=i+2*m;let b,v;return b="middle"===l?t-g/2-y:"end"===l?t-g-y:t-y,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,(0,kr.jsxs)("g",{className:h,children:[(0,kr.jsx)("rect",{x:b,y:v,width:g+2*y,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??wr,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var Sr=require("react/jsx-runtime"),Cr={linear:nr.curveLinear,monotoneX:nr.curveMonotoneX,monotoneY:nr.curveMonotoneY,step:nr.curveStep,stepAfter:nr.curveStepAfter,stepBefore:nr.curveStepBefore,basis:nr.curveBasis,cardinal:nr.curveCardinal,catmullRom:nr.curveCatmullRom};var Mr=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function jr(e){return!!e&&"object"==typeof e&&Mr.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function _r(e){return"primary"===e?.emphasis||!0===e?.defensive}function Rr(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 Pr(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 Lr=32,Ir=6,Tr=4,Nr=8,Fr=72;var Or={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Br(e){if(!Dr(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 Dr(e){return jr(e)}function Wr(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 zr(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 Hr(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Er(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 $r(e,t,n,o,r,i,s,a){const l=Hr(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*Er(l,e);for(const e of o)c+=4*Er(l,e);return c}function Yr(e){const{annotations:t,context:n,defaultOffset:o=Lr,notePadding:r=Ir,markPadding:i=Tr,edgePadding:s=Nr,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Fr,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:m}=e,g=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==b.preferShortText?t.map(Br):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),C=k&&!f?b.responsive??{minWidth:v}:f,M=k&&!y?b.cohesion:y;if(0===w.length||0>=g||0>=x)return w.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=w.map((e,t)=>{if(!Dr(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?cr(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=[...Wr("string"==typeof e.title?e.title:void 0,t),...Wr("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(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(Hr(zr(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=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=$r(zr(i.x,i.y,e.dx,e.dy,u),e,j,_,g,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=Hr(zr(i.x,i.y,d.dx,d.dy,u),r);j.push(p);const y=Math.hypot(d.dx,d.dy),m=l&&y>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...m?{connector:m}:{}}}),L=R?P:w.slice();let I=L;if(d){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?Or[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(A){const e="object"==typeof A?A:{},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}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Rr(g,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=Rr(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,jr(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=>_r(e.annotation)),c=a.filter(e=>!_r(e.annotation)).sort((e,t)=>Pr(t.annotation)-Pr(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))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:I,width:g,height:x,...n});for(const e of o)T.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=g)for(const e of I)Dr(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let N;return N=0===T.size?I:S?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),M?function(e,t){let n=!1;const o=e.map(e=>Dr(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(N,M):N}var Gr=require("react"),qr={positions:new Map},Vr=new Set;function Xr(){for(const e of Vr)e()}function Ur(e,t){const n=qr.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(qr.positions);o.delete(e),qr={positions:o},Xr()}function Kr(e,t){const n=qr.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(qr.positions);o.delete(e),qr={positions:o},Xr()}function Qr(){return qr}function Zr(e){return Vr.add(e),()=>Vr.delete(e)}var Jr={positions:new Map};function ei(){return()=>{}}function ti(){return Jr}function ni(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)}function oi(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function ri(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ii(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function si(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ai(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}var li=require("react/jsx-runtime");function ci(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,ko.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||ui,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??ni(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return hi(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,ko.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||ui,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return hi((e?.tickValues??ni(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,m=a&&s;if(!y&&!m)return null;const g=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=m&&(!g||!1!==g.baseline),v=m&&(!x||!1!==x.baseline),k=g?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,li.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,li.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=si(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=si(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,li.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,li.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,li.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,li.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,li.jsx)("path",{d:ai("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,li.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,li.jsx)("path",{d:ai("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function ui(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function hi(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function di(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:y,title:m,legend:g,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:C,marginalGraphics:M,xValues:j,yValues:_,annotations:R,onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T,autoPlaceAnnotations:N,svgAnnotationRules:F,xAccessor:O,yAccessor:B,annotationData:D,pointNodes:W,curve:z,underlayRendered:H,canvasObscuresUnderlay:E=!0,linkedCrosshairName:$,linkedCrosshairSourceId:Y,children:G}=e,q=function(e){const t=br(e=>e.pushObservation),n=gr.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return gr.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T}),V=(0,ko.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||ui,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o),c=e?.tickValues??ni(s.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),y=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let m=hi(h,y);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=m[m.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,m.length,u);y>t-o&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:r})}}return m},[a,s,l,d,t,p]),X=(0,ko.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||ui,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o);let c=hi((e?.tickValues??ni(s.y,i,p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=s.y.domain()[1],n=s.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[a,s,l,f,n,p]),U=(0,ko.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||ui,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return hi((e.tickValues??ni(s.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,n,p]),K=(0,ko.useRef)(new Map),Q=(0,ko.useRef)(R?.length??0),Z=R?.length??0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=(0,ko.useMemo)(()=>{if(!R||0===R.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=cr(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!ur(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,Sr.jsx)(er,{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=ir(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,Sr.jsxs)("g",{opacity:e.opacity,children:[(0,Sr.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,Sr.jsx)(Ar,{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=sr(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,Sr.jsxs)("g",{opacity:e.opacity,children:[(0,Sr.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,Sr.jsx)(Ar,{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:ir({...e,type:"point"},o),y:sr({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,tr.packEnclose)(t),i=e.padding||10;return(0,Sr.jsxs)("g",{children:[(0,Sr.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,Sr.jsx)(Ar,{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:ir({...e,type:"point"},o),y:sr({...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]=A(i),[c,u]=A(s),h=a-r,d=l+r,f=c-r;return(0,Sr.jsxs)("g",{children:[(0,Sr.jsx)("rect",{x:h,y:f,width:d-h,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,Sr.jsx)(Ar,{x:(h+d)/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,Sr.jsx)("g",{children:r.map((t,n)=>{const r=ir(t,o),s=sr(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,Sr.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=ir(e,o),r=sr(e,o);return(0,Sr.jsx)(er,{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 h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.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,p=o.scales?.y??o.scales?.value;if(!f||!p)return null;const y=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},m=f,g=p;let x;if(s)if(a){const e=y(g);x=(t,n)=>[m(n),e(t)]}else{const e=y(m);x=(t,n)=>[e(t),g(n)]}else x=(e,t)=>[m(e),g(t)];const b=e.method||"linear";let v;if("loess"===b)v=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,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===b?rr(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:or((n*t[3]-t[0]*t[1])/o),i=or(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[or(e),or(r*e+i)]),equation:[r,i]}}(u);v=t.points}const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,C]=x(A[0],A[1]);return(0,Sr.jsxs)("g",{children:[(0,Sr.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Sr.jsx)("text",{x:S+4,y:C-4,fill:w,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=Vn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Sr.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,Sr.jsx)("defs",{children:l.def}),(0,Sr.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,Sr.jsx)(Ar,{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=Vn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Sr.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,Sr.jsx)("defs",{children:s.def}),(0,Sr.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,Sr.jsx)(Ar,{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 h=Cr[o.curve||"linear"]||nr.curveLinear,d=(0,nr.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,Sr.jsxs)("g",{children:[(0,Sr.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Sr.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),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,Sr.jsxs)("g",{children:[f&&(0,Sr.jsx)("rect",{x:0,y:Math.min(x,b),width:o.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const n=ir(e,o),r=sr(e,o);return null==n||null==r?null:(0,Sr.jsx)("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Sr.jsx)("text",{x:(o.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:p,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=rr(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,h=l.map(([e,t])=>t-c(e)),d=h.reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+(t[0]-p)**2,0),m=e.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,x=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;x>=e;e++)k.push(b+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(y>0?(e-p)**2/y:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),C=`${s(b)},${a(c(b))}`,M=e.strokeColor||"#6366f1";return(0,Sr.jsxs)("g",{children:[(0,Sr.jsx)("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Sr.jsx)("polyline",{points:`${C} ${S}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,Sr.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:M,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=cr(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!ur(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,Sr.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,Sr.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Sr.jsx)("div",{...vr(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=cr(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,Sr.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?qo.cloneElement(c,{key:"ann-text-"+n}):(0,Sr.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Sr.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),qo.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(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,Sr.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,Sr.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&(0,Sr.jsx)(Ar,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,Sr.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,Sr.jsx)(Ar,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,q),o={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:O,yAccessor:B,width:t,height:n,data:D,frameType:"xy",pointNodes:W,curve:z,stickyPositionCache:K.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:yr(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>fr(e.annotation)),r=e.some(e=>null!=pr(e.annotation)),i=e.some(e=>"layer"===pr(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=dr[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=fr(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,hr.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:mr(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=pr(t.annotation);return a&&(s=(0,hr.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,hr.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,hr.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,hr.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)}(N?Yr({annotations:R,context:o,..."object"==typeof N?N:{}}):R,e,F,o)},[R,N,F,t,n,O,B,D,s,W,z,q]),ee=function(e){const t=(0,Gr.useSyncExternalStore)(e?Zr:ei,e?Qr:ti,e?Qr:ti);return e?t.positions.get(e)??null:null}($);return(0,ko.useEffect)(()=>{if(!ee?.locked||!$)return;const e=e=>{"Escape"===e.key&&Kr($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ee?.locked,$]),a||m||g||C||M||J&&J.length>0||y||G||ee?(0,li.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,li.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,li.jsx)("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),(0,li.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&s&&(!H||E)&&(()=>{const e=si(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=si(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,li.jsxs)("g",{className:"stream-grid",children:[V.map((t,o)=>(0,li.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),X.map((e,n)=>(0,li.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,d=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",x=!!o?.autoRotate&&V.length>1&&(()=>{const e=t/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=o?.tickAnchor,C=e?.tickAnchor,M=ii(V),j=ii(X);return(0,li.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,li.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||E)&&s&&!d&&(0,li.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&d&&(0,li.jsx)("path",{d:ai("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),V.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):wn(e.value,t>0?V[t-1].value:void 0));return(0,li.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,li.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,li.jsx)("text",{y:b,textAnchor:x?"end":oi(S,e.pixel===M.min,e.pixel===M.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:e.label}):(0,li.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,li.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,li.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),(0,li.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||E)&&r&&!a&&(0,li.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&a&&(0,li.jsx)("path",{d:ai("left",t,n),fill:"none",stroke:y,strokeWidth:1}),X.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):wn(e.value,t>0?X[t-1].value:void 0));return(0,li.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,li.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,li.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:ri(C,e.pixel===j.min,e.pixel===j.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,li.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,li.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,li.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===U.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||h,a=e.tickAnchor,c=ii(U);return(0,li.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,li.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),U.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):wn(e.value,n>0?U[n-1].value:void 0));return(0,li.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,li.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,li.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:ri(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,li.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,li.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,li.jsx)("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:s})]})})()]})})(),J,M&&s&&j&&_&&(0,li.jsxs)(li.Fragment,{children:[M.top&&(0,li.jsx)("g",{transform:"translate(0, 0)",children:(0,li.jsx)(Go,{orient:"top",config:Yo(M.top),values:j,scale:s.x,size:i.top,length:t})}),M.bottom&&(0,li.jsx)("g",{transform:`translate(0, ${n})`,children:(0,li.jsx)(Go,{orient:"bottom",config:Yo(M.bottom),values:j,scale:s.x,size:i.bottom,length:t})}),M.left&&(0,li.jsx)("g",{transform:"translate(0, 0)",children:(0,li.jsx)(Go,{orient:"left",config:Yo(M.left),values:_,scale:s.y,size:i.left,length:n})}),M.right&&(0,li.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,li.jsx)(Go,{orient:"right",config:Yo(M.right),values:_,scale:s.y,size:i.right,length:n})})]}),C,ee&&ee.sourceId!==Y&&s?.x&&(()=>{const e=s.x(ee.xValue);if(null==e||0>e||e>t)return null;const o=ee.locked;return(0,li.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),m&&"string"==typeof m?(0,li.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,li.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,zo({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:w,title:m,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k})]}):null}var fi=y(require("react")),pi=require("d3-shape");function yi(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}var mi=require("react/jsx-runtime");function gi(e,t="#4e79a7"){return En(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function xi(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var bi=require("react/jsx-runtime");function vi(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,bi.jsx)("stop",{offset:e.offset,stopColor:e.color},t))}function ki(e,t,n){if(!e||2>t.length)return null;const o=vi(e.colorStops);return o?(0,bi.jsx)("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:o}):null}var wi="undefined"==typeof window||"undefined"==typeof document,Ai=require("react"),Si="undefined"!=typeof window?Ai.useLayoutEffect:Ai.useEffect,Ci=()=>()=>{},Mi=()=>!1,ji=()=>!0,_i=require("react");function Ri(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 Pi(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 Li(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}function Ii(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:o=""}=e;return"transparent"===t||n?null:t||(o&&"transparent"!==o?o:"")||null}var Ti={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function Ni(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var Fi=y(require("react")),Oi=y(require("react")),Bi=(require("react/jsx-runtime"),Oi.createContext(null)),Di=require("react/jsx-runtime"),Wi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zi({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,Di.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Wi,children:t})}function Hi(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 Ei(e){return e&&"object"==typeof e?e:{}}function $i(e){return Ei(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Yi=require("react/jsx-runtime");function Gi(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 qi=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Vi="semiotic-accessible-data-table",Xi=Vi+" semiotic-accessible-data-table-hidden",Ui=Vi+" semiotic-accessible-data-table-visible",Ki={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"},Qi={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Zi={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)"},Ji={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},es={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))"},ts={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ns={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},os={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 rs({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=Fi.useState(!1),[s,a]=Fi.useState(5),l=Oi.useContext(Bi),c=l?.visible??!1,u=r||c,h=Fi.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Fi.useEffect(()=>{u||a(5)},[u]);const f=Fi.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=Fi.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Yi.jsx)("span",{id:n,tabIndex:-1,style:Wi}):null;if(!u)return(0,Yi.jsx)("div",{id:n,className:Xi,tabIndex:-1,onFocus:f,style:Wi,role:"region","aria-label":d,children:(0,Yi.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=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:Hi($i(o))});break;case"line":case"area":{const e=$i(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Hi(e)});break}case"rect":{const e=$i(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Hi(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=Hi($i(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=$i(o),n=Hi(e);if(null==n.category){const t=Ei(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:Hi($i(o))});break;case"arc":t.push({label:"Arc",values:Hi($i(o))});break;case"candlestick":t.push({label:"Candlestick",values:Hi($i(o))});break;case"geoarea":{const e=Ei($i(o)),n=Hi(e);if(null==n.name){const t=Ei(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),m=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}(y),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${qi(e.min)} to ${qi(e.max)}, mean ${qi(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(" ")}(y.length,m),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Yi.jsxs)("div",{ref:h,id:n,className:Ui,tabIndex:-1,onBlur:p,style:Ki,role:"region","aria-label":d,children:[(0,Yi.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Zi,children:"×"}),(0,Yi.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Qi,children:g}),(0,Yi.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Ji,children:[(0,Yi.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:ns,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,Yi.jsx)("thead",{children:(0,Yi.jsxs)("tr",{children:[(0,Yi.jsx)("th",{style:es,children:"type"}),w.map(e=>(0,Yi.jsx)("th",{style:es,children:e},e))]})}),(0,Yi.jsx)("tbody",{children:b.map((e,t)=>(0,Yi.jsxs)("tr",{children:[(0,Yi.jsx)("td",{style:ts,children:e.label}),w.map(t=>{return(0,Yi.jsx)("td",{style:ts,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":qi(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,Yi.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:os,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function is({summary:e}){return e?(0,Yi.jsx)("div",{role:"note",style:Wi,children:e}):null}function ss({tableId:e}){return(0,Yi.jsx)("a",{href:"#"+e,style:Wi,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,Wi)},children:"Skip to data table"})}var as=require("react/jsx-runtime"),ls="var(--semiotic-focus, #005fcc)";function cs({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,as.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ls,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,as.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:ls,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ls,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,as.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,as.jsx)("path",{d:a,fill:"none",stroke:ls,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,as.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 us=y(require("react"));function hs(e,t){return"touch"===t?Math.max(e,24):e}function ds(e){return Array.isArray(e)?e[0]:e}function fs(e,t,n,o){return{data:ds(e),x:t,y:n,__semioticHoverData:!0,...o}}var ps=["name","label","title"],ys=["type","kind","category","group","class","status","role","shape"],ms=["value","amount","total","count","weight","score"],gs=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 xs(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var bs=require("react/jsx-runtime"),vs={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 ks(e,t){return"function"==typeof t?t(e):e[t]}function ws(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 As(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=ks(e,n);s=ws(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=ks(e,r);a.push({label:n,value:ws(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=ws(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=ws(e[t[0]],o))}}const l={...vs,...r};return(0,bs.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,bs.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,bs.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,bs.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Ss(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,bs.jsx)("div",{className:"semiotic-tooltip",style:vs,children:(0,bs.jsx)("div",{children:ws(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,bs.jsxs)("div",{className:"semiotic-tooltip",style:vs,children:[null!=n&&(0,bs.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:ws(n)}),t.map((e,t)=>(0,bs.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,bs.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,bs.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,bs.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:ws(e.value)})]},t))]})}}function Cs(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=ds(!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,bs.jsx)("div",{className:"semiotic-tooltip",style:vs,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?As(e):As())}}var Ms=require("react/jsx-runtime");function js({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=us.useRef(null),[u,h]=us.useState(null);us.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(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 d;d=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(!us.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),p=f?null:vs;return l?(0,Ms.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var _s=y(require("react")),Rs=require("react"),Ps=require("react");var Ls=require("react");function Is(e,t,n){const o=(0,Ls.useRef)(null),[r,i]=(0,Ls.useState)(null);return(0,Ls.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]]]}var Ts=()=>"undefined"!=typeof performance?performance.now():Date.now();function Ns(e,t){const n=e();return Number.isFinite(n)?n:t}var Fs=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Ts,this.lastWallTime=Ns(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=Ns(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??Ts;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Ns(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)))}},Os="undefined"==typeof window?Rs.useEffect:Rs.useLayoutEffect,Bs={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Ds(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ws(e){const t=function(){const[e,t]=(0,Ps.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Ps.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,Rs.useRef)(t);n.current=t;const[o,r]=Is(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Rs.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=Ds(e.foregroundGraphics,r,a),h=Ds(e.backgroundGraphics,r,a),d=le(e=>e.theme),{transition:f,introEnabled:p}=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),y="semiotic-table-"+_s.useId(),m=(0,Rs.useRef)(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new Fs({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=m.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,Rs.useRef)(null),b=(0,Rs.useRef)(e.frameScheduler??Bs);b.current=e.frameScheduler??Bs;const v=(0,Rs.useRef)(null),k=(0,Rs.useRef)(!1),w=(0,Rs.useRef)(()=>{}),A=(0,Rs.useCallback)(()=>{if(null!==x.current||k.current)return;const e=b.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,v.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=o,v.current=e)},[]),S=(0,Rs.useCallback)(()=>{null!==x.current&&((v.current??b.current).cancelAnimationFrame(x.current),x.current=null,v.current=null)},[]);Os(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Rs.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Rs.useEffect)(()=>()=>{S()},[S]);const C=(0,Rs.useRef)(()=>{}),M=(0,Rs.useRef)(()=>{}),j=(0,Rs.useRef)(null),_=(0,Rs.useRef)(null),R=(0,Rs.useRef)(null),P=(0,Rs.useCallback)(()=>{const e=j.current;j.current=null,e&&C.current(e)},[]),L=(0,Rs.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=b.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,Rs.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),M.current()},[]);(0,Rs.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return Os(()=>{T&&(Fn++,T.current=!0,A())},[d,A,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:p,tableId:y,frameRuntime:g,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:C,hoverLeaveRef:M,onPointerMove:L,onPointerLeave:I}}var zs=require("react"),Hs=require("react/jsx-runtime");function Es({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,Hs.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,Hs.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function $s(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function Ys(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var Gs=require("react");function qs(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 Vs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Xs=3156e7;function Us(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:Xs>t?e=>{const t=new Date(e);return`${Vs[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Xs>t?e=>{const t=new Date(e);return`${Vs[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Ks(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:kt(n.size)});else if("glyph"===n.type){const e=Ln(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var Qs=require("d3-shape");function Zs(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Js(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var ea=(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=Wn(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Js(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Un(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),h=!0},o=function(){h&&(e.stroke(),h=!1)},r=null,s=null,c=null,u=null,h=!1;for(let h=0;t.path.length>h;h++){const[d,f]=t.path[h],p=l[h],y=Zs(p,a,i);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(d,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(d-r)*l.t,u=s+(f-s)*l.t,h=Zs(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=y}else n(y,d,f),r=d,s=f,c=p,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?Zn(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,Qs.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Kn(e,t.style.fill,t.style.fill),c&&!u)(0,Qs.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ta(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function na(e,t,n=.3){ta(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 oa(e,t,n=.6){if(!ta(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 ra(e,t,n,o=.35){ta(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var ia=require("d3-shape");function sa(e,t){const n=Un(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,ia.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var aa=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=Kn(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Wn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(sa(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=Qn(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(sa(e,t),ra(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?Zn(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Wn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Un(t.curve);if(e.beginPath(),o)(0,ia.line)().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},la=(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=Kn(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=Kn(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),oa(e,n)}finally{e.restore()}}},ca=new Map;function ua(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=ca.get(t);return n||(n=new Path2D(vt(e.symbolType,e.size)),ca.size>256&&ca.clear(),ca.set(t,n)),n}catch{return null}}var ha=(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=ua(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=Kn(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=Kn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function da(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Cn(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=Kn(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=Pn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&In(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),In(e,i,c,t.accent,void 0,l),e.restore()}function fa(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(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)}}(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 pa(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}}}var ya=(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)ma(e,t);else if(t.cornerRadii&&yi(t.cornerRadii)){const n=Kn(e,t.style.fill,Wn(e,"var(--semiotic-primary, #007bff)")),o=pa(t),r=t.fillGradient&&"string"==typeof n?Qn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,fa(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Wn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Kn(e,t.style.fill,Wn(e,"var(--semiotic-primary, #007bff)")),o=pa(t),r=t.fillGradient&&"string"==typeof n?Qn(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=Wn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Kn(e,t.style.fill,Wn(e,"var(--semiotic-primary, #007bff)")),o=pa(t),r=t.fillGradient&&"string"==typeof n?Qn(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=Wn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}na(e,t),e.globalAlpha=1}};function ma(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()}function ga(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function xa(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var ba=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Wn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),na(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):xa(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=ga(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},va=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=Wn(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=Wn(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},ka={line:[aa,ea,la],area:[aa,la],stackedarea:[aa,la],scatter:[la,ha],bubble:[la,ha],heatmap:[ba],bar:[ya],swarm:[la],waterfall:[(e,t,n,o)=>{ya(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=Wn(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[va],mixed:[aa,ea,la],custom:[aa,ya,ba,ea,la,ha,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&da(e,o,o.x,o.y,n);e.globalAlpha=n},va]},wa=new Set;function Aa(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 Sa(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;wa.has(n)||(wa.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var Ca=require("react/jsx-runtime");function Ma(e){return"string"==typeof e?e:"value"}function ja(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function _a(e,t){if(!t)return ja(e);try{const n=t(e);return null==n?ja(e):n}catch{return ja(e)}}function Ra(e,t){return"function"==typeof t?t(e):e[t]}function Pa(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e.bands?.[o]?.y0??(0===o?e.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e.bands?.[o]?.y1??(0===o?e.band?.y1:void 0),format:t})}),n}function La(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?_a(Ra(o,t.accessor),t.format):null;return(0,Ca.jsxs)("div",{className:"semiotic-tooltip",style:vs,children:[null!=r&&(0,Ca.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=_a(Ra(o,e.accessor),e.format);return(0,Ca.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,Ca.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,Ca.jsx)("span",{children:n})]},t)})]})}}var Ia=require("react/jsx-runtime");function Ta(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Na({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=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&&gs.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=>ps.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=xs(l,ys),u=xs(l,ms),h=new Set(ys),d=new Set(ms),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&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(t);if(null!=e.title||e.entries.length>0)return(0,Ia.jsxs)("div",{className:"semiotic-tooltip",style:vs,children:[null!=e.title&&(0,Ia.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Ia.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Ia.jsx)("span",{style:{fontWeight:600},children:Ta(e.value)})]},e.key))]})}return(0,Ia.jsxs)("div",{className:"semiotic-tooltip",style:vs,children:[(0,Ia.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Ta(n)}),(0,Ia.jsx)("div",{style:{opacity:.7,fontSize:11},children:Ta(o)})]})}function Fa(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 Oa(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}))}Na.ownsChrome=!0;var Ba=require("react"),Da=require("react");function Wa(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 za(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=Ln(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"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":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??"_default"});break;case"heatcell":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:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}var Ha=require("react/jsx-runtime"),Ea={top:20,right:20,bottom:30,left:40},$a=Ti;function Ya(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var Ga=(0,H.memo)((0,H.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:m,normalize:g,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:C,xExtent:M,yExtent:j,extentPadding:_=.1,scalePadding:R,sizeRange:P,size:L=[500,300],responsiveWidth:I,responsiveHeight:T,margin:N,className:F,background:O,renderMode:B,lineStyle:D,pointStyle:W,areaStyle:E,barStyle:$,waterfallStyle:Y,swarmStyle:G,barColors:V,colorScheme:K,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:te,gradientFill:ne,lineGradient:oe,areaGroups:re,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,showAxes:ue=!0,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:ye,yFormat:me,axisExtent:ge,tickFormatTime:xe,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,annotationObservationCallback:Ce,chartId:Me,enableHover:je,hoverRadius:_e=30,tooltipMode:Re,annotations:Pe,onAnnotationActivate:Le,autoPlaceAnnotations:Ie,svgAnnotationRules:Te,showGrid:Ne,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,legendCategoryAccessor:Ee,onCategoriesChange:$e,backgroundGraphics:Ye,foregroundGraphics:Ge,canvasPreRenderers:qe,svgPreRenderers:Ve,title:Xe,categoryAccessor:Ue,brush:Ke,onBrush:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:nt,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at=!1,suspendWhenHidden:lt=!0,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:ht,showValues:ft,heatmapValueFormat:pt,marginalGraphics:yt,pointIdAccessor:mt,xScaleType:gt,yScaleType:xt,accessibleTable:bt=!0,description:kt,summary:wt,linkedCrosshairName:At,linkedCrosshairSourceId:St,customLayout:Ct,onLayoutError:Mt,layoutConfig:jt,layoutSelection:_t}=e,{customHoverBehavior:Rt,customClickBehavior:Pt,hasClickBehavior:Lt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,Ba.useCallback)((t,i)=>{e?.(t,i),Fa({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,Ba.useCallback)((e,i)=>{t?.(e,i),Oa({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:we,customClickBehavior:Ae,onObservation:Se,chartId:Me,chartType:"StreamXYFrame"}),It=(0,H.useId)().replace(/:/g,""),Tt=(0,H.useRef)(!1),Nt=(0,H.useRef)({w:-1,h:-1}),Ft=(0,H.useRef)(!1),Ot=Ws({sizeProp:L,responsiveWidth:I,responsiveHeight:T,userMargin:N,marginDefault:Ea,title:Xe,legend:Fe,legendPosition:ze,animate:tt,transitionProp:et,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at,suspendWhenHidden:lt,themeDirtyRef:Tt}),Bt=function(){const[e,t]=(0,Ai.useState)(!1);return Si(()=>{t(!0)},[]),e}(),Dt=function(){const e=(0,Ai.useSyncExternalStore)(Ci,Mi,ji);return(0,Ai.useRef)(e).current}(),{reducedMotionRef:Wt,responsiveRef:zt,size:Ht,currentTheme:Et,transition:$t,introEnabled:Yt,tableId:Gt,rafRef:qt,renderFnRef:Vt,scheduleRender:Xt,frameRuntime:Ut}=Ot;let Kt=Ot.margin;if(yt){const e=60,t={...Ot.margin};yt.top&&e>t.top&&(t.top=e),yt.bottom&&e>t.bottom&&(t.bottom=e),yt.left&&e>t.left&&(t.left=e),yt.right&&e>t.right&&(t.right=e),Kt=t}const Qt=Ht[0]-Kt.left-Kt.right,Zt=Ht[1]-Kt.top-Kt.bottom,tn=(0,H.useMemo)(()=>X(r),[r]),nn=ve??je,[on,rn]=(0,H.useState)(0),sn=(0,H.useRef)(0),[cn,hn]=(0,H.useState)(null),dn=$s(Ge,Ht,Kt,cn),fn=$s(Ye,Ht,Kt,cn),pn=(0,H.useRef)(null),yn=(0,H.useRef)(null),mn=(0,H.useRef)(void 0),[bn,vn]=(0,H.useState)(null),kn=(0,H.useRef)($a.primary),wn=(0,H.useRef)(function(){let e=-1,t=Ti;return{resolve(n){if(!n)return Ti;const o=Fn;return o===e||(t=function(e){if(!e)return Ti;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||Ti.axisStroke,tickText:s||Ti.tickText,crosshair:s?Ni(s,"66"):Ti.crosshair,hoverFill:c?Ni(c,"4D"):Ti.hoverFill,hoverStroke:s?Ni(s,"99"):Ti.hoverStroke,pointRing:c||Ti.pointRing,primary:i||Ti.primary,background:c||Ti.background}:Ti}(n),e=o),t},invalidate(){e=-1}}}()),An=(0,H.useRef)(!1),Sn=(0,en.useRef)(new an("StreamXYFrame")),[Mn,_n]=(0,H.useState)(!1),[Rn,Ln]=(0,H.useState)([]),[In,Tn]=(0,H.useState)([]),Nn="streaming"===o||["bar","swarm","waterfall"].includes(n),On=function(e){const t=(0,_i.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Pi(e,t);if(!Li(e)||!Li(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(!Pi(n,r))return!1}else{if(!Li(n)||!Li(r))return!1;if(!Ri(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,H.useMemo)(()=>({chartType:n,runtimeMode:Nn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Nn?w:"right",extentPadding:_,scalePadding:R,axisExtent:ge,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Nn?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:y,xScaleType:gt,yScaleType:xt,xExtent:M,yExtent:j,sizeRange:P,binSize:v,normalize:g,baseline:x,stackOrder:b,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:te,gradientFill:!0===ne?{topOpacity:.8,bottomOpacity:.05}:!1===ne?void 0:ne,areaGroups:re?new Set(re):void 0,lineGradient:oe,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,lineStyle:D,pointStyle:W,areaStyle:E,swarmStyle:G,waterfallStyle:Y,colorScheme:K,barColors:V,barStyle:$,annotations:Pe,decay:Ze,pulse:Je,transition:$t,introAnimation:Yt,staleness:nt,clock:Ut.now,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:ht,showValues:ft,heatmapValueFormat:pt,pointIdAccessor:mt,curve:m,themeCategorical:Et?.colors?.categorical,themeSemantic:ee(Et),themeSequential:Et?.colors?.sequential,themeDiverging:Et?.colors?.diverging,customLayout:Ct,onLayoutError:Mt,layoutConfig:jt,layoutMargin:Kt}),[n,Nn,S,A,w,_,R,ge,a,l,c,C,k,u,h,d,f,p,y,Ue,gt,xt,M,j,P,v,g,x,b,Q,Z,J,te,ne,re,oe,ie,se,ae,le,ce,D,W,E,G,Y,K,V,$,Pe,Ze,Je,$t,Yt,nt,Ut.now,ct,ut,ht,ft,pt,mt,m,Et,Ct,Mt,jt,Kt])),Bn=(0,H.useRef)(null);Bn.current||(Bn.current=new Jt(On));const Dn=function(e,t,n,o){const r=(0,Gs.useRef)({accessor:t,onChange:n,readData:o}),i=(0,Gs.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,Gs.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])}(Bn,Ee,$e,e=>e.getData());!function(e,t,n,o){(0,xn.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(Bn,On,Tt,Xt),function(e,t,n,o){const r=(0,xn.useRef)(null);(0,xn.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])}(Bn,_t,Tt,Xt);const zn=(0,H.useRef)(null);zn.current||(zn.current=new U(e=>{const t=Bn.current;t&&t.ingest(e)&&(Tt.current=!0,Xt())},{chunkThreshold:i,chunkSize:s})),(0,H.useEffect)(()=>{zn.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const Hn=(0,H.useCallback)(e=>{zn.current?.push(e)},[]),$n=(0,H.useCallback)(e=>{zn.current?.pushMany(e)},[]),Yn=(0,H.useCallback)(()=>{zn.current?.clear(),Bn.current?.clear(),Tt.current=!0,Xt()},[Xt]);(0,H.useImperativeHandle)(t,()=>({push:Hn,pushMany:$n,remove:e=>{zn.current?.flush();const t=Bn.current?.remove(e)??[];return t.length>0&&(pn.current&&t.some(e=>e===pn.current?.data)&&(pn.current=null,vn(null)),Tt.current=!0,Xt()),t},update:(e,t)=>{zn.current?.flush();const n=Bn.current?.update(e,t)??[];return n.length>0&&(Tt.current=!0,Xt()),n},clear:Yn,getData:()=>(zn.current?.flush(),Bn.current?.getData()??[]),getScales:()=>Bn.current?.scales??null,getExtents:()=>Bn.current?.getExtents()??null,getCustomLayout:()=>Bn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Bn.current?.lastCustomLayoutFailure??null}),[Hn,$n,Yn,Xt]),(0,H.useEffect)(()=>{if(r){if(y&&tn.length>0&&"object"==typeof tn[0]&&null!==tn[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(tn[0][e])){const t=[];for(const n of tn){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void zn.current?.setBoundedData(t)}}zn.current?.setBoundedData(tn)}},[r,tn,y]);const{canvasRef:Gn,interactionCanvasRef:Vn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,zs.useRef)(null),a=(0,zs.useRef)(null),l=(0,zs.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Si(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,Ai.useRef)(a);l.current=a,(0,Ai.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,zs.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,zs.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})}(Ot,{storeRef:Bn,dirtyRef:Tt,hydrated:Bt,wasHydratingFromSSR:Dt,cleanup:()=>zn.current?.clear(),canvasPaintDependencies:[n,Qt,Zt,ue,O,Ye,D,B,qe,Xt]}),{hoverHandlerRef:Xn,hoverLeaveRef:Kn,onPointerMove:Qn,onPointerLeave:Zn}=Ot;Xn.current=e=>{if(!nn)return;const t=Gn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void(pn.current&&(pn.current=null,yn.current=null,vn(null),Rt&&(Rt(null),Tt.current=!0),Xt()));const s=Bn.current;if(!s||0===s.scene.length)return;const l=hs(_e,e.pointerType),c=no(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Re,h=()=>{pn.current&&(pn.current=null,yn.current=null,vn(null),Rt&&Rt(null),Xt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?dt(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,m="function"==typeof y?y(d):void 0;let g=fs(p,d,f,null!=m?{xValue:m,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=oo(to(e.path,e.curve),t,n);if(null===i)continue;const s=po(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=to(e.topPath,e.curve),s=to(e.bottomPath,e.curve),a=oo(i,t,n);if(null===a)continue;const l=oo(s,t,n),c=po(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,Qt));if(e.length>0){const t=s.scales.y.invert,o=kn.current,r=y?y(d):d;if(c)g.xValue=r,g.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),g=fs(e,d,f,{xValue:r,xPx:d})}g.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:dt(e.datum,s.resolvedRibbons)}})}}c||g.allSeries?.length?(pn.current=g,yn.current=c?.node??null,vn(g),Rt&&(Rt(g),Tt.current=!0),Xt()):h()},Kn.current=()=>{pn.current&&(pn.current=null,yn.current=null,vn(null),Rt&&(Rt(null),Tt.current=!0),Xt())};const Jn=(0,H.useRef)(()=>{});Jn.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Pt)return;const n=Gn.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void Pt(null);const s=Bn.current;if(!s||0===s.scene.length)return void Pt(null);const a=hs(_e,mn.current),l=no(s.scene,r,i,a,s.quadtree,s.maxPointRadius);if(!l)return void Pt(null);const c=l.datum||{},u=s.scales?.x?.invert,h="function"==typeof u?u(l.x):void 0;var d;Pt(fs(c,l.x,l.y,null!=h?{xValue:h,xPx:l.x}:void 0),{type:"activate",inputType:(d=mn.current,"touch"===d?"touch":"pointer")})};const eo=(0,H.useCallback)(e=>Jn.current(e),[]),{kbFocusIndexRef:ro,focusedNavPointRef:io,onKeyDown:so}=(ao={storeRef:Bn,hoverRef:pn,hoveredNodeRef:yn,setHoverPoint:vn,customHoverBehavior:Rt,customClickBehavior:Pt,scheduleRender:Xt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,Da.useRef)(-1),u=(0,Da.useRef)(null),h=(0,Da.useRef)(null),d=(0,Da.useCallback)(d=>{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']")}(d))return;const f=e.current;if(!f)return;const p=()=>{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||p());let y;if(h.current?.version===f.version)y=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());y=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),h.current={version:f.version,graph:y}}let m=c.current;if(y.flat.length>m||(p(),m=-1),("Enter"===d.key||" "===d.key)&&m>=0)return d.preventDefault(),void i(l(y.flat[m],f),{type:"activate",inputType:"keyboard"});if(0>m){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=y.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 g=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?Wa(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?Wa(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}}(d.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}}(y,m),y);if(null===g)return;if(d.preventDefault(),0>g)return void p();c.current=g;const x=y.flat[g];u.current=x;const b=l(x,f);t.current=b,o(b),r(b,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...ao,extractPoints:za,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:dt(e.datum,t.resolvedRibbons)})}));var ao;const lo=(0,H.useCallback)(e=>{mn.current=e.pointerType,ro.current=-1,io.current=null,Qn(e)},[io,ro,Qn]),co=(0,H.useCallback)(e=>{mn.current="mouse",ro.current=-1,io.current=null,Qn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[io,ro,Qn]),uo=(0,H.useCallback)(e=>{mn.current=e.pointerType},[]);Vt.current=()=>{if(qt.current=null,!Ut.isActive)return;const e=Gn.current,t=Vn.current;if(!e||!t)return;const o=Bn.current;if(!o)return;const r=Ut.now(),i=o.advanceTransition(Wt.current?r+1e6:r),s=!Wt.current&&i,c=Nt.current.w!==Qt||Nt.current.h!==Zt,u=Tt.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=Sn.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:Qt,height:Zt}),Nt.current={w:Qt,h:Zt},d=!0,Dn()),Sn.current.afterCompute(p,d,c);const y=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,d,Ft),m=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))}(),g=wn.current.resolve(e);kn.current=g.primary;const x=xo(nt,o.lastIngestTime>0?r-o.lastIngestTime:0),b=nt&&x.isStale;if(u||h||y.changed){const t=Ys(e,Ht,Kt,m);if(t){if(t.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),nt&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t,c=Ii({background:n,hasBackgroundGraphics:o,themeBackground:r});if(!c)return!1;const u=Wn(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:O,hasBackgroundGraphics:!!Ye,themeBackground:g.background,x:-Kt.left,y:-Kt.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Qt,Zt),t.clip()),qe&&o.scales)for(const e of qe)t.save(),e(t,o.scene,o.scales,{width:Qt,height:Zt}),t.restore();const e=Ct?ka.custom:ka[n];!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=Aa(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||(Sa(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:B,pixelRatio:m,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:Qt,height:Zt})}}),t.restore(),nt&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!(nn&&pn.current&&o.scales),k=!!(yn.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||An.current){const e=Ys(t,Ht,Kt,m);if(e&&(e.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),v&&pn.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,pn.current,Qt,Zt,"object"==typeof nn?nn:{},yn.current,g),k&&yn.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,yn.current,t,g)}An.current=w}u&&e&&e.setAttribute("aria-label",Gi(o.scene,n+" chart"));const A=Tt.current;if(Tt.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!cn||e(cn.x.domain()[0])!==e(o.scales.x.domain()[0])||e(cn.x.domain()[1])!==e(o.scales.x.domain()[1])||e(cn.y.domain()[0])!==e(o.scales.y.domain()[0])||e(cn.y.domain()[1])!==e(o.scales.y.domain()[1])||cn.x.range()[0]!==o.scales.x.range()[0]||cn.x.range()[1]!==o.scales.x.range()[1]||cn.y.range()[0]!==o.scales.y.range()[0]||cn.y.range()[1]!==o.scales.y.range()[1])&&hn(o.scales),yt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];Ln(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Tn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Pe&&Pe.length>0||Ct)&&(d||s))||!d&&33>r-sn.current||(rn(e=>e+1),sn.current=r),nt?.showBadge&&_n(!!b),(s||null!=o.activeTransition||y.pending)&&Xt()},function(e,t,n,o,r,i){const s=(0,yo.useRef)("fresh");(0,yo.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=xo(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])}(nt,Bn,Tt,Xt,Mn,_n);const ho=(0,H.useMemo)(()=>{if(ye||xe)return;const e=Bn.current;return e?.xIsDate&&cn?Us(cn.x.domain()):void 0},[ye,xe,cn]),fo=ye||xe||ho,mo=nn&&bn?ke?ke(bn):(0,Ha.jsx)(Na,{hover:bn}):null,go=mo?(0,Ha.jsx)(js,{x:bn.x,y:bn.y,containerWidth:Qt,containerHeight:Zt,margin:Kt,className:"stream-frame-tooltip",children:mo}):null,bo=io.current,ko=(0,Ha.jsx)(cs,{active:ro.current>=0,hoverPoint:bn,margin:Kt,size:Ht,shape:bo?.shape,width:bo?.w,height:bo?.h}),wo=qs(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),Ao=qs(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),So=wo.key,Co=Ao.key,Mo=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}}(wo,Ao,Pe&&Pe.length>0||!1);if(wi||!Bt&&Dt){const e=Bn.current;e&&r&&(e.ingest({inserts:tn,bounded:!0}),e.computeScene({width:Qt,height:Zt}));const t=e?.scene??[],n=e?.scales??null,o=$s(Ge,Ht,Kt,n),i=$s(Ye,Ht,Kt,n),s=fo||(()=>{if(e?.xIsDate&&n)return Us(n.x.domain())})();return(0,Ha.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"img","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1]},children:[(0,Ha.jsx)(is,{summary:wt}),(0,Ha.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,Ha.jsx)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:i}),(0,Ha.jsxs)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:[O&&(0,Ha.jsx)("rect",{x:0,y:0,width:Qt,height:Zt,fill:O}),Ve&&n&&Ve.map((e,o)=>(0,Ha.jsx)(z.Fragment,{children:e(t,n,{width:Qt,height:Zt})},"svgpre-"+o)),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=Aa(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Sa(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:B,fallback:()=>function(e,t,n){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const r=Un(o.curve),i=r?(0,pi.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.path)??"":"M"+o.path.map(([e,t])=>`${e},${t}`).join("L"),s=xi(`${n?n+"-":""}line-${t}-stroke-gradient`),a=ki(o.strokeGradient,o.path,s);return(0,bi.jsxs)(fi.Fragment,{children:[a&&(0,bi.jsx)("defs",{children:a}),(0,bi.jsx)("path",{d:i,fill:"none",stroke:a?`url(#${s})`:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})]},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=Un(o.curve),i=!r||2>o.topPath.length||2>o.bottomPath.length?`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:(0,pi.area)().x(([e])=>e).y0((e,t)=>o.bottomPath[t][1]).y1(([,e])=>e).curve(r)(o.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,a=En(o.style.fill)?qn(o.style.fill,s):void 0,l=xi(`${n?n+"-":""}area-${t}-gradient`),c=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=1/0;for(const[,t]of e.topPath)o=Math.min(o,t);let r=-1/0;for(const[,t]of e.bottomPath)r=Math.max(r,t);if(!Number.isFinite(o)||!Number.isFinite(r))return null;const i=[];if("colorStops"in n){const e=vi(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push((0,bi.jsx)("stop",{offset:0,stopColor:gi(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push((0,bi.jsx)("stop",{offset:1,stopColor:gi(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return(0,bi.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:o,x2:0,y2:r,children:i})}(o,l),u=c?`url(#${l})`:a?`url(#${s})`:gi(o.style.fill),h=c?void 0:o.style.fillOpacity??o.style.opacity??.7,d=r?(0,pi.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.topPath)??"":"M"+o.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=xi(`${n?n+"-":""}area-${t}-stroke-gradient`),p=ki(o.strokeGradient,o.topPath,f),y=o.style.stroke&&"none"!==o.style.stroke?(0,bi.jsx)("path",{d:d,fill:"none",stroke:p?`url(#${f})`:gi(o.style.stroke),strokeWidth:o.style.strokeWidth||2,opacity:o.style.opacity}):null;if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,bi.jsxs)("g",{children:[(0,bi.jsxs)("defs",{children:[c,!c&&a,p,(0,bi.jsx)("clipPath",{id:e,children:(0,bi.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})]}),(0,bi.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,bi.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),y]})]},"area-"+t)}return(0,bi.jsxs)(fi.Fragment,{children:[(c||a||p)&&(0,bi.jsxs)("defs",{children:[c,!c&&a,p]}),(0,bi.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),y]},"area-"+t)}case"point":{const o=e,r=`${n?n+"-":""}point-${t}-hatch`,i=En(o.style.fill)?qn(o.style.fill,r):void 0;return(0,bi.jsxs)(fi.Fragment,{children:[i&&(0,bi.jsx)("defs",{children:i}),(0,bi.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#${r})`:gi(o.style.fill),opacity:o.style.opacity??o.style.fillOpacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=vt(e.symbolType,e.size,e.path);return(0,bi.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?gi(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=Cn(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=Pn(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?xi(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:jn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:jn(n.stroke??"none",a,e.accent);return r||i?(0,mi.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,mi.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,mi.jsx)("clipPath",{id:c,children:(0,mi.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,mi.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,mi.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const o=e,r=`${n?n+"-":""}xyrect-${t}-hatch`,i=En(o.style.fill)?qn(o.style.fill,r):void 0;return(0,bi.jsxs)(fi.Fragment,{children:[i&&(0,bi.jsx)("defs",{children:i}),(0,bi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#${r})`:gi(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),s=.299*o+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,bi.jsxs)("g",{children:[(0,bi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),(0,bi.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,bi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+t)}case"candlestick":{const n=e,o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,bi.jsxs)("g",{children:[(0,bi.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,bi.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,It)})).filter(Boolean)]})]}),(0,Ha.jsx)(di,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:n,showAxes:ue,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:s,yFormat:me||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,foregroundGraphics:un(o,gn(Bn.current?.customLayoutOverlays,_t??null)),marginalGraphics:yt,xValues:[],yValues:[],annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Se,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:0,xAccessor:So,yAccessor:Co,annotationData:Mo(Bn.current?.getData()),pointNodes:Ks(Bn.current?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:At,linkedCrosshairSourceId:St})]})}return(0,Ha.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"group","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),tabIndex:0,style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1],overflow:"visible",touchAction:Ya(Ke)},onKeyDown:so,children:["production"!==process.env.NODE_ENV&&Bn.current&&(0,Ha.jsx)(ln,{store:Bn.current,diagnostics:Sn.current}),bt&&(0,Ha.jsx)(ss,{tableId:Gt}),bt&&(0,Ha.jsx)(rs,{scene:Bn.current?.scene??[],chartType:n+" chart",tableId:Gt,chartTitle:"string"==typeof Xe?Xe:void 0}),(0,Ha.jsx)(is,{summary:wt}),(0,Ha.jsx)(zi,{hoverPoint:bn}),(0,Ha.jsxs)("div",{role:"img","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:nn?lo:void 0,onMouseMove:nn?co:void 0,onPointerLeave:nn?Zn:void 0,onMouseLeave:nn?Zn:void 0,onPointerDown:nn||Lt?uo:void 0,onClick:Lt?eo:void 0,children:[(0,Ha.jsx)(Es,{size:Ht,margin:Kt,children:fn}),(0,Ha.jsx)(ci,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:cn,showAxes:ue,axes:he,showGrid:Ne,xFormat:fo,yFormat:me||be,axisExtent:ge}),(0,Ha.jsx)("canvas",{ref:Gn,"aria-label":Gi(Bn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Ha.jsx)("canvas",{ref:Vn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Ha.jsx)(di,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:cn,showAxes:ue,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:fo,yFormat:me||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,foregroundGraphics:un(dn,gn(Bn.current?.customLayoutOverlays,_t??null)),marginalGraphics:yt,xValues:Rn,yValues:In,annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Se,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:on,xAccessor:So,yAccessor:Co,annotationData:Mo(Bn.current?.getData()),pointNodes:Ks(Bn.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!Ii({background:O,hasBackgroundGraphics:!!Ye,themeBackground:Et?.colors.background}),linkedCrosshairName:At,linkedCrosshairSourceId:St}),(Ke||Qe)&&(0,Ha.jsx)(q,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,dimension:Ke?.dimension??"xy",scales:cn,onBrush:Qe??(()=>{}),binSize:v,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===n?Bn.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===o}),nt?.showBadge&&(0,Ha.jsx)(vo,{isStale:Mn,position:nt.badgePosition}),ko,go]})]})}));Ga.displayName="StreamXYFrame";var qa=Ga,Va=require("react"),Xa=require("react"),Ua=require("react"),Ka=require("react/jsx-runtime"),Qa=(0,Ua.createContext)(null);function Za({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,Ua.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=Ye(e,n)??We[r++%We.length];return o}const e=Array.isArray(n)?n:De[n]||We,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,Ka.jsx)(Qa.Provider,{value:r,children:o})}function Ja(){return(0,Ua.useContext)(Qa)}Za.displayName="CategoryColorProvider";var el=require("react");function tl(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 nl(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function ol(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[rl,il]=Z(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||!ol(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=nl(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=nl(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}})}})),sl=require("react");function al(e){const t=(0,sl.useId)(),n=e.clientId||t,{name:o}=e,r=il(e=>e.selections.get(o)),i=il(e=>e.setClause),s=il(e=>e.clearClause),a=(0,sl.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,sl.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(tl(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,sl.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,sl.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,sl.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function ll(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function cl(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=al({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,sl.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&&ll(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&ll(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),ul(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,sl.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function ul(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var hl=require("react/jsx-runtime"),dl=(0,el.createContext)(!1),fl=(0,el.createContext)(!1),pl=(0,el.createContext)(null),yl="undefined"==typeof window?el.useEffect:el.useLayoutEffect;function ml(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function gl(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}var xl="__linked-legend-isolate__",bl="__linked-legend-highlight__";function vl({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=al({name:n,fields:[o],clientId:xl}),{selectPoints:c,clear:u}=al({name:n,fields:[o],clientId:bl}),h=il(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,el.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(xl)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(bl)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,el.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,el.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[m,[g]]=Is([0,0],!0,!1),x=(0,el.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),g),[r,g]);return 0===r.length?null:(0,hl.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,hl.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,hl.jsx)(Oo,{legendGroups:s,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function kl({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,el.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=Ja(),[c,u]=(0,el.useState)({}),h=(0,el.useRef)({}),d=(0,el.useMemo)(()=>({registerCategories:(e,t)=>{const n=ml(t);u(t=>gl(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,el.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return ml(e)},[c]),p=(0,el.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=We[n%We.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,m=Object.keys(p).length>0;return(0,hl.jsx)(rl,{initialState:a,children:(0,hl.jsx)(xr,{children:(0,hl.jsx)(fl.Provider,{value:!0,children:(0,hl.jsx)(pl.Provider,{value:d,children:(0,hl.jsx)(Za,{colors:p,children:(0,hl.jsxs)(dl.Provider,{value:y&&m,children:[y&&"top"===o&&(0,hl.jsx)(vl,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,hl.jsx)(vl,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function wl(e){return e?"string"==typeof e?{name:e}:e:null}var Al=.5;function Sl(e,t,n){return t?(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??Al;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Cl=y(require("react"));function Ml(){return le(e=>e.theme)}function jl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function _l(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 Rl(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=>_l(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"])jl(e[o])&&jl(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"),Cl.createContext(void 0);var Pl=44,Ll={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Pl,snap:"nearestDatum",brushHandleSize:Pl,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Il(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 Ll;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??Pl,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Pl,standardControls:a.standardControls??!1}}var Tl={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 Nl(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 Fl(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 Ol(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 Bl(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Dl=[];function Wl(){const e=Ml(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function zl(e,t,n){const o=Ja(),r=Wl();return(0,Xa.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&&Bl(i)){const e=Ge(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Ge(n.map(e=>({_cat:e})),"_cat",s)}if(i&&Bl(i)){const n=Ge(e,t,s);return e=>i[e]||n(e)}return Ge(e,t,s)}if(i&&Bl(i)){const e=Ge([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function Hl({selection:e,linkedHover:t,fallbackFields:n=Dl,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,Xa.useId)(),d=(0,Xa.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,Xa.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),p=al({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=al({name:t,fields:n});return{onHover:(0,sl.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}ul(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),m=br(e=>e.pushObservation),g=(0,Xa.useCallback)(e=>{r?.(e),m?.(e)},[r,m]),x=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=(0,Xa.useState)(null),k=(0,Xa.useRef)(!1),w=c||n[0],A=(0,Xa.useMemo)(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=(0,Xa.useCallback)((e,n)=>{const o=!e&&k.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"===d?.mode&&d.xField){const n=Fl(e,t,d.xField);null!=n&&function(e,t,n){const o=qr.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(qr={positions:new Map(qr.positions).set(e,{xValue:t,sourceId:n})},Xr())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||o||Ur(d.name||"hover",h),"x-position"===d?.mode||o||y.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else o||v(null);(r||m)&&Fa({onObservation:g,datum:e?Ol(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,y,d,h,r,i,s,m,g,l,w,u]),C=(0,Xa.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Kr(d.name||"hover",h),Ur(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),M=(0,Xa.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Fl(n,e,d.xField);null!=t&&function(e,t,n){const o=qr.positions.get(e);if(o?.locked){const t=new Map(qr.positions);return t.delete(e),qr={positions:t},Xr(),!1}qr={positions:new Map(qr.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Xr()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const o=Ol(n);if(t&&"x-position"!==d?.mode&&y.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])}Bl(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else x&&C();if(n||x){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||m)&&Oa({onObservation:g,datum:n?Ol(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,m,g,i,s,d,h,u,t,y,e,p,f,l,w,C]);return(0,Xa.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&C()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,C]),(0,Xa.useEffect)(()=>()=>{k.current&&C(!1)},[C]),(0,Xa.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{Kr(e,h),Ur(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:h}}function El(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function $l({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,el.useContext)(dl),u=null!==(0,el.useContext)(pl),h=void 0!==o?o:!c&&!!t,d=!!t&&(h||u),f=(0,Xa.useMemo)(()=>{if(!d)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,d]);!function(e){const t=(0,el.useContext)(pl),n=(0,el.useId)(),o=ml(e),r=(0,el.useRef)([]);gl(r.current,o)||(r.current=o);const i=r.current;yl(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),yl(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(u&&t?f:[]);const p=(0,Xa.useMemo)(()=>{if(!h||!t)return;const o=function({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):He[i%He.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:$e,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[h,t,e,n,f]),y=(0,Xa.useMemo)(()=>Bo(p,l),[p,l]),m=(0,Xa.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 y&&("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,y,r]);return{legend:y,margin:m,legendPosition:r}}function Yl(e,t,n){const[o,r]=(0,Xa.useState)(null),[i,s]=(0,Xa.useState)(new Set),a=(0,Xa.useMemo)(()=>new Set,[]),l=(0,Xa.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,Xa.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,Xa.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}}function Gl(e,t,n){return function(e,t,n){const o=Tl[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Rl({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=Tl[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:Nl(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Il(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var ql=require("react/jsx-runtime");function Vl({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,ql.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,ql.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,ql.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,ql.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,ql.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 Xl=y(require("react")),Ul=require("react/jsx-runtime"),Kl=class extends Xl.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,Ul.jsx)(Vl,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},Ql=require("react/jsx-runtime"),Zl="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Jl({componentName:e,width:t,height:n,children:o}){return(0,Ql.jsx)(Kl,{fallback:o=>(0,Ql.jsx)(Vl,{componentName:e,message:o.message,width:t,height:n}),children:o})}var ec={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"},tc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function nc(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,Ql.jsx)("div",{style:{...ec,width:t,height:n},children:o||"No data available"}):null}function oc(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,Ql.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,Ql.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,Ql.jsx)("div",{className:"semiotic-loading-bar",style:{...tc,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))})}function rc(e,t,n,o){if(!Zl)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 ic(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 sc(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=ic(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function ac({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=sc(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var lc=require("react"),cc=require("react");function uc(e){const t=le(e=>e.theme.colors.selectionOpacity);return(0,cc.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function hc(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,legend:y,userMargin:m,marginDefaults:g,onClick:x,hoverHighlight:b,mobileInteraction:v,mobileSemantics:k,loading:w,loadingContent:A,emptyContent:S,width:C,height:M}=e,j=void 0===n,_=(0,lc.useMemo)(()=>X(t),[t]),[R,P]=(0,lc.useState)([]),L=(0,lc.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,lc.useMemo)(()=>Il(v,{width:C,mobileSemantics:k}),[v,C,k]),{activeSelectionHook:N,hoverSelectionHook:F,customHoverBehavior:O,customClickBehavior:B,crosshairSourceId:D}=Hl({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:x,hoverHighlight:b,colorByField:I,mobileInteraction:T}),W=El(l,D),z=zl(_,o,r),H=(0,lc.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),E=(0,lc.useMemo)(()=>j&&R.length>0?R:H,[j,R,H]),$=Yl(i,o,E),Y=(0,lc.useMemo)(()=>F||($.legendSelectionHook?$.legendSelectionHook:N),[F,$.legendSelectionHook,N]),G=uc(a),q=Wl(),V=Ja(),U=(0,lc.useMemo)(()=>{if(z)return z;if(!o||0===E.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:q&&q.length>0?q:He,t="__streamCat",n=Ge(E.map(e=>({[t]:e})),t,e);return e=>V?.[e]||n(e)||"#999"},[z,o,E,r,q,V]),{legend:K,margin:Q,legendPosition:Z}=$l({data:_,colorBy:o,colorScale:U,showLegend:p,legendPosition:s,userMargin:m,defaults:g,categories:E,additionalLegend:y}),J=(0,lc.useMemo)(()=>{const e={};return K&&(e.legend=K,e.legendPosition=Z),i&&"none"!==i&&(e.legendHoverBehavior=$.onLegendHover,e.legendClickBehavior=$.onLegendClick,e.legendHighlightedCategory=$.highlightedCategory,e.legendIsolatedCategories=$.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[K,Z,i,$.onLegendHover,$.onLegendClick,$.highlightedCategory,$.isolatedCategories,j,o,L]),ee=Array.isArray(n)?X(n):n,te=oc(w,C,M,A),ne=te?null:nc(ee,C,M,S);return{data:_,colorScale:z,allCategories:E,legendState:$,effectiveSelectionHook:Y,activeSelectionHook:N,customHoverBehavior:O,customClickBehavior:B,mobileInteraction:T,legend:K,margin:Q,legendPosition:Z,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:W,resolvedSelection:G}}var dc=require("react");function fc(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 pc(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>mc(t(e))}function yc(e,t){const n=pc(e),o=pc(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function mc(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 gc(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=mc(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 xc(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):gc(o,t,n))}function bc(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!xc(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function vc(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,bc(s,t,n(s,i))),a}:r}function kc(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,styleRules:f,ruleContext:p}=e,y=(0,dc.useMemo)(()=>function(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{const h={strokeWidth:t},d=!0===s||Array.isArray(s)&&null!=u&&s.includes(u);let f;return i?f=i(e,u):n?o&&(f=$e(e,n,o)):f=r||ze,void 0!==f&&(h.stroke=f,d&&(h.fill=f,h.fillOpacity=a)),l?.length&&Object.assign(h,bc(e,l,c?c(e,u):{value:void 0,category:u})),h}}({lineWidth:t,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a,styleRules:f,ruleContext:p}),[t,n,o,r,i,s,a,f,p]),m=(0,dc.useMemo)(()=>fc(y,{stroke:l,strokeWidth:c,opacity:u}),[y,l,c,u]);return(0,dc.useMemo)(()=>Sl(m,h??null,d),[m,h,d])}var wc=require("react");function Ac(e,t){const{variant:n,frameRef:o,overrides:r}=t;(0,wc.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])}function Sc(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 Cc(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};o&&(f.annotationObservationCallback=o);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function Mc(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Cs(t)||n}}var jc="__forecastSegment",_c=null;async function Rc(){return _c||(_c=await Promise.resolve().then(()=>(D(),L))),_c}var Pc=require("react"),Lc="__semiotic_resolvedX",Ic="__semiotic_resolvedY";function Tc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:Lc,l="string"==typeof o?o:Ic,c=(0,Pc.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[Lc]=n(t)),s&&(r[Ic]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,Pc.useState)(null),[d,f]=(0,Pc.useState)([]),p=(0,Pc.useRef)(r),y=(0,Pc.useRef)(i);return(0,Pc.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await Rc()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await Rc()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var Nc=require("react/jsx-runtime"),Fc="__lineObjectSeries",Oc=(0,Va.forwardRef)(function(e,t){const n=(0,Va.useRef)(null);Ac(t,{variant:"xy",frameRef:n});const o=Gl(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,styleRules:m,curve:g="linear",showPoints:x=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:A,tooltip:S,pointIdAccessor:C,annotations:M,directLabel:j,gapStrategy:_="break",anomaly:R,forecast:P,band:L,xExtent:I,yExtent:T,frameProps:N={},selection:F,linkedHover:O,onObservation:B,onClick:D,hoverHighlight:W,hoverRadius:z,chartId:H,loading:E,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:q,legend:V,xScaleType:U,yScaleType:K,color:Q,stroke:Z,strokeWidth:J,opacity:ee}=e,{legend:te,...ne}=N,oe=(0,Va.useMemo)(()=>Bo(te,V),[te,V]),{width:re,height:ie,enableHover:se,showGrid:ae,showLegend:le,title:ce,description:ue,summary:he,accessibleTable:de,xLabel:fe,yLabel:pe}=o,ye=(0,Va.useMemo)(()=>X(r),[r]),me=Array.isArray(ye[0]?.[f])?ye[0][f]:ye;rc("LineChart",me,"xAccessor",u),rc("LineChart",me,"yAccessor",h);const{effectiveData:ge,statisticalAnnotations:xe}=Tc({data:ye,xAccessor:u,yAccessor:h,forecast:P,anomaly:R,groupBy:d}),be="__compoundGroup",ve=!(!P||!d),ke=ve?be:P?jc:d,we=(0,Va.useMemo)(()=>{if(!ve)return ge;const e="function"==typeof d?d:e=>e[d];return ge.map(t=>{const n={...t};return n[be]=`${e(t)}__${t[jc]||"observed"}`,n})},[ge,ve,d]),Ae=ve?we:ge,Se=p||d,Ce=(0,Va.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ge;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,ge,h]),Me=(0,Va.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),je=void 0!==Ae[0]?.[f],_e=je?Fc:ke,Re=(0,Va.useMemo)(()=>{if(je)return Ae.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[Fc]:o,[f]:r.map(t=>({...t,[Fc]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ke){const e=Ae.reduce((e,t)=>{const n="function"==typeof ke?ke(t):t[ke];if(!e[n]){const o={[f]:[]};"string"==typeof ke&&(o[ke]=n),ve&&(o[jc]=t[jc],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:Ae}]},[je,ke,f,Ae,d,ve]),{gapProcessedLineData:Pe,hasGaps:Le}=(0,Va.useMemo)(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of Re){const o=(n[f]||[]).filter(t=>!Me(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of Re){const o=n[f]||[];let r=[],i=0;const s=_e&&"string"==typeof _e?n[_e]:void 0;for(const a of o)if(Me(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===_){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Re){const r=o[f]||[],i=[];for(const n of r)Me(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Re,hasGaps:!1}},[Re,_,f,Me,_e,h]),Ie="object"==typeof j?j:{},Te=Ie.position||"end",Ne=Ie.fontSize||11,Fe=(0,Va.useMemo)(()=>{if(!j||!Se)return[];const e="function"==typeof Se?Se:e=>e[Se],t=new Set;for(const n of Pe){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===Te?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[j,Se,Pe,f,Te]),Oe=(0,Va.useMemo)(()=>{if(!j)return o.marginDefaults;const e=Fe.reduce((e,t)=>Math.max(e,t.length*(.6*Ne)),0)+10,t="end"===Te?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[j,Fe,Ne,Te,o.marginDefaults]),Be=hc({data:ge,rawData:r,colorBy:Se,colorScheme:y,legendInteraction:G,legendPosition:q,selection:F,linkedHover:O,fallbackFields:Se?["string"==typeof Se?Se:""]:[],unwrapData:!1,onObservation:B,onClick:D,hoverHighlight:W,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!j||void 0!==le)&&le,legend:oe,userMargin:i,marginDefaults:Oe,loading:E,loadingContent:$,emptyContent:Y,width:re,height:ie}),De=Be.colorScale,We=Be.effectiveSelectionHook,He=Be.resolvedSelection,Ee=Be.customHoverBehavior,Ye=Be.customClickBehavior,Ge=Be.crosshairProps,qe=(0,Va.useMemo)(()=>{if(Se)return je?e=>{const t=e.parentLine||e;return"function"==typeof Se?Se(t):t[Se]}:Se},[Se,je]),Ve=(0,Va.useMemo)(()=>yc(u,h),[u,h]),Xe=kc({lineWidth:w,colorBy:qe,colorScale:De,color:Q,fillArea:v,areaOpacity:k,stroke:Z,strokeWidth:J,opacity:ee,effectiveSelectionHook:We,resolvedSelection:He,styleRules:m,ruleContext:Ve}),[Ue,Ke]=(0,Va.useState)(null);(0,Va.useEffect)(()=>{if(!P)return void Ke(null);let e=!1;return async function(...e){return(await Rc()).createSegmentLineStyle(...e)}(Xe,P).then(t=>{e||Ke(()=>t)}).catch(()=>{e||Ke(null)}),()=>{e=!0}},[Xe,P]);const Qe=Ue||Xe,Ze=(0,Va.useMemo)(()=>{if(x)return e=>{const t={r:b,fillOpacity:1};return Se?De&&(t.fill=$e(e.parentLine||e,Se,De)):t.fill=Q||ze,t}},[x,b,Se,De,Q]),Je=Array.isArray(v)?"mixed":v?"area":"line",et=(0,Va.useMemo)(()=>{if(!j||!Se)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof Se?Se:e=>e[Se],o=new Map;for(const e of Pe){const t=e[f]||[];if(0===t.length)continue;const r="end"===Te?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===Te?6:-6,dy:0,color:De?De(n):ze,fontSize:Ne}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Ne+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ne+2)}return r},[j,Se,De,Pe,f,u,h,Te,Ne]),tt=Be.margin,nt=d||p,ot=(0,Va.useMemo)(()=>La([{label:fe||Ma(u),accessor:u,role:"x",format:a},{label:pe||Ma(h),accessor:h,role:"y",format:l},...nt?[{label:Ma(nt),accessor:nt,role:"group"}]:[],...Pa(L,l)]),[u,h,fe,pe,nt,a,l,L]),rt=ac({componentName:"LineChart",data:je?ge[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),it=(0,Va.useMemo)(()=>je||_e||Le?Pe.flatMap(e=>{const t=e[f]||[];return _e&&"string"==typeof _e?t.map(t=>({...t,[_e]:t[_e]??e[_e]})):t}):Ae,[Pe,f,je,_e,Ae,Le]),st={chartType:Je,...Array.isArray(v)&&{areaGroups:v},...A&&{lineGradient:A},...null!=r&&{data:it},xAccessor:u,yAccessor:h,xScaleType:U,yScaleType:K,...I&&{xExtent:I},...!T||null==T[0]&&null==T[1]?Ce?{yExtent:Ce}:{}:{yExtent:T},groupAccessor:"break"===_&&Le?"_gapSegment":_e||void 0,...L&&{band:L},curve:g,lineStyle:Qe,...x&&{pointStyle:Ze},size:[re,ie],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:tt,showAxes:o.showAxes,xLabel:fe,yLabel:pe,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:se,showGrid:ae,...Be.legendBehaviorProps,...ce&&{title:ce},...ue&&{description:ue},...he&&{summary:he},...void 0!==de&&{accessibleTable:de},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?Ss():Cs(S)||ot,..."multi"===S&&{tooltipMode:"multi"},...Cc({linkedHover:O,selection:F,onObservation:B,onClick:D,hoverRadius:z,hoverHighlight:W,mobileInteraction:Be.mobileInteraction,customHoverBehavior:Ee,customClickBehavior:Ye}),...C&&{pointIdAccessor:C},...(M?.length||xe.length||et.length)&&{annotations:[...M||[],...xe,...et]},...Ge,...ne};return Be.earlyReturn?Be.earlyReturn:rt?(0,Nc.jsx)(Vl,{componentName:"LineChart",message:rt,width:re,height:ie}):(0,Nc.jsx)(Jl,{componentName:"LineChart",width:re,height:ie,children:(0,Nc.jsx)(qa,{ref:n,...st})})});Oc.displayName="LineChart";var Bc=require("react"),Dc=require("react");function Wc(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:m,pointRadius:g,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S,styleRules:C,ruleContext:M}=e,j=(0,Dc.useMemo)(()=>function({data:e,safeData:t,areaBy:n,lineDataAccessor:o}){if(null==e)return[];const r=void 0!==t[0]?.[o];if(!r&&!n)return t;let i;if(r)i=t;else{const e=t.reduce((e,t)=>{const r="function"==typeof n?n(t):t[n],i=r+"";if(!e[i]){const t={[o]:[]};"string"==typeof n&&(t[n]=r),e[i]=t}return e[i][o].push(t),e},{});i=Object.values(e)}return i.flatMap(e=>{const t=Array.isArray(e[o])?e[o]:[];return"string"==typeof n?t.map(t=>({...t,[n]:t[n]??e[n]})):t})}({data:n,safeData:t,areaBy:o,lineDataAccessor:r}),[n,t,o,r]),_=(0,Dc.useMemo)(()=>e=>{const t={};if(i){if(s){const n=$e(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||ze;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,C&&C.length>0&&Object.assign(t,bc(e,C,M?M(e):{value:void 0})),t},[i,s,a,f,p,y,C,M]),R=(0,Dc.useMemo)(()=>fc(_,{stroke:l,strokeWidth:c,opacity:u}),[_,l,c,u]);return{flattenedData:j,lineStyle:(0,Dc.useMemo)(()=>Sl(R,h??null,d),[R,h,d]),pointStyle:(0,Dc.useMemo)(()=>{if(m)return e=>{const t={r:g,fillOpacity:1};return i?s&&(t.fill=$e(e.parentLine||e,i,s)):t.fill=a||ze,t}},[m,g,i,s,a]),defaultTooltipContent:(0,Dc.useMemo)(()=>La([{label:v||Ma(x),accessor:x,role:"x",format:w},{label:k||Ma(b),accessor:b,role:"y",format:A},...S?[{label:Ma(S),accessor:S,role:"group"}]:[],...Pa(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var zc=require("react/jsx-runtime");function Hc(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Ec=(0,Bc.forwardRef)(function(e,t){const n=(0,Bc.useRef)(null);Ac(t,{variant:"xy",frameRef:n});const o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:g,styleRules:x,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:k,showLine:w=!0,lineWidth:A=2,showPoints:S=!1,pointRadius:C=3,tooltip:M,annotations:j,forecast:_,anomaly:R,band:P,xExtent:L,yExtent:I,frameProps:T={},selection:N,linkedHover:F,onObservation:O,onClick:B,hoverHighlight:D,chartId:W,loading:z,loadingContent:H,emptyContent:E,legendInteraction:$,legendPosition:Y,color:G,stroke:q,strokeWidth:V,opacity:U}=e,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:re,xLabel:ie,yLabel:se}=o,ae=(0,Bc.useMemo)(()=>X(r),[r]),le=m||h,ce=(0,Bc.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Hc(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);rc("AreaChart",ae,"xAccessor",c),rc("AreaChart",ae,"yAccessor",u);const ue=hc({data:ae,rawData:r,colorBy:le,colorScheme:g,legendInteraction:$,legendPosition:Y,selection:N,linkedHover:F,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:O,onClick:B,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:W,showLegend:ee,userMargin:i,marginDefaults:o.marginDefaults,loading:z,loadingContent:H,emptyContent:E,width:K,height:Q}),{effectiveData:he,statisticalAnnotations:de}=Tc({data:ae,xAccessor:c,yAccessor:u,forecast:_,anomaly:R,groupBy:h}),fe=(0,Bc.useMemo)(()=>yc(c,u),[c,u]),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ge}=Wc({safeData:he,data:r,areaBy:h,lineDataAccessor:y,colorBy:le,colorScale:ue.colorScale,color:G,stroke:q,strokeWidth:V,opacity:U,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:v,showLine:w,lineWidth:A,showPoints:S,pointRadius:C,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,groupField:h||m,band:P,styleRules:x,ruleContext:fe}),xe=ac({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),be={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...P&&{band:P},...ce&&{gradientFill:ce},...k&&{lineGradient:k},curve:b,lineStyle:ye,...S&&me&&{pointStyle:me},size:[K,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue.margin,showAxes:o.showAxes,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,enableHover:Z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...ue.legendBehaviorProps,...Sc({title:te,description:ne,summary:oe,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:Ss(),tooltipMode:"multi"}:Mc({tooltip:M,defaultTooltipContent:ge}),...Cc({linkedHover:F,selection:N,onObservation:O,onClick:B,hoverHighlight:D,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...(j&&j.length>0||de.length>0)&&{annotations:[...j||[],...de]},...L&&{xExtent:L},...I&&{yExtent:I},...ue.crosshairProps,...T};return ue.earlyReturn?ue.earlyReturn:xe?(0,zc.jsx)(Vl,{componentName:"AreaChart",message:xe,width:K,height:Q}):(0,zc.jsx)(Jl,{componentName:"AreaChart",width:K,height:Q,children:(0,zc.jsx)(qa,{ref:n,...be})})});Ec.displayName="AreaChart";var $c=require("react"),Yc=require("react/jsx-runtime");function Gc(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var qc=(0,$c.forwardRef)(function(e,t){const n=(0,$c.useRef)(null),o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:g=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:C,yExtent:M,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:D,pointIdAccessor:W,windowSize:z}=e,{width:H,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:V,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=o,J=(0,$c.useMemo)(()=>"function"==typeof c?e=>Gc(c(e)):e=>Gc(e[c]),[c]),ee=(0,$c.useMemo)(()=>"function"==typeof u?e=>Gc(u(e)):e=>Gc(e[u]),[u]),te=(0,$c.useMemo)(()=>"function"==typeof h?e=>Gc(h(e)):e=>Gc(e[h]),[h]),[ne,oe]=(0,$c.useState)([]),re=(0,$c.useRef)([]),ie=null==r,se=(0,$c.useMemo)(()=>X(ie?ne:r),[ie,ne,r]),ae=(0,$c.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),m=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(m))continue;const g=u(y,m);if(null!==g)if(null!=a){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(m-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=g,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else{a=g;for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,$c.useMemo)(()=>m?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[m,se,J,ee,te]),ce=(0,$c.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,$c.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,$c.useImperativeHandle)(t,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;re.current=t,oe(t)},t=W?"function"==typeof W?W:e=>e[W]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of re.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=re.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?re.current:se,getScales:()=>n.current?.getScales()??null}},[ie,se,W,z]);const he=hc({data:se,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:B,legendPosition:D,selection:_,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:T,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:H,height:E}),de=(0,$c.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[G,d,f,p,y]),fe=(0,$c.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,$c.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:g,fill:"none"}),[p,y,g]),ye=(0,$c.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),me=(0,$c.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=se.find(e=>J(e)===o);e&&(null==r&&(r=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,Yc.jsxs)("div",{className:"semiotic-tooltip",style:vs,children:[l&&(0,Yc.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,Yc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Yc.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,Yc.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,Yc.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,Yc.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,Yc.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,Yc.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[se,J,ee,te,a,p,y,d,f]),ge="multi"===A,xe=(0,$c.useMemo)(()=>!1===A?()=>null:ge?me:Cs(A)||me,[A,ge,me]);if(he.earlyReturn)return he.earlyReturn;const be={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[H,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:Q,yLabel:Z,xFormat:a,yFormat:l,enableHover:$,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...de&&{legend:de,legendPosition:he.legendPosition},...Sc({title:q,description:V,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...ge&&{tooltipMode:"multi"},...Cc({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...C&&{xExtent:C},...M&&{yExtent:M},...he.crosshairProps,...j};return(0,Yc.jsx)(Jl,{componentName:"DifferenceChart",width:H,height:E,children:(0,Yc.jsx)(qa,{ref:n,...be})})});"function"==typeof qc&&(qc.displayName="DifferenceChart");var Vc=require("react"),Xc=require("react/jsx-runtime"),Uc=(0,Vc.forwardRef)(function(e,t){const n=(0,Vc.useRef)(null),o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,styleRules:y,curve:m="monotoneX",areaOpacity:g=.7,showLine:x=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:k=3,normalize:w=!1,baseline:A="zero",stackOrder:S,tooltip:C,annotations:M,xExtent:j,yExtent:_,frameProps:R={},selection:P,linkedHover:L,onObservation:I,onClick:T,hoverHighlight:N,chartId:F,loading:O,loadingContent:B,emptyContent:D,legendInteraction:W,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:G,height:q,enableHover:V,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=o,oe=(0,Vc.useMemo)(()=>X(r),[r]),re=f||h;Ac(t,{variant:"xy",frameRef:n});const ie=hc({data:oe,rawData:r,colorBy:re,colorScheme:p,legendInteraction:W,legendPosition:z,selection:P,linkedHover:L,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:O,loadingContent:B,emptyContent:D,width:G,height:q}),se=(0,Vc.useMemo)(()=>yc(c,u),[c,u]),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=Wc({safeData:oe,data:r,areaBy:h,lineDataAccessor:d,colorBy:re,colorScale:ie.colorScale,color:H,stroke:E,strokeWidth:$,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,areaOpacity:g,showLine:x,lineWidth:b,showPoints:v,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:te,yLabel:ne,xFormat:a,yFormat:l,groupField:h||f,styleRules:y,ruleContext:se}),he=ac({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:ae},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:m,normalize:w,baseline:w?"zero":A,stackOrder:S,lineStyle:le,...v&&ce&&{pointStyle:ce},size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,showAxes:o.showAxes,xLabel:te,yLabel:ne,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:U,...ie.legendBehaviorProps,...Sc({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:Ss(),tooltipMode:"multi"}:Mc({tooltip:C,defaultTooltipContent:ue}),...Cc({linkedHover:L,selection:P,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...M&&M.length>0&&{annotations:M},...j&&{xExtent:j},..._&&{yExtent:_},...ie.crosshairProps,...R};return ie.earlyReturn?ie.earlyReturn:he?(0,Xc.jsx)(Vl,{componentName:"StackedAreaChart",message:he,width:G,height:q}):(0,Xc.jsx)(Jl,{componentName:"StackedAreaChart",width:G,height:q,children:(0,Xc.jsx)(qa,{ref:n,...de})})});Uc.displayName="StackedAreaChart";var Kc=y(require("react")),Qc=require("react"),Zc=require("react");function Jc(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p,styleRules:y,ruleContext:m}=e,g=(0,Zc.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=$e(o,t,n)}}else u.fill=a?a(e):o||ze;return void 0===u.r&&(u.r=i?i(e):r),y&&y.length>0&&Object.assign(u,bc(e,y,m?m(e):{value:void 0})),u},[t,n,o,r,i,s,a,l,p,y,m]),x=(0,Zc.useMemo)(()=>fc(g,{stroke:c,strokeWidth:u,opacity:h}),[g,c,u,h]);return(0,Zc.useMemo)(()=>Sl(x,d??null,f),[x,d,f])}var eu=require("react");function tu(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,eu.useRef)(null),[i,s]=(0,eu.useState)(0),a=(0,eu.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,eu.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,eu.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function nu(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 ou=require("react/jsx-runtime"),ru=(0,Qc.forwardRef)(function(e,t){const n=(0,Qc.useRef)(null),o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,styleRules:y,sizeBy:m,sizeRange:g=[3,15],symbolBy:x,symbolMap:b,pointRadius:v=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:C,regression:M,forecast:j,anomaly:_,xExtent:R,yExtent:P,frameProps:L={},selection:I,linkedHover:T,linkedBrush:N,onObservation:F,onClick:O,hoverHighlight:B,chartId:D,loading:W,loadingContent:z,emptyContent:H,legendInteraction:E,legendPosition:$,color:Y,stroke:G,strokeWidth:q,opacity:V}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:re,yLabel:ie}=o,se=(0,Qc.useMemo)(()=>X(r),[r]),ae=void 0===r,{domain:le,trackPushed:ce,reset:ue}=tu({accessor:m,data:se,isPushMode:ae}),he=(0,Qc.useCallback)(e=>{ce([e]),n.current?.push(e)},[ce]),de=(0,Qc.useCallback)(e=>{ce(e),n.current?.pushMany(e)},[ce]);Ac(t,{variant:"xy",frameRef:n,overrides:{push:he,pushMany:de,clear:()=>{ue(),n.current?.clear()}}});const fe=hc({data:se,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:$,selection:I,linkedHover:T,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:D,showLegend:J,userMargin:i,marginDefaults:o.marginDefaults,loading:W,loadingContent:z,emptyContent:H,width:U,height:K}),pe=wl(N),ye=cl({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,ge=Kc.useRef(ye.brushInteraction);ge.current=ye.brushInteraction;const xe=(0,Qc.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);rc("Scatterplot",se,"xAccessor",c),rc("Scatterplot",se,"yAccessor",u);const be=(0,Qc.useMemo)(()=>m?le??[0,1]:void 0,[m,le]),ve=(0,Qc.useMemo)(()=>m?e=>qe(e,m,g,be):void 0,[m,g,be]),ke=(0,Qc.useMemo)(()=>yc(c,u),[c,u]),we=Jc({colorBy:f,colorScale:fe.colorScale,color:Y,pointRadius:v,fillOpacity:k,radiusFn:ve,stroke:G,strokeWidth:q,opacity:V,styleRules:y,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Ae=(0,Qc.useMemo)(()=>La([{label:re||Ma(c),accessor:c,role:"x",format:a},{label:ie||Ma(u),accessor:u,role:"y",format:l},...f?[{label:Ma(f),accessor:f,role:"color"}]:[],...m?[{label:Ma(m),accessor:m,role:"size"}]:[]]),[c,u,re,ie,f,m,a,l]),{effectiveData:Se,statisticalAnnotations:Ce}=Tc({data:se,xAccessor:c,yAccessor:u,forecast:j,anomaly:_}),Me=(0,Qc.useMemo)(()=>{const e=nu(M);return e||0!==Ce.length?[...e?[e]:[],...C||[],...Ce]:C},[M,C,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const je=ac({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(je)return(0,ou.jsx)(Vl,{componentName:"Scatterplot",message:je,width:U,height:K});const _e={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:m||void 0,...x&&{symbolAccessor:x},...b&&{symbolMap:b},sizeRange:g,pointStyle:we,colorScheme:p,size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:o.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,showGrid:Z,...fe.legendBehaviorProps,...Sc({title:ee,description:te,summary:ne,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Mc({tooltip:w,defaultTooltipContent:Ae}),...Cc({linkedHover:T,selection:I,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...A&&{marginalGraphics:A},...S&&{pointIdAccessor:S},...Me&&Me.length>0&&{annotations:Me},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:me},onBrush:xe},...fe.crosshairProps,...L};return(0,ou.jsx)(Jl,{componentName:"Scatterplot",width:U,height:K,children:(0,ou.jsx)(qa,{ref:n,..._e})})});ru.displayName="Scatterplot";var iu=require("react"),su=require("react/jsx-runtime");function au(e,t){return Pe(1===t?.5:e/(t-1))}var lu=(0,iu.forwardRef)(function(e,t){const n=(0,iu.useRef)(null);Ac(t,{variant:"xy",frameRef:n});const o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,styleRules:f,pointRadius:p=4,tooltip:y,pointIdAccessor:m,annotations:g,regression:x,forecast:b,anomaly:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,stroke:N,strokeWidth:F,opacity:O}=e,{width:B,height:D,enableHover:W,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:G,yLabel:q}=o,{safeData:V,orderMap:X}=(0,iu.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],n="function"==typeof u?u:e=>e[u];let o=e;if(h&&e.length>0){const t="function"==typeof h?h:e=>e[h];o=[...e].sort((e,n)=>{const o=t(e),r=t(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&s++}let a=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:o,orderMap:i}},[r,h,c,u]);rc("ConnectedScatterplot",V,"xAccessor",c),rc("ConnectedScatterplot",V,"yAccessor",u);const U=hc({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:P,loadingContent:L,emptyContent:I,width:B,height:D}),K=U.resolvedSelection?.unselectedOpacity??Al,Q=(0,iu.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=au(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,iu.useMemo)(()=>[Q],[Q]),J=(0,iu.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=au(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,su.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,su.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,su.jsx)(su.Fragment,{children:s})},[p]),ee=(0,iu.useMemo)(()=>[J],[J]),te=Jc({colorScale:void 0,baseStyleExtras:(0,iu.useMemo)(()=>e=>{const t=X.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?au(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:N,strokeWidth:F,opacity:O,styleRules:f,ruleContext:(0,iu.useMemo)(()=>yc(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,iu.useMemo)(()=>La([{label:G||Ma(c),accessor:c,role:"x",format:a},{label:q||Ma(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,G,q,h,ne,a,l]),re=ac({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=Tc({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=nu(x),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:G,yLabel:q,xFormat:a,yFormat:l,enableHover:W,showGrid:z,...Sc({title:H,description:E,summary:$,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Mc({tooltip:y,defaultTooltipContent:oe}),...Cc({linkedHover:C,selection:S,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...A};return re?(0,su.jsx)(Vl,{componentName:"ConnectedScatterplot",message:re,width:B,height:D}):(0,su.jsx)(Jl,{componentName:"ConnectedScatterplot",width:B,height:D,children:(0,su.jsx)(qa,{ref:n,...ce})})});lu.displayName="ConnectedScatterplot";var cu=require("react"),uu=require("react/jsx-runtime"),hu=(0,cu.forwardRef)(function(e,t){const n=(0,cu.useRef)(null),o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,styleRules:y,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:x="white",tooltip:b,marginalGraphics:v,pointIdAccessor:k,annotations:w,regression:A,xExtent:S,yExtent:C,frameProps:M={},selection:j,linkedHover:_,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:D,color:W,stroke:z,strokeWidth:H,opacity:E}=e,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:V,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,cu.useMemo)(()=>X(r),[r]),ne=void 0===r,oe=hc({data:te,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:D,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:$,height:Y}),{domain:re,trackPushed:ie,reset:se}=tu({accessor:h,data:te,isPushMode:ne}),ae=(0,cu.useCallback)(e=>{ie([e]),n.current?.push(e)},[ie]),le=(0,cu.useCallback)(e=>{ie(e),n.current?.pushMany(e)},[ie]);Ac(t,{variant:"xy",frameRef:n,overrides:{push:ae,pushMany:le,clear:()=>{se(),n.current?.clear()}}});const ce=wl(R),ue=(cl({name:ce?.name||"__unused_brush__",xField:ce?.xField||("string"==typeof c?c:void 0),yField:ce?.yField||("string"==typeof u?u:void 0)}),(0,cu.useMemo)(()=>({stroke:x,strokeWidth:g}),[x,g])),he=(0,cu.useMemo)(()=>re??[0,1],[re]),de=(0,cu.useCallback)(e=>qe(e,h,d,he),[h,d,he]),fe=(0,cu.useMemo)(()=>yc(c,u),[c,u]),pe=Jc({colorBy:f,colorScale:oe.colorScale,color:W,fillOpacity:m,radiusFn:de,baseStyleExtras:ue,stroke:z,strokeWidth:H,opacity:E,styleRules:y,ruleContext:fe,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ye=(0,cu.useMemo)(()=>La([{label:J||Ma(c),accessor:c,role:"x",format:a},{label:ee||Ma(u),accessor:u,role:"y",format:l},{label:Ma(h),accessor:h,role:"size"},...f?[{label:Ma(f),accessor:f,role:"color"}]:[]]),[c,u,J,ee,h,f,a,l]);if(oe.earlyReturn)return oe.earlyReturn;const me=ac({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(me)return(0,uu.jsx)(Vl,{componentName:"BubbleChart",message:me,width:$,height:Y});const ge=nu(A),xe=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:te},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:pe,colorScheme:p,size:[$,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:G,showGrid:q,...oe.legendBehaviorProps,...Sc({title:U,description:K,summary:Q,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Mc({tooltip:b,defaultTooltipContent:ye}),...Cc({linkedHover:_,selection:j,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...v&&{marginalGraphics:v},...k&&{pointIdAccessor:k},...xe&&xe.length>0&&{annotations:xe},...S&&{xExtent:S},...C&&{yExtent:C},...oe.crosshairProps,...M};return(0,uu.jsx)(Jl,{componentName:"BubbleChart",width:$,height:Y,children:(0,uu.jsx)(qa,{ref:n,...be})})});hu.displayName="BubbleChart";var du=require("react"),fu=require("d3-scale");C();var pu=require("react/jsx-runtime"),yu=(0,du.forwardRef)(function(e,t){const n=(0,du.useRef)(null);Ac(t,{variant:"xy",frameRef:n});const o=Gl(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:h,colorScheme:d,customColorScale:f,showValues:p=!1,valueFormat:y,cellBorderColor:m="#fff",cellBorderWidth:g=1,tooltip:x,annotations:b,xExtent:v,yExtent:k,frameProps:w={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,showLegend:T,legendPosition:N,legendInteraction:F}=e,{width:O,height:B,enableHover:D,title:W,description:z,summary:H,accessibleTable:E,xLabel:$,yLabel:Y}=o,G=oc(P,O,B,L),q=G?null:nc(r,O,B,I),V=(0,du.useMemo)(()=>X(r),[r]),U=function(){const e=Ml();return e?.colors?.sequential||void 0}(),K=d??U??"blues",Q=T??!1,Z=N??"right",{margin:J}=$l({data:V,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:i,defaults:o.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:ne}=Hl({selection:S,linkedHover:C,fallbackFields:[],onObservation:M,onClick:j,chartType:"Heatmap",chartId:R,hoverHighlight:_,colorByField:void 0,mobileInteraction:o.mobileInteraction});uc(S);const oe=El(C,ne);Yl(F,void 0,[]);const re=(0,du.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,du.useMemo)(()=>A(V.map(re)),[V,re]),se=(0,du.useMemo)(()=>{if("custom"===K&&f)return f;const e=Be(K);return(0,fu.scaleSequential)(e).domain(ie)},[K,f,ie]),ae=(0,du.useMemo)(()=>La([{label:$||Ma(a),accessor:a,role:"x",format:u},{label:Y||Ma(l),accessor:l,role:"y",format:h},{label:Ma(c),accessor:c,role:"value",format:y}]),[a,l,$,Y,c,u,h,y]),le=ac({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,du.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:y}}},[Q,se,ie,c,y]),ue={chartType:"heatmap",...null!=r&&{data:V},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:p,heatmapValueFormat:y,size:[O,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:o.showAxes,xLabel:$,yLabel:Y,xFormat:u,yFormat:h,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...Sc({title:W,description:z,summary:H,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Mc({tooltip:x,defaultTooltipContent:ae}),...Cc({linkedHover:C,selection:S,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...b&&b.length>0&&{annotations:b},...v&&{xExtent:v},...k&&{yExtent:k},...oe,...w};return G||q||(le?(0,pu.jsx)(Vl,{componentName:"Heatmap",message:le,width:O,height:B}):(0,pu.jsx)(Jl,{componentName:"Heatmap",width:O,height:B,children:(0,pu.jsx)(qa,{ref:n,...ue})}))});yu.displayName="Heatmap";var mu=y(require("react")),gu=require("react"),xu=require("d3-brush"),bu=require("d3-selection");C();var vu=require("react/jsx-runtime"),ku="__splomIdx",wu="splom-hover-source",Au={top:4,bottom:4,left:4,right:4};function Su({frameRef:e,cellSize:t,onBrush:n}){const o=(0,gu.useRef)(null),r=t-Au.left-Au.right,i=t-Au.top-Au.bottom;return(0,gu.useEffect)(()=>{if(!o.current)return;const t=(0,bu.select)(o.current).select(".brush-g"),s=(0,xu.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void n(null);var r;const[[i,s],[a,l]]=t.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];n(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,vu.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,vu.jsx)("g",{className:"brush-g",transform:`translate(${Au.left},${Au.top})`})})}function Cu({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,gu.useRef)(null),m=al({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),g=cl({name:l,xField:t,yField:n}),x=al({name:c,clientId:wu,fields:[ku]}),b=x.selectPoints,v=(0,gu.useCallback)(e=>{e?g.brushInteraction.during(e):g.brushInteraction.end(null)},[g.brushInteraction]),k=(0,gu.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[ku];void 0!==n&&(b({[ku]:[n]}),f?.(t,e.x+Au.left,e.y+Au.top))},[b,f]),w=(0,gu.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+Au.left,e.y+Au.top)},[p]),A=(0,gu.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?$e(e,s,a):ze,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[i,r,s,d,a,x,m,u]);return(0,vu.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,vu.jsx)(qa,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:Au,showAxes:!1,enableHover:"hover"===d,...Cc({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,vu.jsx)(Su,{frameRef:y,cellSize:o,xField:t,yField:n,onBrush:v})]})}function Mu({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=al({name:a,clientId:"splom-diag-"+t,fields:[t]}),h=al({name:l,clientId:`splom-diag-${t}-hover`,fields:[ku]}),d="hover"===c?h:u,f=d.isActive,p=d.predicate,y=(0,gu.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=A(s),u=(c-l)/r||1,h=Array.from(a),d=new Map(h.map((e,t)=>[e,t])),y=Array(r).fill(0),m=Array(r).fill(0),g=Array.from({length:r},()=>Array(h.length).fill(0)),x=Array.from({length:r},()=>Array(h.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/u),r-1);if(y[i]++,f&&!p(o)||m[i]++,n){const e=d.get(o[n]+"");void 0!==e&&(g[i][e]++,f&&!p(o)||x[i][e]++)}}const b=S(y,1),v=g.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})}),k=x.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})});return{bars:y.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),selectedBars:m.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),categoryBars:v,selectedCategoryBars:k,max:b,categories:h}},[e,t,r,o,f,p,i]);return(0,vu.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,vu.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,n)=>(0,vu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):ze,opacity:f?.3:.6},`bg-${t}-${n}`))):y.bars.map((e,t)=>(0,vu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:ze,opacity:f?.3:.6},"bg-"+t)),f&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,vu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):ze,opacity:.7},`sel-${t}-${n}`))):y.selectedBars.map((e,t)=>(0,vu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:ze,opacity:.7},"sel-"+t)))]})}function ju({label:e,cellSize:t}){return(0,vu.jsx)("svg",{width:t,height:t,children:(0,vu.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function _u(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:m,showLegend:g,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",C="splom-hover",M=Il(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),j=f?"hover":d?"brush":"hover",_=il(e=>e.clearSelection),[R,P]=(0,gu.useState)(null),L=(0,gu.useCallback)(()=>{_(C),P(null)},[_,C]),I=(0,gu.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[ku]?e:{...e,[ku]:t}),[t]),T=zl(I,r,i),N=(0,gu.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),F=void 0!==g?g:!!r,O=(0,gu.useMemo)(()=>{if(!F||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(I.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:T?T(e+""):ze})):null},[F,r,I,T]),B=(0,gu.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,vu.jsxs)("div",{className:v,style:{position:"relative"},children:[O&&(0,vu.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>(0,vu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,vu.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,vu.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,vu.jsxs)("div",{style:B,onMouseLeave:"hover"===j?L:void 0,children:[n.map((e,t)=>(0,vu.jsxs)(mu.Fragment,{children:[(0,vu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,vu.jsx)(ju,{label:o[e]||e,cellSize:s},"diag-"+e):(0,vu.jsx)(Mu,{data:I,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,mode:j},"diag-"+e):(0,vu.jsx)(Cu,{data:I,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,showGrid:y,tooltip:m,mobileInteraction:M,mode:j,onPointHover:"hover"===j?(o,r,s)=>{if(o){if(P({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=N(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=N(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,vu.jsx)("div",{})," ",n.map(e=>(0,vu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),R&&"hover"===j&&(()=>{const e=R.datum,t=o[R.xField]||R.xField,n=o[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[ku];return(0,vu.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,vu.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,vu.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,vu.jsxs)("div",{children:[n,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,vu.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Ru(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,vu.jsx)(kl,{selections:o,children:(0,vu.jsx)(_u,{...e})})}Ru.displayName="ScatterplotMatrix";var Pu=require("react"),Lu=require("d3-brush"),Iu=require("d3-selection"),Tu=require("react/jsx-runtime");function Nu({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,Pu.useRef)(null),l=(0,Pu.useRef)(null),c=(0,Pu.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,Pu.useEffect)(()=>{if(!a.current||!o)return;const n=(0,Iu.select)(a.current).select(".brush-group"),i="x"===r?(0,Lu.brushX)().extent([[0,0],[e,t]]):(0,Lu.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=e=>{n.call(i.move,e)},n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[o,e,t,r,s]),(0,Pu.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e="x"===r?o.x:o.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,o,r]),(0,Tu.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,Tu.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function Fu(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:C=!0,showGrid:M=!1,showLegend:j,legendPosition:_,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:I,brushExtent:T,yExtent:N,frameProps:F={},loading:O,loadingContent:B,emptyContent:D}=e,W=oc(O,n,o,B),z=W?null:nc(t,n,o,D),H=(0,Pu.useMemo)(()=>X(t),[t]),[E,$]=(0,Pu.useState)(null),Y=T??E,G=(0,Pu.useCallback)(e=>{T||$(e),I?.(e)},[T,I]),q=(0,Pu.useRef)(null),[V,U]=(0,Pu.useState)(null);(0,Pu.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=q.current?.getScales?.();o?U(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==H[0]?.[m],Q=(0,Pu.useMemo)(()=>{if(K)return H;if(y){const e=H.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[m]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:H}]},[H,y,m,K]),Z=(0,Pu.useMemo)(()=>K||y?Q.flatMap(e=>{const t=e[m]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):H,[Q,m,K,y,H]),J=zl(H,g,x),ee=kc({lineWidth:v,colorBy:g,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,Pu.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),ne=kc({lineWidth:1,colorBy:g,colorScale:J}),oe=te??ne,re=(0,Pu.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=g?$e(e.parentLine||e,g,J):ze,t}},[A,S,g,J]),{legend:ie,margin:se,legendPosition:ae}=$l({data:Q,colorBy:g,colorScale:J,showLegend:j,legendPosition:_,userMargin:r}),le=P.height||60,ce=(0,Pu.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??se.left,right:P.margin?.right??se.right}),[P.margin,se]),ue=P.brushDirection||"x",he=(0,Pu.useMemo)(()=>La([{label:c||Ma(f),accessor:f,role:"x",format:h},{label:u||Ma(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=ac({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,Tu.jsx)(Vl,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ee,...A&&{pointStyle:re},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:Cs(R)||he,...Y&&{xExtent:Y},...N&&{yExtent:N},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...F},ye={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:oe,size:[n,le+ce.top+ce.bottom],margin:ce,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...N&&{yExtent:N}},me=(0,Tu.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,Tu.jsx)(qa,{ref:q,...ye}),(0,Tu.jsx)(Nu,{width:n-ce.left-ce.right,height:le,margin:ce,scales:V,brushDirection:ue,extent:Y,onBrush:G})]},"minimap"),ge=(0,Tu.jsx)("div",{style:{overflow:"hidden"},children:(0,Tu.jsx)(qa,{...pe})},"main");return W||z||(0,Tu.jsx)(Jl,{componentName:"MinimapChart",width:n,height:o,children:(0,Tu.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?me:ge,L?ge:me]})})}Fu.displayName="MinimapChart";var Ou=require("react"),Bu={label:"Low / High",color:"#E9C46A",opacity:.08},Du={label:"High / High",color:"#2A9D8F",opacity:.08},Wu={label:"Low / Low",color:"#E76F51",opacity:.08},zu={label:"High / Low",color:"#86BBD8",opacity:.08};C();var Hu=require("react/jsx-runtime");function Eu(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var $u=(0,Ou.forwardRef)(function(e,t){const n=(0,Ou.useRef)(null);Ac(t,{variant:"xy",frameRef:n});const o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xCenter:h,yCenter:d,quadrants:f,centerlineStyle:p={},showQuadrantLabels:y=!0,quadrantLabelSize:m=12,colorBy:g,colorScheme:x,styleRules:b,sizeBy:v,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:C,pointIdAccessor:M,annotations:j,frameProps:_={},selection:R,linkedHover:P,onObservation:L,onClick:I,hoverHighlight:T,chartId:N,loading:F,loadingContent:O,emptyContent:B,legendInteraction:D,legendPosition:W,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:G,enableHover:q,showGrid:V,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,Ou.useMemo)(()=>({topLeft:Eu(Bu,f?.topLeft),topRight:Eu(Du,f?.topRight),bottomLeft:Eu(Wu,f?.bottomLeft),bottomRight:Eu(zu,f?.bottomRight)}),[f]),oe=(0,Ou.useMemo)(()=>X(r),[r]),re=hc({data:oe,rawData:r,colorBy:g,colorScheme:x,legendInteraction:D,legendPosition:W,selection:R,linkedHover:P,fallbackFields:"string"==typeof g?[g]:[],unwrapData:!1,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:O,emptyContent:B,width:Y,height:G});rc("QuadrantChart",oe,"xAccessor",c),rc("QuadrantChart",oe,"yAccessor",u);const ie=(0,Ou.useMemo)(()=>{if(!oe.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof u?u:e=>+e[u];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(n>h&&(n=h),h>o&&(o=h)),null!=d&&isFinite(d)&&(r>d&&(r=d),d>i&&(i=d)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[oe,c,u,h,d]),se=(0,Ou.useMemo)(()=>{if(!v||0===oe.length)return;const e=oe.map(e=>"function"==typeof v?v(e):e[v]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?A(e):void 0},[oe,v]),ae=(0,Ou.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),le=(0,Ou.useMemo)(()=>"function"==typeof u?u:e=>+e[u],[u]),ce=(0,Ou.useMemo)(()=>e=>{const t=ae(e),n=le(e),o=null!=h?t>=h:void 0,r=null!=d?n>=d:void 0;return void 0===r||void 0===o?z||ze:r&&o?ne.topRight.color:r&&!o?ne.topLeft.color:!r&&o?ne.bottomRight.color:ne.bottomLeft.color},[ae,le,h,d,ne,z]),ue=(0,Ou.useMemo)(()=>v?e=>qe(e,v,k,se):void 0,[v,k,se]),he=(0,Ou.useMemo)(()=>yc(c,u),[c,u]),de=Jc({colorBy:g,colorScale:re.colorScale,color:z,pointRadius:w,fillOpacity:S,radiusFn:ue,fallbackFill:ce,stroke:H,strokeWidth:E,opacity:$,styleRules:b,ruleContext:he,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),fe=(0,Ou.useMemo)(()=>{if(!oe.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof u&&e.add(u),"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v);const t=oe[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[oe,c,u,g,v]),pe=(0,Ou.useMemo)(()=>La([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ee||Ma(c),accessor:c,role:"x",format:a},{label:te||Ma(u),accessor:u,role:"y",format:l},...g?[{label:Ma(g),accessor:g,role:"color"}]:[],...v?[{label:Ma(v),accessor:v,role:"size"}]:[]]),[fe,c,u,ee,te,g,v,a,l]),ye=ac({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),me=(0,Ou.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=h?o.x(h):i/2,l=null!=d?o.y(d):s/2;if(null!=h&&!isFinite(a))return;if(null!=d&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),f=[{config:ne.topLeft,x:0,y:0,w:c,h:u},{config:ne.topRight,x:c,y:0,w:i-c,h:u},{config:ne.bottomLeft,x:0,y:u,w:c,h:s-u},{config:ne.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of f)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,d,ne,p]),ge=(0,Ou.useMemo)(()=>y?[...me,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;(null==h||isFinite(s))&&(null==d||isFinite(a))&&(e.font=`600 ${m}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ne.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ne.topLeft.label,8,8),e.fillStyle=ne.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ne.topRight.label,r-8,8),e.fillStyle=ne.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ne.bottomLeft.label,8,i-8),e.fillStyle=ne.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ne.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:me,[me,y,m,ne,h,d]),xe=(0,Ou.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ge,...e]},[ge,_.canvasPreRenderers]),be=(0,Ou.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray?Array.isArray(p.strokeDasharray)?p.strokeDasharray.join(","):p.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;if(null!=h&&!isFinite(s))return null;if(null!=d&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Hu.jsxs)(Hu.Fragment,{children:[[{config:ne.topLeft,x:0,y:0,w:l,h:c},{config:ne.topRight,x:l,y:0,w:r-l,h:c},{config:ne.bottomLeft,x:0,y:c,w:l,h:i-c},{config:ne.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Hu.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Hu.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Hu.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),y&&(0,Hu.jsxs)(Hu.Fragment,{children:[(0,Hu.jsx)("text",{x:8,y:8+m,fill:ne.topLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:ne.topLeft.label}),(0,Hu.jsx)("text",{x:r-8,y:8+m,fill:ne.topRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:ne.topRight.label}),(0,Hu.jsx)("text",{x:8,y:i-8,fill:ne.bottomLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:ne.bottomLeft.label}),(0,Hu.jsx)("text",{x:r-8,y:i-8,fill:ne.bottomRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:ne.bottomRight.label})]})]})}]},[h,d,ne,p,y,m]);if(re.earlyReturn)return re.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:oe},xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:v||void 0,sizeRange:k,pointStyle:de,colorScheme:x,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:q,showGrid:V,...ie&&{xExtent:ie.xExtent,yExtent:ie.yExtent},...re.legendBehaviorProps,...K&&{title:K},...Q&&{description:Q},...Z&&{summary:Z},...void 0!==J&&{accessibleTable:J},...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===C?()=>null:!0===C||void 0===C?pe:Cs(C)||pe,...Cc({linkedHover:P,selection:R,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...M&&{pointIdAccessor:M},...j&&j.length>0&&{annotations:j},canvasPreRenderers:xe,...re.crosshairProps,..._,...xe.length>0&&{canvasPreRenderers:xe},svgPreRenderers:be};return ye?(0,Hu.jsx)(Vl,{componentName:"QuadrantChart",message:ye,width:Y,height:G}):(0,Hu.jsx)(Jl,{componentName:"QuadrantChart",width:Y,height:G,children:(0,Hu.jsx)(qa,{ref:n,...ve})})});$u.displayName="QuadrantChart";var Yu=y(require("react")),Gu=require("react"),qu=require("react/jsx-runtime"),Vu="__ma_unitized",Xu="__ma_series";function Uu(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Ku(e,t){return t[0]+e*(t[1]-t[0])}var Qu=(0,Gu.forwardRef)(function(e,t){const n=(0,Gu.useRef)(null),o=(0,Gu.useRef)([]),r=(0,Gu.useRef)(e.series);r.current=e.series,(0,Gu.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[Vu]:Uu(a,s),[Xu]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[Vu]:Uu(a,s),[Xu]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:m,frameProps:g={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:N,showGrid:F,showLegend:O=!0,title:B,description:D,summary:W,accessibleTable:z,xLabel:H}=i,E=(0,Gu.useMemo)(()=>X(s),[s]),$=(0,Gu.useMemo)(()=>X(h),[h]),Y=$,G=2===$.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${$.length}. Rendering as a standard multi-line chart.`);const q=oc(S,I,T,C),V=q?null:nc(s,I,T,M),U=Wl(),K=(0,Gu.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(U&&U.length>0)e=U;else{const t=De[d];e=Array.isArray(t)?t:We}return Y.map((t,n)=>t.color||e[n%e.length])},[Y,d,U]),Q=(0,Gu.useMemo)(()=>$.map((e,t)=>e.label||"Series "+(t+1)),[$]),{unitizedData:Z,extents:J}=(0,Gu.useMemo)(()=>{if(0===E.length){const e=$.map(e=>e.extent||null).filter(Boolean);return e.length===$.length&&(o.current=e),{unitizedData:[],extents:e.length===$.length?e:[]}}const e=$.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(E,e.yAccessor));if(o.current=e,!G){const t=[];for(const e of E)for(let n=0;$.length>n;n++){const o=$[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[Vu]:r,[Xu]:Q[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of E)for(let o=0;2>o;o++){const r=$[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[Vu]:Uu(i,e[o]),[Xu]:Q[o]})}return{unitizedData:t,extents:e}},[E,$,G,Q]),ee=(0,Gu.useMemo)(()=>{if(G&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:$[0].format||(e=>{const t=Ku(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:$[1].format||(e=>{const t=Ku(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,J,$,Q]),te=hc({data:(0,Gu.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Xu]:e})),[Z,Q]),rawData:s,colorBy:Xu,colorScheme:K,legendInteraction:j,legendPosition:_,selection:x,linkedHover:b,fallbackFields:[Xu],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:O,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:C,emptyContent:M,width:I,height:T}),ne=(0,Gu.useMemo)(()=>{const e=new Map;return Q.forEach((t,n)=>e.set(t,K[n])),e},[Q,K]),oe=kc({lineWidth:p,resolveStroke:(0,Gu.useCallback)(e=>ne.get(e[Xu])||K[0],[ne,K]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,Gu.useMemo)(()=>{if(!1===y)return()=>null;return Cs(y)||(e=>{const t=e.data||e,n=t[Xu],o=Q.indexOf(n),r=t[Vu],i=G&&o>=0&&J[o]?Ku(r,J[o]):r,s=o>=0&&$[o]?.format?$[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Yu.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Yu.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[o]||"inherit"}},n),Yu.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Yu.createElement("div",null,`${n}: ${s(i)}`))})},[y,Q,K,J,G,$,u]);if(te.earlyReturn)return te.earlyReturn;const ie=ac({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=G?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:Vu,groupAccessor:Xu,lineStyle:oe,colorScheme:K,size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:H,...G?{}:{yLabel:Q[0]},xFormat:c,...G&&se&&{yExtent:se},enableHover:N,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:F,curve:f,...te.legendBehaviorProps,...B&&{title:B},...D&&{description:D},...W&&{summary:W},...void 0!==z&&{accessibleTable:z},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:re,...m&&{annotations:m},...Cc({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...g};return q||V||(ie?(0,qu.jsx)(Vl,{componentName:"MultiAxisLineChart",message:ie,width:I,height:T}):(0,qu.jsx)(Jl,{componentName:"MultiAxisLineChart",width:I,height:T,children:(0,qu.jsx)(qa,{ref:n,...ae})}))});Qu.displayName="MultiAxisLineChart";var Zu=require("react");function Ju(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}var eh=require("react/jsx-runtime"),th=(0,Zu.forwardRef)(function(e,t){const n=(0,Zu.useRef)(null);Ac(t,{variant:"xy",frameRef:n});const o=Gl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:m,xExtent:g,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:C,loadingContent:M,emptyContent:j}=e,{width:_,height:R,enableHover:P,showGrid:L,title:I,description:T,summary:N,accessibleTable:F,xLabel:O,yLabel:B}=o,D=oc(C,_,R,M),W=D?null:nc(r,_,R,j),z=(0,Zu.useMemo)(()=>X(r),[r]),H=null==d||null==f;rc("CandlestickChart",z,"xAccessor",c),rc("CandlestickChart",z,"highAccessor",u),rc("CandlestickChart",z,"lowAccessor",h),H||(rc("CandlestickChart",z,"openAccessor",d),rc("CandlestickChart",z,"closeAccessor",f));const{customHoverBehavior:E,customClickBehavior:$,crosshairSourceId:Y}=Hl({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),G=El(k,Y),q=(0,Zu.useMemo)(()=>{const t=o.marginDefaults,n="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?n:{...n,...Ju(i)}},[i,o.marginDefaults,e.mode]),V=(0,Zu.useMemo)(()=>{const e=[{label:O||Ma(c),accessor:c,role:"x",format:a}];return H?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),La(e)},[c,O,a,l,u,h,d,f,H]),U=ac({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f}}}),K={chartType:"candlestick",...null!=r&&{data:z},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(_/40))),extentPadding:_>200?.1:.02,size:[_,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:q,showAxes:o.showAxes,xLabel:O,yLabel:B,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Sc({title:I,description:T,summary:N,accessibleTable:F,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Mc({tooltip:y,defaultTooltipContent:V}),...Cc({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:E,customClickBehavior:$}),...m&&m.length>0&&{annotations:m},...g&&{xExtent:g},...x&&{yExtent:x},...G,...b};return D||W||(U?(0,eh.jsx)(Vl,{componentName:"CandlestickChart",message:U,width:_,height:R}):(0,eh.jsx)(Jl,{componentName:"CandlestickChart",width:_,height:R,children:(0,eh.jsx)(qa,{ref:n,...K})}))});th.displayName="CandlestickChart";var nh=require("react"),oh=require("react");var rh=require("react/jsx-runtime"),ih=(0,nh.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,chartId:m,loading:g,loadingContent:x,emptyContent:b,colorBy:v,colorScheme:k,legend:w,frameProps:A={}}=e,{legend:S,...C}=A,M=(0,nh.useMemo)(()=>Bo(S,w),[S,w]),{frameRef:j,resolved:_,safeData:R,setup:P,earlyReturn:L}=function(e){const t=function(e){const t=(0,oh.useRef)(null);return Ac(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Gl(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,oh.useMemo)(()=>Ju(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=hc({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:"XYCustomChart",unwrapData:!1,data:n,colorBy:v,colorScheme:k,legend:M,selection:p,linkedHover:y,onObservation:d,onClick:f,chartId:m,loading:g,loadingContent:x,emptyContent:b,margin:c,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,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),I=P.effectiveSelectionHook,T=(0,nh.useMemo)(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]);if(L)return L;const{width:N,height:F,enableHover:O,showGrid:B,title:D,description:W,summary:z,accessibleTable:H,xLabel:E,yLabel:$}=_,Y={chartType:"custom",...null!=n&&{data:R},customLayout:o,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},xExtent:s,yExtent:a,colorAccessor:v,colorScheme:k,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,showAxes:l,xLabel:E,yLabel:$,enableHover:O,showGrid:B,...P.legendBehaviorProps,...Sc({title:D,description:W,summary:z,accessibleTable:H,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...Cc({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverHighlight:!1,mobileInteraction:P.mobileInteraction,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior}),...h&&h.length>0&&{annotations:h},...P.crosshairProps,...C};return(0,rh.jsx)(Jl,{componentName:"XYCustomChart",width:N,height:F,children:(0,rh.jsx)(qa,{ref:j,...Y})})});ih.displayName="XYCustomChart";var sh={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},ah=8;function lh(e){return null==e?void 0:e+""}function ch(e){const t=lh(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??ah,style:{...sh},datum:e.datum,pointId:t,_transitionKey:t}}function uh(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...sh},datum:e.datum,group:e.group,_transitionKey:lh(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,h=Object.prototype.hasOwnProperty,d=(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})},p=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let r of c(t))h.call(e,r)||r===n||a(e,r,{get:()=>t[r],enumerable:!(o=l(t,r))||o.enumerable});return e},y=(e,t,n)=>(n=null!=e?s(u(e)):{},p(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),m=d({"src/components/stream/brushAccessibility.ts"(){e=y(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),g={};function x(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function b(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function v(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function k({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,dimension:h,scales:d,onBrush:f,binSize:p,snap:y,binBoundaries:m,snapDuring:g,streaming:k}){const w=(0,n.useRef)(null),A=(0,n.useRef)(null),S=(0,n.useRef)(f);S.current=f;const M=(0,n.useRef)(d);M.current=d;const C=(0,n.useMemo)(()=>m?[...m].sort((e,t)=>e-t):void 0,[m]),j=(0,n.useRef)(C);j.current=C;const _=(0,n.useRef)(!1),R=(0,n.useRef)(null),P=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:"xy"===h?"Two-dimensional data range brush":h.toUpperCase()+" data range brush",onAction:e=>{const t=M.current,n=A.current;if(!t||!n||!w.current)return;const r=(0,o.select)(w.current).select(".brush-g");if("clear"===e.type)return _.current=!0,r.call(n.move,null),_.current=!1,R.current=null,void S.current(null);const i=t.x.domain(),s=t.y.domain(),a=R.current;let l=a?.x??[i[0]+.4*(i[1]-i[0]),i[0]+.6*(i[1]-i[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==h&&(l=x(l,i,d,e.resize)),u||"x"===h||(c=x(c,s,d,e.resize)),u&&"y"===h||!u&&"x"===h)return;const f={x:l,y:c};_.current=!0,r.call(n.move,"x"===h?[t.x(l[0]),t.x(l[1])]:"y"===h?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),_.current=!1,R.current=f,S.current(f)}});return(0,n.useEffect)(()=>{if(!w.current)return;const e=(0,o.select)(w.current).select(".brush-g"),t="x"===h?(0,r.brushX)():"y"===h?(0,r.brushY)():(0,r.brush)();return t.extent([[0,0],[s,a]]),t.on("brush end",n=>{if(_.current)return;const o=M.current;if(!o)return;if(!n.selection)return R.current=null,void S.current(null);let r,i;if("x"===h){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],i=[o.y.invert(a),o.y.invert(0)]}else if("y"===h){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(s)],i=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[s,a]]=n.selection;r=[o.x.invert(e),o.x.invert(s)],i=[o.y.invert(a),o.y.invert(t)]}if("bin"===y&&"y"!==h&&("end"===n.type||"brush"===n.type&&g)){const i=j.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[b(e[0],t),v(e[1],t)]}(r,i):p&&p>0&&(r=[Math.floor(r[0]/p)*p,Math.ceil(r[1]/p)*p]);const s=o.x(r[0]),a=o.x(r[1]);if(_.current=!0,"x"===h)e.call(t.move,[s,a]);else if("xy"===h){const o=n.selection;e.call(t.move,[[s,o[0][1]],[a,o[1][1]]])}_.current=!1}const l={x:r,y:i};R.current=l,S.current(l)}),e.call(t),A.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),A.current=null}},[s,a,h,y,p,g]),(0,n.useEffect)(()=>{if(!(k&&d&&A.current&&R.current))return;if(!w.current)return;if("y"===h)return;const e=R.current,t=d.x.domain()[0],n=(0,o.select)(w.current).select(".brush-g");if(t>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);let r=e.x[0],i=!1;if(t>e.x[0]){if(r=t,"bin"===y){const e=j.current;e&&e.length>0?r=v(t,e):p&&p>0&&(r=Math.ceil(t/p)*p)}if(r>=e.x[1])return _.current=!0,n.call(A.current.move,null),_.current=!1,R.current=null,void S.current(null);i=!0}const s=d.x(r),a=d.x(e.x[1]);if(_.current=!0,"x"===h)n.call(A.current.move,[s,a]);else{const t=d.y(e.y[1]),o=d.y(e.y[0]);n.call(A.current.move,[[s,t],[a,o]])}if(_.current=!1,i){const t={x:[r,e.x[1]],y:e.y};R.current=t,S.current(t)}},[d,k,h,y,p]),(0,i.jsxs)("svg",{ref:w,width:l,height:c,...P.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,i.jsx)("title",{children:P.svgProps["aria-label"]}),(0,i.jsx)("desc",{id:P.descriptionId,children:P.description}),(0,i.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`})]})}f(g,{XYBrushOverlay:()=>k});var w=d({"src/components/stream/XYBrushOverlay.tsx"(){n=require("react"),o=require("d3-selection"),r=require("d3-brush"),m(),i=require("react/jsx-runtime")}});function A(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 S(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var M=d({"src/components/charts/shared/minMax.ts"(){}});function C(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function j(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var _,R,P=d({"src/components/charts/shared/colorManipulation.ts"(){}}),L={};function I(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[R]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),u=c.filter(e=>Number.isFinite(e));if(0===u.length)return;const[h,d]=A(u),f=d-h;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[R]=l-(f>0?(n-h)/f:0)*(l-a))})}function T(e,t){return"function"==typeof t?t(e):!!e[t]}function N(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function F(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,y=e.map(e=>{let t="observed";return s&&T(e,s)?t="forecast":i&&T(e,i)&&(t="training"),{...e,[_]:t}}),m=o._groupBy,g=[];if(m){const e=new Map;for(const t of y){const n=t[m]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][_]!==n[e+1][_]&&(t.push({...n[e+1],[_]:n[e][_]}),t.push({...n[e],[_]:n[e+1][_]}));g.push(...y,...t)}else for(let e=0;y.length>e;e++)g.push(y[e]),y.length-1>e&&y[e][_]!==y[e+1][_]&&(g.push({...y[e+1],[_]:y[e][_]}),g.push({...y[e],[_]:y[e+1][_]}));if(o.trainUnderline){const e=[];for(const t of g)"training"===t[_]&&e.push({...t,[_]:"training-base"});g.unshift(...e)}const x=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of g)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));x.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};I(g.filter(e=>"forecast"===e[_]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>T(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),x.push(t)}return r&&x.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:g,annotations:x}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const h=[],d=[];for(const n of e)n[t]>i?d.push({...n,[_]:"observed"}):h.push({...n,[_]:"training"});const f=h.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),p=[],y=[];if(f.length>=3){const r=f.length;let i=0,h=0,d=0,m=0;for(const[e,t]of f)i+=e,h+=t,d+=e*e,m+=e*t;const g=r*d-i*i;if(Math.abs(g)>1e-12){const d=(r*m-i*h)/g,x=(h-d*i)/r,b=e=>x+d*e,v=f.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(v/Math.max(r-2,1)),w=f.reduce((e,t)=>e+t[0],0)/r,A=f.reduce((e,t)=>e+(t[0]-w)**2,0),M=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,C=S(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),j=f.length>1?(f[r-1][0]-f[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=C+e*j,i=b(o),s=k*Math.sqrt(1+1/r+(A>0?(o-w)**2/A:0))*M;y.push({[t]:o,[n]:i,[_]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}I(y,o,e=>e.__forecastUpper,e=>e.__forecastLower),p.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}p.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&p.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const m=[];if(m.push(...h),h.length>0&&d.length>0&&m.push({...h[h.length-1],[_]:"observed"}),m.push(...d),y.length>0){const e=d.length>0?d[d.length-1]:h[h.length-1];e&&m.push({...e,[_]:"forecast"}),m.push(...y)}return{processedData:m,annotations:p}}(e,t,n,o,r);var i}function O(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[_];if("training"===h){let e=u.stroke;return"darken"===a?e=C(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=j(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[R],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}f(L,{FORECAST_OPACITY_FIELD:()=>R,SEGMENT_FIELD:()=>_,buildAnomalyAnnotations:()=>N,buildForecast:()=>F,createSegmentLineStyle:()=>O,darkenColor:()=>C,lightenColor:()=>j,stampForecastOpacity:()=>I});var B,W,D,z,H,E=d({"src/components/charts/shared/statisticalOverlays.ts"(){M(),P(),P(),_="__forecastSegment",R="__forecastOpacity"}}),$=d({"src/components/charts/xy/scatterplotMatrixInteractionTypes.ts"(){}}),Y={};function G({frameRef:e,cellSize:t,onBrush:n}){const o=(0,B.useRef)(null),r=t-H.left-H.right,i=t-H.top-H.bottom;return(0,B.useEffect)(()=>{if(!o.current)return;const t=(0,D.select)(o.current).select(".brush-g"),s=(0,W.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void n(null);var r;const[[i,s],[a,l]]=t.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];n(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,z.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,z.jsx)("g",{className:"brush-g",transform:`translate(${H.left},${H.top})`})})}f(Y,{ScatterplotMatrixBrushOverlay:()=>G});var q,V,X,U,K=d({"src/components/charts/xy/scatterplotMatrixBrushOverlay.tsx"(){B=require("react"),W=require("d3-brush"),D=require("d3-selection"),$(),z=require("react/jsx-runtime"),H={top:4,bottom:4,left:4,right:4}}}),Q={};function Z({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,q.useRef)(null),l=(0,q.useRef)(null),c=(0,q.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,q.useEffect)(()=>{if(!a.current||!o)return;const n=(0,X.select)(a.current).select(".brush-group"),i="x"===r?(0,V.brushX)().extent([[0,0],[e,t]]):(0,V.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=e=>{n.call(i.move,e)},n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[o,e,t,r,s]),(0,q.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e="x"===r?o.x:o.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,o,r]),(0,U.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,U.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}f(Q,{MinimapBrushOverlay:()=>Z});var J,ee=d({"src/components/charts/xy/minimapBrushOverlay.tsx"(){q=require("react"),V=require("d3-brush"),X=require("d3-selection"),U=require("react/jsx-runtime")}}),te={};f(te,{AreaChart:()=>su,BubbleChart:()=>Ru,CandlestickChart:()=>Ah,ConnectedScatterplot:()=>Cu,DEFAULT_HIT_RADIUS:()=>Rh,DifferenceChart:()=>uu,Heatmap:()=>Tu,LineChart:()=>eu,MinimapChart:()=>oh,MultiAxisLineChart:()=>bh,QuadrantChart:()=>hh,Scatterplot:()=>wu,ScatterplotMatrix:()=>Uu,StackedAreaChart:()=>fu,StreamXYFrame:()=>ul,XYCustomChart:()=>jh,composeStyleRules:()=>Wc,glyphExtent:()=>$n,glyphPlacement:()=>En,hatchFillId:()=>ao,hatchPatternDef:()=>co,hitTargetPoint:()=>Lh,hitTargetRect:()=>Ih,isHatchFill:()=>io,makeRuleValueResolver:()=>Ic,makeXYRuleContext:()=>Tc,matchesThreshold:()=>Fc,resolveResponsiveRules:()=>Vl,resolveStyleRules:()=>Bc,resolveSvgFill:()=>uo,responsiveRuleMatches:()=>ql,ruleMatches:()=>Oc,useCustomLayoutSelection:()=>Tn}),module.exports=(J=te,p(a({},"__esModule",{value:!0}),J));var ne=y(require("react")),oe=require("react"),re=y(require("react")),ie=require("react/jsx-runtime"),se=null,ae=null;function le(e){const[t,n]=re.useState(()=>se);return re.useEffect(()=>{if(t)return;let e=!1;return(se?Promise.resolve(se):(ae||(ae=Promise.resolve().then(()=>(w(),g)).then(e=>se=e.XYBrushOverlay).catch(e=>{throw ae=null,e})),ae)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,ie.jsx)(t,{...e}):null}var ce=Object.freeze([]);function ue(e){if(!e)return ce;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 he=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=ue(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=ue(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}},de=require("react"),fe=require("react/jsx-runtime");function pe(e){let t=null;const n=()=>(t||(t=(0,de.createContext)(null)),t),o=ye(e);return[function({children:t,initialState:o}){const r=(0,de.useRef)(o),i=(0,de.useMemo)(()=>ye(e,r.current),[]),s=n();return(0,fe.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,de.useContext)(r)??o,s=(0,de.useRef)(e);s.current=e;const a=(0,de.useRef)({hasValue:!1,value:void 0}),l=(0,de.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,de.useCallback)(()=>s.current(i.getState()),[i]);return(0,de.useSyncExternalStore)(i.subscribe,l,c)}]}function ye(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)}}}}function me(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 ge(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:xe}}),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 xe=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],be={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}},ve={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}},ke={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:xe,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 we(e,t){if("light"===t)return be;if("dark"===t)return ve;if("high-contrast"===t)return ke;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?ve:be;return ge({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return ge({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Ae,Se]=pe(e=>({theme:be,setTheme(t){e(e=>({theme:we(e.theme,t)}))}})),Me=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}},Ce=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 je(e,t){return e===t}function _e(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function Re(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Pe(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var Le=/^\d{4}-\d{1,2}$/;function Ie(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=Le.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function Te(e){return e instanceof Date?e.getTime():"string"==typeof e?Ie(e):+e}function Ne(e){return new Set(Array.isArray(e)?e:[e])}var Fe=require("d3-scale");function Oe(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Be(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function We(e){const t=e.map(Oe),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Be(e,n,o)}if(e>=1){const[e,o,r]=t[n];return Be(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return Be(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var De=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ze=We(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),He=We(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ee=We(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),$e=We(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Ye=We(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Ge=We(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),qe=We(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Ve=We(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Xe=We(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ue=We(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ke=We(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Qe=We(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Ze={blues:ze,reds:He,greens:Ee,viridis:qe,oranges:$e,purples:Ye,greys:Ge,plasma:Ve,inferno:Xe,magma:Ue,cividis:Ke,turbo:Qe};function Je(e){return e&&Ze[e]||ze}We(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),We(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),We(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),We(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),We(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),We(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),We(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var et={category10:De,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Ze},tt=De,nt="#007bff",ot=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],rt=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 it(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")||rt.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):tt[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))%tt.length]}function st(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 at(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>st(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,Fe.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=et[n]||et.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:tt;return(0,Fe.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function lt(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)}function ct(e,t,n){return e+(t-e)*n}function ut(){return"undefined"!=typeof performance?performance.now():Date.now()}function ht(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})}function dt(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function ft(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function pt(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 yt(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function mt(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function gt(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function xt(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function bt(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function vt(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function kt(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function wt(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function At(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function St(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,...e.config.curve&&"linear"!==e.config.curve&&{curve:e.config.curve},style:At(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Mt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function Ct(e,t,n){const o=[];for(const r of n){const n=St(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function jt(e,t,n,o){const r=[];for(const i of o){const o=St(e,t,n,i);o&&r.push(o)}return r}function _t(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function Rt(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=bt(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}function Pt(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var Lt={topOpacity:.8,bottomOpacity:.05};function It(e){if(e)return!0===e?Lt:"colorStops"in e?e:{topOpacity:e.topOpacity??Lt.topOpacity,bottomOpacity:e.bottomOpacity??Lt.bottomOpacity}}var Tt=require("d3-shape"),Nt={circle:Tt.symbolCircle,square:Tt.symbolSquare,triangle:Tt.symbolTriangle,diamond:Tt.symbolDiamond,star:Tt.symbolStar,cross:Tt.symbolCross,wye:Tt.symbolWye},Ft=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Ot(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*Bt(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,Tt.symbol)(Nt[o]??Tt.symbolCircle,Math.max(1,t))()??""}function Bt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Wt=new Map;function Dt(e,t,n){const o=n.config.areaStyle?.(t);return o&&(e.style=o),e}function zt(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function Ht(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Ht))}function Et(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function $t(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function Yt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=$t(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=_e(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:$t(e.y1Accessor,"y1"),getBottom:$t(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Gt=require("d3-scale");function qt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Vt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Gt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,Gt.scaleSymlog)().domain(t).range(n):"time"===e?(0,Gt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,Gt.scaleLinear)().domain(t).range(n)}function Xt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var Ut=new WeakMap;var Kt={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 Qt(e,t){const n={...e};for(const e of t)n[Kt[e]]++;return n}function Zt(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:Qt(n,o)}}var Jt=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=Zt({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=Zt(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},en=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],tn=["scene-style","data-paint","accessibility","evidence"],nn=(e,t)=>({retainedData:e,invalidations:t}),on=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],rn=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],sn=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],an=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ln=["scene-geometry","data-paint","accessibility","evidence"],cn=["scene-style","data-paint","accessibility","evidence"],un=[],hn={chartType:nn("rebuild",on),runtimeMode:nn("rebuild",on),xAccessor:nn("rebuild",on),yAccessor:nn("rebuild",on),timeAccessor:nn("rebuild",on),valueAccessor:nn("rebuild",on),y0Accessor:nn("rebuild",on),boundsAccessor:nn("rebuild",on),band:nn("rebuild",on),openAccessor:nn("rebuild",on),highAccessor:nn("rebuild",on),lowAccessor:nn("rebuild",on),closeAccessor:nn("rebuild",on),candlestickRangeMode:nn("rebuild",on),accessorRevision:nn("rebuild",on),groupAccessor:nn("rebuild",rn),categoryAccessor:nn("rebuild",rn),lineDataAccessor:nn("rebuild",rn),colorAccessor:nn("rebuild",cn),sizeAccessor:nn("rebuild",ln),symbolAccessor:nn("rebuild",ln),pointIdAccessor:nn("rebuild",ln),xScaleType:nn("preserve",sn),yScaleType:nn("preserve",sn),xExtent:nn("preserve",sn),yExtent:nn("preserve",sn),extentPadding:nn("preserve",sn),scalePadding:nn("preserve",sn),axisExtent:nn("preserve",sn),binSize:nn("preserve",sn),normalize:nn("preserve",sn),heatmapAggregation:nn("preserve",sn),heatmapXBins:nn("preserve",sn),heatmapYBins:nn("preserve",sn),arrowOfTime:nn("preserve",an),baseline:nn("preserve",an),stackOrder:nn("preserve",an),sizeRange:nn("preserve",an),curve:nn("preserve",an),areaGroups:nn("preserve",an),customLayout:nn("preserve",an),layoutConfig:nn("preserve",an),layoutMargin:nn("preserve",an),symbolMap:nn("preserve",ln),showValues:nn("preserve",ln),heatmapValueFormat:nn("preserve",ln),lineStyle:nn("preserve",cn),pointStyle:nn("preserve",cn),areaStyle:nn("preserve",cn),barStyle:nn("preserve",cn),swarmStyle:nn("preserve",cn),waterfallStyle:nn("preserve",cn),candlestickStyle:nn("preserve",cn),boundsStyle:nn("preserve",cn),gradientFill:nn("preserve",cn),lineGradient:nn("preserve",cn),colorScheme:nn("preserve",cn),themeCategorical:nn("preserve",cn),themeSemantic:nn("preserve",cn),themeSequential:nn("preserve",cn),themeDiverging:nn("preserve",cn),barColors:nn("preserve",cn),decay:nn("preserve",cn),pulse:nn("preserve",cn),staleness:nn("preserve",cn),layoutSelection:nn("preserve",cn),annotations:nn("preserve",["overlay","accessibility","evidence"]),windowSize:nn("preserve",un),windowMode:nn("preserve",un),maxCapacity:nn("preserve",un),clock:nn("preserve",un),transition:nn("preserve",un),introAnimation:nn("preserve",un),onLayoutError:nn("preserve",un)},dn=nn("preserve",an),fn=class{constructor(){this.tracker=new Jt}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}},en)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},tn):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=hn[o]??dn;"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)}},pn=require("d3-quadtree"),yn=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,pn.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},mn=class e{constructor(e){if(this.xExtent=new Ce,this.yExtent=new Ce,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new fn,this.scales=null,this.scene=[],this.version=0,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.xIsDate=!1,this.spatialIndex=new yn,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=ft(e,s,i);l>r&&(r=l)}a&&(l=pt(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=pt(n,null==r?0:ft(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new Me(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=_e(e.timeAccessor||e.xAccessor,"time"),this.getY=_e(e.valueAccessor||e.yAccessor,"value")):(this.getX=_e(e.xAccessor,"x"),this.getY=_e(e.yAccessor,"y")),this.getGroup=Pe(e.groupAccessor),this.getCategory=Pe(e.categoryAccessor),this.getSize=e.sizeAccessor?_e(e.sizeAccessor,"size"):void 0,this.getColor=Pe(e.colorAccessor),this.getSymbol=Pe(e.symbolAccessor),this.getY0=e.y0Accessor?_e(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Yt(e),this.getPointId=Pe(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?_e(e.openAccessor,"open"):void 0,this.getHigh=_e(e.highAccessor,"high"),this.getLow=_e(e.lowAccessor,"low"),this.getClose=n?_e(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new Me(e.windowSize))}currentTime(){return this.config.clock?.()??ut()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new Me(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?_e(this.config.timeAccessor||this.config.xAccessor,"time"):_e(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(Ie(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>Te(t[e]):e=>Te(n(e))}}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)Xt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Xt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(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}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=qt(this.xExtent.extent,t.xExtent),l=qt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=xt(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=zt(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,Gt.scaleLinear)().domain(o).range(e),y:Vt(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:Vt(t.yScaleType,r,[s,n.width-s]),y:(0,Gt.scaleLinear)().domain(o).range(e)}}var a;return{x:Vt(t.xScaleType,o,[s,n.width-s]),y:Vt(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Vt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??ot},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,o=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}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}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=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;Ht(o)&&0===n.length&&Et(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)&&Et(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:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(Pt).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(...jt(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=mt(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Rt(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(...jt(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=gt(t.data,e.scales,e.getX,e.getY,r,n,t.key,i),a=It(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return Rt(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Mt(e.ribbons);if(i.length>0&&o.push(...Ct(e,t,i)),r.length>0)for(const t of n)o.push(...jt(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=gt(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=It(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=mt(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Rt(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=xt(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,m=new Map,g=new Map,x=new Map;for(const e of c)m.set(e,d.get(e)??0),g.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=g.get(n),c=s+u,g.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=m.get(n),c=s+u,m.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);Rt(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=Ft[h%Ft.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=vt(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=bt(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=_e(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),m=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>m)continue;const g=m*o+f;p[g]++;const x=s(i);y[g]+=isFinite(x)?x:0}let m=1/0,g=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}m>t&&(m=t),t>g&&(g=t)}if(!isFinite(m))return[];const x=g-m||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let t=0;r>t;t++){const n=t*o;for(let s=0;o>s;s++){const o=n+s;if(0===p[o])continue;let l;switch(i){case"sum":l=y[o];break;case"mean":l=y[o]/p[o];break;default:l=p[o]}const u=(l-m)/x,f={xi:s,yi:t,value:l,count:p[o],sum:y[o],xCenter:a+(s+.5)*h,yCenter:c+(t+.5)*d,agg:i};A.push(Dt(wt(s*b,(r-1-t)*v,b,v,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,e))}}return A}(e,t,n);if(0===t.length)return[];const o=_e(e.config.valueAccessor,"value"),r=Re(e.config.xAccessor,"x"),i=Re(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const m=new Float64Array(t.length),g=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),m[p]=d,g[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=g[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Ze?e:"blues";let n=Wt.get(t);if(n)return n;n=Array(256);const o=Je(t);for(let e=0;256>e;e++)n[e]=o(e/255);return Wt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),M=n.width/u,C=n.height/h,j=e.config.showValues,_=e.config.heatmapValueFormat,R=[];for(let t=0;v>t;t++){const n=g[t];if(!isFinite(n))continue;const o=m[t],r=o%u,i=x[t];R.push(Dt(wt(r*M,(h-1-(o-r)/u)*C,M,C,A[Math.min((n-k)*S+.5|0,255)],i,j?{value:n,showValues:!0,valueFormat:_}:void 0),i,e))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=zt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),m=y>h+1?h:0,g=Math.min(f,p)+m/2,x=Math.max(y-m,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(kt(g,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(kt(g,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),m=e.getY(p),g=f+m;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=g;continue}const A=r.y(f),S=r.y(g),M=Math.min(A,S),C=Math.abs(A-S),j={fill:0>m?l:a,stroke:u,strokeWidth:h};null!=d&&(j.opacity=d),o.push(kt(k,M,w,C,j,{...p,baseline:f,cumEnd:g,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=g}return o}(r,t,e);case"candlestick":return function(e,t,n){if(!e.getHigh||!e.getLow||!e.scales)return[];const o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];const r=[],i=e.config.candlestickStyle||{},s=i.rangeColor||"#6366f1",a=o?s:i.upColor||"#28a745",l=o?s:i.downColor||"#dc3545",c=o?s:i.wickColor||"#333",u=i.wickWidth||(o?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=i.bodyWidth??0;if(null==i.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const i of t){const t=e.getX(i);if(null==t||Number.isNaN(t))continue;const s=e.getHigh(i),h=e.getLow(i);if(null==s||Number.isNaN(s)||null==h||Number.isNaN(h))continue;const f=o?s:e.getOpen(i),p=o?h:e.getClose(i);if(!o&&[f,p].some(e=>null==e||Number.isNaN(e)))continue;const y=p>=f,m={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(f),closeY:e.scales.y(p),highY:e.scales.y(s),lowY:e.scales.y(h),bodyWidth:d,upColor:a,downColor:l,wickColor:c,wickWidth:u,isUp:y,datum:i};o&&(m.isRange=!0,m.dotRadius=Math.max(2,Math.min(d/2,.12*n.height))),r.push(m)}return r}(r,t,e);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?ht(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=dt(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=dt(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=ht(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=ht(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=ht(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=ht(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}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())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=yt(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=yt(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r,i=ut()){if(0===o.size&&0===r.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],s=yt(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},a=!0;continue}const u=o.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(s);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}for(const[e,t]of o)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:i,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=ct(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=ct(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=ct(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==n.w&&(e.w=ct(n.w,e._targetW,i)),void 0!==n.h&&(e.h=ct(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:ct(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),e.y=ct(n.y,e._targetY,i),void 0!==n.w&&(e.w=ct(n.w,e._targetW,i)),void 0!==n.h&&(e.h=ct(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:ct(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ct(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=ct(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=ct(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=ct(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=ct(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:ct(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ct(t[o][0],n[o][0],i),e.path[o][1]=ct(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:ct(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ct(t[n][0],o[n][0],i),e.topPath[n][1]=ct(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ct(n[t][0],r[t][0],i),e.bottomPath[t][1]=ct(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||ot,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||ot;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=Ne(e),n=this.getPointId,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.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=Ne(e),o=this.getPointId,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.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}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.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}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||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!je(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!je(n,s);(a||l)&&(e?(this.getX=_e(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=_e(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=_e(this.config.xAccessor,"x"),this.getY=_e(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Yt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!je(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Pe(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!je(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Pe(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!je(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?_e(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!je(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Pe(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!je(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Pe(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!je(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?_e(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!je(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Yt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!je(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Pe(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!je(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!je(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!je(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!je(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?_e(this.config.openAccessor,"open"):void 0,this.getHigh=_e(this.config.highAccessor,"high"),this.getLow=_e(this.config.lowAccessor,"low"),this.getClose=t?_e(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};mn.GROUP_COLOR_MAP_CAP=1e3;var gn=mn;Object.assign(gn.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(){Ut.set(this,!0)},consumeStylePaintPending:function(){const e=!0===Ut.get(this);return Ut.delete(this),e}});var xn=require("react"),bn={sceneGeometry:0,layout:0,domain:0};function vn(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function kn(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 wn="production"!==process.env.NODE_ENV,An={revisions:bn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Sn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=bn,this.lastObserved=bn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){wn&&(this.lastObserved=kn(this.lastObserved,vn(e)))}beforeCompute(e,t){if(!wn)return An;const n=kn(vn(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(wn){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="")}}},Mn=(0,xn.memo)(function({store:e,diagnostics:t}){return(0,xn.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),Cn=y(require("react"));function jn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Cn.createElement(Cn.Fragment,null,...t)}var _n=y(require("react")),Rn=require("react/jsx-runtime"),Pn={isActive:!1,predicate:()=>!0},Ln=_n.createContext(null);function In({value:e,children:t}){return(0,Rn.jsx)(Ln.Provider,{value:e,children:t})}function Tn(){return _n.useContext(Ln)??Pn}function Nn(e,t){return null!=e?(0,Rn.jsx)(In,{value:t,children:e}):e}var Fn=require("react");function On(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function Bn(e,t=30){return Math.max((e??4)+5,12,t)}function Wn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Dn(e,t){const n=Wn(e);if(!n)return!1;const o=Wn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var zn=[40,40],Hn=[.5,.5];function En(e,t){const[n,o]=e.viewBox??zn,[r,i]=e.anchor??Hn,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 $n(e,t){const n=En(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 Yn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var Gn=null;function qn(e){if("undefined"==typeof Path2D)return null;Gn||(Gn=new Map);const t=Gn.get(e);if(t)return t;const n=new Path2D(e);return Gn.size>1024&&Gn.clear(),Gn.set(e,n),n}function Vn(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??zn,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 Xn(e,t){const n=En(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 Un(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=qn(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:Yn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Yn(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)}}var Kn=new WeakMap,Qn=0,Zn=!1,Jn=null,eo=null;function to(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?to(e,n.fallback):t,r=e.canvas;if(!r)return o();!function(){if(Zn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Zn=!0;const e=()=>{Qn++};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{Jn=window.matchMedia("(prefers-color-scheme: dark)"),eo=e,"function"==typeof Jn.addEventListener?Jn.addEventListener("change",eo):"function"==typeof Jn.addListener&&Jn.addListener(eo)}catch{}}();let i=Kn.get(r);i&&i.version===Qn||(i={version:Qn,map:new Map},Kn.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 no(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var oo=null;var ro=require("react/jsx-runtime");function io(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function so(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function ao(e,t){let n=2166136261;const o=so(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 lo=new Map;function co(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,ro.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,ro.jsx)("rect",{width:l,height:l,fill:n}),(0,ro.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,ro.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function uo(e,t,n="#4e79a7"){if(io(e)){const n=ao(t,e);return{fill:`url(#${n})`,def:co(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var ho=require("d3-shape");function fo(e){switch(e){case"monotoneX":return ho.curveMonotoneX;case"monotoneY":return ho.curveMonotoneY;case"cardinal":return ho.curveCardinal;case"catmullRom":return ho.curveCatmullRom;case"step":return ho.curveStep;case"stepBefore":return ho.curveStepBefore;case"stepAfter":return ho.curveStepAfter;case"basis":return ho.curveBasis;case"natural":return ho.curveNatural;default:return null}}function po(e,t,n){if(null==t)return n;if(io(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${so(e)}@${n}`,r=lo.get(o);if(void 0!==r)return r;const i=function(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):(oo||(oo=document.createElement("canvas")),oo.width=e,oo.height=e,oo)}(l)}catch{return no(a)}const u=c.getContext("2d");if(!u)return no(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 h=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(h);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")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),s=io(i)?null:i;return lo.set(o,s),s}(t,e);return o||t.background&&to(e,t.background)||n}return"string"!=typeof t?t:to(e,t)||n}function yo(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)),h=e.createLinearGradient(o,r,i,s),[d,f,p]=function(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]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${p},${c})`),h.addColorStop(1,`rgba(${d},${f},${p},${u})`),h}function mo(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var go=require("d3-shape"),xo=new WeakMap;function bo(e,t){const n=fo(t);if(!n)return e;const o=xo.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,go.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return xo.set(e,r),r}function vo(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,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,m)=>{if(r>u||c>y||l>d||h>m)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);Bn(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,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"point":if(r)break;e=wo(i,t,n,o);break;case"symbol":e=Ao(i,t,n,o);break;case"glyph":e=So(i,t,n,o);break;case"line":e=Mo(i,t,n,o);break;case"rect":if(null==i.datum)break;e=jo(i,t,n);break;case"heatcell":e=_o(i,t,n);break;case"area":if(!1===i.interactive)break;e=Po(i,t,n);break;case"candlestick":e=Ro(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ko(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=Lo(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function wo(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Bn(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Ao(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>Bn(Bt(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function So(e,t,n,o=30){if(null==e.datum)return null;const r=Xn(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>Bn(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function Mo(e,t,n,o=30){if(0===e.path.length)return null;const r=Lo(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=Co(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Co(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function jo(e,t,n){const o=On(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function _o(e,t,n){const o=On(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function Ro(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Po(e,t,n){if(0===e.topPath.length)return null;const o=Lo(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function Lo(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var Io=require("react"),To={fresh:1,aging:.7,stale:.45,expired:.25},No={alpha:1,band:"fresh",isStale:!1};function Fo(e,t){if(!e||0>=t)return No;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:{...To,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:No}var Oo=require("react/jsx-runtime");function Bo({isStale:e,position:t}){return(0,Oo.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 Wo=require("react"),Do=y(require("react")),zo=16,Ho=6,Eo=10,$o=22,Yo=require("react/jsx-runtime"),Go={fill:(e,t)=>(0,Yo.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Yo.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function qo(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Go[n])(o(e,t),r),i}function Vo({swatchSize:e}){return(0,Yo.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 Xo(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Uo=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=qo(e,c,h,d,x),k=Xo(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,Yo.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?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:m?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,Yo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Yo.jsx)(Vo,{swatchSize:x}),(0,Yo.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},Ko=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=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 p=d[f];h.push((0,Yo.jsx)("line",{stroke:"gray",x1:0,y1:p.lineY,x2:t,y2:p.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=p.labelY&&h.push((0,Yo.jsx)("text",{y:p.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h.push((0,Yo.jsx)("g",{className:"legend-item",transform:`translate(0,${p.itemsY})`,children:Uo(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f))}),h},Qo=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>m+g+7*e.label.length),S=[];let M=0,C=0;A.forEach((e,t)=>{const n=0===C?e:C+x+e;h&&h>0&&C>0&&n>h?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=qo(e,h,d,f,m),S=Xo(e,o,r),M=r&&r.size>0&&r.has(e.label);y.push((0,Yo.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?M||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Yo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,M&&(0,Yo.jsx)(Vo,{swatchSize:m}),(0,Yo.jsx)("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const j=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:j,totalRows:_,totalHeight:_*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const m=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(m.push((0,Yo.jsx)("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),y+=16),m.push((0,Yo.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&m.push((0,Yo.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,Yo.jsx)("g",{children:m})};function Zo({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-"+Do.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,Yo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,Yo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Yo.jsx)("defs",{children:(0,Yo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Yo.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Yo.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Yo.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,Yo.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,Yo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,Yo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Yo.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Yo.jsx)("defs",{children:(0,Yo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Yo.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Yo.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,Yo.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Jo(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:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??zo),n=Math.max(t,e?.rowHeight??$o);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??Ho),itemGap:Math.max(0,e?.itemGap??Eo),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=Do.useState(0),[y,m]=Do.useState(0),g=Do.useCallback((e,t)=>{p(e),m(t)},[]),x="vertical"===u?Ko({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):Qo({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,Yo.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"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,Yo.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}),x]})}function er(...e){let t;for(const n of e)n&&(t=tr(t)&&tr(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function tr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}var nr=require("react/jsx-runtime");function or(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,y=Math.max(0,n-r.left-r.right),m=Math.max(1,f?s?.maxWidth??y:100);let g,x;return"left"===i?(g=Math.max(4,r.left-m-10),x=r.top):"top"===i?(g=r.left,x=p?32:8):"bottom"===i?(g=r.left,x=o-r.bottom+38):(g=n-r.right+10,x=r.top),(0,nr.jsx)("g",{transform:`translate(${g}, ${x})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?(0,nr.jsx)(Zo,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):tr(t)?(0,nr.jsx)(Jo,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var b}var rr=require("react"),ir=require("d3-array");M();var sr=require("react/jsx-runtime");function ar(e){return"string"==typeof e?{type:e}:e}function lr({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,rr.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,m=0;return(0,sr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,sr.jsx)("line",{x1:l,y1:m+y*(f+d/2),x2:p,y2:m+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:l,y1:m+y*f,x2:l,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("rect",{x:Math.min(t,n),y:"top"===e?m-f-d:m+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:a,y1:"top"===e?m-f-d:m+f,x2:a,y2:"top"===e?m-f:m+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,m=0;return(0,sr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,sr.jsx)("line",{x1:m+y*(f+d/2),y1:l,x2:m+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:m+y*f,y1:l,x2:m+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:m+y*f,y1:p,x2:m+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,sr.jsx)("rect",{x:"left"===e?m-f-d:m+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,sr.jsx)("line",{x1:"left"===e?m-f-d:m+f,y1:a,x2:"left"===e?m-f:m+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,ir.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=S(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,sr.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,sr.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,sr.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,sr.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,sr.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,sr.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,sr.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,sr.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var cr=y(require("react")),ur=require("react/jsx-runtime");function hr(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 dr(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 fr(e,t,n,o){if(!e)return(0,ur.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,ur.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:hr(i,l):[],y=r?c?[r]:hr(r,l):[],m="leftRight"===u?"end"===d?-4:4:0;let g=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,ur.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?m-l:"middle"===d?m-l/2:m,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,ur.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,ur.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,ur.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,ur.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,ur.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),y.length>0&&x.push((0,ur.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:g,children:y.map((e,t)=>(0,ur.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=(0,ur.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,ur.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,ur.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,ur.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function pr(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,ur.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,ur.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,ur.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,ur.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,ur.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,ur.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,ur.jsx)("path",{d:dr(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,ur.jsx)("g",{className:"annotation-subject",children:i})}function yr(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,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}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,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,ur.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,ur.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,ur.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,ur.jsx)("g",{className:"annotation-connector",children:s})}function mr(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:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,ur.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...m,children:[!v.has("connector")&&yr(k,w,l,h,A,c),!v.has("subject")&&pr(A,c,h,x,b),!v.has("note")&&fr(a,k,w,h)]})}function gr(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,ur.jsx)(mr,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,ur.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,ur.jsx)(mr,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var xr=require("d3-hierarchy"),br=require("d3-shape");function vr(e){return Math.round(100*e)/100}function kr(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(vr);return{points:e.map(([e])=>[vr(e),vr(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function wr(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 Ar(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 Sr(e){return null==e?null:e+""}function Mr(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Cr(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 Mr(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?Mr(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return Sr(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>Sr(e.pointId)===o);if(r)return Mr(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return Sr(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=wr(i,n),a=Ar(i,n);return null==s||null==a?null:Mr(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=wr(e,n),i=Ar(e,n)),null!=r&&null!=i)return Mr(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function jr(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var _r=require("react/jsx-runtime"),Rr={secondary:0,primary:3};function Pr(e){return!0===e?._annotationDeferred}function Lr(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Ir(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Tr(e){return Math.max(.72,.95-.06*e)}M();var Nr=y(require("react")),[Fr,Or]=pe(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 Br(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 Wr=require("react/jsx-runtime"),Dr="var(--semiotic-bg, #ffffff)";function zr(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:h}=e,d=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,Wr.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??Dr,strokeWidth:d.haloWidth??3});const p=d.padding??{x:6,y:3},y="number"==typeof p?p:p.x,m="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(o,i),x=i+2*m;let b,v;return b="middle"===l?t-g/2-y:"end"===l?t-g-y:t-y,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,(0,Wr.jsxs)("g",{className:h,children:[(0,Wr.jsx)("rect",{x:b,y:v,width:g+2*y,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??Dr,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var Hr=require("react/jsx-runtime"),Er={linear:br.curveLinear,monotoneX:br.curveMonotoneX,monotoneY:br.curveMonotoneY,step:br.curveStep,stepAfter:br.curveStepAfter,stepBefore:br.curveStepBefore,basis:br.curveBasis,cardinal:br.curveCardinal,catmullRom:br.curveCatmullRom};var $r=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Yr(e){return!!e&&"object"==typeof e&&$r.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Gr(e){return"primary"===e?.emphasis||!0===e?.defensive}function qr(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 Vr(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 Xr=32,Ur=6,Kr=4,Qr=8,Zr=72;var Jr={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function ei(e){if(!ti(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 ti(e){return Yr(e)}function ni(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 oi(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 ri(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ii(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 si(e,t,n,o,r,i,s,a){const l=ri(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*ii(l,e);for(const e of o)c+=4*ii(l,e);return c}function ai(e){const{annotations:t,context:n,defaultOffset:o=Xr,notePadding:r=Ur,markPadding:i=Kr,edgePadding:s=Qr,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Zr,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:m}=e,g=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==b.preferShortText?t.map(ei):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),M=k&&!f?b.responsive??{minWidth:v}:f,C=k&&!y?b.cohesion:y;if(0===w.length||0>=g||0>=x)return w.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=w.map((e,t)=>{if(!ti(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?Cr(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=[...ni("string"==typeof e.title?e.title:void 0,t),...ni("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(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(ri(oi(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=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=si(oi(i.x,i.y,e.dx,e.dy,u),e,j,_,g,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=ri(oi(i.x,i.y,d.dx,d.dy,u),r);j.push(p);const y=Math.hypot(d.dx,d.dy),m=l&&y>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...m?{connector:m}:{}}}),L=R?P:w.slice();let I=L;if(d){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?Jr[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(A){const e="object"==typeof A?A:{},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}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??qr(g,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=qr(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Yr(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=>Gr(e.annotation)),c=a.filter(e=>!Gr(e.annotation)).sort((e,t)=>Vr(t.annotation)-Vr(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))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:I,width:g,height:x,...n});for(const e of o)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of I)ti(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let N;return N=0===T.size?I:S?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=>ti(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(N,C):N}var li=require("react"),ci={positions:new Map},ui=new Set;function hi(){for(const e of ui)e()}function di(e,t){const n=ci.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(ci.positions);o.delete(e),ci={positions:o},hi()}function fi(e,t){const n=ci.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(ci.positions);o.delete(e),ci={positions:o},hi()}function pi(){return ci}function yi(e){return ui.add(e),()=>ui.delete(e)}var mi={positions:new Map};function gi(){return()=>{}}function xi(){return mi}function bi(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)}function vi(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function ki(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function wi(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Ai(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Si(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}var Mi=require("react/jsx-runtime");function Ci(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,Wo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||ji,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??bi(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return _i(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,Wo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||ji,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return _i((e?.tickValues??bi(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,m=a&&s;if(!y&&!m)return null;const g=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=m&&(!g||!1!==g.baseline),v=m&&(!x||!1!==x.baseline),k=g?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,Mi.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,Mi.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=Ai(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Ai(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Mi.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,Mi.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,Mi.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,Mi.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,Mi.jsx)("path",{d:Si("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,Mi.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,Mi.jsx)("path",{d:Si("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function ji(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function _i(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function Ri(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:y,title:m,legend:g,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:M,marginalGraphics:C,xValues:j,yValues:_,annotations:R,onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T,autoPlaceAnnotations:N,svgAnnotationRules:F,xAccessor:O,yAccessor:B,annotationData:W,pointNodes:D,curve:z,underlayRendered:H,canvasObscuresUnderlay:E=!0,linkedCrosshairName:$,linkedCrosshairSourceId:Y,children:G}=e,q=function(e){const t=Or(e=>e.pushObservation),n=Nr.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Nr.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T}),V=(0,Wo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||ji,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o),c=e?.tickValues??bi(s.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),y=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let m=_i(h,y);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=m[m.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,m.length,u);y>t-o&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:r})}}return m},[a,s,l,d,t,p]),X=(0,Wo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||ji,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o);let c=_i((e?.tickValues??bi(s.y,i,p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=s.y.domain()[1],n=s.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[a,s,l,f,n,p]),U=(0,Wo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||ji,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return _i((e.tickValues??bi(s.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,n,p]),K=(0,Wo.useRef)(new Map),Q=(0,Wo.useRef)(R?.length??0),Z=R?.length??0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=(0,Wo.useMemo)(()=>{if(!R||0===R.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)})}(R),o=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Cr(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!jr(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,Hr.jsx)(gr,{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=wr(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,Hr.jsxs)("g",{opacity:e.opacity,children:[(0,Hr.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,Hr.jsx)(zr,{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=Ar(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,Hr.jsxs)("g",{opacity:e.opacity,children:[(0,Hr.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,Hr.jsx)(zr,{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:wr({...e,type:"point"},o),y:Ar({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,xr.packEnclose)(t),i=e.padding||10;return(0,Hr.jsxs)("g",{children:[(0,Hr.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,Hr.jsx)(zr,{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:wr({...e,type:"point"},o),y:Ar({...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]=A(i),[c,u]=A(s),h=a-r,d=l+r,f=c-r;return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("rect",{x:h,y:f,width:d-h,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,Hr.jsx)(zr,{x:(h+d)/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,Hr.jsx)("g",{children:r.map((t,n)=>{const r=wr(t,o),s=Ar(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,Hr.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=wr(e,o),r=Ar(e,o);return(0,Hr.jsx)(gr,{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 h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.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,p=o.scales?.y??o.scales?.value;if(!f||!p)return null;const y=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},m=f,g=p;let x;if(s)if(a){const e=y(g);x=(t,n)=>[m(n),e(t)]}else{const e=y(m);x=(t,n)=>[e(t),g(n)]}else x=(e,t)=>[m(e),g(t)];const b=e.method||"linear";let v;if("loess"===b)v=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,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===b?kr(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:vr((n*t[3]-t[0]*t[1])/o),i=vr(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[vr(e),vr(r*e+i)]),equation:[r,i]}}(u);v=t.points}const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,M]=x(A[0],A[1]);return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Hr.jsx)("text",{x:S+4,y:M-4,fill:w,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,h=uo(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Hr.jsxs)("g",{opacity:e.opacity,children:[h.def&&(0,Hr.jsx)("defs",{children:h.def}),(0,Hr.jsx)("rect",{x:0,y:Math.min(c,u),width:o.width||0,height:Math.abs(u-c),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,Hr.jsx)(zr,{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=uo(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Hr.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,Hr.jsx)("defs",{children:c.def}),(0,Hr.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,Hr.jsx)(zr,{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 h=Er[o.curve||"linear"]||br.curveLinear,d=(0,br.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Hr.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),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,Hr.jsxs)("g",{children:[f&&(0,Hr.jsx)("rect",{x:0,y:Math.min(x,b),width:o.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const n=wr(e,o),r=Ar(e,o);return null==n||null==r?null:(0,Hr.jsx)("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Hr.jsx)("text",{x:(o.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:p,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=kr(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,h=l.map(([e,t])=>t-c(e)),d=h.reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+(t[0]-p)**2,0),m=e.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,x=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;x>=e;e++)k.push(b+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(y>0?(e-p)**2/y:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(b)},${a(c(b))}`,C=e.strokeColor||"#6366f1";return(0,Hr.jsxs)("g",{children:[(0,Hr.jsx)("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Hr.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,Hr.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.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=Cr(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!jr(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,Hr.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,Hr.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Hr.jsx)("div",{...Br(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Cr(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,Hr.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?cr.cloneElement(c,{key:"ann-text-"+n}):(0,Hr.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Hr.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),cr.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(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,Hr.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,Hr.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&(0,Hr.jsx)(zr,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,Hr.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,Hr.jsx)(zr,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,q),r={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:O,yAccessor:B,width:t,height:n,data:W,frameType:"xy",pointNodes:D,curve:z,stickyPositionCache:K.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:Ir(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>Pr(e.annotation)),r=e.some(e=>null!=Lr(e.annotation)),i=e.some(e=>"layer"===Lr(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=Rr[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=Pr(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,_r.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Tr(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=Lr(t.annotation);return a&&(s=(0,_r.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,_r.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,_r.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,_r.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)}(N?ai({annotations:e,context:r,..."object"==typeof N?N:{}}):e,o,F,r)},[R,N,F,t,n,O,B,W,s,D,z,q]),ee=function(e){const t=(0,li.useSyncExternalStore)(e?yi:gi,e?pi:xi,e?pi:xi);return e?t.positions.get(e)??null:null}($);return(0,Wo.useEffect)(()=>{if(!ee?.locked||!$)return;const e=e=>{"Escape"===e.key&&fi($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ee?.locked,$]),a||m||g||M||C||J&&J.length>0||y||G||ee?(0,Mi.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Mi.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,Mi.jsx)("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),(0,Mi.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&s&&(!H||E)&&(()=>{const e=Ai(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Ai(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Mi.jsxs)("g",{className:"stream-grid",children:[V.map((t,o)=>(0,Mi.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),X.map((e,n)=>(0,Mi.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,d=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",x=!!o?.autoRotate&&V.length>1&&(()=>{const e=t/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=o?.tickAnchor,M=e?.tickAnchor,C=wi(V),j=wi(X);return(0,Mi.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Mi.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||E)&&s&&!d&&(0,Mi.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&d&&(0,Mi.jsx)("path",{d:Si("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),V.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Dn(e.value,t>0?V[t-1].value:void 0));return(0,Mi.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,Mi.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Mi.jsx)("text",{y:b,textAnchor:x?"end":vi(S,e.pixel===C.min,e.pixel===C.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:e.label}):(0,Mi.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Mi.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,Mi.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),(0,Mi.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||E)&&r&&!a&&(0,Mi.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&a&&(0,Mi.jsx)("path",{d:Si("left",t,n),fill:"none",stroke:y,strokeWidth:1}),X.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):Dn(e.value,t>0?X[t-1].value:void 0));return(0,Mi.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,Mi.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Mi.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:ki(M,e.pixel===j.min,e.pixel===j.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,Mi.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Mi.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,Mi.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===U.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||h,a=e.tickAnchor,c=wi(U);return(0,Mi.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,Mi.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),U.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):Dn(e.value,n>0?U[n-1].value:void 0));return(0,Mi.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,Mi.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Mi.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:ki(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,Mi.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Mi.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,Mi.jsx)("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:s})]})})()]})})(),J,C&&s&&j&&_&&(0,Mi.jsxs)(Mi.Fragment,{children:[C.top&&(0,Mi.jsx)("g",{transform:"translate(0, 0)",children:(0,Mi.jsx)(lr,{orient:"top",config:ar(C.top),values:j,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,Mi.jsx)("g",{transform:`translate(0, ${n})`,children:(0,Mi.jsx)(lr,{orient:"bottom",config:ar(C.bottom),values:j,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,Mi.jsx)("g",{transform:"translate(0, 0)",children:(0,Mi.jsx)(lr,{orient:"left",config:ar(C.left),values:_,scale:s.y,size:i.left,length:n})}),C.right&&(0,Mi.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,Mi.jsx)(lr,{orient:"right",config:ar(C.right),values:_,scale:s.y,size:i.right,length:n})})]}),M,ee&&ee.sourceId!==Y&&s?.x&&(()=>{const e=s.x(ee.xValue);if(null==e||0>e||e>t)return null;const o=ee.locked;return(0,Mi.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),m&&"string"==typeof m?(0,Mi.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,Mi.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:m}):null,or({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:w,title:m,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:b,legendHighlightedCategory:v,legendIsolatedCategories:k})]}):null}var Pi=y(require("react")),Li=require("d3-shape");function Ii(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}var Ti=require("react/jsx-runtime");function Ni(e,t="#4e79a7"){return io(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function Fi(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function Oi(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,Ti.jsx)("stop",{offset:e.offset,stopColor:e.color},t))}var Bi=require("react/jsx-runtime");function Wi(e,t,n){if(!e||2>t.length)return null;const o=Oi(e.colorStops);return o?(0,Bi.jsx)("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:o}):null}var Di="undefined"==typeof window||"undefined"==typeof document,zi=require("react"),Hi="undefined"!=typeof window?zi.useLayoutEffect:zi.useEffect,Ei=()=>()=>{},$i=()=>!1,Yi=()=>!0,Gi=require("react");function qi(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 Vi(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 Xi(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}function Ui(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:o=""}=e;return"transparent"===t||n?null:t||(o&&"transparent"!==o?o:"")||null}var Ki={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function Qi(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var Zi=y(require("react")),Ji=y(require("react")),es=(require("react/jsx-runtime"),Ji.createContext(null)),ts=require("react/jsx-runtime"),ns={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function os({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,ts.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:ns,children:t})}function rs(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 is(e){return e&&"object"==typeof e?e:{}}function ss(e){return is(e.accessibility).tableFields??e.accessibleDatum??e.datum}var as=require("react/jsx-runtime");function ls(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 cs=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},us="semiotic-accessible-data-table",hs=us+" semiotic-accessible-data-table-hidden",ds=us+" semiotic-accessible-data-table-visible",fs={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"},ps={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ys={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)"},ms={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},gs={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))"},xs={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},bs={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},vs={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 ks({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=Zi.useState(!1),[s,a]=Zi.useState(5),l=Ji.useContext(es),c=l?.visible??!1,u=r||c,h=Zi.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Zi.useEffect(()=>{u||a(5)},[u]);const f=Zi.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=Zi.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,as.jsx)("span",{id:n,tabIndex:-1,style:ns}):null;if(!u)return(0,as.jsx)("div",{id:n,className:hs,tabIndex:-1,onFocus:f,style:ns,role:"region","aria-label":d,children:(0,as.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=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:rs(ss(o))});break;case"line":case"area":{const e=ss(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:rs(e)});break}case"rect":{const e=ss(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=rs(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=rs(ss(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=ss(o),n=rs(e);if(null==n.category){const t=is(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:rs(ss(o))});break;case"arc":t.push({label:"Arc",values:rs(ss(o))});break;case"candlestick":t.push({label:"Candlestick",values:rs(ss(o))});break;case"geoarea":{const e=is(ss(o)),n=rs(e);if(null==n.name){const t=is(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),m=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}(y),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${cs(e.min)} to ${cs(e.max)}, mean ${cs(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(" ")}(y.length,m),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,as.jsxs)("div",{ref:h,id:n,className:ds,tabIndex:-1,onBlur:p,style:fs,role:"region","aria-label":d,children:[(0,as.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:ys,children:"×"}),(0,as.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ps,children:g}),(0,as.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:ms,children:[(0,as.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:bs,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,as.jsx)("thead",{children:(0,as.jsxs)("tr",{children:[(0,as.jsx)("th",{style:gs,children:"type"}),w.map(e=>(0,as.jsx)("th",{style:gs,children:e},e))]})}),(0,as.jsx)("tbody",{children:b.map((e,t)=>(0,as.jsxs)("tr",{children:[(0,as.jsx)("td",{style:xs,children:e.label}),w.map(t=>{return(0,as.jsx)("td",{style:xs,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":cs(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,as.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:vs,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function ws({summary:e}){return e?(0,as.jsx)("div",{role:"note",style:ns,children:e}):null}function As({tableId:e}){return(0,as.jsx)("a",{href:"#"+e,style:ns,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,ns)},children:"Skip to data table"})}var Ss=require("react/jsx-runtime"),Ms="var(--semiotic-focus, #005fcc)";function Cs({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,Ss.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ms,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Ss.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Ms,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Ms,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Ss.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Ss.jsx)("path",{d:a,fill:"none",stroke:Ms,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Ss.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 js=y(require("react"));function _s(e,t){return"touch"===t?Math.max(e,24):e}function Rs(e){return Array.isArray(e)?e[0]:e}function Ps(e,t,n,o){return{data:Rs(e),x:t,y:n,__semioticHoverData:!0,...o}}var Ls=["name","label","title"],Is=["type","kind","category","group","class","status","role","shape"],Ts=["value","amount","total","count","weight","score"],Ns=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 Fs(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Os(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&&Ns.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=>Ls.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=Fs(l,Is),u=Fs(l,Ts),h=new Set(Is),d=new Set(Ts),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&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}var Bs=require("react/jsx-runtime"),Ws={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 Ds(e,t){return"function"==typeof t?t(e):e[t]}function zs(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 Hs(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=Ds(e,n);s=zs(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=Ds(e,r);a.push({label:n,value:zs(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=zs(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=zs(e[t[0]],o))}}const l={...Ws,...r};return(0,Bs.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Bs.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Bs.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Bs.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Es(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,Bs.jsx)("div",{className:"semiotic-tooltip",style:Ws,children:(0,Bs.jsx)("div",{children:zs(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,Bs.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[null!=n&&(0,Bs.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:zs(n)}),t.map((e,t)=>(0,Bs.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,Bs.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,Bs.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,Bs.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:zs(e.value)})]},t))]})}}function $s(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Rs(!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,Bs.jsx)("div",{className:"semiotic-tooltip",style:Ws,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Hs(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=Ds(e,n);l.push({value:zs(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=zs(Ds(e,r),i);l.push({label:s?n:void 0,value:a})});else{const t=Os(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:zs(t.title,o),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:zs(e.value,o)})})}const c={...Ws,...r};return Array.isArray(l)&&0!==l.length?(0,Bs.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,Bs.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,Bs.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}()):Hs())}}var Ys=require("react/jsx-runtime");function Gs({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=js.useRef(null),[u,h]=js.useState(null);js.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(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 d;d=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(!js.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),p=f?null:Ws;return l?(0,Ys.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var qs=y(require("react")),Vs=require("react"),Xs=require("react");var Us=require("react");function Ks(e,t,n){const o=(0,Us.useRef)(null),[r,i]=(0,Us.useState)(null);return(0,Us.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]]]}var Qs=()=>"undefined"!=typeof performance?performance.now():Date.now();function Zs(e,t){const n=e();return Number.isFinite(n)?n:t}var Js=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Qs,this.lastWallTime=Zs(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=Zs(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??Qs;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Zs(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)))}},ea="undefined"==typeof window?Vs.useEffect:Vs.useLayoutEffect,ta={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function na(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function oa(e){const t=function(){const[e,t]=(0,Xs.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Xs.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,Vs.useRef)(t);n.current=t;const[o,r]=Ks(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Vs.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=na(e.foregroundGraphics,r,a),h=na(e.backgroundGraphics,r,a),d=Se(e=>e.theme),{transition:f,introEnabled:p}=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),y="semiotic-table-"+qs.useId(),m=(0,Vs.useRef)(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new Js({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=m.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,Vs.useRef)(null),b=(0,Vs.useRef)(e.frameScheduler??ta);b.current=e.frameScheduler??ta;const v=(0,Vs.useRef)(null),k=(0,Vs.useRef)(!1),w=(0,Vs.useRef)(()=>{}),A=(0,Vs.useCallback)(()=>{if(null!==x.current||k.current)return;const e=b.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,v.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=o,v.current=e)},[]),S=(0,Vs.useCallback)(()=>{null!==x.current&&((v.current??b.current).cancelAnimationFrame(x.current),x.current=null,v.current=null)},[]);ea(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Vs.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Vs.useEffect)(()=>()=>{S()},[S]);const M=(0,Vs.useRef)(()=>{}),C=(0,Vs.useRef)(()=>{}),j=(0,Vs.useRef)(null),_=(0,Vs.useRef)(null),R=(0,Vs.useRef)(null),P=(0,Vs.useCallback)(()=>{const e=j.current;j.current=null,e&&M.current(e)},[]),L=(0,Vs.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=b.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,Vs.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),C.current()},[]);(0,Vs.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return ea(()=>{T&&(Qn++,T.current=!0,A())},[d,A,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:p,tableId:y,frameRuntime:g,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:L,onPointerLeave:I}}var ra=require("react"),ia=require("react/jsx-runtime");function sa({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,ia.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,ia.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function aa(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function la(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var ca=require("react");function ua(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 ha=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],da=3156e7;function fa(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:da>t?e=>{const t=new Date(e);return`${ha[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*da>t?e=>{const t=new Date(e);return`${ha[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function pa(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:Bt(n.size)});else if("glyph"===n.type){const e=Xn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var ya=require("d3-shape");function ma(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function ga(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var xa=(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=to(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ga(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=fo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),h=!0},o=function(){h&&(e.stroke(),h=!1)},r=null,s=null,c=null,u=null,h=!1;for(let h=0;t.path.length>h;h++){const[d,f]=t.path[h],p=l[h],y=ma(p,a,i);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(d,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(d-r)*l.t,u=s+(f-s)*l.t,h=ma(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=y}else n(y,d,f),r=d,s=f,c=p,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?mo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,ya.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=po(e,t.style.fill,t.style.fill),c&&!u)(0,ya.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ba(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function va(e,t,n=.3){ba(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 ka(e,t,n=.6){if(!ba(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 wa(e,t,n,o=.35){ba(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var Aa=require("d3-shape");function Sa(e,t){const n=fo(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,Aa.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var Ma=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=po(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(Sa(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=yo(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Sa(e,t),wa(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?mo(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=fo(t.curve);if(e.beginPath(),o)(0,Aa.line)().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Ca=(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=po(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=po(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),ka(e,n)}finally{e.restore()}}},ja=new Map;function _a(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=ja.get(t);return n||(n=new Path2D(Ot(e.symbolType,e.size)),ja.size>256&&ja.clear(),ja.set(t,n)),n}catch{return null}}var Ra=(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=_a(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=po(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=po(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function Pa(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=En(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=po(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=Vn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Un(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Un(e,i,c,t.accent,void 0,l),e.restore()}function La(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(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)}}(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 Ia(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}}}var Ta=(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)Na(e,t);else if(t.cornerRadii&&Ii(t.cornerRadii)){const n=po(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),o=Ia(t),r=t.fillGradient&&"string"==typeof n?yo(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,La(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=po(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),o=Ia(t),r=t.fillGradient&&"string"==typeof n?yo(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=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=po(e,t.style.fill,to(e,"var(--semiotic-primary, #007bff)")),o=Ia(t),r=t.fillGradient&&"string"==typeof n?yo(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=to(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}va(e,t),e.globalAlpha=1}};function Na(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()}function Fa(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Oa(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Ba=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h);const o=Math.max(0,n?.strokeWidth??1);if(o>0&&(e.strokeStyle=to(e,n?.stroke??"var(--semiotic-surface, #fff)"),e.lineWidth=o,e.strokeRect(t.x,t.y,t.w,t.h)),va(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Oa(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=Fa(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},Wa=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=to(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=t.dotRadius??Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=to(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},Da={line:[Ma,xa,Ca],area:[Ma,Ca],stackedarea:[Ma,Ca],scatter:[Ca,Ra],bubble:[Ca,Ra],heatmap:[Ba],bar:[Ta],swarm:[Ca],waterfall:[(e,t,n,o)=>{Ta(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=to(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Wa],mixed:[Ma,xa,Ca],custom:[Ma,Ta,Ba,xa,Ca,Ra,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Pa(e,o,o.x,o.y,n);e.globalAlpha=n},Wa]},za=new Set;function Ha(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 Ea(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;za.has(n)||(za.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var $a=require("react/jsx-runtime");function Ya(e){return"string"==typeof e?e:"value"}function Ga(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function qa(e,t){if(!t)return Ga(e);try{const n=t(e);return null==n?Ga(e):n}catch{return Ga(e)}}function Va(e,t){return"function"==typeof t?t(e):e[t]}function Xa(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e.bands?.[o]?.y0??(0===o?e.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e.bands?.[o]?.y1??(0===o?e.band?.y1:void 0),format:t})}),n}function Ua(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?qa(Va(o,t.accessor),t.format):null;return(0,$a.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[null!=r&&(0,$a.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=qa(Va(o,e.accessor),e.format);return(0,$a.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,$a.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,$a.jsx)("span",{children:n})]},t)})]})}}var Ka=require("react/jsx-runtime");function Qa(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Za({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=Os(t);if(null!=e.title||e.entries.length>0)return(0,Ka.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[null!=e.title&&(0,Ka.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Ka.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Ka.jsx)("span",{style:{fontWeight:600},children:Qa(e.value)})]},e.key))]})}return(0,Ka.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[(0,Ka.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Qa(n)}),(0,Ka.jsx)("div",{style:{opacity:.7,fontSize:11},children:Qa(o)})]})}function Ja(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 el(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}))}Za.ownsChrome=!0;var tl=require("react"),nl=require("react");function ol(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 rl(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=Xn(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"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":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??"_default"});break;case"heatcell":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:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}var il=require("react/jsx-runtime"),sl={top:20,right:20,bottom:30,left:40},al=Ki;function ll(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var cl=(0,oe.memo)((0,oe.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:m,normalize:g,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:M,xExtent:C,yExtent:j,extentPadding:_=.1,scalePadding:R,sizeRange:P,size:L=[500,300],responsiveWidth:I,responsiveHeight:T,margin:N,className:F,background:O,renderMode:B,lineStyle:W,pointStyle:D,areaStyle:z,barStyle:H,waterfallStyle:E,swarmStyle:$,barColors:Y,colorScheme:G,boundsAccessor:q,boundsStyle:V,y0Accessor:X,band:U,gradientFill:K,lineGradient:Q,areaGroups:Z,openAccessor:J,highAccessor:ee,lowAccessor:te,closeAccessor:re,candlestickStyle:ie,showAxes:se=!0,axes:ae,xLabel:ce,yLabel:de,yLabelRight:fe,xFormat:pe,yFormat:ye,axisExtent:ge,tickFormatTime:xe,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,annotationObservationCallback:Me,chartId:Ce,enableHover:je,hoverRadius:_e=30,tooltipMode:Re,annotations:Pe,onAnnotationActivate:Le,autoPlaceAnnotations:Ie,svgAnnotationRules:Te,showGrid:Ne,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:ze,legendLayout:He,legendCategoryAccessor:Ee,onCategoriesChange:$e,backgroundGraphics:Ye,foregroundGraphics:Ge,canvasPreRenderers:qe,svgPreRenderers:Ve,title:Xe,categoryAccessor:Ue,brush:Ke,onBrush:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:nt,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at=!1,suspendWhenHidden:lt=!0,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:ht,showValues:dt,heatmapValueFormat:ft,marginalGraphics:pt,pointIdAccessor:yt,xScaleType:mt,yScaleType:gt,accessibleTable:xt=!0,description:bt,summary:vt,linkedCrosshairName:kt,linkedCrosshairSourceId:wt,customLayout:At,onLayoutError:St,layoutConfig:Mt,layoutSelection:Ct}=e,{customHoverBehavior:jt,customClickBehavior:Rt,hasClickBehavior:Pt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,tl.useCallback)((t,i)=>{e?.(t,i),Ja({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,tl.useCallback)((e,i)=>{t?.(e,i),el({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:we,customClickBehavior:Ae,onObservation:Se,chartId:Ce,chartType:"StreamXYFrame"}),Lt=(0,oe.useId)().replace(/:/g,""),It=(0,oe.useRef)(!1),Tt=(0,oe.useRef)({w:-1,h:-1}),Nt=(0,oe.useRef)(!1),Ft=oa({sizeProp:L,responsiveWidth:I,responsiveHeight:T,userMargin:N,marginDefault:sl,title:Xe,legend:Fe,legendPosition:ze,animate:tt,transitionProp:et,frameScheduler:ot,clock:rt,random:it,seed:st,paused:at,suspendWhenHidden:lt,themeDirtyRef:It}),Bt=function(){const[e,t]=(0,zi.useState)(!1);return Hi(()=>{t(!0)},[]),e}(),Wt=function(){const e=(0,zi.useSyncExternalStore)(Ei,$i,Yi);return(0,zi.useRef)(e).current}(),{reducedMotionRef:Dt,responsiveRef:zt,size:Ht,currentTheme:Et,transition:$t,introEnabled:Yt,tableId:Gt,rafRef:qt,renderFnRef:Vt,scheduleRender:Xt,frameRuntime:Ut}=Ft;let Kt=Ft.margin;if(pt){const e=60,t={...Ft.margin};pt.top&&e>t.top&&(t.top=e),pt.bottom&&e>t.bottom&&(t.bottom=e),pt.left&&e>t.left&&(t.left=e),pt.right&&e>t.right&&(t.right=e),Kt=t}const Qt=Ht[0]-Kt.left-Kt.right,Zt=Ht[1]-Kt.top-Kt.bottom,Jt=(0,oe.useMemo)(()=>ue(r),[r]),en=ve??je,[tn,nn]=(0,oe.useState)(0),on=(0,oe.useRef)(0),[rn,sn]=(0,oe.useState)(null),an=aa(Ge,Ht,Kt,rn),ln=aa(Ye,Ht,Kt,rn),cn=(0,oe.useRef)(null),un=(0,oe.useRef)(null),hn=(0,oe.useRef)(void 0),[dn,fn]=(0,oe.useState)(null),pn=(0,oe.useRef)(al.primary),yn=(0,oe.useRef)(function(){let e=-1,t=Ki;return{resolve(n){if(!n)return Ki;const o=Qn;return o===e||(t=function(e){if(!e)return Ki;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||Ki.axisStroke,tickText:s||Ki.tickText,crosshair:s?Qi(s,"66"):Ki.crosshair,hoverFill:c?Qi(c,"4D"):Ki.hoverFill,hoverStroke:s?Qi(s,"99"):Ki.hoverStroke,pointRing:c||Ki.pointRing,primary:i||Ki.primary,background:c||Ki.background}:Ki}(n),e=o),t},invalidate(){e=-1}}}()),mn=(0,oe.useRef)(!1),bn=(0,xn.useRef)(new Sn("StreamXYFrame")),[vn,kn]=(0,oe.useState)(!1),[wn,An]=(0,oe.useState)([]),[Cn,_n]=(0,oe.useState)([]),Rn="streaming"===o||["bar","swarm","waterfall"].includes(n),Pn=function(e){const t=(0,Gi.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Vi(e,t);if(!Xi(e)||!Xi(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(!Vi(n,r))return!1}else{if(!Xi(n)||!Xi(r))return!1;if(!qi(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,oe.useMemo)(()=>({chartType:n,runtimeMode:Rn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Rn?w:"right",extentPadding:_,scalePadding:R,axisExtent:ge,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Rn?M:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:y,xScaleType:mt,yScaleType:gt,xExtent:C,yExtent:j,sizeRange:P,binSize:v,normalize:g,baseline:x,stackOrder:b,boundsAccessor:q,boundsStyle:V,y0Accessor:X,band:U,gradientFill:!0===K?{topOpacity:.8,bottomOpacity:.05}:!1===K?void 0:K,areaGroups:Z?new Set(Z):void 0,lineGradient:Q,openAccessor:J,highAccessor:ee,lowAccessor:te,closeAccessor:re,candlestickStyle:ie,lineStyle:W,pointStyle:D,areaStyle:z,swarmStyle:$,waterfallStyle:E,colorScheme:G,barColors:Y,barStyle:H,annotations:Pe,decay:Ze,pulse:Je,transition:$t,introAnimation:Yt,staleness:nt,clock:Ut.now,heatmapAggregation:ct,heatmapXBins:ut,heatmapYBins:ht,showValues:dt,heatmapValueFormat:ft,pointIdAccessor:yt,curve:m,themeCategorical:Et?.colors?.categorical,themeSemantic:me(Et),themeSequential:Et?.colors?.sequential,themeDiverging:Et?.colors?.diverging,customLayout:At,onLayoutError:St,layoutConfig:Mt,layoutMargin:Kt}),[n,Rn,S,A,w,_,R,ge,a,l,c,M,k,u,h,d,f,p,y,Ue,mt,gt,C,j,P,v,g,x,b,q,V,X,U,K,Z,Q,J,ee,te,re,ie,W,D,z,$,E,G,Y,H,Pe,Ze,Je,$t,Yt,nt,Ut.now,ct,ut,ht,dt,ft,yt,m,Et,At,St,Mt,Kt])),Ln=(0,oe.useRef)(null);Ln.current||(Ln.current=new gn(Pn));const In=function(e,t,n,o){const r=(0,ca.useRef)({accessor:t,onChange:n,readData:o}),i=(0,ca.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,ca.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])}(Ln,Ee,$e,e=>e.getData());!function(e,t,n,o){(0,Fn.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(Ln,Pn,It,Xt),function(e,t,n,o){const r=(0,Fn.useRef)(null);(0,Fn.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])}(Ln,Ct,It,Xt);const Tn=(0,oe.useRef)(null);Tn.current||(Tn.current=new he(e=>{const t=Ln.current;t&&t.ingest(e)&&(It.current=!0,Xt())},{chunkThreshold:i,chunkSize:s})),(0,oe.useEffect)(()=>{Tn.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const On=(0,oe.useCallback)(e=>{Tn.current?.push(e)},[]),Bn=(0,oe.useCallback)(e=>{Tn.current?.pushMany(e)},[]),Wn=(0,oe.useCallback)(()=>{Tn.current?.clear(),Ln.current?.clear(),It.current=!0,Xt()},[Xt]);(0,oe.useImperativeHandle)(t,()=>({push:On,pushMany:Bn,remove:e=>{Tn.current?.flush();const t=Ln.current?.remove(e)??[];return t.length>0&&(cn.current&&t.some(e=>e===cn.current?.data)&&(cn.current=null,fn(null)),It.current=!0,Xt()),t},update:(e,t)=>{Tn.current?.flush();const n=Ln.current?.update(e,t)??[];return n.length>0&&(It.current=!0,Xt()),n},clear:Wn,getData:()=>(Tn.current?.flush(),Ln.current?.getData()??[]),getScales:()=>Ln.current?.scales??null,getExtents:()=>Ln.current?.getExtents()??null,getCustomLayout:()=>Ln.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Ln.current?.lastCustomLayoutFailure??null}),[On,Bn,Wn,Xt]),(0,oe.useEffect)(()=>{if(r){if(y&&Jt.length>0&&"object"==typeof Jt[0]&&null!==Jt[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(Jt[0][e])){const t=[];for(const n of Jt){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void Tn.current?.setBoundedData(t)}}Tn.current?.setBoundedData(Jt)}},[r,Jt,y]);const{canvasRef:Dn,interactionCanvasRef:zn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,ra.useRef)(null),a=(0,ra.useRef)(null),l=(0,ra.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Hi(()=>{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,zi.useRef)(a);l.current=a,(0,zi.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,ra.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,ra.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})}(Ft,{storeRef:Ln,dirtyRef:It,hydrated:Bt,wasHydratingFromSSR:Wt,cleanup:()=>Tn.current?.clear(),canvasPaintDependencies:[n,Qt,Zt,se,O,Ye,W,B,qe,Xt]}),{hoverHandlerRef:Hn,hoverLeaveRef:$n,onPointerMove:Gn,onPointerLeave:qn}=Ft;Hn.current=e=>{if(!en)return;const t=Dn.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void(cn.current&&(cn.current=null,un.current=null,fn(null),jt&&(jt(null),It.current=!0),Xt()));const s=Ln.current;if(!s||0===s.scene.length)return;const l=_s(_e,e.pointerType),c=vo(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Re,h=()=>{cn.current&&(cn.current=null,un.current=null,fn(null),jt&&jt(null),Xt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?_t(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,m="function"==typeof y?y(d):void 0;let g=Ps(p,d,f,null!=m?{xValue:m,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=ko(bo(e.path,e.curve),t,n);if(null===i)continue;const s=Lo(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=bo(e.topPath,e.curve),s=bo(e.bottomPath,e.curve),a=ko(i,t,n);if(null===a)continue;const l=ko(s,t,n),c=Lo(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,Qt));if(e.length>0){const t=s.scales.y.invert,o=pn.current,r=y?y(d):d;if(c)g.xValue=r,g.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),g=Ps(e,d,f,{xValue:r,xPx:d})}g.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:_t(e.datum,s.resolvedRibbons)}})}}c||g.allSeries?.length?(cn.current=g,un.current=c?.node??null,fn(g),jt&&(jt(g),It.current=!0),Xt()):h()},$n.current=()=>{cn.current&&(cn.current=null,un.current=null,fn(null),jt&&(jt(null),It.current=!0),Xt())};const Xn=(0,oe.useRef)(()=>{});Xn.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Rt)return;const n=Dn.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Kt.left,i=e.clientY-o.top-Kt.top;if(0>r||r>Qt||0>i||i>Zt)return void Rt(null);const s=Ln.current;if(!s||0===s.scene.length)return void Rt(null);const a=_s(_e,hn.current),l=vo(s.scene,r,i,a,s.quadtree,s.maxPointRadius);if(!l)return void Rt(null);const c=l.datum||{},u=s.scales?.x?.invert,h="function"==typeof u?u(l.x):void 0;var d;Rt(Ps(c,l.x,l.y,null!=h?{xValue:h,xPx:l.x}:void 0),{type:"activate",inputType:(d=hn.current,"touch"===d?"touch":"pointer")})};const Un=(0,oe.useCallback)(e=>Xn.current(e),[]),{kbFocusIndexRef:Kn,focusedNavPointRef:Zn,onKeyDown:Jn}=(eo={storeRef:Ln,hoverRef:cn,hoveredNodeRef:un,setHoverPoint:fn,customHoverBehavior:jt,customClickBehavior:Rt,scheduleRender:Xt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,nl.useRef)(-1),u=(0,nl.useRef)(null),h=(0,nl.useRef)(null),d=(0,nl.useCallback)(d=>{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']")}(d))return;const f=e.current;if(!f)return;const p=()=>{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||p());let y;if(h.current?.version===f.version)y=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());y=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),h.current={version:f.version,graph:y}}let m=c.current;if(y.flat.length>m||(p(),m=-1),("Enter"===d.key||" "===d.key)&&m>=0)return d.preventDefault(),void i(l(y.flat[m],f),{type:"activate",inputType:"keyboard"});if(0>m){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=y.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 g=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?ol(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?ol(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}}(d.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}}(y,m),y);if(null===g)return;if(d.preventDefault(),0>g)return void p();c.current=g;const x=y.flat[g];u.current=x;const b=l(x,f);t.current=b,o(b),r(b,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...eo,extractPoints:rl,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:_t(e.datum,t.resolvedRibbons)})}));var eo;const no=(0,oe.useCallback)(e=>{hn.current=e.pointerType,Kn.current=-1,Zn.current=null,Gn(e)},[Zn,Kn,Gn]),oo=(0,oe.useCallback)(e=>{hn.current="mouse",Kn.current=-1,Zn.current=null,Gn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Zn,Kn,Gn]),ro=(0,oe.useCallback)(e=>{hn.current=e.pointerType},[]);Vt.current=()=>{if(qt.current=null,!Ut.isActive)return;const e=Dn.current,t=zn.current;if(!e||!t)return;const o=Ln.current;if(!o)return;const r=Ut.now(),i=o.advanceTransition(Dt.current?r+1e6:r),s=!Dt.current&&i,c=Tt.current.w!==Qt||Tt.current.h!==Zt,u=It.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=bn.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:Qt,height:Zt}),Tt.current={w:Qt,h:Zt},d=!0,In()),bn.current.afterCompute(p,d,c);const y=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,d,Nt),m=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))}(),g=yn.current.resolve(e);pn.current=g.primary;const x=Fo(nt,o.lastIngestTime>0?r-o.lastIngestTime:0),b=nt&&x.isStale;if(u||h||y.changed){const t=la(e,Ht,Kt,m);if(t){if(t.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),nt&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t,c=Ui({background:n,hasBackgroundGraphics:o,themeBackground:r});if(!c)return!1;const u=to(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:O,hasBackgroundGraphics:!!Ye,themeBackground:g.background,x:-Kt.left,y:-Kt.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Qt,Zt),t.clip()),qe&&o.scales)for(const e of qe)t.save(),e(t,o.scene,o.scales,{width:Qt,height:Zt}),t.restore();const e=At?Da.custom:Da[n];!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=Ha(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||(Ea(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:B,pixelRatio:m,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:Qt,height:Zt})}}),t.restore(),nt&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!(en&&cn.current&&o.scales),k=!!(un.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||mn.current){const e=la(t,Ht,Kt,m);if(e&&(e.clearRect(-Kt.left,-Kt.top,Ht[0],Ht[1]),v&&cn.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,cn.current,Qt,Zt,"object"==typeof en?en:{},un.current,g),k&&un.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,un.current,t,g)}mn.current=w}u&&e&&e.setAttribute("aria-label",ls(o.scene,n+" chart"));const A=It.current;if(It.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!rn||e(rn.x.domain()[0])!==e(o.scales.x.domain()[0])||e(rn.x.domain()[1])!==e(o.scales.x.domain()[1])||e(rn.y.domain()[0])!==e(o.scales.y.domain()[0])||e(rn.y.domain()[1])!==e(o.scales.y.domain()[1])||rn.x.range()[0]!==o.scales.x.range()[0]||rn.x.range()[1]!==o.scales.x.range()[1]||rn.y.range()[0]!==o.scales.y.range()[0]||rn.y.range()[1]!==o.scales.y.range()[1])&&sn(o.scales),pt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];An(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),_n(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Pe&&Pe.length>0||At)&&(d||s))||!d&&33>r-on.current||(nn(e=>e+1),on.current=r),nt?.showBadge&&kn(!!b),(s||null!=o.activeTransition||y.pending)&&Xt()},function(e,t,n,o,r,i){const s=(0,Io.useRef)("fresh");(0,Io.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=Fo(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])}(nt,Ln,It,Xt,vn,kn);const so=(0,oe.useMemo)(()=>{if(pe||xe)return;const e=Ln.current;return e?.xIsDate&&rn?fa(rn.x.domain()):void 0},[pe,xe,rn]),ao=pe||xe||so,lo=en&&dn?ke?ke(dn):(0,il.jsx)(Za,{hover:dn}):null,uo=lo?(0,il.jsx)(Gs,{x:dn.x,y:dn.y,containerWidth:Qt,containerHeight:Zt,margin:Kt,className:"stream-frame-tooltip",children:lo}):null,ho=Zn.current,po=(0,il.jsx)(Cs,{active:Kn.current>=0,hoverPoint:dn,margin:Kt,size:Ht,shape:ho?.shape,width:ho?.w,height:ho?.h}),yo=ua(a,M,"__semiotic_resolvedX","__semiotic_resolvedTime"),mo=ua(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),go=yo.key,xo=mo.key,wo=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}}(yo,mo,Pe&&Pe.length>0||!1);if(Di||!Bt&&Wt){const e=Ln.current;e&&r&&(e.ingest({inserts:Jt,bounded:!0}),e.computeScene({width:Qt,height:Zt}));const t=e?.scene??[],n=e?.scales??null,o=aa(Ge,Ht,Kt,n),i=aa(Ye,Ht,Kt,n),s=ao||(()=>{if(e?.xIsDate&&n)return fa(n.x.domain())})();return(0,il.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"img","aria-label":bt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1]},children:[(0,il.jsx)(ws,{summary:vt}),(0,il.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,il.jsx)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:i}),(0,il.jsxs)("g",{transform:`translate(${Kt.left},${Kt.top})`,children:[O&&(0,il.jsx)("rect",{x:0,y:0,width:Qt,height:Zt,fill:O}),Ve&&n&&Ve.map((e,o)=>(0,il.jsx)(ne.Fragment,{children:e(t,n,{width:Qt,height:Zt})},"svgpre-"+o)),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=Ha(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ea(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:B,fallback:()=>function(e,t,n){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const r=fo(o.curve),i=r?(0,Li.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.path)??"":"M"+o.path.map(([e,t])=>`${e},${t}`).join("L"),s=Fi(`${n?n+"-":""}line-${t}-stroke-gradient`),a=Wi(o.strokeGradient,o.path,s);return(0,Bi.jsxs)(Pi.Fragment,{children:[a&&(0,Bi.jsx)("defs",{children:a}),(0,Bi.jsx)("path",{d:i,fill:"none",stroke:a?`url(#${s})`:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity})]},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=fo(o.curve),i=!r||2>o.topPath.length||2>o.bottomPath.length?`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:(0,Li.area)().x(([e])=>e).y0((e,t)=>o.bottomPath[t][1]).y1(([,e])=>e).curve(r)(o.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,a=io(o.style.fill)?co(o.style.fill,s):void 0,l=Fi(`${n?n+"-":""}area-${t}-gradient`),c=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let o=1/0;for(const[,t]of e.topPath)o=Math.min(o,t);let r=-1/0;for(const[,t]of e.bottomPath)r=Math.max(r,t);if(!Number.isFinite(o)||!Number.isFinite(r))return null;const i=[];if("colorStops"in n){const e=Oi(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push((0,Bi.jsx)("stop",{offset:0,stopColor:Ni(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push((0,Bi.jsx)("stop",{offset:1,stopColor:Ni(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return(0,Bi.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:o,x2:0,y2:r,children:i})}(o,l),u=c?`url(#${l})`:a?`url(#${s})`:Ni(o.style.fill),h=c?void 0:o.style.fillOpacity??o.style.opacity??.7,d=r?(0,Li.line)().x(([e])=>e).y(([,e])=>e).curve(r)(o.topPath)??"":"M"+o.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=Fi(`${n?n+"-":""}area-${t}-stroke-gradient`),p=Wi(o.strokeGradient,o.topPath,f),y=o.style.stroke&&"none"!==o.style.stroke?(0,Bi.jsx)("path",{d:d,fill:"none",stroke:p?`url(#${f})`:Ni(o.style.stroke),strokeWidth:o.style.strokeWidth||2,opacity:o.style.opacity}):null;if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,Bi.jsxs)("g",{children:[(0,Bi.jsxs)("defs",{children:[c,!c&&a,p,(0,Bi.jsx)("clipPath",{id:e,children:(0,Bi.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})]}),(0,Bi.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,Bi.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),y]})]},"area-"+t)}return(0,Bi.jsxs)(Pi.Fragment,{children:[(c||a||p)&&(0,Bi.jsxs)("defs",{children:[c,!c&&a,p]}),(0,Bi.jsx)("path",{d:i,fill:u,fillOpacity:h,opacity:c?o.style.opacity:void 0,stroke:"none"}),y]},"area-"+t)}case"point":{const o=e,r=`${n?n+"-":""}point-${t}-hatch`,i=io(o.style.fill)?co(o.style.fill,r):void 0;return(0,Bi.jsxs)(Pi.Fragment,{children:[i&&(0,Bi.jsx)("defs",{children:i}),(0,Bi.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#${r})`:Ni(o.style.fill),opacity:o.style.opacity??o.style.fillOpacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=Ot(e.symbolType,e.size,e.path);return(0,Ti.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Ni(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=En(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=Vn(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Fi(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:Yn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:Yn(n.stroke??"none",a,e.accent);return r||i?(0,Ti.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,Ti.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Ti.jsx)("clipPath",{id:c,children:(0,Ti.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Ti.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,Ti.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const o=e,r=`${n?n+"-":""}xyrect-${t}-hatch`,i=io(o.style.fill)?co(o.style.fill,r):void 0;return(0,Bi.jsxs)(Pi.Fragment,{children:[i&&(0,Bi.jsx)("defs",{children:i}),(0,Bi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#${r})`:Ni(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),s=.299*o+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,Bi.jsxs)("g",{children:[(0,Bi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth}),(0,Bi.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,Bi.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return(0,Bi.jsxs)("g",{children:[(0,Bi.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,Bi.jsx)("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),(0,Bi.jsx)("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,Bi.jsxs)("g",{children:[(0,Bi.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,Bi.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Lt)})).filter(Boolean)]})]}),(0,il.jsx)(Ri,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:n,showAxes:se,axes:ae,xLabel:ce,yLabel:de,yLabelRight:fe,xFormat:s,yFormat:ye||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:ze,legendLayout:He,foregroundGraphics:jn(o,Nn(Ln.current?.customLayoutOverlays,Ct??null)),marginalGraphics:pt,xValues:[],yValues:[],annotations:Pe,onAnnotationActivate:Le,onObservation:Me??Se,chartId:Ce,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:0,xAccessor:go,yAccessor:xo,annotationData:wo(Ln.current?.getData()),pointNodes:pa(Ln.current?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:kt,linkedCrosshairSourceId:wt})]})}return(0,il.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(F?" "+F:""),role:"group","aria-label":bt||("string"==typeof Xe?Xe:"XY chart"),tabIndex:0,style:{position:"relative",width:I?"100%":Ht[0],height:T?"100%":Ht[1],overflow:"visible",touchAction:ll(Ke)},onKeyDown:Jn,children:["production"!==process.env.NODE_ENV&&Ln.current&&(0,il.jsx)(Mn,{store:Ln.current,diagnostics:bn.current}),xt&&(0,il.jsx)(As,{tableId:Gt}),xt&&(0,il.jsx)(ks,{scene:Ln.current?.scene??[],chartType:n+" chart",tableId:Gt,chartTitle:"string"==typeof Xe?Xe:void 0}),(0,il.jsx)(ws,{summary:vt}),(0,il.jsx)(os,{hoverPoint:dn}),(0,il.jsxs)("div",{role:"img","aria-label":bt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:en?no:void 0,onMouseMove:en?oo:void 0,onPointerLeave:en?qn:void 0,onMouseLeave:en?qn:void 0,onPointerDown:en||Pt?ro:void 0,onClick:Pt?Un:void 0,children:[(0,il.jsx)(sa,{size:Ht,margin:Kt,children:ln}),(0,il.jsx)(Ci,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:rn,showAxes:se,axes:ae,showGrid:Ne,xFormat:ao,yFormat:ye||be,axisExtent:ge}),(0,il.jsx)("canvas",{ref:Dn,"aria-label":ls(Ln.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,il.jsx)("canvas",{ref:zn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,il.jsx)(Ri,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,scales:rn,showAxes:se,axes:ae,xLabel:ce,yLabel:de,yLabelRight:fe,xFormat:ao,yFormat:ye||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:We,legendIsolatedCategories:De,legendPosition:ze,legendLayout:He,foregroundGraphics:jn(an,Nn(Ln.current?.customLayoutOverlays,Ct??null)),marginalGraphics:pt,xValues:wn,yValues:Cn,annotations:Pe,onAnnotationActivate:Le,onObservation:Me??Se,chartId:Ce,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:tn,xAccessor:go,yAccessor:xo,annotationData:wo(Ln.current?.getData()),pointNodes:pa(Ln.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!Ui({background:O,hasBackgroundGraphics:!!Ye,themeBackground:Et?.colors.background}),linkedCrosshairName:kt,linkedCrosshairSourceId:wt}),(Ke||Qe)&&(0,il.jsx)(le,{width:Qt,height:Zt,totalWidth:Ht[0],totalHeight:Ht[1],margin:Kt,dimension:Ke?.dimension??"xy",scales:rn,onBrush:Qe??(()=>{}),binSize:v,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===n?Ln.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===o}),nt?.showBadge&&(0,il.jsx)(Bo,{isStale:vn,position:nt.badgePosition}),po,uo]})]})}));cl.displayName="StreamXYFrame";var ul=cl,hl=require("react"),dl=require("react"),fl=require("react"),pl=require("react/jsx-runtime"),yl=(0,fl.createContext)(null);function ml({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,fl.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=st(e,n)??tt[r++%tt.length];return o}const e=Array.isArray(n)?n:et[n]||tt,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,pl.jsx)(yl.Provider,{value:r,children:o})}function gl(){return(0,fl.useContext)(yl)}ml.displayName="CategoryColorProvider";var xl=require("react");function bl(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 vl(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function kl(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[wl,Al]=pe(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||!kl(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=vl(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=vl(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}})}})),Sl=require("react");function Ml(e){const t=(0,Sl.useId)(),n=e.clientId||t,{name:o}=e,r=Al(e=>e.selections.get(o)),i=Al(e=>e.setClause),s=Al(e=>e.clearClause),a=(0,Sl.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,Sl.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(bl(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,Sl.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,Sl.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,Sl.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Cl(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function jl(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ml({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,Sl.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&&Cl(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Cl(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),_l(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,Sl.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function _l(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Rl=require("react/jsx-runtime"),Pl=(0,xl.createContext)(!1),Ll=(0,xl.createContext)(!1),Il=(0,xl.createContext)(null),Tl="undefined"==typeof window?xl.useEffect:xl.useLayoutEffect;function Nl(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Fl(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}var Ol="__linked-legend-isolate__",Bl="__linked-legend-highlight__";function Wl({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=Ml({name:n,fields:[o],clientId:Ol}),{selectPoints:c,clear:u}=Ml({name:n,fields:[o],clientId:Bl}),h=Al(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,xl.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(Ol)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(Bl)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,xl.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,xl.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[m,[g]]=Ks([0,0],!0,!1),x=(0,xl.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),g),[r,g]);return 0===r.length?null:(0,Rl.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,Rl.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,Rl.jsx)(Jo,{legendGroups:s,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function Dl({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,xl.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=gl(),[c,u]=(0,xl.useState)({}),h=(0,xl.useRef)({}),d=(0,xl.useMemo)(()=>({registerCategories:(e,t)=>{const n=Nl(t);u(t=>Fl(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,xl.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return Nl(e)},[c]),p=(0,xl.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=tt[n%tt.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,m=Object.keys(p).length>0;return(0,Rl.jsx)(wl,{initialState:a,children:(0,Rl.jsx)(Fr,{children:(0,Rl.jsx)(Ll.Provider,{value:!0,children:(0,Rl.jsx)(Il.Provider,{value:d,children:(0,Rl.jsx)(ml,{colors:p,children:(0,Rl.jsxs)(Pl.Provider,{value:y&&m,children:[y&&"top"===o&&(0,Rl.jsx)(Wl,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,Rl.jsx)(Wl,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function zl(e){return e?"string"==typeof e?{name:e}:e:null}var Hl=.5;function El(e,t,n){return t?(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??Hl;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var $l=y(require("react"));function Yl(){return Se(e=>e.theme)}function Gl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ql(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 Vl(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=>ql(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"])Gl(e[o])&&Gl(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"),$l.createContext(void 0);var Xl=44,Ul={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Xl,snap:"nearestDatum",brushHandleSize:Xl,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Kl(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 Ul;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??Xl,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Xl,standardControls:a.standardControls??!1}}var Ql={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 Zl(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 Jl(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 ec(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 tc(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var nc=[];function oc(){const e=Yl(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function rc(e,t,n){const o=gl(),r=oc();return(0,dl.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&&tc(i)){const e=at(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return at(n.map(e=>({_cat:e})),"_cat",s)}if(i&&tc(i)){const n=at(e,t,s);return e=>i[e]||n(e)}return at(e,t,s)}if(i&&tc(i)){const e=at([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function ic({selection:e,linkedHover:t,fallbackFields:n=nc,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,dl.useId)(),d=(0,dl.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,dl.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),p=Ml({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Ml({name:t,fields:n});return{onHover:(0,Sl.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}_l(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),m=Or(e=>e.pushObservation),g=(0,dl.useCallback)(e=>{r?.(e),m?.(e)},[r,m]),x=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=(0,dl.useState)(null),k=(0,dl.useRef)(!1),w=c||n[0],A=(0,dl.useMemo)(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=(0,dl.useCallback)((e,n)=>{const o=!e&&k.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"===d?.mode&&d.xField){const n=Jl(e,t,d.xField);null!=n&&function(e,t,n){const o=ci.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(ci={positions:new Map(ci.positions).set(e,{xValue:t,sourceId:n})},hi())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||o||di(d.name||"hover",h),"x-position"===d?.mode||o||y.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else o||v(null);(r||m)&&Ja({onObservation:g,datum:e?ec(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,y,d,h,r,i,s,m,g,l,w,u]),M=(0,dl.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(fi(d.name||"hover",h),di(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),C=(0,dl.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Jl(n,e,d.xField);null!=t&&function(e,t,n){const o=ci.positions.get(e);if(o?.locked){const t=new Map(ci.positions);return t.delete(e),ci={positions:t},hi(),!1}ci={positions:new Map(ci.positions).set(e,{xValue:t,sourceId:n,locked:!0})},hi()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const o=ec(n);if(t&&"x-position"!==d?.mode&&y.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])}tc(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else x&&M();if(n||x){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||m)&&el({onObservation:g,datum:n?ec(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,m,g,i,s,d,h,u,t,y,e,p,f,l,w,M]);return(0,dl.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,dl.useEffect)(()=>()=>{k.current&&M(!1)},[M]),(0,dl.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{fi(e,h),di(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:h}}function sc(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function ac({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,xl.useContext)(Pl),u=null!==(0,xl.useContext)(Il),h=void 0!==o?o:!c&&!!t,d=!!t&&(h||u),f=(0,dl.useMemo)(()=>{if(!d)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,d]);!function(e){const t=(0,xl.useContext)(Il),n=(0,xl.useId)(),o=Nl(e),r=(0,xl.useRef)([]);Fl(r.current,o)||(r.current=o);const i=r.current;Tl(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Tl(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(u&&t?f:[]);const p=(0,dl.useMemo)(()=>{if(!h||!t)return;const o=function({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):ot[i%ot.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:it,categories:f});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[h,t,e,n,f]),y=(0,dl.useMemo)(()=>er(p,l),[p,l]),m=(0,dl.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 y&&("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,y,r]);return{legend:y,margin:m,legendPosition:r}}function lc(e,t,n){const[o,r]=(0,dl.useState)(null),[i,s]=(0,dl.useState)(new Set),a=(0,dl.useMemo)(()=>new Set,[]),l=(0,dl.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,dl.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,dl.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}}function cc(e,t,n){return function(e,t,n){const o=Ql[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Vl({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e||"primary",l=Ql[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:Zl(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Kl(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var uc=require("react/jsx-runtime");function hc({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,uc.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,uc.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,uc.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,uc.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,uc.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 dc=y(require("react")),fc=require("react/jsx-runtime"),pc=class extends dc.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,fc.jsx)(hc,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},yc=require("react/jsx-runtime"),mc="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function gc({componentName:e,width:t,height:n,children:o}){return(0,yc.jsx)(pc,{fallback:o=>(0,yc.jsx)(hc,{componentName:e,message:o.message,width:t,height:n}),children:o})}var xc={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"},bc={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function vc(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,yc.jsx)("div",{style:{...xc,width:t,height:n},children:o||"No data available"}):null}function kc(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,yc.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,yc.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,yc.jsx)("div",{className:"semiotic-loading-bar",style:{...bc,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))})}function wc(e,t,n,o){if(!mc)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 Ac(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 Sc(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=Ac(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function Mc({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=Sc(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var Cc=require("react"),jc=require("react");function _c(e){const t=Se(e=>e.theme.colors.selectionOpacity);return(0,jc.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Rc(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,legend:y,userMargin:m,marginDefaults:g,onClick:x,hoverHighlight:b,mobileInteraction:v,mobileSemantics:k,loading:w,loadingContent:A,emptyContent:S,width:M,height:C}=e,j=void 0===n,_=(0,Cc.useMemo)(()=>ue(t),[t]),[R,P]=(0,Cc.useState)([]),L=(0,Cc.useCallback)(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,Cc.useMemo)(()=>Kl(v,{width:M,mobileSemantics:k}),[v,M,k]),{activeSelectionHook:N,hoverSelectionHook:F,customHoverBehavior:O,customClickBehavior:B,crosshairSourceId:W}=ic({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:x,hoverHighlight:b,colorByField:I,mobileInteraction:T}),D=sc(l,W),z=rc(_,o,r),H=(0,Cc.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of _){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[_,o]),E=(0,Cc.useMemo)(()=>j&&R.length>0?R:H,[j,R,H]),$=lc(i,o,E),Y=(0,Cc.useMemo)(()=>F||($.legendSelectionHook?$.legendSelectionHook:N),[F,$.legendSelectionHook,N]),G=_c(a),q=oc(),V=gl(),X=(0,Cc.useMemo)(()=>{if(z)return z;if(!o||0===E.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:q&&q.length>0?q:ot,t="__streamCat",n=at(E.map(e=>({[t]:e})),t,e);return e=>V?.[e]||n(e)||"#999"},[z,o,E,r,q,V]),{legend:U,margin:K,legendPosition:Q}=ac({data:_,colorBy:o,colorScale:X,showLegend:p,legendPosition:s,userMargin:m,defaults:g,categories:E,additionalLegend:y}),Z=(0,Cc.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=$.onLegendHover,e.legendClickBehavior=$.onLegendClick,e.legendHighlightedCategory=$.highlightedCategory,e.legendIsolatedCategories=$.isolatedCategories),j&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[U,Q,i,$.onLegendHover,$.onLegendClick,$.highlightedCategory,$.isolatedCategories,j,o,L]),J=Array.isArray(n)?ue(n):n,ee=kc(w,M,C,A),te=ee?null:vc(J,M,C,S);return{data:_,colorScale:z,allCategories:E,legendState:$,effectiveSelectionHook:Y,activeSelectionHook:N,customHoverBehavior:O,customClickBehavior:B,mobileInteraction:T,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:G}}var Pc=require("react");function Lc(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 Ic(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>Nc(t(e))}function Tc(e,t){const n=Ic(e),o=Ic(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function Nc(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 Fc(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=Nc(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 Oc(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):Fc(o,t,n))}function Bc(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!Oc(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function Wc(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,Bc(s,t,n(s,i))),a}:r}function Dc(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,styleRules:f,ruleContext:p}=e,y=(0,Pc.useMemo)(()=>function(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{const h={strokeWidth:t},d=!0===s||Array.isArray(s)&&null!=u&&s.includes(u);let f;return i?f=i(e,u):n?o&&(f=it(e,n,o)):f=r||nt,void 0!==f&&(h.stroke=f,d&&(h.fill=f,h.fillOpacity=a)),l?.length&&Object.assign(h,Bc(e,l,c?c(e,u):{value:void 0,category:u})),h}}({lineWidth:t,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a,styleRules:f,ruleContext:p}),[t,n,o,r,i,s,a,f,p]),m=(0,Pc.useMemo)(()=>Lc(y,{stroke:l,strokeWidth:c,opacity:u}),[y,l,c,u]);return(0,Pc.useMemo)(()=>El(m,h??null,d),[m,h,d])}var zc=require("react");function Hc(e,t){const{variant:n,frameRef:o,overrides:r}=t,i=(0,zc.useRef)(r);i.current=r,(0,zc.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)})},[])}function Ec(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 $c(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};o&&(f.annotationObservationCallback=o);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function Yc(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:$s(t)||n}}var Gc="__forecastSegment",qc=null;async function Vc(){return qc||(qc=await Promise.resolve().then(()=>(E(),L))),qc}var Xc=require("react"),Uc="__semiotic_resolvedX",Kc="__semiotic_resolvedY";function Qc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:Uc,l="string"==typeof o?o:Kc,c=(0,Xc.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[Uc]=n(t)),s&&(r[Kc]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,Xc.useState)(null),[d,f]=(0,Xc.useState)([]),p=(0,Xc.useRef)(r),y=(0,Xc.useRef)(i);return(0,Xc.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await Vc()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await Vc()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var Zc=require("react/jsx-runtime"),Jc="__lineObjectSeries",eu=(0,hl.forwardRef)(function(e,t){const n=(0,hl.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(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}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,styleRules:m,curve:g="linear",showPoints:x=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:A,tooltip:S,pointIdAccessor:M,annotations:C,directLabel:j,gapStrategy:_="break",anomaly:R,forecast:P,band:L,xExtent:I,yExtent:T,frameProps:N={},selection:F,linkedHover:O,onObservation:B,onClick:W,hoverHighlight:D,hoverRadius:z,chartId:H,loading:E,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:q,legend:V,xScaleType:X,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=e,{legend:ee,...te}=N,ne=(0,hl.useMemo)(()=>er(ee,V),[ee,V]),{width:oe,height:re,enableHover:ie,showGrid:se,showLegend:ae,title:le,description:ce,summary:he,accessibleTable:de,xLabel:fe,yLabel:pe}=o,ye=(0,hl.useMemo)(()=>ue(r),[r]),me=Array.isArray(ye[0]?.[f])?ye[0][f]:ye;wc("LineChart",me,"xAccessor",u),wc("LineChart",me,"yAccessor",h);const{effectiveData:ge,statisticalAnnotations:xe}=Qc({data:ye,xAccessor:u,yAccessor:h,forecast:P,anomaly:R,groupBy:d}),be="__compoundGroup",ve=!(!P||!d),ke=ve?be:P?Gc:d,we=(0,hl.useMemo)(()=>{if(!ve)return ge;const e="function"==typeof d?d:e=>e[d];return ge.map(t=>{const n={...t};return n[be]=`${e(t)}__${t[Gc]||"observed"}`,n})},[ge,ve,d]),Ae=ve?we:ge,Se=p||d,Me=(0,hl.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=ge;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,ge,h]),Ce=(0,hl.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),je=void 0!==Ae[0]?.[f],_e=je?Jc:ke,Re=(0,hl.useMemo)(()=>{if(je)return Ae.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[Jc]:o,[f]:r.map(t=>({...t,[Jc]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ke){const e=Ae.reduce((e,t)=>{const n="function"==typeof ke?ke(t):t[ke];if(!e[n]){const o={[f]:[]};"string"==typeof ke&&(o[ke]=n),ve&&(o[Gc]=t[Gc],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:Ae}]},[je,ke,f,Ae,d,ve]),{gapProcessedLineData:Pe,hasGaps:Le}=(0,hl.useMemo)(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of Re){const o=(n[f]||[]).filter(t=>!Ce(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of Re){const o=n[f]||[];let r=[],i=0;const s=_e&&"string"==typeof _e?n[_e]:void 0;for(const a of o)if(Ce(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===_){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Re){const r=o[f]||[],i=[];for(const n of r)Ce(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Re,hasGaps:!1}},[Re,_,f,Ce,_e,h]),Ie="object"==typeof j?j:{},Te=Ie.position||"end",Ne=Ie.fontSize||11,Fe=(0,hl.useMemo)(()=>{if(!j||!Se)return[];const e="function"==typeof Se?Se:e=>e[Se],t=new Set;for(const n of Pe){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===Te?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[j,Se,Pe,f,Te]),Oe=(0,hl.useMemo)(()=>{if(!j)return o.marginDefaults;const e=Fe.reduce((e,t)=>Math.max(e,t.length*(.6*Ne)),0)+10,t="end"===Te?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[j,Fe,Ne,Te,o.marginDefaults]),Be=Rc({data:ge,rawData:r,colorBy:Se,colorScheme:y,legendInteraction:G,legendPosition:q,selection:F,linkedHover:O,fallbackFields:Se?["string"==typeof Se?Se:""]:[],unwrapData:!1,onObservation:B,onClick:W,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!j||void 0!==ae)&&ae,legend:ne,userMargin:i,marginDefaults:Oe,loading:E,loadingContent:$,emptyContent:Y,width:oe,height:re}),We=Be.colorScale,De=Be.effectiveSelectionHook,ze=Be.resolvedSelection,He=Be.customHoverBehavior,Ee=Be.customClickBehavior,$e=Be.crosshairProps,Ye=(0,hl.useMemo)(()=>{if(Se)return je?e=>{const t=e.parentLine||e;return"function"==typeof Se?Se(t):t[Se]}:Se},[Se,je]),Ge=(0,hl.useMemo)(()=>Tc(u,h),[u,h]),qe=Dc({lineWidth:w,colorBy:Ye,colorScale:We,color:K,fillArea:v,areaOpacity:k,stroke:Q,strokeWidth:Z,opacity:J,effectiveSelectionHook:De,resolvedSelection:ze,styleRules:m,ruleContext:Ge}),[Ve,Xe]=(0,hl.useState)(null);(0,hl.useEffect)(()=>{if(!P)return void Xe(null);let e=!1;return async function(...e){return(await Vc()).createSegmentLineStyle(...e)}(qe,P).then(t=>{e||Xe(()=>t)}).catch(()=>{e||Xe(null)}),()=>{e=!0}},[qe,P]);const Ue=Ve||qe,Ke=(0,hl.useMemo)(()=>{if(x)return e=>{const t={r:b,fillOpacity:1};return Se?We&&(t.fill=it(e.parentLine||e,Se,We)):t.fill=K||nt,t}},[x,b,Se,We,K]),Qe=Array.isArray(v)?"mixed":v?"area":"line",Ze=(0,hl.useMemo)(()=>{if(!j||!Se)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof Se?Se:e=>e[Se],o=new Map;for(const e of Pe){const t=e[f]||[];if(0===t.length)continue;const r="end"===Te?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===Te?6:-6,dy:0,color:We?We(n):nt,fontSize:Ne}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Ne+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ne+2)}return r},[j,Se,We,Pe,f,u,h,Te,Ne]),Je=Be.margin,et=d||p,tt=(0,hl.useMemo)(()=>Ua([{label:fe||Ya(u),accessor:u,role:"x",format:a},{label:pe||Ya(h),accessor:h,role:"y",format:l},...et?[{label:Ya(et),accessor:et,role:"group"}]:[],...Xa(L,l)]),[u,h,fe,pe,et,a,l,L]),ot=Mc({componentName:"LineChart",data:je?ge[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),rt=(0,hl.useMemo)(()=>je||_e||Le?Pe.flatMap(e=>{const t=e[f]||[];return _e&&"string"==typeof _e?t.map(t=>({...t,[_e]:t[_e]??e[_e]})):t}):Ae,[Pe,f,je,_e,Ae,Le]),st={chartType:Qe,...Array.isArray(v)&&{areaGroups:v},...A&&{lineGradient:A},...null!=r&&{data:rt},xAccessor:u,yAccessor:h,xScaleType:X,yScaleType:U,...I&&{xExtent:I},...!T||null==T[0]&&null==T[1]?Me?{yExtent:Me}:{}:{yExtent:T},groupAccessor:"break"===_&&Le?"_gapSegment":_e||void 0,...L&&{band:L},curve:g,lineStyle:Ue,...x&&{pointStyle:Ke},size:[oe,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Je,showAxes:o.showAxes,xLabel:fe,yLabel:pe,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ie,showGrid:se,...Be.legendBehaviorProps,...le&&{title:le},...ce&&{description:ce},...he&&{summary:he},...void 0!==de&&{accessibleTable:de},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?Es():$s(S)||tt,..."multi"===S&&{tooltipMode:"multi"},...$c({linkedHover:O,selection:F,onObservation:B,onClick:W,hoverRadius:z,hoverHighlight:D,mobileInteraction:Be.mobileInteraction,customHoverBehavior:He,customClickBehavior:Ee}),...M&&{pointIdAccessor:M},...(C?.length||xe.length||Ze.length)&&{annotations:[...C||[],...xe,...Ze]},...$e,...te};return Be.earlyReturn?Be.earlyReturn:ot?(0,Zc.jsx)(hc,{componentName:"LineChart",message:ot,width:oe,height:re}):(0,Zc.jsx)(gc,{componentName:"LineChart",width:oe,height:re,children:(0,Zc.jsx)(ul,{ref:n,...st})})});eu.displayName="LineChart";var tu=require("react"),nu=require("react");function ou(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:m,pointRadius:g,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S,styleRules:M,ruleContext:C}=e,j=(0,nu.useMemo)(()=>function({data:e,safeData:t,areaBy:n,lineDataAccessor:o}){if(null==e)return[];const r=void 0!==t[0]?.[o];if(!r&&!n)return t;let i;if(r)i=t;else{const e=t.reduce((e,t)=>{const r="function"==typeof n?n(t):t[n],i=r+"";if(!e[i]){const t={[o]:[]};"string"==typeof n&&(t[n]=r),e[i]=t}return e[i][o].push(t),e},{});i=Object.values(e)}return i.flatMap(e=>{const t=Array.isArray(e[o])?e[o]:[];return"string"==typeof n?t.map(t=>({...t,[n]:t[n]??e[n]})):t})}({data:n,safeData:t,areaBy:o,lineDataAccessor:r}),[n,t,o,r]),_=(0,nu.useMemo)(()=>e=>{const t={};if(i){if(s){const n=it(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||nt;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,M&&M.length>0&&Object.assign(t,Bc(e,M,C?C(e):{value:void 0})),t},[i,s,a,f,p,y,M,C]),R=(0,nu.useMemo)(()=>Lc(_,{stroke:l,strokeWidth:c,opacity:u}),[_,l,c,u]);return{flattenedData:j,lineStyle:(0,nu.useMemo)(()=>El(R,h??null,d),[R,h,d]),pointStyle:(0,nu.useMemo)(()=>{if(m)return e=>{const t={r:g,fillOpacity:1};return i?s&&(t.fill=it(e.parentLine||e,i,s)):t.fill=a||nt,t}},[m,g,i,s,a]),defaultTooltipContent:(0,nu.useMemo)(()=>Ua([{label:v||Ya(x),accessor:x,role:"x",format:w},{label:k||Ya(b),accessor:b,role:"y",format:A},...S?[{label:Ya(S),accessor:S,role:"group"}]:[],...Xa(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var ru=require("react/jsx-runtime");function iu(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var su=(0,tu.forwardRef)(function(e,t){const n=(0,tu.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:g,styleRules:x,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:k,showLine:w=!0,lineWidth:A=2,showPoints:S=!1,pointRadius:M=3,tooltip:C,annotations:j,forecast:_,anomaly:R,band:P,xExtent:L,yExtent:I,frameProps:T={},selection:N,linkedHover:F,onObservation:O,onClick:B,hoverHighlight:W,chartId:D,loading:z,loadingContent:H,emptyContent:E,legendInteraction:$,legendPosition:Y,color:G,stroke:q,strokeWidth:V,opacity:X}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:re,yLabel:ie}=o,se=(0,tu.useMemo)(()=>ue(r),[r]),ae=m||h,le=(0,tu.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:iu(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);wc("AreaChart",se,"xAccessor",c),wc("AreaChart",se,"yAccessor",u);const ce=Rc({data:se,rawData:r,colorBy:ae,colorScheme:g,legendInteraction:$,legendPosition:Y,selection:N,linkedHover:F,fallbackFields:ae?["string"==typeof ae?ae:""]:[],unwrapData:!1,onObservation:O,onClick:B,hoverHighlight:W,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:D,showLegend:J,userMargin:i,marginDefaults:o.marginDefaults,loading:z,loadingContent:H,emptyContent:E,width:U,height:K}),{effectiveData:he,statisticalAnnotations:de}=Qc({data:se,xAccessor:c,yAccessor:u,forecast:_,anomaly:R,groupBy:h}),fe=(0,tu.useMemo)(()=>Tc(c,u),[c,u]),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ge}=ou({safeData:he,data:r,areaBy:h,lineDataAccessor:y,colorBy:ae,colorScale:ce.colorScale,color:G,stroke:q,strokeWidth:V,opacity:X,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,areaOpacity:v,showLine:w,lineWidth:A,showPoints:S,pointRadius:M,xAccessor:c,yAccessor:u,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,groupField:h||m,band:P,styleRules:x,ruleContext:fe}),xe=Mc({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),be={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...P&&{band:P},...le&&{gradientFill:le},...k&&{lineGradient:k},curve:b,lineStyle:ye,...S&&me&&{pointStyle:me},size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,showAxes:o.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Z,...ce.legendBehaviorProps,...Ec({title:ee,description:te,summary:ne,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:Es(),tooltipMode:"multi"}:Yc({tooltip:C,defaultTooltipContent:ge}),...$c({linkedHover:F,selection:N,onObservation:O,onClick:B,hoverHighlight:W,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...(j&&j.length>0||de.length>0)&&{annotations:[...j||[],...de]},...L&&{xExtent:L},...I&&{yExtent:I},...ce.crosshairProps,...T};return ce.earlyReturn?ce.earlyReturn:xe?(0,ru.jsx)(hc,{componentName:"AreaChart",message:xe,width:U,height:K}):(0,ru.jsx)(gc,{componentName:"AreaChart",width:U,height:K,children:(0,ru.jsx)(ul,{ref:n,...be})})});su.displayName="AreaChart";var au=require("react"),lu=require("react/jsx-runtime");function cu(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var uu=(0,au.forwardRef)(function(e,t){const n=(0,au.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:g=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:M,yExtent:C,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:W,pointIdAccessor:D,windowSize:z}=e,{width:H,height:E,enableHover:$,showGrid:Y,showLegend:G,title:q,description:V,summary:X,accessibleTable:U,xLabel:K,yLabel:Q}=o,Z=(0,au.useMemo)(()=>"function"==typeof c?e=>cu(c(e)):e=>cu(e[c]),[c]),J=(0,au.useMemo)(()=>"function"==typeof u?e=>cu(u(e)):e=>cu(e[u]),[u]),ee=(0,au.useMemo)(()=>"function"==typeof h?e=>cu(h(e)):e=>cu(e[h]),[h]),[te,ne]=(0,au.useState)([]),oe=(0,au.useRef)([]),re=null==r,ie=(0,au.useMemo)(()=>ue(re?te:r),[re,te,r]),se=(0,au.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),m=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(m))continue;const g=u(y,m);if(null!==g)if(null!=a){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(m-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=g,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else{a=g;for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(ie,Z,J,ee),[ie,Z,J,ee]),ae=(0,au.useMemo)(()=>m?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(ie,Z,J,ee):[],[m,ie,Z,J,ee]),le=(0,au.useMemo)(()=>[...se,...ae],[se,ae]),ce=(0,au.useMemo)(()=>{const e=new Set;for(const t of se)e.add(t.__diffSegment);return Array.from(e)},[se]);(0,au.useImperativeHandle)(t,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;oe.current=t,ne(t)},t=D?"function"==typeof D?D:e=>e[D]:null;return{push:t=>e([...oe.current,t]),pushMany:t=>e([...oe.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of oe.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=oe.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>re?oe.current:ie,getScales:()=>n.current?.getScales()??null}},[re,ie,D,z]);const he=Rc({data:ie,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:B,legendPosition:W,selection:_,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:T,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:H,height:E}),de=(0,au.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[G,d,f,p,y]),fe=(0,au.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,au.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:g,fill:"none"}),[p,y,g]),ye=(0,au.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),me=(0,au.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=ie.find(e=>Z(e)===o);e&&(null==r&&(r=J(e)),null==i&&(i=ee(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,lu.jsxs)("div",{className:"semiotic-tooltip",style:Ws,children:[l&&(0,lu.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,lu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,lu.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,lu.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,lu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,lu.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,lu.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,lu.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[ie,Z,J,ee,a,p,y,d,f]),ge="multi"===A,xe=(0,au.useMemo)(()=>!1===A?()=>null:ge?me:$s(A)||me,[A,ge,me]);if(he.earlyReturn)return he.earlyReturn;const be={chartType:"mixed",data:le,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ce,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[H,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:K,yLabel:Q,xFormat:a,yFormat:l,enableHover:$,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...de&&{legend:de,legendPosition:he.legendPosition},...Ec({title:q,description:V,summary:X,accessibleTable:U,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...ge&&{tooltipMode:"multi"},...$c({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...M&&{xExtent:M},...C&&{yExtent:C},...he.crosshairProps,...j};return(0,lu.jsx)(gc,{componentName:"DifferenceChart",width:H,height:E,children:(0,lu.jsx)(ul,{ref:n,...be})})});"function"==typeof uu&&(uu.displayName="DifferenceChart");var hu=require("react"),du=require("react/jsx-runtime"),fu=(0,hu.forwardRef)(function(e,t){const n=(0,hu.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,styleRules:y,curve:m="monotoneX",areaOpacity:g=.7,showLine:x=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:k=3,normalize:w=!1,baseline:A="zero",stackOrder:S,tooltip:M,annotations:C,xExtent:j,yExtent:_,frameProps:R={},selection:P,linkedHover:L,onObservation:I,onClick:T,hoverHighlight:N,chartId:F,loading:O,loadingContent:B,emptyContent:W,legendInteraction:D,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,hu.useMemo)(()=>ue(r),[r]),oe=f||h;Hc(t,{variant:"xy",frameRef:n});const re=Rc({data:ne,rawData:r,colorBy:oe,colorScheme:p,legendInteraction:D,legendPosition:z,selection:P,linkedHover:L,fallbackFields:oe?["string"==typeof oe?oe:""]:[],unwrapData:!1,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:O,loadingContent:B,emptyContent:W,width:G,height:q}),ie=(0,hu.useMemo)(()=>Tc(c,u),[c,u]),{flattenedData:se,lineStyle:ae,pointStyle:le,defaultTooltipContent:ce}=ou({safeData:ne,data:r,areaBy:h,lineDataAccessor:d,colorBy:oe,colorScale:re.colorScale,color:H,stroke:E,strokeWidth:$,opacity:Y,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:g,showLine:x,lineWidth:b,showPoints:v,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:h||f,styleRules:y,ruleContext:ie}),he=Mc({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:se},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:m,normalize:w,baseline:w?"zero":A,stackOrder:S,lineStyle:ae,...v&&le&&{pointStyle:le},size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...re.legendBehaviorProps,...Ec({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:Es(),tooltipMode:"multi"}:Yc({tooltip:M,defaultTooltipContent:ce}),...$c({linkedHover:L,selection:P,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&C.length>0&&{annotations:C},...j&&{xExtent:j},..._&&{yExtent:_},...re.crosshairProps,...R};return re.earlyReturn?re.earlyReturn:he?(0,du.jsx)(hc,{componentName:"StackedAreaChart",message:he,width:G,height:q}):(0,du.jsx)(gc,{componentName:"StackedAreaChart",width:G,height:q,children:(0,du.jsx)(ul,{ref:n,...de})})});fu.displayName="StackedAreaChart";var pu=y(require("react")),yu=require("react"),mu=require("react");function gu(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p,styleRules:y,ruleContext:m}=e,g=(0,mu.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=it(o,t,n)}}else u.fill=a?a(e):o||nt;return void 0===u.r&&(u.r=i?i(e):r),y&&y.length>0&&Object.assign(u,Bc(e,y,m?m(e):{value:void 0})),u},[t,n,o,r,i,s,a,l,p,y,m]),x=(0,mu.useMemo)(()=>Lc(g,{stroke:c,strokeWidth:u,opacity:h}),[g,c,u,h]);return(0,mu.useMemo)(()=>El(x,d??null,f),[x,d,f])}var xu=require("react");function bu(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,xu.useRef)(null),[i,s]=(0,xu.useState)(0),a=(0,xu.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,xu.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,xu.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function vu(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 ku=require("react/jsx-runtime"),wu=(0,yu.forwardRef)(function(e,t){const n=(0,yu.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,styleRules:y,sizeBy:m,sizeRange:g=[3,15],symbolBy:x,symbolMap:b,pointRadius:v=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:M,regression:C,forecast:j,anomaly:_,xExtent:R,yExtent:P,frameProps:L={},selection:I,linkedHover:T,linkedBrush:N,onObservation:F,onClick:O,hoverHighlight:B,chartId:W,loading:D,loadingContent:z,emptyContent:H,legendInteraction:E,legendPosition:$,color:Y,stroke:G,strokeWidth:q,opacity:V}=e,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:ne,xLabel:oe,yLabel:re}=o,ie=(0,yu.useMemo)(()=>ue(r),[r]),se=void 0===r,{domain:ae,trackPushed:le,reset:ce}=bu({accessor:m,data:ie,isPushMode:se}),he=(0,yu.useCallback)(e=>{le([e]),n.current?.push(e)},[le]),de=(0,yu.useCallback)(e=>{le(e),n.current?.pushMany(e)},[le]);Hc(t,{variant:"xy",frameRef:n,overrides:{push:he,pushMany:de,clear:()=>{ce(),n.current?.clear()}}});const fe=Rc({data:ie,rawData:r,colorBy:f,colorScheme:p,legendInteraction:E,legendPosition:$,selection:I,linkedHover:T,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:W,showLegend:Z,userMargin:i,marginDefaults:o.marginDefaults,loading:D,loadingContent:z,emptyContent:H,width:X,height:U}),pe=zl(N),ye=jl({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,ge=pu.useRef(ye.brushInteraction);ge.current=ye.brushInteraction;const xe=(0,yu.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);wc("Scatterplot",ie,"xAccessor",c),wc("Scatterplot",ie,"yAccessor",u);const be=(0,yu.useMemo)(()=>m?ae??[0,1]:void 0,[m,ae]),ve=(0,yu.useMemo)(()=>m?e=>lt(e,m,g,be):void 0,[m,g,be]),ke=(0,yu.useMemo)(()=>Tc(c,u),[c,u]),we=gu({colorBy:f,colorScale:fe.colorScale,color:Y,pointRadius:v,fillOpacity:k,radiusFn:ve,stroke:G,strokeWidth:q,opacity:V,styleRules:y,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Ae=(0,yu.useMemo)(()=>Ua([{label:oe||Ya(c),accessor:c,role:"x",format:a},{label:re||Ya(u),accessor:u,role:"y",format:l},...f?[{label:Ya(f),accessor:f,role:"color"}]:[],...m?[{label:Ya(m),accessor:m,role:"size"}]:[]]),[c,u,oe,re,f,m,a,l]),{effectiveData:Se,statisticalAnnotations:Me}=Qc({data:ie,xAccessor:c,yAccessor:u,forecast:j,anomaly:_}),Ce=(0,yu.useMemo)(()=>{const e=vu(C);return e||0!==Me.length?[...e?[e]:[],...M||[],...Me]:M},[C,M,Me]);if(fe.earlyReturn)return fe.earlyReturn;const je=Mc({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(je)return(0,ku.jsx)(hc,{componentName:"Scatterplot",message:je,width:X,height:U});const _e={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:m||void 0,...x&&{symbolAccessor:x},...b&&{symbolMap:b},sizeRange:g,pointStyle:we,colorScheme:p,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:o.showAxes,xLabel:oe,yLabel:re,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...fe.legendBehaviorProps,...Ec({title:J,description:ee,summary:te,accessibleTable:ne,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:w,defaultTooltipContent:Ae}),...$c({linkedHover:T,selection:I,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...A&&{marginalGraphics:A},...S&&{pointIdAccessor:S},...Ce&&Ce.length>0&&{annotations:Ce},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:me},onBrush:xe},...fe.crosshairProps,...L};return(0,ku.jsx)(gc,{componentName:"Scatterplot",width:X,height:U,children:(0,ku.jsx)(ul,{ref:n,..._e})})});wu.displayName="Scatterplot";var Au=require("react"),Su=require("react/jsx-runtime");function Mu(e,t){return qe(1===t?.5:e/(t-1))}var Cu=(0,Au.forwardRef)(function(e,t){const n=(0,Au.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,styleRules:f,pointRadius:p=4,tooltip:y,pointIdAccessor:m,annotations:g,regression:x,forecast:b,anomaly:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,stroke:N,strokeWidth:F,opacity:O}=e,{width:B,height:W,enableHover:D,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:G,yLabel:q}=o,{safeData:V,orderMap:X}=(0,Au.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],n="function"==typeof u?u:e=>e[u];let o=e;if(h&&e.length>0){const t="function"==typeof h?h:e=>e[h];o=[...e].sort((e,n)=>{const o=t(e),r=t(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&s++}let a=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:o,orderMap:i}},[r,h,c,u]);wc("ConnectedScatterplot",V,"xAccessor",c),wc("ConnectedScatterplot",V,"yAccessor",u);const U=Rc({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:M,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:L,emptyContent:I,width:B,height:W}),K=U.resolvedSelection?.unselectedOpacity??Hl,Q=(0,Au.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=Mu(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,Au.useMemo)(()=>[Q],[Q]),J=(0,Au.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=Mu(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,Su.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Su.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Su.jsx)(Su.Fragment,{children:s})},[p]),ee=(0,Au.useMemo)(()=>[J],[J]),te=gu({colorScale:void 0,baseStyleExtras:(0,Au.useMemo)(()=>e=>{const t=X.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?Mu(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:N,strokeWidth:F,opacity:O,styleRules:f,ruleContext:(0,Au.useMemo)(()=>Tc(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,Au.useMemo)(()=>Ua([{label:G||Ya(c),accessor:c,role:"x",format:a},{label:q||Ya(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,G,q,h,ne,a,l]),re=Mc({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=Qc({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=vu(x),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:G,yLabel:q,xFormat:a,yFormat:l,enableHover:D,showGrid:z,...Ec({title:H,description:E,summary:$,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:y,defaultTooltipContent:oe}),...$c({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...A};return re?(0,Su.jsx)(hc,{componentName:"ConnectedScatterplot",message:re,width:B,height:W}):(0,Su.jsx)(gc,{componentName:"ConnectedScatterplot",width:B,height:W,children:(0,Su.jsx)(ul,{ref:n,...ce})})});Cu.displayName="ConnectedScatterplot";var ju=require("react"),_u=require("react/jsx-runtime"),Ru=(0,ju.forwardRef)(function(e,t){const n=(0,ju.useRef)(null),o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,styleRules:y,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:x="white",tooltip:b,marginalGraphics:v,pointIdAccessor:k,annotations:w,regression:A,xExtent:S,yExtent:M,frameProps:C={},selection:j,linkedHover:_,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:W,color:D,stroke:z,strokeWidth:H,opacity:E}=e,{width:$,height:Y,enableHover:G,showGrid:q,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=o,ee=(0,ju.useMemo)(()=>ue(r),[r]),te=void 0===r,ne=Rc({data:ee,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:W,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:$,height:Y}),{domain:oe,trackPushed:re,reset:ie}=bu({accessor:h,data:ee,isPushMode:te}),se=(0,ju.useCallback)(e=>{re([e]),n.current?.push(e)},[re]),ae=(0,ju.useCallback)(e=>{re(e),n.current?.pushMany(e)},[re]);Hc(t,{variant:"xy",frameRef:n,overrides:{push:se,pushMany:ae,clear:()=>{ie(),n.current?.clear()}}});const le=zl(R),ce=(jl({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,ju.useMemo)(()=>({stroke:x,strokeWidth:g}),[x,g])),he=(0,ju.useMemo)(()=>oe??[0,1],[oe]),de=(0,ju.useCallback)(e=>lt(e,h,d,he),[h,d,he]),fe=(0,ju.useMemo)(()=>Tc(c,u),[c,u]),pe=gu({colorBy:f,colorScale:ne.colorScale,color:D,fillOpacity:m,radiusFn:de,baseStyleExtras:ce,stroke:z,strokeWidth:H,opacity:E,styleRules:y,ruleContext:fe,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ye=(0,ju.useMemo)(()=>Ua([{label:Z||Ya(c),accessor:c,role:"x",format:a},{label:J||Ya(u),accessor:u,role:"y",format:l},{label:Ya(h),accessor:h,role:"size"},...f?[{label:Ya(f),accessor:f,role:"color"}]:[]]),[c,u,Z,J,h,f,a,l]);if(ne.earlyReturn)return ne.earlyReturn;const me=Mc({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(me)return(0,_u.jsx)(hc,{componentName:"BubbleChart",message:me,width:$,height:Y});const ge=vu(A),xe=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:pe,colorScheme:p,size:[$,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:o.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:G,showGrid:q,...ne.legendBehaviorProps,...Ec({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:b,defaultTooltipContent:ye}),...$c({linkedHover:_,selection:j,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...v&&{marginalGraphics:v},...k&&{pointIdAccessor:k},...xe&&xe.length>0&&{annotations:xe},...S&&{xExtent:S},...M&&{yExtent:M},...ne.crosshairProps,...C};return(0,_u.jsx)(gc,{componentName:"BubbleChart",width:$,height:Y,children:(0,_u.jsx)(ul,{ref:n,...be})})});Ru.displayName="BubbleChart";var Pu=require("react"),Lu=require("d3-scale");M();var Iu=require("react/jsx-runtime"),Tu=(0,Pu.forwardRef)(function(e,t){const n=(0,Pu.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:h,colorScheme:d,customColorScale:f,showValues:p=!1,valueFormat:y,cellBorderColor:m="#fff",cellBorderWidth:g=1,tooltip:x,annotations:b,xExtent:v,yExtent:k,frameProps:w={},selection:S,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,showLegend:T,legendPosition:N,legendInteraction:F}=e,{width:O,height:B,enableHover:W,title:D,description:z,summary:H,accessibleTable:E,xLabel:$,yLabel:Y}=o,G=kc(P,O,B,L),q=G?null:vc(r,O,B,I),V=(0,Pu.useMemo)(()=>ue(r),[r]),X=function(){const e=Yl();return e?.colors?.sequential||void 0}(),U=d??X??"blues",K=T??!1,Q=N??"right",{margin:Z}=ac({data:V,colorBy:K?"value":void 0,colorScale:void 0,showLegend:K,legendPosition:Q,userMargin:i,defaults:o.marginDefaults}),{customHoverBehavior:J,customClickBehavior:ee,crosshairSourceId:te}=ic({selection:S,linkedHover:M,fallbackFields:[],onObservation:C,onClick:j,chartType:"Heatmap",chartId:R,hoverHighlight:_,colorByField:void 0,mobileInteraction:o.mobileInteraction});_c(S);const ne=sc(M,te);lc(F,void 0,[]);const oe=(0,Pu.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),re=(0,Pu.useMemo)(()=>A(V.map(oe)),[V,oe]),ie=(0,Pu.useMemo)(()=>{if("custom"===U&&f)return f;const e=Je(U);return(0,Lu.scaleSequential)(e).domain(re)},[U,f,re]),se=(0,Pu.useMemo)(()=>{const e=Number.isFinite(g)?Math.max(0,g):1;return()=>({stroke:m,strokeWidth:e})},[m,g]),ae=(0,Pu.useMemo)(()=>Ua([{label:$||Ya(a),accessor:a,role:"x",format:u},{label:Y||Ya(l),accessor:l,role:"y",format:h},{label:Ya(c),accessor:c,role:"value",format:y}]),[a,l,$,Y,c,u,h,y]),le=Mc({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,Pu.useMemo)(()=>{if(K)return{gradient:{colorFn:e=>ie(e),domain:re,label:"string"==typeof c?c:"value",format:y}}},[K,ie,re,c,y]),he={chartType:"heatmap",...null!=r&&{data:V},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==U?U:void 0,areaStyle:se,showValues:p,heatmapValueFormat:y,size:[O,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,showAxes:o.showAxes,xLabel:$,yLabel:Y,xFormat:u,yFormat:h,enableHover:W,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Q},...Ec({title:D,description:z,summary:H,accessibleTable:E,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:x,defaultTooltipContent:ae}),...$c({linkedHover:M,selection:S,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,customHoverBehavior:J,customClickBehavior:ee}),...b&&b.length>0&&{annotations:b},...v&&{xExtent:v},...k&&{yExtent:k},...ne,...w};return G||q||(le?(0,Iu.jsx)(hc,{componentName:"Heatmap",message:le,width:O,height:B}):(0,Iu.jsx)(gc,{componentName:"Heatmap",width:O,height:B,children:(0,Iu.jsx)(ul,{ref:n,...he})}))});Tu.displayName="Heatmap";var Nu=y(require("react")),Fu=require("react");M();var Ou=y(require("react")),Bu=require("react/jsx-runtime"),Wu=null,Du=null;function zu(e){const[t,n]=Ou.useState(()=>Wu);return Ou.useEffect(()=>{if(t)return;let e=!1;return(Wu?Promise.resolve(Wu):(Du||(Du=Promise.resolve().then(()=>(K(),Y)).then(e=>Wu=e.ScatterplotMatrixBrushOverlay).catch(e=>{throw Du=null,e})),Du)).then(t=>{e||n(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,Bu.jsx)(t,{...e}):null}var Hu=require("react/jsx-runtime"),Eu="__splomIdx",$u="splom-hover-source",Yu={top:4,bottom:4,left:4,right:4};function Gu({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,Fu.useRef)(null),m=Ml({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),g=jl({name:l,xField:t,yField:n}),x=Ml({name:c,clientId:$u,fields:[Eu]}),b=x.selectPoints,v=(0,Fu.useCallback)(e=>{e?g.brushInteraction.during(e):g.brushInteraction.end(null)},[g.brushInteraction]),k=(0,Fu.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[Eu];void 0!==n&&(b({[Eu]:[n]}),f?.(t,e.x+Yu.left,e.y+Yu.top))},[b,f]),w=(0,Fu.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+Yu.left,e.y+Yu.top)},[p]),A=(0,Fu.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?it(e,s,a):nt,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[i,r,s,d,a,x,m,u]);return(0,Hu.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,Hu.jsx)(ul,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:Yu,showAxes:!1,enableHover:"hover"===d,...$c({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,Hu.jsx)(zu,{frameRef:y,cellSize:o,onBrush:v})]})}function qu({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=Ml({name:a,clientId:"splom-diag-"+t,fields:[t]}),h=Ml({name:l,clientId:`splom-diag-${t}-hover`,fields:[Eu]}),d="hover"===c?h:u,f=d.isActive,p=d.predicate,y=(0,Fu.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=A(s),u=(c-l)/r||1,h=Array.from(a),d=new Map(h.map((e,t)=>[e,t])),y=Array(r).fill(0),m=Array(r).fill(0),g=Array.from({length:r},()=>Array(h.length).fill(0)),x=Array.from({length:r},()=>Array(h.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/u),r-1);if(y[i]++,f&&!p(o)||m[i]++,n){const e=d.get(o[n]+"");void 0!==e&&(g[i][e]++,f&&!p(o)||x[i][e]++)}}const b=S(y,1),v=g.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})}),k=x.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/b*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:h[i]};return n+=s,a})});return{bars:y.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),selectedBars:m.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/b*(o-24),count:e})),categoryBars:v,selectedCategoryBars:k,max:b,categories:h}},[e,t,r,o,f,p,i]);return(0,Hu.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,Hu.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,n)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):nt,opacity:f?.3:.6},`bg-${t}-${n}`))):y.bars.map((e,t)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:nt,opacity:f?.3:.6},"bg-"+t)),f&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):nt,opacity:.7},`sel-${t}-${n}`))):y.selectedBars.map((e,t)=>(0,Hu.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:nt,opacity:.7},"sel-"+t)))]})}function Vu({label:e,cellSize:t}){return(0,Hu.jsx)("svg",{width:t,height:t,children:(0,Hu.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Xu(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:m,showLegend:g,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",M="splom-hover",C=Kl(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),j=f?"hover":d?"brush":"hover",_=Al(e=>e.clearSelection),[R,P]=(0,Fu.useState)(null),L=(0,Fu.useCallback)(()=>{_(M),P(null)},[_,M]),I=(0,Fu.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[Eu]?e:{...e,[Eu]:t}),[t]),T=rc(I,r,i),N=(0,Fu.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),F=void 0!==g?g:!!r,O=(0,Fu.useMemo)(()=>{if(!F||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(I.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:T?T(e+""):nt})):null},[F,r,I,T]),B=(0,Fu.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,Hu.jsxs)("div",{className:v,style:{position:"relative"},children:[O&&(0,Hu.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>(0,Hu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Hu.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,Hu.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,Hu.jsxs)("div",{style:B,onMouseLeave:"hover"===j?L:void 0,children:[n.map((e,t)=>(0,Hu.jsxs)(Nu.Fragment,{children:[(0,Hu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,Hu.jsx)(Vu,{label:o[e]||e,cellSize:s},"diag-"+e):(0,Hu.jsx)(qu,{data:I,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:M,unselectedOpacity:p,mode:j},"diag-"+e):(0,Hu.jsx)(Gu,{data:I,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:M,unselectedOpacity:p,showGrid:y,tooltip:m,mobileInteraction:C,mode:j,onPointHover:"hover"===j?(o,r,s)=>{if(o){if(P({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=N(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=N(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,Hu.jsx)("div",{})," ",n.map(e=>(0,Hu.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),R&&"hover"===j&&(()=>{const e=R.datum,t=o[R.xField]||R.xField,n=o[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[Eu];return(0,Hu.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,Hu.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,Hu.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,Hu.jsxs)("div",{children:[n,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,Hu.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Uu(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,Hu.jsx)(Dl,{selections:o,children:(0,Hu.jsx)(Xu,{...e})})}Uu.displayName="ScatterplotMatrix";var Ku=require("react"),Qu=y(require("react")),Zu=require("react/jsx-runtime"),Ju=null,eh=null;function th(e){const[t,n]=Qu.useState(()=>Ju);return Qu.useEffect(()=>{if(t)return;let e=!1;return(Ju?Promise.resolve(Ju):(eh||(eh=Promise.resolve().then(()=>(ee(),Q)).then(e=>Ju=e.MinimapBrushOverlay).catch(e=>{throw eh=null,e})),eh)).then(t=>{e||n(()=>t)}).catch(()=>{}),()=>{e=!0}},[t]),t?(0,Zu.jsx)(t,{...e}):null}var nh=require("react/jsx-runtime");function oh(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:M=!0,showGrid:C=!1,showLegend:j,legendPosition:_,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:I,brushExtent:T,yExtent:N,frameProps:F={},loading:O,loadingContent:B,emptyContent:W}=e,D=kc(O,n,o,B),z=D?null:vc(t,n,o,W),H=(0,Ku.useMemo)(()=>ue(t),[t]),[E,$]=(0,Ku.useState)(null),Y=T??E,G=(0,Ku.useCallback)(e=>{T||$(e),I?.(e)},[T,I]),q=(0,Ku.useRef)(null),[V,X]=(0,Ku.useState)(null);(0,Ku.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=q.current?.getScales?.();o?X(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const U=void 0!==H[0]?.[m],K=(0,Ku.useMemo)(()=>{if(U)return H;if(y){const e=H.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[m]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:H}]},[H,y,m,U]),Q=(0,Ku.useMemo)(()=>U||y?K.flatMap(e=>{const t=e[m]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):H,[K,m,U,y,H]),Z=rc(H,g,x),J=Dc({lineWidth:v,colorBy:g,colorScale:Z,fillArea:k,areaOpacity:w}),ee=(0,Ku.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),te=Dc({lineWidth:1,colorBy:g,colorScale:Z}),ne=ee??te,oe=(0,Ku.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=g?it(e.parentLine||e,g,Z):nt,t}},[A,S,g,Z]),{legend:re,margin:ie,legendPosition:se}=ac({data:K,colorBy:g,colorScale:Z,showLegend:j,legendPosition:_,userMargin:r}),ae=P.height||60,le=(0,Ku.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??ie.left,right:P.margin?.right??ie.right}),[P.margin,ie]),ce=P.brushDirection||"x",he=(0,Ku.useMemo)(()=>Ua([{label:c||Ya(f),accessor:f,role:"x",format:h},{label:u||Ya(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=Mc({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,nh.jsx)(hc,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:J,...A&&{pointStyle:oe},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:M,showGrid:C,...re&&{legend:re,legendPosition:se},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:$s(R)||he,...Y&&{xExtent:Y},...N&&{yExtent:N},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...F},ye={chartType:fe,data:Q,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ne,size:[n,ae+le.top+le.bottom],margin:le,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...N&&{yExtent:N}},me=(0,nh.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,nh.jsx)(ul,{ref:q,...ye}),(0,nh.jsx)(th,{width:n-le.left-le.right,height:ae,margin:le,scales:V,brushDirection:ce,extent:Y,onBrush:G})]},"minimap"),ge=(0,nh.jsx)("div",{style:{overflow:"hidden"},children:(0,nh.jsx)(ul,{...pe})},"main");return D||z||(0,nh.jsx)(gc,{componentName:"MinimapChart",width:n,height:o,children:(0,nh.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?me:ge,L?ge:me]})})}oh.displayName="MinimapChart";var rh=require("react"),ih={label:"Low / High",color:"#E9C46A",opacity:.08},sh={label:"High / High",color:"#2A9D8F",opacity:.08},ah={label:"Low / Low",color:"#E76F51",opacity:.08},lh={label:"High / Low",color:"#86BBD8",opacity:.08};M();var ch=require("react/jsx-runtime");function uh(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var hh=(0,rh.forwardRef)(function(e,t){const n=(0,rh.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xCenter:h,yCenter:d,quadrants:f,centerlineStyle:p={},showQuadrantLabels:y=!0,quadrantLabelSize:m=12,colorBy:g,colorScheme:x,styleRules:b,sizeBy:v,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:M,pointIdAccessor:C,annotations:j,frameProps:_={},selection:R,linkedHover:P,onObservation:L,onClick:I,hoverHighlight:T,chartId:N,loading:F,loadingContent:O,emptyContent:B,legendInteraction:W,legendPosition:D,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:G,enableHover:q,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,rh.useMemo)(()=>({topLeft:uh(ih,f?.topLeft),topRight:uh(sh,f?.topRight),bottomLeft:uh(ah,f?.bottomLeft),bottomRight:uh(lh,f?.bottomRight)}),[f]),ne=(0,rh.useMemo)(()=>ue(r),[r]),oe=Rc({data:ne,rawData:r,colorBy:g,colorScheme:x,legendInteraction:W,legendPosition:D,selection:R,linkedHover:P,fallbackFields:"string"==typeof g?[g]:[],unwrapData:!1,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:O,emptyContent:B,width:Y,height:G});wc("QuadrantChart",ne,"xAccessor",c),wc("QuadrantChart",ne,"yAccessor",u);const re=(0,rh.useMemo)(()=>{if(!ne.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof u?u:e=>+e[u];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(n>h&&(n=h),h>o&&(o=h)),null!=d&&isFinite(d)&&(r>d&&(r=d),d>i&&(i=d)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[ne,c,u,h,d]),ie=(0,rh.useMemo)(()=>{if(!v||0===ne.length)return;const e=ne.map(e=>"function"==typeof v?v(e):e[v]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?A(e):void 0},[ne,v]),se=(0,rh.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,rh.useMemo)(()=>"function"==typeof u?u:e=>+e[u],[u]),le=(0,rh.useMemo)(()=>e=>{const t=se(e),n=ae(e),o=null!=h?t>=h:void 0,r=null!=d?n>=d:void 0;return void 0===r||void 0===o?z||nt:r&&o?te.topRight.color:r&&!o?te.topLeft.color:!r&&o?te.bottomRight.color:te.bottomLeft.color},[se,ae,h,d,te,z]),ce=(0,rh.useMemo)(()=>v?e=>lt(e,v,k,ie):void 0,[v,k,ie]),he=(0,rh.useMemo)(()=>Tc(c,u),[c,u]),de=gu({colorBy:g,colorScale:oe.colorScale,color:z,pointRadius:w,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:H,strokeWidth:E,opacity:$,styleRules:b,ruleContext:he,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),fe=(0,rh.useMemo)(()=>{if(!ne.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof u&&e.add(u),"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v);const t=ne[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[ne,c,u,g,v]),pe=(0,rh.useMemo)(()=>Ua([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:J||Ya(c),accessor:c,role:"x",format:a},{label:ee||Ya(u),accessor:u,role:"y",format:l},...g?[{label:Ya(g),accessor:g,role:"color"}]:[],...v?[{label:Ya(v),accessor:v,role:"size"}]:[]]),[fe,c,u,J,ee,g,v,a,l]),ye=Mc({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),me=(0,rh.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=h?o.x(h):i/2,l=null!=d?o.y(d):s/2;if(null!=h&&!isFinite(a))return;if(null!=d&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),f=[{config:te.topLeft,x:0,y:0,w:c,h:u},{config:te.topRight,x:c,y:0,w:i-c,h:u},{config:te.bottomLeft,x:0,y:u,w:c,h:s-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of f)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,d,te,p]),ge=(0,rh.useMemo)(()=>y?[...me,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;(null==h||isFinite(s))&&(null==d||isFinite(a))&&(e.font=`600 ${m}px sans-serif`,e.globalAlpha=.5,e.fillStyle=te.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(te.topLeft.label,8,8),e.fillStyle=te.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(te.topRight.label,r-8,8),e.fillStyle=te.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(te.bottomLeft.label,8,i-8),e.fillStyle=te.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(te.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:me,[me,y,m,te,h,d]),xe=(0,rh.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ge,...e]},[ge,_.canvasPreRenderers]),be=(0,rh.useMemo)(()=>{const e={stroke:p.stroke||"#999",strokeWidth:p.strokeWidth??1,dashArray:p.strokeDasharray?Array.isArray(p.strokeDasharray)?p.strokeDasharray.join(","):p.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=h?n.x(h):r/2,a=null!=d?n.y(d):i/2;if(null!=h&&!isFinite(s))return null;if(null!=d&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,ch.jsxs)(ch.Fragment,{children:[[{config:te.topLeft,x:0,y:0,w:l,h:c},{config:te.topRight,x:l,y:0,w:r-l,h:c},{config:te.bottomLeft,x:0,y:c,w:l,h:i-c},{config:te.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,ch.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,ch.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,ch.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),y&&(0,ch.jsxs)(ch.Fragment,{children:[(0,ch.jsx)("text",{x:8,y:8+m,fill:te.topLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.topLeft.label}),(0,ch.jsx)("text",{x:r-8,y:8+m,fill:te.topRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,ch.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:m,opacity:.5,children:te.bottomLeft.label}),(0,ch.jsx)("text",{x:r-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:m,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[h,d,te,p,y,m]);if(oe.earlyReturn)return oe.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:ne},xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:v||void 0,sizeRange:k,pointStyle:de,colorScheme:x,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:q,showGrid:V,...re&&{xExtent:re.xExtent,yExtent:re.yExtent},...oe.legendBehaviorProps,...U&&{title:U},...K&&{description:K},...Q&&{summary:Q},...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===M?()=>null:!0===M||void 0===M?pe:$s(M)||pe,...$c({linkedHover:P,selection:R,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...C&&{pointIdAccessor:C},...j&&j.length>0&&{annotations:j},canvasPreRenderers:xe,...oe.crosshairProps,..._,...xe.length>0&&{canvasPreRenderers:xe},svgPreRenderers:be};return ye?(0,ch.jsx)(hc,{componentName:"QuadrantChart",message:ye,width:Y,height:G}):(0,ch.jsx)(gc,{componentName:"QuadrantChart",width:Y,height:G,children:(0,ch.jsx)(ul,{ref:n,...ve})})});hh.displayName="QuadrantChart";var dh=y(require("react")),fh=require("react"),ph=require("react/jsx-runtime"),yh="__ma_unitized",mh="__ma_series";function gh(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function xh(e,t){return t[0]+e*(t[1]-t[0])}var bh=(0,fh.forwardRef)(function(e,t){const n=(0,fh.useRef)(null),o=(0,fh.useRef)([]),r=(0,fh.useRef)(e.series);r.current=e.series,(0,fh.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[yh]:gh(a,s),[mh]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[yh]:gh(a,s),[mh]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:m,frameProps:g={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:M,emptyContent:C,legendInteraction:j,legendPosition:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:N,showGrid:F,showLegend:O=!0,title:B,description:W,summary:D,accessibleTable:z,xLabel:H}=i,E=(0,fh.useMemo)(()=>ue(s),[s]),$=(0,fh.useMemo)(()=>ue(h),[h]),Y=$,G=2===$.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${$.length}. Rendering as a standard multi-line chart.`);const q=kc(S,I,T,M),V=q?null:vc(s,I,T,C),X=oc(),U=(0,fh.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(X&&X.length>0)e=X;else{const t=et[d];e=Array.isArray(t)?t:tt}return Y.map((t,n)=>t.color||e[n%e.length])},[Y,d,X]),K=(0,fh.useMemo)(()=>$.map((e,t)=>e.label||"Series "+(t+1)),[$]),{unitizedData:Q,extents:Z}=(0,fh.useMemo)(()=>{if(0===E.length){const e=$.map(e=>e.extent||null).filter(Boolean);return e.length===$.length&&(o.current=e),{unitizedData:[],extents:e.length===$.length?e:[]}}const e=$.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(E,e.yAccessor));if(o.current=e,!G){const t=[];for(const e of E)for(let n=0;$.length>n;n++){const o=$[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[yh]:r,[mh]:K[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of E)for(let o=0;2>o;o++){const r=$[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[yh]:gh(i,e[o]),[mh]:K[o]})}return{unitizedData:t,extents:e}},[E,$,G,K]),J=(0,fh.useMemo)(()=>{if(G&&Z.length>=2)return[{orient:"left",label:K[0],tickFormat:$[0].format||(e=>{const t=xh(e,Z[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:K[1],tickFormat:$[1].format||(e=>{const t=xh(e,Z[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,Z,$,K]),ee=Rc({data:(0,fh.useMemo)(()=>Q.length>0?Q:K.map(e=>({[mh]:e})),[Q,K]),rawData:s,colorBy:mh,colorScheme:U,legendInteraction:j,legendPosition:_,selection:x,linkedHover:b,fallbackFields:[mh],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:O,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:M,emptyContent:C,width:I,height:T}),te=(0,fh.useMemo)(()=>{const e=new Map;return K.forEach((t,n)=>e.set(t,U[n])),e},[K,U]),ne=Dc({lineWidth:p,resolveStroke:(0,fh.useCallback)(e=>te.get(e[mh])||U[0],[te,U]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),oe=(0,fh.useMemo)(()=>{if(!1===y)return()=>null;return $s(y)||(e=>{const t=e.data||e,n=t[mh],o=K.indexOf(n),r=t[yh],i=G&&o>=0&&Z[o]?xh(r,Z[o]):r,s=o>=0&&$[o]?.format?$[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return dh.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},dh.createElement("div",{style:{fontWeight:600,marginBottom:4,color:U[o]||"inherit"}},n),dh.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),dh.createElement("div",null,`${n}: ${s(i)}`))})},[y,K,U,Z,G,$,u]);if(ee.earlyReturn)return ee.earlyReturn;const re=Mc({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),ie=G?[0,1]:void 0,se={chartType:"line",...null!=s&&{data:Q},xAccessor:u,yAccessor:yh,groupAccessor:mh,lineStyle:ne,colorScheme:U,size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,showAxes:i.showAxes,...J&&{axes:J},xLabel:H,...G?{}:{yLabel:K[0]},xFormat:c,...G&&ie&&{yExtent:ie},enableHover:N,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:F,curve:f,...ee.legendBehaviorProps,...B&&{title:B},...W&&{description:W},...D&&{summary:D},...void 0!==z&&{accessibleTable:z},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:oe,...m&&{annotations:m},...$c({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ee.crosshairProps,...g};return q||V||(re?(0,ph.jsx)(hc,{componentName:"MultiAxisLineChart",message:re,width:I,height:T}):(0,ph.jsx)(gc,{componentName:"MultiAxisLineChart",width:I,height:T,children:(0,ph.jsx)(ul,{ref:n,...se})}))});bh.displayName="MultiAxisLineChart";var vh=require("react");function kh(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}var wh=require("react/jsx-runtime"),Ah=(0,vh.forwardRef)(function(e,t){const n=(0,vh.useRef)(null);Hc(t,{variant:"xy",frameRef:n});const o=cc(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:m,xExtent:g,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:M,loadingContent:C,emptyContent:j}=e,{width:_,height:R,enableHover:P,showGrid:L,title:I,description:T,summary:N,accessibleTable:F,xLabel:O,yLabel:B}=o,W=kc(M,_,R,C),D=W?null:vc(r,_,R,j),z=(0,vh.useMemo)(()=>ue(r),[r]),H=null==d||null==f;wc("CandlestickChart",z,"xAccessor",c),wc("CandlestickChart",z,"highAccessor",u),wc("CandlestickChart",z,"lowAccessor",h),H||(wc("CandlestickChart",z,"openAccessor",d),wc("CandlestickChart",z,"closeAccessor",f));const{customHoverBehavior:E,customClickBehavior:$,crosshairSourceId:Y}=ic({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),G=sc(k,Y),q=(0,vh.useMemo)(()=>{const e=o.marginDefaults,t="sparkline"===o.mode?{...e,top:0,bottom:0}:e;return null==i?t:{...t,...kh(i)}},[i,o.marginDefaults,o.mode]),V=(0,vh.useMemo)(()=>{const e=[{label:O||Ya(c),accessor:c,role:"x",format:a}];return H?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),Ua(e)},[c,O,a,l,u,h,d,f,H]),X=Mc({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f}}}),U={chartType:"candlestick",...null!=r&&{data:z},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!H&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(_/40))),extentPadding:_>200?.1:.02,size:[_,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:q,showAxes:o.showAxes,xLabel:O,yLabel:B,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Ec({title:I,description:T,summary:N,accessibleTable:F,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Yc({tooltip:y,defaultTooltipContent:V}),...$c({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:E,customClickBehavior:$}),...m&&m.length>0&&{annotations:m},...g&&{xExtent:g},...x&&{yExtent:x},...G,...b};return W||D||(X?(0,wh.jsx)(hc,{componentName:"CandlestickChart",message:X,width:_,height:R}):(0,wh.jsx)(gc,{componentName:"CandlestickChart",width:_,height:R,children:(0,wh.jsx)(ul,{ref:n,...U})}))});Ah.displayName="CandlestickChart";var Sh=require("react"),Mh=require("react");var Ch=require("react/jsx-runtime"),jh=(0,Sh.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,chartId:m,loading:g,loadingContent:x,emptyContent:b,colorBy:v,colorScheme:k,legend:w,frameProps:A={}}=e,{legend:S,...M}=A,C=(0,Sh.useMemo)(()=>er(S,w),[S,w]),{frameRef:j,resolved:_,safeData:R,setup:P,earlyReturn:L}=function(e){const t=function(e){const t=(0,Mh.useRef)(null);return Hc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:cc(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,Mh.useMemo)(()=>kh(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=Rc({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:"XYCustomChart",unwrapData:!1,data:n,colorBy:v,colorScheme:k,legend:C,selection:p,linkedHover:y,onObservation:d,onClick:f,chartId:m,loading:g,loadingContent:x,emptyContent:b,margin:c,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,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),I=P.effectiveSelectionHook,T=(0,Sh.useMemo)(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]);if(L)return L;const{width:N,height:F,enableHover:O,showGrid:B,title:W,description:D,summary:z,accessibleTable:H,xLabel:E,yLabel:$}=_,Y={chartType:"custom",...null!=n&&{data:R},customLayout:o,layoutConfig:r,onLayoutError:i,...T&&{layoutSelection:T},xExtent:s,yExtent:a,colorAccessor:v,colorScheme:k,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,showAxes:l,xLabel:E,yLabel:$,enableHover:O,showGrid:B,...P.legendBehaviorProps,...Ec({title:W,description:D,summary:z,accessibleTable:H,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...$c({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverHighlight:!1,mobileInteraction:P.mobileInteraction,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior}),...h&&h.length>0&&{annotations:h},...P.crosshairProps,...M};return(0,Ch.jsx)(gc,{componentName:"XYCustomChart",width:N,height:F,children:(0,Ch.jsx)(ul,{ref:j,...Y})})});jh.displayName="XYCustomChart";var _h={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Rh=8;function Ph(e){return null==e?void 0:e+""}function Lh(e){const t=Ph(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Rh,style:{..._h},datum:e.datum,pointId:t,_transitionKey:t}}function Ih(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{..._h},datum:e.datum,group:e.group,_transitionKey:Ph(e.id)}}
|