@graphysdk/react-renderer 0.0.1-plugins.8 → 0.0.1-plugins.9

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/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  require('./index.css');
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),N=require("clsx"),g=require("react"),ve=require("zustand"),f=require("@graphysdk/viz-engine"),st=require("zustand/vanilla"),A=require("motion/react"),te=require("d3-shape"),Dr=require("d3-interpolate-path"),H=require("zustand/react/shallow"),Ze=require("color2k"),F=require("@floating-ui/react-dom"),zr=require("@tiptap/core"),Zt=require("@tiptap/extension-bold"),Je=require("@tiptap/extension-document"),Jt=require("@tiptap/extension-hard-break"),Qt=require("@tiptap/extension-heading"),en=require("@tiptap/extension-italic"),tn=require("@tiptap/extension-link"),nn=require("@tiptap/extension-text"),rn=require("@tiptap/extension-text-align"),ce=require("@tiptap/extension-text-style"),on=require("@tiptap/extension-underline"),Me=require("@tiptap/extensions"),Gr=require("@tiptap/extension-paragraph"),at=require("@tiptap/react"),E=require("@base-ui/react/toolbar"),le=require("@base-ui/react/tooltip"),sn=require("react-dom"),Wr=require("@vanilla-extract/dynamic"),_=require("@base-ui/react/popover"),pt=require("react-colorful"),R=require("@base-ui/react/menu"),$r=require("@base-ui/react/toggle");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-plugins.7");const Xr=(e=[])=>{const t=new Map;for(const n of e)t.set(n.type,n);return n=>t.get(n)??null},qr=5,Yr=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>Ur,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let n=null;return{emit:o=>{const s=e.getLastCompile();if(s){n=o;for(const a of t)a(o,s)}},subscribe:o=>(t.add(o),()=>{t.delete(o)}),getLastTrigger:()=>n,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Vr=()=>st.createStore(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,n)=>e(o=>{if(o.lastSnapshot===n)return o;const s={id:o.nextId,label:Kr(t),stages:n.stages,durationMs:n.durationMs};return{lastCompile:s,history:Zr(o.history,s,qr),nextId:o.nextId+1,lastSnapshot:n}})})),Ur=()=>{},Kr=e=>{switch(e.kind){case"init":return"init";case"input":return"input change";case"data":return"data change";case"command":return e.command.metadata.description}},Zr=(e,t,n)=>{const o=e.length>=n?e.length-(n-1):0;return[...e.slice(o),t]},mt="graphy-editor",Jr="graphy-editor-host";function Qr({id:e,store:t,dispatch:n}){const o=g.useRef(n);o.current=n,g.useEffect(()=>{if(!e||!eo())return;const s=()=>{const u=f.convertSpecToInput(t.getState().compiled.spec);window.parent.postMessage({source:mt,type:"spec",id:e,input:u},"*")};let a=t.getState().compiled.spec;s();const c=t.subscribe(u=>{u.compiled.spec!==a&&(a=u.compiled.spec,s())}),i=u=>{const h=u.data;if(!h||h.source!==Jr||h.type!=="command"||h.id!==e)return;const m=h.command,p=f.commandRegistry.deserialize({type:m.type,params:m.params,metadata:f.createCommandMetadata({description:m.type})});o.current(p)};window.addEventListener("message",i);const d=u=>{const h=u.target;if(!(h instanceof Element))return;const m=h.closest("[data-graphy-id]");m instanceof HTMLElement&&m.dataset.graphyId===e&&window.parent.postMessage({source:mt,type:"select",id:e},"*")};return document.addEventListener("click",d,!0),()=>{c(),window.removeEventListener("message",i),document.removeEventListener("click",d,!0)}},[e,t])}function eo(){if(typeof window>"u"||window.parent===window)return!1;try{return new URLSearchParams(window.location.search).has("graphyEditor")}catch{return!1}}function to(e){return e}function no(e,t){return{...t,geom:e.type,highlightStrategy:e.highlightStrategy}}var an=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],l={white:"var(--graphy-white)",black:"var(--graphy-black)",transparent:"var(--graphy-transparent)",grey100:"var(--graphy-grey-100)",grey95:"var(--graphy-grey-95)",grey90:"var(--graphy-grey-90)",grey85:"var(--graphy-grey-85)",grey80:"var(--graphy-grey-80)",grey75:"var(--graphy-grey-75)",grey70:"var(--graphy-grey-70)",grey60:"var(--graphy-grey-60)",grey50:"var(--graphy-grey-50)",grey0:"var(--graphy-grey-0)",greyGradient80:"var(--graphy-grey-gradient-80)",green60:"var(--graphy-green-60)",green50:"var(--graphy-green-50)",red60:"var(--graphy-red-60)",red50:"var(--graphy-red-50)",amber70:"var(--graphy-amber-70)",amber50:"var(--graphy-amber-50)",amber40:"var(--graphy-amber-40)",amber30:"var(--graphy-amber-30)",blue80:"var(--graphy-blue-80)",blue60:"var(--graphy-blue-60)",purple50:"var(--graphy-purple-50)",purple30:"var(--graphy-purple-30)",brand:"var(--graphy-brand)",success:"var(--graphy-success)",warning:"var(--graphy-warning)",alert:"var(--graphy-alert)",textPrimary:"var(--graphy-text-primary)",textSecondary:"var(--graphy-text-secondary)",textDisabled:"var(--graphy-text-disabled)",iconPrimary:"var(--graphy-icon-primary)",iconSecondary:"var(--graphy-icon-secondary)",iconStickerBackground:"var(--graphy-icon-sticker-background)",border100:"var(--graphy-border-100)",border50:"var(--graphy-border-50)",border10:"var(--graphy-border-10)",sunkenBackground:"var(--graphy-sunken-background)",defaultBackground:"var(--graphy-default-background)",raisedBackground:"var(--graphy-raised-background)",overlayBackground:"var(--graphy-overlay-background)",overlayBorderGradient:"var(--graphy-overlay-border-gradient)",graphBackground:"var(--graphy-graph-background)",gridLineColor:"var(--graphy-grid-line-color)",originLineColor:"var(--graphy-origin-line-color)",targetLineColor:"var(--graphy-target-line-color)",targetLineMarkerColor:"var(--graphy-target-line-marker-color)",targetLineLabelTextColor:"var(--graphy-target-line-label-text-color)",legendBackground:"var(--graphy-legend-background)",legendBorderColor:"var(--graphy-legend-border-color)",legendFocusOutlineColor:"var(--graphy-legend-focus-outline-color)",legendTextColor:"var(--graphy-legend-text-color)",dimmedSeriesLabelTextColor:"var(--graphy-dimmed-series-label-text-color)",dimmedSeriesLabelLineColor:"var(--graphy-dimmed-series-label-line-color)",trendNegativeColor:"var(--graphy-trend-negative-color)",trendPositiveColor:"var(--graphy-trend-positive-color)",trendNeutralColor:"var(--graphy-trend-neutral-color)",defaultAnnotationArrowStroke:"var(--graphy-default-annotation-arrow-stroke)",defaultAnnotationShapeStroke:"var(--graphy-default-annotation-shape-stroke)",defaultAnnotationShapeFill:"var(--graphy-default-annotation-shape-fill)",arrowAnnotationStickerOutlineColor:"var(--graphy-arrow-annotation-sticker-outline-color)",arrowAnnotationStickerOutlineColorInverse:"var(--graphy-arrow-annotation-sticker-outline-color-inverse)",annotationFrameBorderColor:"var(--graphy-annotation-frame-border-color)",annotationMenuTriggerIconColor:"var(--graphy-annotation-menu-trigger-icon-color)",heatmapEmptyTileBackground:"var(--graphy-heatmap-empty-tile-background)",dataLabelOutsideBackground:"var(--graphy-data-label-outside-background)",canvasDefault:"var(--graphy-canvas-default)",canvasBlue:"var(--graphy-canvas-blue)",canvasCyan:"var(--graphy-canvas-cyan)",canvasGreen:"var(--graphy-canvas-green)",canvasYellow:"var(--graphy-canvas-yellow)",canvasOrange:"var(--graphy-canvas-orange)",canvasRed:"var(--graphy-canvas-red)",canvasPink:"var(--graphy-canvas-pink)",canvasPurple:"var(--graphy-canvas-purple)",canvasGray:"var(--graphy-canvas-gray)",canvasInverse:"var(--graphy-canvas-inverse)",elevationXs:"var(--graphy-elevation-xs)",elevationSm:"var(--graphy-elevation-sm)",elevationMd:"var(--graphy-elevation-md)",elevationLg:"var(--graphy-elevation-lg)",radiiXs:"var(--graphy-radii-xs)",radiiSm:"var(--graphy-radii-sm)",radiiMd:"var(--graphy-radii-md)",radiiLg:"var(--graphy-radii-lg)",spaceXxs:"var(--graphy-space-xxs)",spaceXs:"var(--graphy-space-xs)",spaceSm:"var(--graphy-space-sm)",spaceMd:"var(--graphy-space-md)",spaceLg:"var(--graphy-space-lg)",spaceXl:"var(--graphy-space-xl)",zIndexToolbar:"var(--graphy-z-index-toolbar)",zIndexToolbarTooltip:"var(--graphy-z-index-toolbar-tooltip)",zIndexToolbarPopover:"var(--graphy-z-index-toolbar-popover)",toolbarBackgroundColor:"var(--graphy-toolbar-background-color)",toolbarButtonBackgroundColor:"var(--graphy-toolbar-button-background-color)",toolbarButtonBackgroundColorHovered:"var(--graphy-toolbar-button-background-color-hovered)",toolbarButtonBackgroundColorSelected:"var(--graphy-toolbar-button-background-color-selected)",toolbarSeparatorColor:"var(--graphy-toolbar-separator-color)",tooltipBackground:"var(--graphy-tooltip-background)",tooltipBorderColor:"var(--graphy-tooltip-border-color)",tooltipHeadingTextColor:"var(--graphy-tooltip-heading-text-color)",tooltipLabelTextColor:"var(--graphy-tooltip-label-text-color)",tooltipValueTextColor:"var(--graphy-tooltip-value-text-color)",tooltipPrimaryRowColor:"var(--graphy-tooltip-primary-row-color)",hoverGuideLineColor:"var(--graphy-hover-guide-line-color)",hoverGuideFillColor:"var(--graphy-hover-guide-fill-color)",hoveredBarBorderColor:"var(--graphy-hovered-bar-border-color)",hoveredPointRingColor:"var(--graphy-hovered-point-ring-color)",pointStrokeColor:"var(--graphy-point-stroke-color)",stackedBarHoverBorderColor:"var(--graphy-stacked-bar-hover-border-color)",fontFamilyDefault:"var(--graphy-font-family-default)",fontFamilyHeading:"var(--graphy-font-family-heading)",fontWeightRegular:"var(--graphy-font-weight-regular)",fontWeightMedium:"var(--graphy-font-weight-medium)",fontWeightSemibold:"var(--graphy-font-weight-semibold)",fontWeightBold:"var(--graphy-font-weight-bold)",fontWeightExtraBold:"var(--graphy-font-weight-extra-bold)",fontWeightBlack:"var(--graphy-font-weight-black)",textScale:"var(--graphy-text-scale)",fontSizeXxs:"var(--graphy-font-size-xxs)",fontSizeXs:"var(--graphy-font-size-xs)",fontSizeSm:"var(--graphy-font-size-sm)",fontSizeMd:"var(--graphy-font-size-md)",fontSizeLg:"var(--graphy-font-size-lg)",fontSizeXl:"var(--graphy-font-size-xl)",fontLineHeightXxs:"var(--graphy-font-line-height-xxs)",fontLineHeightXs:"var(--graphy-font-line-height-xs)",fontLineHeightSm:"var(--graphy-font-line-height-sm)",fontLineHeightMd:"var(--graphy-font-line-height-md)",fontLineHeightLg:"var(--graphy-font-line-height-lg)",fontLineHeightXl:"var(--graphy-font-line-height-xl)",fontSizeEditorBody:"var(--graphy-font-size-editor-body)",fontSizeHeadingSm:"var(--graphy-font-size-heading-sm)",fontSizeHeadingMd:"var(--graphy-font-size-heading-md)",fontSizeHeadingLg:"var(--graphy-font-size-heading-lg)",fontLineHeightEditorBody:"var(--graphy-font-line-height-editor-body)",fontLineHeightHeadingSm:"var(--graphy-font-line-height-heading-sm)",fontLineHeightHeadingMd:"var(--graphy-font-line-height-heading-md)",fontLineHeightHeadingLg:"var(--graphy-font-line-height-heading-lg)",fontTickLabel:"var(--graphy-font-tick-label)",fontAxisLabel:"var(--graphy-font-axis-label)",fontDataLabel:"var(--graphy-font-data-label)",fontStackTotal:"var(--graphy-font-stack-total)",fontLegendLabel:"var(--graphy-font-legend-label)",fontSeriesLabel:"var(--graphy-font-series-label)",fontTooltipLabel:"var(--graphy-font-tooltip-label)",fontTooltipHeading:"var(--graphy-font-tooltip-heading)",fontTooltipFooter:"var(--graphy-font-tooltip-footer)",fontJumboTooltipLabel:"var(--graphy-font-jumbo-tooltip-label)",fontJumboTooltip:"var(--graphy-font-jumbo-tooltip)",fontMiniTooltipLabel:"var(--graphy-font-mini-tooltip-label)",fontMiniTooltipFooter:"var(--graphy-font-mini-tooltip-footer)",fontTooltipCaption:"var(--graphy-font-tooltip-caption)",fontTooltipCaptionSmall:"var(--graphy-font-tooltip-caption-small)",fontTrendTag:"var(--graphy-font-trend-tag)",fontTrendTagSmall:"var(--graphy-font-trend-tag-small)",fontGoalLineLabel:"var(--graphy-font-goal-line-label)",fontPieLabel:"var(--graphy-font-pie-label)",fontPieChartTotal:"var(--graphy-font-pie-chart-total)",fontDifferenceArrowSmall:"var(--graphy-font-difference-arrow-small)",fontDifferenceArrowMedium:"var(--graphy-font-difference-arrow-medium)",fontDifferenceArrowLarge:"var(--graphy-font-difference-arrow-large)",fontButton:"var(--graphy-font-button)",fontInput:"var(--graphy-font-input)",fontInputLabel:"var(--graphy-font-input-label)",fontSelectLabel:"var(--graphy-font-select-label)",fontSelectDescription:"var(--graphy-font-select-description)",fontColorSelectLabel:"var(--graphy-font-color-select-label)",fontMenuTitle:"var(--graphy-font-menu-title)",fontMenuGroupTitle:"var(--graphy-font-menu-group-title)",fontMenuItemLabel:"var(--graphy-font-menu-item-label)",fontMenuItemLabelSecondary:"var(--graphy-font-menu-item-label-secondary)",fontUITooltip:"var(--graphy-font-uitooltip)",fontUITooltipSecondary:"var(--graphy-font-uitooltip-secondary)",fontErrorBoundaryTitle:"var(--graphy-font-error-boundary-title)",fontErrorBoundaryMessage:"var(--graphy-font-error-boundary-message)",fontTableCell:"var(--graphy-font-table-cell)",fontTableHeaderCell:"var(--graphy-font-table-header-cell)",fontSourceLabel:"var(--graphy-font-source-label)",fontSourceLink:"var(--graphy-font-source-link)",fontTextEditorH1:"var(--graphy-font-text-editor-h1)",fontTextEditorH2:"var(--graphy-font-text-editor-h2)",fontTextEditorH3:"var(--graphy-font-text-editor-h3)",fontTextEditorH6:"var(--graphy-font-text-editor-h6)",fontTextEditorBody:"var(--graphy-font-text-editor-body)",fontTextEditorLink:"var(--graphy-font-text-editor-link)",fontHighlightModeTitle:"var(--graphy-font-highlight-mode-title)",fontHighlightModeSubtitle:"var(--graphy-font-highlight-mode-subtitle)"};const it=1,ln=8,ro=12;l.pointStrokeColor;const oo=1;function so(e){return e}function z(e){return 1-e}const b=e=>`${Number.parseFloat((e*100).toFixed(4))}%`,ao=2,io=.7,ne=({hit:e})=>{const t=f.getColor(e.observation),n=(f.getAlpha(e.observation)??it)*io,o=(f.getSize(e.observation)??ln)/2;return r.jsx("circle",{cx:b(e.x),cy:b(z(e.y)),r:o,fill:t,opacity:n,stroke:l.hoveredPointRingColor,strokeWidth:ao,"data-testid":"companion-point"})},cn=.3,dn=1,I={type:"spring",stiffness:500,damping:60,mass:1},un=1,lo=2,hn=e=>e==="catmull-rom"?te.curveCatmullRom:te.curveLinear,Re=e=>{switch(e){case"dashed":return"8 4";case"dotted":return"2 2";case"solid":return}},Be=(e,t)=>t.lineWidth!=="auto"?t.lineWidth:f.getStrokeWidth(e)??lo,Ie=e=>t=>`${e}:${f.getIdentityKey(t)}`,Pe=(e,t)=>{const n=A.useMotionValue(e);return g.useEffect(()=>{const o=Dr.interpolatePath(n.get(),e);A.animate(0,1,{...t,onUpdate:s=>{const a=o(s);return n.set(a)}})},[t,e,n]),n};var he="_1d8mpa10";const gn=(e,t)=>{const n=hn(t.interpolate),o=te.area().curve(n),s=te.line().curve(n);if(e.mainAxis==="y"){const a=d=>z(f.getY(d)??0),c=d=>f.getXMin(d)??0,i=d=>f.getXMax(d)??f.getX(d)??0;o.y(a).x0(c).x1(i),s.y(a).x(i)}else{const a=d=>f.getX(d)??0,c=d=>z(f.getYMin(d)??0),i=d=>z(f.getYMax(d)??f.getY(d)??0);o.x(a).y0(c).y1(i),s.x(a).y(i)}if(t.missingValues==="gap"){const a=c=>f.getX(c)!==null&&f.getY(c)!==null;o.defined(a),s.defined(a)}return{lineGenerator:s,areaGenerator:o}},fn=(e,t)=>t!=="connect"?e:e.filter(n=>f.getX(n)!==null&&f.getY(n)!==null),co=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const{lineGenerator:s,areaGenerator:a}=g.useMemo(()=>gn(n,t.params),[t.params,n]),c=g.useMemo(()=>{const i=Ie(t.id),d=[];return t.data.groupBy(f.GROUP_VARIABLES.group).forEach(u=>{const h=fn([...u],t.params.missingValues),m=a(h),p=s(h);if(!m||!p)return;const x=h[0];if(!x)return;const v=f.getColor(x),y=f.getAlpha(x),L=Be(x,t.params),j=Re(f.getLineType(x));d.push({key:i(x),areaPath:m,linePath:p,color:v,fillOpacity:y??cn,strokeWidth:L,strokeOpacity:dn,strokeDasharray:j})}),d},[a,s,t.data,t.id,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:he,children:c.map(i=>r.jsx(uo,{areaPath:i.areaPath,linePath:i.linePath,color:i.color,fillOpacity:i.fillOpacity,strokeWidth:i.strokeWidth,strokeOpacity:i.strokeOpacity,strokeDasharray:i.strokeDasharray,isAnimated:o},i.key))})}),uo=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:s,strokeOpacity:a,strokeDasharray:c,isAnimated:i})=>i?r.jsx(ho,{areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:s,strokeOpacity:a,strokeDasharray:c}):r.jsxs("g",{children:[r.jsx("path",{d:e,fill:n,fillOpacity:o,stroke:"none"}),r.jsx("path",{d:t,fill:"none",stroke:n,strokeWidth:s,strokeOpacity:a,strokeDasharray:c,vectorEffect:"non-scaling-stroke"})]}),ho=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:s,strokeOpacity:a,strokeDasharray:c})=>{const i=Pe(e,I),d=Pe(t,I);return r.jsxs("g",{children:[r.jsx(A.motion.path,{d:i,fill:n,fillOpacity:o,stroke:"none"}),r.jsx(A.motion.path,{d,fill:"none",stroke:n,strokeWidth:s,strokeOpacity:a,strokeDasharray:c,vectorEffect:"non-scaling-stroke"})]})};var go="_46ebsf0";const Ge=1,fo=2,po=1,mo=ro/2,xo=2.25,Oe=({hit:e,...t})=>{const n=vo(e.observation),o=f.getColor(e.observation),s=f.getAlpha(e.observation)??it,a=b(e.x),c=b(z(e.y)),d=n+Ge/2+po+Ge/2;return r.jsxs("g",{...t,className:go,children:[r.jsx("circle",{cx:a,cy:c,r:d,fill:"none",stroke:l.hoveredPointRingColor,strokeWidth:fo}),r.jsx("circle",{cx:a,cy:c,r:n,fill:o,opacity:s,stroke:l.hoveredPointRingColor,strokeWidth:Ge})]})},vo=e=>{const t=f.getSize(e);return f.isDefined(t)?t/xo:mo},yo=({layer:e,coordSystem:t,primary:n,companions:o})=>{const s=f.getGroup(n.observation),a=g.useMemo(()=>{const p=e.data.filter(f.GROUP_VARIABLES.group,"eq",s);return fn([...p],e.params.missingValues)},[e.data,e.params.missingValues,s]),{areaPath:c,linePath:i}=g.useMemo(()=>{const{lineGenerator:p,areaGenerator:x}=gn(t,e.params);return{areaPath:x(a)??"",linePath:p(a)??""}},[t,e.params,a]);if(!c||!i)return null;const d=f.getColor(n.observation),u=f.getAlpha(n.observation)??cn,h=Be(n.observation,e.params),m=Re(f.getLineType(n.observation));return r.jsxs("g",{"data-testid":"hovered-area",children:[r.jsxs("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:he,children:[r.jsx("path",{d:c,fill:d,fillOpacity:u,stroke:"none","data-testid":"hovered-area-fill"}),r.jsx("path",{d:i,fill:"none",stroke:d,strokeWidth:h,strokeOpacity:dn,strokeDasharray:m,vectorEffect:"non-scaling-stroke","data-testid":"hovered-area-edge"})]}),o.map(p=>r.jsx(ne,{hit:p},`companion-${p.layerId}-${p.pointIndex}`)),r.jsx(Oe,{hit:n,"data-testid":"hovered-area-point"})]})},bo={geom:"area",coord:"cartesian",highlightStrategy:"overlay-anchor",guideMode:"continuous",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(co,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({layer:e,coordSystem:t,primary:n,group:o,related:s})=>r.jsx(yo,{layer:e,coordSystem:t,primary:n,companions:[...o,...s]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ne,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e,coordSystem:t})=>{if(t.mainAxis==="x"){const s=f.getX(e),a=f.getYMax(e)??f.getY(e);return s===null||a===null?null:{x:s,y:a}}const n=f.getY(e),o=f.getXMax(e)??f.getX(e);return n===null||o===null?null:{x:o,y:n}}},pn=1,ye=4,mn=(e,t)=>{const n=f.getXMin(t),o=f.getXMax(t),s=f.getYMin(t),a=f.getYMax(t)??f.getY(t);if(n===null||o===null||s===null||a===null)return null;if(e==="x"){let d=1-a,u=a-s;return u<0&&(d+=u,u=-u),{x:n,y:d,width:o-n,height:u}}let c=n,i=o-n;return i<0&&(c+=i,i=-i),{x:c,y:1-a,width:i,height:a-s}},So=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const s=g.useId(),a=g.useMemo(()=>{const i=Ie(t.id),d=new Map;for(const u of t.data){const h=mn(n.mainAxis,u);if(!h)continue;const m=jo(n.mainAxis,h),p=d.get(m),x={key:i(u),...h,fill:f.getColor(u),opacity:f.getAlpha(u)??pn};p?p.push(x):d.set(m,[x])}return[...d.entries()].map(([u,h])=>({id:`${s}${u}`,bars:h,...Co(h)}))},[s,n.mainAxis,t]),c=a.filter(i=>i.bars.length>1);return r.jsxs(r.Fragment,{children:[c.length>0&&r.jsx("defs",{children:c.map(i=>r.jsx("clipPath",{id:i.id,children:r.jsx(Lo,{column:i,isAnimated:o})},i.id))}),a.map(i=>{const[d]=i.bars;if(i.bars.length===1&&d!==void 0){const{key:u,...h}=d;return r.jsx(xt,{...h,rx:ye,isAnimated:o},u)}return r.jsx("g",{clipPath:`url(#${i.id})`,children:i.bars.map(u=>{const{key:h,...m}=u;return r.jsx(xt,{...m,isAnimated:o},h)})},i.id)})]})}),xt=({isAnimated:e,rx:t,...n})=>e?r.jsx(A.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:I,fill:n.fill,opacity:n.opacity,rx:t,animate:{x:b(n.x),y:b(n.y),width:b(n.width),height:b(n.height),opacity:n.opacity}}):r.jsx("rect",{style:{transformBox:"view-box"},x:b(n.x),y:b(n.y),width:b(n.width),height:b(n.height),fill:n.fill,opacity:n.opacity,rx:t}),Lo=({column:e,isAnimated:t})=>t?r.jsx(A.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:I,rx:ye,animate:{x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height)}}):r.jsx("rect",{x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),rx:ye}),jo=(e,t)=>e==="x"?`${t.x}-${t.width}`:`${t.y}-${t.height}`,Co=e=>{let t=1/0,n=1/0,o=-1/0,s=-1/0;for(const a of e)a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x+a.width>o&&(o=a.x+a.width),a.y+a.height>s&&(s=a.y+a.height);return{x:t,y:n,width:o-t,height:s-n}};var To="_1i6dtb60";const pe=3,ko=({coordSystem:e,primary:t,panelRect:n})=>{const o=mn(e.mainAxis,t.observation);if(!o)return null;const s=o.x*n.width,a=o.y*n.height,c=o.width*n.width,i=o.height*n.height,d=s-pe,u=a-pe,h=c+pe*2,m=i+pe*2,p=ye+pe,x=f.getColor(t.observation),v=f.getAlpha(t.observation)??pn;return r.jsxs("g",{"data-testid":"hovered-bar",children:[r.jsx("rect",{x:d,y:u,width:h,height:m,rx:p,fill:l.hoveredBarBorderColor,className:To,"data-testid":"hovered-bar-border"}),r.jsx("rect",{x:b(o.x),y:b(o.y),width:b(o.width),height:b(o.height),fill:x,opacity:v,rx:ye,"data-testid":"hovered-bar-fill"})]})},wo={geom:"bar",coord:"cartesian",highlightStrategy:"observation-rerender",guideMode:"bar",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(So,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({coordSystem:e,primary:t,panelRect:n})=>r.jsx(ko,{coordSystem:e,primary:t,panelRect:n}),renderHoverCompanions:()=>null},xn=e=>{const t=te.line().x(n=>f.getX(n)??0).y(n=>z(f.getY(n)??0)).curve(hn(e.interpolate));return e.missingValues==="gap"&&t.defined(n=>f.getX(n)!==null&&f.getY(n)!==null),t},vn=(e,t)=>t!=="connect"?e:e.filter(n=>f.getX(n)!==null&&f.getY(n)!==null),Ao=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>xn(t.params),[t.params]),s=g.useMemo(()=>{const a=Ie(t.id),c=[];return t.data.groupBy(f.GROUP_VARIABLES.group).forEach(i=>{const d=vn([...i],t.params.missingValues),u=o(d);if(!u)return;const h=d[0];if(!h)return;const m=f.getColor(h),p=f.getAlpha(h),x=Be(h,t.params),v=Re(f.getLineType(h));c.push({key:a(h),pathData:u,color:m,opacity:p??un,strokeWidth:x,strokeDasharray:v})}),c},[o,t.data,t.id,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:he,children:s.map(a=>r.jsx(Eo,{pathData:a.pathData,color:a.color,strokeWidth:a.strokeWidth,opacity:a.opacity,strokeDasharray:a.strokeDasharray,isAnimated:n},a.key))})}),Eo=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:s,isAnimated:a})=>a?r.jsx(_o,{pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:s}):r.jsx("path",{d:e,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:s,vectorEffect:"non-scaling-stroke"}),_o=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:s})=>{const a=Pe(e,I);return r.jsx(A.motion.path,{d:a,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:s,vectorEffect:"non-scaling-stroke"})},Mo=({layer:e,primary:t,companions:n})=>{const o=f.getGroup(t.observation),s=g.useMemo(()=>{const h=e.data.filter(f.GROUP_VARIABLES.group,"eq",o);return vn([...h],e.params.missingValues)},[e.data,e.params.missingValues,o]),a=g.useMemo(()=>xn(e.params)(s),[e.params,s]);if(!a)return null;const c=f.getColor(t.observation),i=f.getAlpha(t.observation)??un,d=Be(t.observation,e.params),u=Re(f.getLineType(t.observation));return r.jsxs("g",{"data-testid":"hovered-line",children:[r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:he,children:r.jsx("path",{d:a,fill:"none",stroke:c,strokeWidth:d,opacity:i,strokeDasharray:u,vectorEffect:"non-scaling-stroke","data-testid":"hovered-line-path"})}),n.map(h=>r.jsx(ne,{hit:h},`companion-${h.layerId}-${h.pointIndex}`)),r.jsx(Oe,{hit:t,"data-testid":"hovered-line-point"})]})},Po={geom:"line",coord:"cartesian",highlightStrategy:"overlay-anchor",guideMode:"continuous",render:({layer:e,isAnimated:t})=>r.jsx(Ao,{layer:e,isAnimated:t}),renderHover:({layer:e,primary:t,group:n,related:o})=>r.jsx(Mo,{layer:e,primary:t,companions:[...n,...o]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ne,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=f.getX(e),n=f.getY(e);return t===null||n===null?null:{x:t,y:n}}},Fo=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>{const s=[];for(const a of t.data){const c=f.getX(a),i=f.getY(a);if(c===null||i===null)continue;const d=f.getColor(a),u=f.getAlpha(a),h=f.getSize(a),m=f.getStrokeWidth(a);s.push({key:f.getIdentityKey(a),cx:c,cy:z(i),radius:(h??t.params.size)/2,fill:d,stroke:l.pointStrokeColor,opacity:u??it,strokeWidth:m??oo})}return s},[t.data,t.params.size]);return r.jsx(r.Fragment,{children:o.map(s=>n?r.jsx(A.motion.circle,{initial:!1,transition:I,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth,animate:{cx:b(s.cx),cy:b(s.cy),r:s.radius,opacity:s.opacity}},s.key):r.jsx("circle",{cx:b(s.cx),cy:b(s.cy),r:s.radius,fill:s.fill,opacity:s.opacity,stroke:s.stroke,strokeWidth:s.strokeWidth},s.key))})}),No={geom:"point",coord:"cartesian",highlightStrategy:"overlay-anchor",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(Fo,{layer:e,isAnimated:t}),renderHover:({primary:e,group:t,related:n})=>r.jsxs("g",{"data-testid":"hovered-point",children:[[...t,...n].map(o=>r.jsx(ne,{hit:o},`companion-${o.layerId}-${o.pointIndex}`)),r.jsx(Oe,{hit:e})]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(ne,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=f.getX(e),n=f.getY(e);return t===null||n===null?null:{x:t,y:n}}},yn=10,V=(e,t)=>e*yn*t,Ho=/\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu,bn="😀";class De{constructor(){this.emojiCorrections=new Map,this.currentFont="";const n=new OffscreenCanvas(1,1).getContext("2d");if(!n)throw new Error("Failed to create OffscreenCanvas 2D context");this.ctx=n}static async create(){return typeof document<"u"&&"fonts"in document&&await document.fonts.ready,new De}measureText(t,n){const o=f.buildFontString(n);this.setFont(o);const{width:s,fontBoundingBoxAscent:a,fontBoundingBoxDescent:c}=this.ctx.measureText(t);let i=s;const d=Ro(t);if(d>0){const u=this.getEmojiCorrection(o);i-=u*d}return{width:i,height:a+c,ascent:a,descent:c}}setFont(t){this.currentFont!==t&&(this.ctx.font=t,this.currentFont=t)}getEmojiCorrection(t){const n=this.emojiCorrections.get(t);if(n!==void 0)return n;this.setFont(t);const o=this.ctx.measureText(bn).width,s=Bo(t);let a=0;if(s!==null){const c=o-s;a=c>.5?c:0}return this.emojiCorrections.set(t,a),a}}let q=null;const Ro=e=>{const t=e.match(Ho);return t?t.length:0},Bo=e=>{const t=Io();return t?(t.style.font=e,t.getBoundingClientRect().width):null},Io=()=>typeof document>"u"?null:(q||(q=document.createElement("span"),q.style.position="absolute",q.style.visibility="hidden",q.style.whiteSpace="nowrap",q.style.left="-9999px",q.textContent=bn,document.body.appendChild(q)),q),Sn=g.createContext(null),Ln=({children:e,measurer:t})=>{const[n,o]=g.useState(null);g.useEffect(()=>{if(t!==void 0)return;let a=!1;const c=()=>{a||o(Oo())};return(async()=>{typeof document<"u"&&"fonts"in document&&await document.fonts.ready,c()})(),typeof document<"u"&&"fonts"in document&&document.fonts.addEventListener("loadingdone",c),()=>{a=!0,typeof document<"u"&&"fonts"in document&&document.fonts.removeEventListener("loadingdone",c)}},[t]);const s=t??n;return s===null?null:r.jsx(Sn.Provider,{value:s,children:e})},re=()=>{const e=g.useContext(Sn);if(e===null)throw new Error("useTextMeasurer must be used inside a <TextMeasurerProvider>.");return e},Oo=()=>{try{return new f.CachedTextMeasurer(new De)}catch{return new f.CachedTextMeasurer(new f.HeuristicTextMeasurer)}},O=`'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu',
3
- 'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`,Do=O,Y={regular:400,medium:500,semibold:600,bold:700,extraBold:800,black:900},M={xxs:1,xs:1.1,sm:1.2,md:1.4,lg:1.6,xl:2,editorBody:1.5,headingSm:1.8,headingMd:2.2,headingLg:2.8},B={xxs:1,xs:1,sm:1.3,md:1.43,lg:1,xl:1,editorBody:1.47,headingSm:1.25,headingMd:1.41,headingLg:1.29},zo=`var(--typography-chart-font-family, ${l.fontFamilyDefault})`,We=`var(--typography-chart-heading-font-family, ${l.fontFamilyHeading})`,$=e=>`${e}em`,jn={textScale:"1",fontFamilyDefault:O,fontFamilyHeading:Do,fontWeightRegular:Y.regular.toString(),fontWeightMedium:Y.medium.toString(),fontWeightSemibold:Y.semibold.toString(),fontWeightBold:Y.bold.toString(),fontWeightExtraBold:Y.extraBold.toString(),fontWeightBlack:Y.black.toString(),fontSizeXxs:$(M.xxs),fontSizeXs:$(M.xs),fontSizeSm:$(M.sm),fontSizeMd:$(M.md),fontSizeLg:$(M.lg),fontSizeXl:$(M.xl),fontLineHeightXxs:B.xxs.toString(),fontLineHeightXs:B.xs.toString(),fontLineHeightSm:B.sm.toString(),fontLineHeightMd:B.md.toString(),fontLineHeightLg:B.lg.toString(),fontLineHeightXl:B.xl.toString()},Cn={fontSizeEditorBody:$(M.editorBody),fontSizeHeadingSm:$(M.headingSm),fontSizeHeadingMd:$(M.headingMd),fontSizeHeadingLg:$(M.headingLg),fontLineHeightEditorBody:B.editorBody.toString(),fontLineHeightHeadingSm:B.headingSm.toString(),fontLineHeightHeadingMd:B.headingMd.toString(),fontLineHeightHeadingLg:B.headingLg.toString()},S=(e,t,n,o=zo)=>`${e} ${t}/${n} ${o}`,Tn={fontTickLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontAxisLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontDataLabel:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontStackTotal:S(l.fontWeightSemibold,l.fontSizeXs,l.fontLineHeightXs),fontLegendLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontSeriesLabel:S(l.fontWeightSemibold,l.fontSizeSm,l.fontLineHeightSm),fontTooltipLabel:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTooltipHeading:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTooltipFooter:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontJumboTooltipLabel:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontJumboTooltip:S(l.fontWeightMedium,l.fontSizeHeadingMd,l.fontLineHeightHeadingMd),fontMiniTooltipLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontMiniTooltipFooter:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontTooltipCaption:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTooltipCaptionSmall:S(l.fontWeightMedium,l.fontSizeXxs,l.fontLineHeightXxs),fontUITooltip:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontUITooltipSecondary:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTrendTag:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTrendTagSmall:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontGoalLineLabel:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontPieLabel:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontPieChartTotal:S(l.fontWeightBold,l.fontSizeHeadingLg,l.fontLineHeightHeadingLg),fontDifferenceArrowSmall:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontDifferenceArrowMedium:S(l.fontWeightMedium,l.fontSizeLg,l.fontLineHeightLg),fontDifferenceArrowLarge:S(l.fontWeightSemibold,l.fontSizeXl,l.fontLineHeightXl),fontButton:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontInput:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontInputLabel:S(l.fontWeightMedium,l.fontSizeXxs,l.fontLineHeightXxs),fontSelectLabel:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontSelectDescription:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontColorSelectLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontMenuTitle:S(l.fontWeightSemibold,l.fontSizeMd,l.fontLineHeightMd),fontMenuGroupTitle:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontMenuItemLabel:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontMenuItemLabelSecondary:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontErrorBoundaryTitle:S(l.fontWeightSemibold,l.fontSizeHeadingSm,l.fontLineHeightHeadingSm),fontErrorBoundaryMessage:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTableCell:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTableHeaderCell:S(l.fontWeightSemibold,l.fontSizeSm,l.fontLineHeightSm),fontSourceLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontSourceLink:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontTextEditorH1:S(l.fontWeightBold,l.fontSizeHeadingLg,l.fontLineHeightHeadingLg,We),fontTextEditorH2:S(l.fontWeightBold,l.fontSizeHeadingMd,l.fontLineHeightHeadingMd,We),fontTextEditorH3:S(l.fontWeightSemibold,l.fontSizeHeadingSm,l.fontLineHeightHeadingSm,We),fontTextEditorH6:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTextEditorBody:S(l.fontWeightMedium,l.fontSizeEditorBody,l.fontLineHeightEditorBody),fontTextEditorLink:S(l.fontWeightRegular,l.fontSizeMd,l.fontLineHeightMd),fontHighlightModeTitle:S(l.fontWeightBold,l.fontSizeMd,l.fontLineHeightMd),fontHighlightModeSubtitle:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm)},Go=11.7,Wo=M.xs,$o=O,Xo=Y.medium,xe=5,qo=5,vt=10,yt=10,Yo=4,Fe=13,kn=6,$e=12,bt=21.6,Vo="0 0 10 18",Uo="M2.48935 16.9323L9.07098 9.82964C9.51595 9.34944 9.51504 8.60728 9.0689 8.12818L2.48866 1.06172C1.85811 0.384586 0.974477 0 0.049217 0H0V18H0.0443689C0.972463 18 1.85854 17.6131 2.48935 16.9323Z",St="#FFFFFF",Xe="#1A1A1A";var Ko="_16vokpr0";const Zo=(e,t)=>{const n=e.mapping.y!==void 0,o=t.mainAxis==="y";return n!==o},Jo=(e,t)=>{const n=b(e?1-t:t);return e?{x1:"0%",y1:n,x2:"100%",y2:n}:{x1:n,y1:"0%",x2:n,y2:"100%"}},Qo=(e,t)=>e==="solid"?{}:e==="dotted"?{strokeDasharray:`0 ${t*2}`,strokeLinecap:"round"}:{strokeDasharray:`${t*2} ${t*3}`,strokeLinecap:"round",strokeMiterlimit:16},es=e=>{const t=e.params.color,n=t??l.targetLineColor;let o=l.targetLineLabelTextColor;if(t!==void 0)try{o=Ze.getContrast(t,St)>Ze.getContrast(t,Xe)?St:Xe}catch{o=Xe}return{lineColor:n,labelTextColor:o}},ts=(e,t)=>ke(e)&&ke(t)?`${e}: ${t}`:ke(e)?e:ke(t)?t:null,ke=e=>e!=null&&e.trim()!=="";var ns="_2qyyu60";const Lt=2,rs=12,os=12,jt=1,Ct=2,ss=4,be=({shape:e,color:t,lineType:n="solid",width:o=rs,height:s=os})=>r.jsx("svg",{className:ns,width:o,height:s,viewBox:`0 0 ${o} ${s}`,"aria-hidden":!0,"data-testid":"chart-swatch","data-shape":e,children:as({shape:e,color:t,lineType:n,width:o,height:s})}),as=({shape:e,color:t,lineType:n,width:o,height:s})=>{const a=is(n,o);switch(e){case"square":return r.jsx("rect",{x:1,y:1,width:o-2,height:s-2,rx:2,fill:t});case"line":return r.jsx("line",{x1:a.x1,y1:s/2,x2:a.x2,y2:s/2,stroke:t,strokeWidth:Lt,strokeLinecap:a.linecap,strokeDasharray:a.dashArray});case"circle":{const c=(Math.min(o,s)-2)/2;return r.jsx("circle",{cx:o/2,cy:s/2,r:c,fill:t})}case"area":{const c=s/2-1;return r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:1,y:c,width:o-2,height:s-c-1,fill:t,opacity:.45}),r.jsx("line",{x1:a.x1,y1:c,x2:a.x2,y2:c,stroke:t,strokeWidth:Lt,strokeLinecap:a.linecap,strokeDasharray:a.dashArray})]})}case"slice":return r.jsx("path",{d:`M 0 ${s} L ${o} ${s} A ${o} ${s} 0 0 0 0 0 Z`,fill:t})}},is=(e,t)=>{if(e==="solid")return{x1:0,x2:t,dashArray:void 0,linecap:"round"};if(e==="dashed"){const o=(t-jt*(Ct-1))/Ct;return{x1:0,x2:t,dashArray:`${o} ${jt}`,linecap:"butt"}}const n=t/(ss-1);return{x1:0,x2:t,dashArray:`1 ${n}`,linecap:"round"}},ls=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:s,text:a,isAnimated:c})=>{const i=e==="start",d=i?-Fe:-(o-Fe),u=i?d+o-xe:d+xe-$e,h=i?void 0:`rotate(180 ${u+$e/2} ${s/2})`,m=i?"0%":"100%",p=b(1-t),x=r.jsxs("g",{transform:`translate(0, ${-s/2})`,pointerEvents:"none",children:[r.jsx("rect",{x:d,y:0,width:o,height:s,rx:kn,fill:n}),r.jsx("g",{transform:h,children:r.jsx("svg",{x:u,y:(s-bt)/2,width:$e,height:bt,viewBox:Vo,overflow:"visible",children:r.jsx("path",{d:Uo,fill:n})})}),r.jsx("g",{transform:`translate(${d+xe}, ${s/2})`,children:a})]});return c?r.jsx(A.motion.svg,{initial:!1,transition:I,x:m,animate:{y:p},overflow:"visible",children:x}):r.jsx("svg",{x:m,y:p,overflow:"visible",children:x})},cs=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:s,text:a,isAnimated:c})=>{const i=e==="start",d=i?-Fe:-(s-Fe),u=b(t),h=i?"100%":"0%",m=r.jsxs("g",{transform:`translate(${-o/2}, 0)`,pointerEvents:"none",children:[r.jsx("rect",{x:0,y:d,width:o,height:s,rx:kn,fill:n}),r.jsx("g",{transform:`translate(${xe}, ${d+s/2})`,children:a})]});return c?r.jsx(A.motion.svg,{initial:!1,transition:I,y:h,animate:{x:u},overflow:"visible",children:m}):r.jsx("svg",{x:u,y:h,overflow:"visible",children:m})},ds=({label:e,textWidth:t,labelPosition:n,isHorizontalLine:o,position:s,color:a,textColor:c,symbolShape:i,symbolColor:d,isAnimated:u})=>{const h=i===null?0:vt+Yo,m=t+h+xe*2,p=Go+qo*2,x=r.jsxs(r.Fragment,{children:[i!==null&&d!==null&&r.jsx("g",{transform:`translate(0, ${-yt/2})`,children:r.jsx(be,{shape:i,color:d,width:vt,height:yt})}),r.jsx("text",{x:h,textAnchor:"start",dominantBaseline:"central",fill:c,style:{font:l.fontGoalLineLabel},children:e})]});return o?r.jsx(ls,{labelPosition:n,linePosition:s,color:a,pillWidth:m,pillHeight:p,text:x,isAnimated:u}):r.jsx(cs,{labelPosition:n,linePosition:s,color:a,pillWidth:m,pillHeight:p,text:x,isAnimated:u})},us=({layer:e,isHorizontalLine:t,position:n,lineColor:o,isAnimated:s})=>{const a=Jo(t,n),c=Qo(e.params.lineType,e.params.strokeWidth);return s?r.jsx(A.motion.line,{initial:!1,transition:I,animate:{x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},...c,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"}):r.jsx("line",{...a,...c,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"})},hs=g.memo(function({layer:t,coordSystem:n,formattingLocale:o,isAnimated:s}){const a=re(),{guides:c,numberFormat:i,textScale:d,layers:u,compiledLayers:h,colorScale:m}=k(H.useShallow(G=>({guides:G.guides,numberFormat:G.config.numberFormat,textScale:G.config.appearance.textScale,layers:G.spec.layers,compiledLayers:G.layers,colorScale:G.scales.color}))),p=g.useMemo(()=>f.buildAverageLineSymbols(u,h,m,n).get(t.id)??null,[u,h,m,n,t.id]),x=g.useMemo(()=>ts(t.params.label,f.formatRuleValue({guides:c,numberFormat:i,layer:t,locale:o})),[c,i,o,t]),v=g.useMemo(()=>({family:$o,size:V(Wo,d),weight:Xo}),[d]),y=g.useMemo(()=>x===null?0:a.measureText(x,v).width,[x,v,a]),L=t.data.getFirst();if(!L)return null;const{lineColor:j,labelTextColor:C}=es(t),T=Zo(t,n),P=T?f.getY(L):f.getX(L);return P===null?null:r.jsxs("g",{"data-geom":"rule",className:Ko,children:[r.jsx(us,{layer:t,isHorizontalLine:T,position:P,lineColor:j,isAnimated:s}),x!==null&&r.jsx(ds,{label:x,textWidth:y,labelPosition:t.params.labelPosition,isHorizontalLine:T,position:P,color:j,textColor:C,symbolShape:p?.shape??null,symbolColor:p?.color??null,isAnimated:s})]})}),gs={geom:"rule",coord:"cartesian",highlightStrategy:null,guideMode:null,render:({layer:e,coordSystem:t,formattingLocale:n,isAnimated:o})=>r.jsx(hs,{layer:e,coordSystem:t,formattingLocale:n,isAnimated:o}),renderHover:()=>null,renderHoverCompanions:()=>null},wn=1,Qe=te.arc(),Tt=Math.PI*2,fs=g.memo(function({layer:t,isAnimated:n}){const o=g.useRef(!1);g.useEffect(()=>{o.current=!0},[]);const s=g.useMemo(()=>{const a=Ie(t.id),c=[];for(const i of t.data){const d=a(i),{startAngle:u,endAngle:h}=f.getAngleExtent(i),{innerRadius:m,outerRadius:p}=f.getRadiusExtent(i);u===null||h===null||m===null||p===null||c.push({key:d,startAngle:u,endAngle:h,innerRadius:m,outerRadius:p,fill:f.getColor(i),opacity:f.getAlpha(i)??wn})}return c},[t]);return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"bar",className:he,children:s.map(a=>{if(n){const{key:c,...i}=a;return r.jsx(ps,{isInitialRender:!o.current,...i},c)}return r.jsx("path",{d:Qe({startAngle:a.startAngle,endAngle:a.endAngle,innerRadius:a.innerRadius,outerRadius:a.outerRadius})??void 0,fill:a.fill,opacity:a.opacity},a.key)})})}),ps=({startAngle:e,endAngle:t,innerRadius:n,outerRadius:o,fill:s,opacity:a,isInitialRender:c})=>{const i=c?e:Tt,d=c?t:Tt,u=A.useSpring(i,I),h=A.useSpring(d,I),m=A.useMotionValue(Qe({startAngle:i,endAngle:d,innerRadius:n,outerRadius:o})??"");return g.useEffect(()=>{u.set(e),h.set(t)},[u,h,e,t]),g.useEffect(()=>{const p=()=>{const y=u.get(),L=h.get();m.set(Qe({startAngle:y,endAngle:L,innerRadius:n,outerRadius:o})??"")},x=u.on("change",p),v=h.on("change",p);return()=>{x(),v()}},[u,h,n,o,m]),r.jsx(A.motion.path,{d:m,fill:s,opacity:a,transition:I})},ms=te.arc(),xs=({primary:e})=>{const{startAngle:t,endAngle:n}=f.getAngleExtent(e.observation),{innerRadius:o,outerRadius:s}=f.getRadiusExtent(e.observation);if(t===null||n===null||o===null||s===null)return null;const a=ms({startAngle:t,endAngle:n,innerRadius:o,outerRadius:s});if(!a)return null;const c=f.getColor(e.observation),i=f.getAlpha(e.observation)??wn;return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"arc","data-testid":"hovered-arc",className:he,children:r.jsx("path",{d:a,fill:c,opacity:i})})},vs={geom:"bar",coord:"polar",highlightStrategy:"observation-rerender",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(fs,{layer:e,isAnimated:t}),renderHover:({primary:e})=>r.jsx(xs,{primary:e}),renderHoverCompanions:()=>null},kt={bar:{cartesian:wo,polar:vs},line:{cartesian:Po},area:{cartesian:bo},point:{cartesian:No},rule:{cartesian:gs}},ys=(e=[])=>{const t={};for(const n of Object.keys(kt))t[n]={...kt[n]};for(const n of e){const o=t[n.geom]??{};o[n.coord]=n,t[n.geom]=o}return(n,o)=>t[n.geom]?.[o.type]??null},bs=e=>st.createStore(t=>({compiled:e,setCompiled:n=>t(o=>o.compiled===n?o:{compiled:n})}));function Ss(e,t){const n=f.isGraphConfig(e)?e.themeOverrides:void 0;return g.useMemo(()=>({...t,...n}),[t,n])}const An=g.createContext(null),Ls=({data:e,input:t,formattingLocale:n,onChange:o,customPalettes:s,theme:a="light",themeOverrides:c,geoms:i,plugins:d,annotationPlugins:u,id:h,children:m})=>{const[p]=g.useState(()=>f.createCompiler({geoms:i})),[x]=g.useState(()=>Yr(p)),v=g.useMemo(()=>ys(d),[d]),y=g.useMemo(()=>Xr(u),[u]),L=Ss(t,c),j=g.useMemo(()=>({customPalettes:s,theme:a}),[s,a]),[C]=g.useState(()=>{const D=p.compile({input:t,data:e,ctx:j});return x.emit({kind:"init"}),bs(D)}),T=g.useRef({input:t,data:e,ctx:j});g.useEffect(()=>{const D=t!==T.current.input,W=e!==T.current.data,K=j!==T.current.ctx;if(!D&&!W&&!K)return;const Z=C.getState(),J=D||K?p.compile({input:t,data:e,ctx:j}):p.recompile({spec:Z.compiled.spec,data:e});T.current={input:t,data:e,ctx:j},Z.setCompiled(J),x.emit({kind:D?"input":"data"})},[t,e,j,p,C,x]);const P=g.useCallback(D=>{const W=C.getState(),K=D.apply(W.compiled.spec);if(!K)return;const Z=p.recompile({spec:K.spec});if(W.setCompiled(Z),x.emit({kind:"command",command:D}),!o)return;const J=f.convertSpecToInput(K.spec);T.current={input:J,data:T.current.data,ctx:T.current.ctx},o(J)},[o,p,x,C]);Qr({id:h,store:C,dispatch:P});const G=g.useMemo(()=>({store:C,dispatch:P,formattingLocale:n,compileBus:x,theme:a,themeOverrides:L,resolvePlugin:v,resolveAnnotationPlugin:y,id:h}),[C,P,n,x,a,L,v,y,h]);return r.jsx(An.Provider,{value:G,children:m})},oe=()=>{const e=g.useContext(An);if(!e)throw new Error("useGraph* hooks must be used inside a <GraphProvider>");return e},k=e=>{const{store:t}=oe();return ve.useStore(t,n=>e(n.compiled))},lt=()=>{const{dispatch:e}=oe();return e},Se=()=>{const{resolvePlugin:e}=oe();return e},js=()=>{const{resolveAnnotationPlugin:e}=oe();return e};var Cs="drqe3u0",Ts="drqe3u1",ks="drqe3u2",ws="drqe3u3",we="drqe3u4",As="drqe3u5",Es="drqe3u6",_s="drqe3u7",qe="drqe3u8",Ms="drqe3u9",Ps="drqe3ua",Fs="drqe3ub",Ns="drqe3uc",Hs="drqe3ud",Rs="drqe3ue",Bs="drqe3uf",Is="drqe3ug",Os="drqe3uh",Ds="drqe3ui",wt={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},At={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},En={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const zs=({width:e=380,style:t,className:n}={})=>{const{compileBus:o}=oe(),[s]=g.useState(()=>Vr()),[a,c]=g.useState(!1),[i,d]=g.useState(f.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:v}=s.getState(),y=o.getLastTrigger(),L=o.getLastCompile();return y&&L&&v(y,L),o.subscribe(v)},[s,o]);const u=ve.useStore(s,v=>v.lastCompile),h=ve.useStore(s,v=>v.history),m=o.getCacheStats(),p=u===null&&h.length===0,x=()=>{d(v=>{const y=!v;return f.setCompilerCachingEnabled(y),y})};return r.jsxs("div",{className:N(Ps,n),style:{width:e,...t},children:[r.jsxs("div",{className:Cs,children:[r.jsxs("div",{children:[r.jsx("div",{className:Ts,children:"compile cache"}),r.jsx("div",{className:Rs,children:p?"production: stats disabled":u?`last: ${u.label} · ${_n(u.durationMs)}`:"awaiting first compile…"})]}),r.jsx("button",{type:"button",onClick:()=>c(v=>!v),className:Bs,children:a?"▾":"▴"})]}),!a&&r.jsxs("div",{className:Fs,children:[r.jsxs("button",{type:"button",onClick:x,className:i?wt.enabled:wt.disabled,"aria-pressed":i,children:["cache ",i?"enabled":"disabled"]}),r.jsx("span",{className:Is,children:"next compile reflects this toggle"})]}),!a&&!p&&r.jsxs(r.Fragment,{children:[r.jsx(Gs,{delta:u?.stages,cumulative:m}),r.jsx(Ws,{entries:h})]})]})},Gs=({delta:e,cumulative:t})=>r.jsxs("table",{className:ks,children:[r.jsx("thead",{children:r.jsxs("tr",{className:Os,children:[r.jsx("th",{className:ws,children:"stage"}),r.jsx("th",{className:we,children:"Δ miss"}),r.jsx("th",{className:we,children:"Δ hit"}),r.jsx("th",{className:we,children:"total miss"}),r.jsx("th",{className:we,children:"total hit"})]})}),r.jsx("tbody",{children:f.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],s=$s(o);return r.jsxs("tr",{className:Ns,children:[r.jsxs("td",{className:As,children:[r.jsx("span",{className:En[s],"aria-hidden":!0})," ",n]}),r.jsx("td",{className:s==="ran"?At.ran:At.dim,children:o?.misses??0}),r.jsx("td",{className:qe,children:o?.hits??0}),r.jsx("td",{className:qe,children:t[n].misses}),r.jsx("td",{className:qe,children:t[n].hits})]},n)})})]}),Ws=({entries:e})=>e.length===0?null:r.jsxs("div",{className:Hs,children:[r.jsx("div",{className:Ds,children:"recent compiles"}),e.map(t=>{const n=Xs(t.stages,a=>a.misses>0),o=f.COMPILER_STAGE_KEYS.length,s=n===0?"cached":"ran";return r.jsxs("div",{className:Es,children:[r.jsx("span",{className:En[s],"aria-hidden":!0}),r.jsx("span",{className:_s,title:t.label,children:t.label}),r.jsxs("span",{className:Ms,children:[n,"/",o," ran · ",_n(t.durationMs)]})]},t.id)})]}),$s=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Xs=(e,t)=>{let n=0;for(const o of f.COMPILER_STAGE_KEYS)t(e[o])&&(n+=1);return n},_n=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,qs={small:1.9,medium:2.3,large:2.6},Ys={small:1,medium:1,large:1.2},Vs=O,Mn=B.sm,Us=12,Ks=4,Zs=4,Js=12,Qs=4,ea=2,Pn=24,ta=()=>st.createStore(e=>({hover:f.RESTING_HOVER_STATE,isPointerInside:!1,setHoverState:t=>e(n=>n.hover===t?n:{hover:t}),setPointerInside:t=>e(n=>n.isPointerInside===t?n:{isPointerInside:t})})),na=(e,t)=>{const n=g.useMemo(()=>({layers:e,coordSystem:t}),[e,t]),o=g.useRef(null);o.current===null&&(o.current=new f.HoverEngine(n));const s=o.current,a=g.useRef(!1);return g.useEffect(()=>{if(!a.current){a.current=!0;return}s.update(n)},[s,n]),s},Fn=g.createContext(null),Nn=({children:e})=>{const{layers:t,coordSystem:n}=k(H.useShallow(d=>({layers:d.layers,coordSystem:d.coordSystem}))),o=na(t,n),[s]=g.useState(()=>ta()),a=g.useRef(null),c=g.useRef(null);if(c.current===null){const d=new Map,u={current:null},h=new Set,m=x=>{if(u.current=x,s.getState().setPointerInside(x!==null),x!==null)for(const v of h)v()},p=x=>(h.add(x),()=>{h.delete(x)});c.current={engine:o,store:s,overlayRef:a,hitTesterRegistry:d,cursorRef:u,setCursor:m,subscribeCursorMove:p}}const{hitTesterRegistry:i}=c.current;return g.useEffect(()=>{o.setHitTesters(i)},[o,i]),r.jsx(Fn.Provider,{value:c.current,children:e})},ge=()=>{const e=g.useContext(Fn);if(e===null)throw new Error("useHoverContext must be used inside a <HoverProvider>.");return e};function Le(e){const{store:t}=ge();return ve.useStore(t,e)}var ra="_19519k80",oa="_19519k81",sa="_19519k82",aa="_19519k83",ia="_19519k86",la="_19519k87",ca="_19519k88";const Hn=({content:e})=>r.jsxs(r.Fragment,{children:[e.header!==null&&r.jsx("div",{className:ra,children:e.header}),r.jsx("div",{className:oa,children:e.rows.map(t=>r.jsx(Rn,{row:t,shouldHighlight:t.isPrimary&&e.rows.length>1},t.key))})]}),Rn=({row:e,shouldHighlight:t})=>r.jsxs("div",{className:N(sa,{[aa]:t}),"data-testid":"chart-tooltip-row",children:[e.swatchColor!==null?r.jsx(be,{shape:e.swatchShape,color:e.swatchColor,lineType:e.swatchLineType}):null,r.jsx("span",{className:ia,children:e.label}),r.jsx("span",{className:la,children:e.value})]}),da=e=>{const{cursorRef:t,subscribeCursorMove:n}=ge(),o=Le(a=>a.isPointerInside),s=g.useRef(e);return s.current=e,g.useEffect(()=>n(()=>s.current?.()),[n]),{cursorRef:t,isInside:o}},ua=16,ha=8,ga={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},fa=()=>{const e=k(H.useShallow(j=>({layers:j.layers,coordSystem:j.coordSystem,scales:j.scales,guides:j.guides,numberFormat:j.config.numberFormat,parsingLocale:j.config.parsingLocale}))),{formattingLocale:t}=oe(),n=Le(j=>j.hover),o=Se(),s=g.useRef(()=>{}),{cursorRef:a,isInside:c}=da(()=>s.current()),i=g.useMemo(()=>f.buildTooltipContent({...e,hover:n,formattingLocale:t}),[e,n,t]),d=i!==null&&c,u=g.useMemo(()=>({getBoundingClientRect:()=>{const j=a.current;return j===null?ga:pa(j)}}),[a]),{refs:h,floatingStyles:m,update:p}=F.useFloating({open:d,placement:"right",middleware:[F.offset(ua),F.flip(),F.shift({padding:ha})],elements:{reference:u}});if(s.current=p,!d)return null;const x=n.primary,v=x===null?null:e.layers.find(j=>j.id===x.layerId)??null,y=v===null?null:o(v,e.coordSystem),L=x!==null&&v!==null&&y?.renderTooltip?y.renderTooltip({content:i,layer:v,coordSystem:e.coordSystem,primary:x,group:n.group,related:n.related}):null;return r.jsx("div",{ref:h.setFloating,role:"tooltip",className:ca,style:m,"data-testid":"chart-tooltip",children:L??r.jsx(Hn,{content:i})})},pa=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),ct=M.sm,Bn=O,In=!1,Ae=6,Q=10,ma=(e,t)=>n=>{if(!n.isVisible||n.ticks.length===0)return 0;const o=n.position==="top"||n.position==="bottom",s=n.ticks.map(i=>e.measureText(i.formattedLabel,{family:Bn,size:V(ct,t)})),a=n.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(o){if(n.labelRotation!==0){const i=s.map(u=>u.width);return Et(i,a)+2*Q}return Math.max(...s.map(i=>i.height))+Q}return Et(s.map(i=>i.width),a)+Q},Et=(e,t)=>Math.min(Math.max(...e),t),xa=e=>()=>V(ct,e),va=(e,t)=>(n,o)=>{const{labelLineHeight:s,labelFontWeight:a}=f.getDifferenceArrowDimensions(o,t);return e.measureText(n,{family:O,size:s,weight:a})},On=e=>{const{value:t,observationLabel:n,comparison:o,swatch:s,label:a}=e;return[{role:"valueRow",gap:Zs,segments:Ye([Ee("value","value",t??"–"),Ee("observation","label",n)])},{role:"trendRow",gap:Qs,ariaLabel:o===null?void 0:La(o),segments:Ye([ba(o),Sa(o),Ee("trendReference","label",o?.reference??null)])},{role:"groupRow",gap:Ks,segments:Ye([ya(s),Ee("label","label",a)])}].filter(i=>i.segments.length>0)},Ee=(e,t,n)=>n===null?null:{kind:"text",textRole:e,fontRole:t,text:n},ya=e=>e===null?null:{kind:"swatch",swatch:e,size:Us},ba=e=>e===null?null:{kind:"trendArrow",direction:e.direction,size:Js},Sa=e=>e===null?null:{kind:"text",textRole:"trendPercentage",fontRole:"label",text:e.percentage,trendDirection:e.direction},La=e=>{switch(e.direction){case"up":return`Increased ${e.percentage} ${e.reference}`;case"down":return`Decreased ${e.percentage} ${e.reference}`;case"flat":return`No change ${e.reference}`}},Ye=e=>e.filter(t=>t!==null),ja=(e,t)=>(n,o)=>{const s=Dn(n,o,e,t),a=zn(s.map(i=>i.width)),c=Math.max(0,s.length-1)*Pn;return{width:a+c,height:Math.max(0,...s.map(i=>i.height))}},Ca=(e,t)=>(n,o)=>Dn(n,o,e,t).map(s=>s.width),Ta=(e,t)=>(n,o)=>{const s=et("value",o,t);return{width:e.measureText(n,s).width,height:s.size*Mn}},ka=(e,t)=>{const n=ja(e,t),o=Ta(e,t);return(s,a)=>s.kind==="perGroup"?n(s,a):o(s.value,a)},Dn=(e,t,n,o)=>{const s={value:et("value",t,o),label:et("label",t,o)},a=c=>wa(c,s,n);return e.items.map(c=>{const i=On(c).map(a),d=Math.max(0,i.length-1)*ea;return{width:Math.max(0,...i.map(u=>u.width)),height:zn(i.map(u=>u.height))+d}})},wa=(e,t,n)=>{let o=0,s=0;for(const a of e.segments)if(a.kind==="text"){const c=t[a.fontRole];o+=n.measureText(a.text,c).width,s=Math.max(s,c.size*Mn)}else o+=a.size,s=Math.max(s,a.size);return{width:o+Math.max(0,e.segments.length-1)*e.gap,height:s}},et=(e,t,n)=>{const o=e==="value"?qs[t]:Ys[t];return{family:Vs,size:V(o,n)}},zn=e=>e.reduce((t,n)=>t+n,0),dt=12,Gn=10,Wn=8,Aa=8,Ea=8,_a=2,$n=1,Xn=2,qn=4,Yn=M.sm,Vn=B.sm,Un=O,Kn=2*(Ea+$n),ut=2*(_a+$n),Ma=Xn*qn,Zn=e=>{const t=V(Yn,e);return{fontSizePx:t,lineBoxHeight:t*Vn}},Jn=e=>e?Gn:0,Pa=(e,t)=>n=>{if(n.items.length===0)return 0;const{fontSizePx:o,lineBoxHeight:s}=Zn(t),a={family:Un,size:o};if(n.position==="top"||n.position==="bottom")return Math.max(s,dt)+ut;const i=n.items.map(d=>{const u=e.measureText(d.formattedLabel,a).width,h=Jn(d.visual.color);return h+(h>0?Wn:0)+u});return Math.max(...i)+Kn},Fa=(e,t)=>n=>e.measureText(n,{family:Bn,size:V(ct,t)}),Na=(e,t)=>g.useMemo(()=>e?{measureAxis:ma(e,t),measureAxisLabel:xa(t),measureLegend:Pa(e,t),measureHeadline:ka(e,t),measureHeadlineItemWidths:Ca(e,t),measureTickLabel:Fa(e,t),measureDifferenceArrowLabel:va(e,t)}:null,[e,t]),Ha=({measurer:e,axes:t,numberFormat:n,parsingLocale:o,formattedLegends:s,containerSize:a,externalMeasurements:c,headline:i,formattingLocale:d,annotations:u,coordSystem:h,textScale:m})=>g.useMemo(()=>e?new f.LayoutCompiler(e).compile({axes:t,numberFormat:n,parsingLocale:o,formattedLegends:s,containerSize:a,externalMeasurements:c,headline:i,formattingLocale:d,annotations:u,coordSystem:h,textScale:m}):null,[t,n,o,s,a,c,i,d,u,h,m,e]),_t="data-variant",Qn=Gr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(_t)??null,renderHTML:e=>e.variant?{[_t]:e.variant}:{}}}}}),Ra=zr.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:n}=t;return n.depth!==1||n.parentOffset!==0?!1:n.index(0)===1}}}}),Ba=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:n,isSubtitleVisible:o})=>[Oa({isTitleVisible:n,isSubtitleVisible:o}),Qn,nn.Text,Me.UndoRedo,Qt.Heading.configure({levels:[1,2,3]}),Zt.Bold,en.Italic,on.Underline,rn.TextAlign.configure({types:["heading","paragraph"]}),tn.Link.configure({openOnClick:!1,autolink:!0}),ce.TextStyle,ce.Color,ce.FontFamily,Jt.HardBreak,Ra.configure({isTitleVisible:n}),Me.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:s,editor:a})=>{if(n&&s===0)return e;const c=n?a.state.doc.firstChild?.nodeSize??-1:0;return o&&s===c?t:""}})],Ia=({placeholder:e})=>[Je.Document,Qn,nn.Text,Me.UndoRedo,Qt.Heading.configure({levels:[1,2,3]}),Zt.Bold,en.Italic,on.Underline,rn.TextAlign.configure({types:["heading","paragraph"]}),tn.Link.configure({openOnClick:!1,autolink:!0}),ce.TextStyle,ce.Color,ce.FontFamily,Jt.HardBreak,Me.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Oa=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?Je.Document.extend({content:"block{2,}"}):Je.Document,w=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,ze=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,er=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,tt=(e,t,n)=>`color-mix(in srgb, ${e}, ${t} ${n*100}%)`,Da=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),za=e=>e.length===0?!1:typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("color",e):/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),tr={elevationXs:"0 0 2px rgba(15, 15, 24, 0.12), 0 2px 2px rgba(14, 14, 52, 0.08)",elevationSm:"0 0 4px rgba(15, 15, 24, 0.12), 0 4px 4px rgba(14, 14, 52, 0.08)",elevationMd:"0 0 8px rgba(15, 15, 24, 0.12), 0 8px 8px rgba(14, 14, 52, 0.08)",elevationLg:"0 0 16px rgba(15, 15, 24, 0.12), 0 16px 16px rgba(14, 14, 52, 0.08)"},nr={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},rr={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},Ga=8,ie=e=>`${Ga*e}px`,or={spaceXxs:ie(.25),spaceXs:ie(.5),spaceSm:ie(.75),spaceMd:ie(1),spaceLg:ie(1.5),spaceXl:ie(2)},Wa={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#000000",grey95:"#0D0D0D",grey90:"#1A1A1A",grey85:"#1F1F1F",grey80:"#2A2A2A",grey75:"#2e2e2e",grey70:"#353535",grey60:"#494949",grey50:"#6F6F6F",grey0:"#FFFFFF",red60:"#CB3333",red50:"#F93939",amber70:"#F48135",amber50:"#FEAE47",amber40:"#FFC849",amber30:"#ffd061",green60:"#0AC600",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #222429, #31353f)"},$a={textPrimary:l.grey0,textSecondary:w(l.textPrimary,.8),textDisabled:w(l.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:w(l.textPrimary,.6),iconStickerBackground:l.grey70,border100:l.grey0,border50:w(l.grey0,.5),border10:w(l.grey0,.1),brand:l.purple50,success:l.green50,warning:l.amber50,alert:l.red50,sunkenBackground:l.grey100,defaultBackground:l.grey90,raisedBackground:l.grey80,overlayBackground:l.grey90,overlayBorderGradient:l.greyGradient80},Xa={graphBackground:l.grey90,gridLineColor:l.border10,originLineColor:l.grey0,targetLineColor:l.border100,targetLineMarkerColor:l.border100,targetLineLabelTextColor:l.grey100,legendBackground:l.defaultBackground,legendBorderColor:l.border10,legendFocusOutlineColor:l.border50,legendTextColor:l.textPrimary,dimmedSeriesLabelTextColor:l.textDisabled,dimmedSeriesLabelLineColor:l.grey60,trendNegativeColor:l.red60,trendPositiveColor:l.green60,trendNeutralColor:l.textSecondary,toolbarBackgroundColor:l.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:l.grey80,toolbarButtonBackgroundColorSelected:l.grey60,toolbarSeparatorColor:l.grey60,tooltipBackground:l.grey70,tooltipBorderColor:l.grey60,tooltipHeadingTextColor:l.textPrimary,tooltipLabelTextColor:l.textSecondary,tooltipValueTextColor:l.textPrimary,tooltipPrimaryRowColor:l.grey60,hoverGuideLineColor:w(l.white,.08),hoverGuideFillColor:w(l.white,.06),hoveredBarBorderColor:l.white,hoveredPointRingColor:l.white,pointStrokeColor:l.white,stackedBarHoverBorderColor:l.grey0,heatmapEmptyTileBackground:l.grey80,dataLabelOutsideBackground:w(l.textPrimary,.1),defaultAnnotationArrowStroke:l.white,defaultAnnotationShapeStroke:l.white,defaultAnnotationShapeFill:l.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:l.blue60,annotationMenuTriggerIconColor:l.white},qa={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},Ya={...Wa,...$a,...tr,...nr,...or,...rr,...Xa,...qa,...jn,...Cn,...Tn},Va={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#FFFFFF",grey95:"#FCFCFC",grey90:"#FAFAFA",grey85:"#F5F5F5",grey80:"#F0F0F0",grey75:"#E8E8E8",grey70:"#E5E5E5",grey60:"#CCCCCC",grey50:"#C4C4C4",grey0:"#1D2129",red60:"#E14B49",red50:"#F93939",amber70:"#FFBA8C",amber50:"#FFC849",amber40:"#FEAE47",amber30:"#E7A816",green60:"#06B299",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #F0F0F1, #F9F9FF)"},Ua={textPrimary:l.black,textSecondary:w(l.textPrimary,.6),textDisabled:w(l.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:w(l.textPrimary,.6),iconStickerBackground:l.grey100,brand:l.purple50,success:l.green50,warning:l.amber50,alert:l.red50,border100:l.grey0,border50:w(l.grey0,.5),border10:w(l.grey0,.1),sunkenBackground:l.grey90,defaultBackground:l.grey100,raisedBackground:l.grey85,overlayBackground:l.grey100,overlayBorderGradient:l.border10},Ka={graphBackground:l.grey100,gridLineColor:l.border10,originLineColor:l.grey0,targetLineColor:l.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:l.grey100,legendBackground:l.defaultBackground,legendBorderColor:l.border10,legendFocusOutlineColor:l.border50,legendTextColor:l.textPrimary,dimmedSeriesLabelTextColor:l.textDisabled,dimmedSeriesLabelLineColor:l.grey60,trendNegativeColor:l.red60,trendPositiveColor:l.green60,trendNeutralColor:l.textSecondary,toolbarBackgroundColor:l.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:l.grey80,toolbarButtonBackgroundColorSelected:l.grey60,toolbarSeparatorColor:l.grey60,tooltipBackground:l.white,tooltipBorderColor:l.border10,tooltipHeadingTextColor:l.textPrimary,tooltipLabelTextColor:l.textSecondary,tooltipValueTextColor:l.textPrimary,tooltipPrimaryRowColor:l.grey80,hoverGuideLineColor:w(l.black,.08),hoverGuideFillColor:w(l.black,.04),hoveredBarBorderColor:l.white,hoveredPointRingColor:l.white,pointStrokeColor:l.white,stackedBarHoverBorderColor:l.grey0,heatmapEmptyTileBackground:l.grey80,dataLabelOutsideBackground:w(l.textPrimary,.1),defaultAnnotationArrowStroke:l.black,defaultAnnotationShapeStroke:l.black,defaultAnnotationShapeFill:l.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:l.blue60,annotationMenuTriggerIconColor:"#3d414c"},Za={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},Ja={...Va,...Ua,...tr,...nr,...or,...rr,...Ka,...Za,...jn,...Cn,...Tn},Ne=.1,Qa={light:.05,dark:.1},ei=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return ri(e.color,t);case"gradient":return oi(e.color,t);case"preset":return f.BORDER_PRESET_GRADIENTS[e.preset]}},ti=e=>e.type==="none"?0:e.width,ni=(e,t,n)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return tt(n,e.color,Qa[t])},ri=(e,t)=>t==="dark"?ze(e,Ne):er(e,Ne),oi=(e,t,n=90)=>{const o=e,s=t==="dark"?ze(e,Ne):er(e,Ne);return`linear-gradient(${n}deg, ${o} 0%, ${s} 100%)`};var si="bow4tg0",ai="bow4tg1",ii="bow4tg2",li="bow4tg3",sr="_1ii3bsb0",ar="_1ii3bsb1";const ht=g.createContext(null),gt=()=>{const e=g.useContext(ht);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},ir=({theme:e,themeOverrides:t={},appearance:n,children:o})=>{const s=g.useMemo(()=>({...e==="dark"?Ya:Ja,...t}),[e,t]),a=g.useMemo(()=>{const i={[l.textScale]:String(n.textScale)};for(const[u,h]of Object.entries(t))i[l[u]]=h;const d=ni(n.background,e,s.graphBackground);return d!==void 0&&(i[l.graphBackground]=d),Wr.assignInlineVars(i)},[n.textScale,n.background,e,s.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?ar:sr,inlineVarsStyle:a,themeValues:s}),[e,a,s]);return r.jsx(ht.Provider,{value:c,children:o})},se=({children:e,className:t,style:n})=>{const o=g.useContext(ht),s=o?N(o.themeClass,ai):void 0,a=o?{...o.inlineVarsStyle,...n}:n;return r.jsx("div",{className:N(s,t),style:a,children:e})},ci="graphy_root",ae=()=>typeof document>"u"?null:document.getElementById(ci)??document.body;var di="yp3g0k0",ui="yp3g0k1",lr="yp3g0k3",hi="yp3g0k4",cr="yp3g0k5",nt="yp3g0k6",gi="yp3g0k7",fi="yp3g0k8",dr="yp3g0k9",pi="yp3g0ka",mi="yp3g0kb",xi="yp3g0kc",vi="yp3g0kd",yi="yp3g0ke";const bi=an.map(e=>l[e]),Si=Object.fromEntries(an.map(e=>[l[e],e])),Li=({editor:e,currentColor:t,isOpen:n,onOpenChange:o})=>{const s=Ci(),a=g.useCallback(i=>{e.chain().setColor(i).run()},[e]),c=i=>{e.chain().focus().setColor(i).run(),o(!1)};return r.jsxs(_.Popover.Root,{open:n,onOpenChange:o,children:[r.jsx(_.Popover.Trigger,{render:r.jsx(E.Toolbar.Button,{}),"aria-label":"Text color",className:di,onMouseDown:i=>i.preventDefault(),children:r.jsx("span",{className:ui,style:{background:t??"transparent"}})}),r.jsx(_.Popover.Portal,{container:ae(),children:r.jsx(se,{children:r.jsx(_.Popover.Positioner,{sideOffset:6,align:"start",className:lr,children:r.jsxs(_.Popover.Popup,{className:hi,onMouseDown:i=>i.preventDefault(),children:[r.jsx(Mt,{title:"Colors",colors:bi,currentColor:t,onPick:c}),s.length>0&&r.jsx(Mt,{title:"Chart colors",colors:s,currentColor:t,onPick:c}),r.jsx(ji,{value:t??"#000000",onChange:a})]})})})})]})},Mt=({title:e,colors:t,currentColor:n,onPick:o})=>r.jsxs("div",{className:cr,children:[r.jsx("div",{className:nt,children:e}),r.jsx("div",{className:gi,children:t.map(s=>r.jsx("button",{type:"button","aria-label":s,className:fi,"data-active":ki(s,n),onMouseDown:a=>a.preventDefault(),onClick:()=>o(s),children:r.jsx("span",{className:dr,style:ur(s)})},s))})]}),ji=({value:e,onChange:t})=>{const[n,o]=g.useState(!1),s=za(e)?e:"#000000",a=Ti(s);return r.jsxs(_.Popover.Root,{open:n,onOpenChange:o,children:[r.jsxs("div",{className:cr,children:[r.jsx("div",{className:nt,children:"Custom"}),r.jsxs(_.Popover.Trigger,{className:pi,onMouseDown:c=>c.preventDefault(),"aria-label":"Pick custom color",children:[r.jsx("span",{className:dr,style:ur(s)}),r.jsx("span",{className:mi,children:a})]})]}),r.jsx(_.Popover.Portal,{container:ae(),children:r.jsx(se,{children:r.jsx(_.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:lr,children:r.jsxs(_.Popover.Popup,{className:xi,onMouseDown:c=>c.preventDefault(),children:[r.jsx("div",{className:nt,children:"Pick color"}),r.jsx(pt.HexColorPicker,{color:a,onChange:t,className:vi}),r.jsx(pt.HexColorInput,{color:a,onChange:t,prefixed:!0,className:yi,onMouseDown:c=>c.stopPropagation()})]})})})})]})},Ci=()=>{const e=k(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const n of e.domain){const o=e.map(n);typeof o=="string"&&t.add(o)}return[...t]},[e])},ur=e=>({background:e,border:`1px solid ${ze(e,.1)}`}),Ti=e=>{const{themeValues:t}=gt();if(Da(e))return e.toUpperCase();const n=Si[e];return n?t[n].toUpperCase():"#000000"},ki=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),wi={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var Ai={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const U=({children:e,title:t,variant:n="primary",size:o="sm",...s})=>{const a=g.useId(),c=wi[o];return r.jsxs("svg",{className:Ai[n],"aria-labelledby":t?a:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...s,children:[t&&r.jsx("title",{id:a,children:t}),e]})},hr=e=>r.jsx(U,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})}),Ei="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",gr=`'Aeonik', 'Aeonik Fallback', ${O}`,_i="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",Mi="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",Pi=`var(--brand-font-family), ${gr}`,rt=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:O},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:gr},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:Ei},{id:"technical",label:"Technical",preview:"00",fontFamily:_i},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:Mi},{id:"brand",label:"Brand",preview:"Aa",fontFamily:Pi}],Fi=e=>e?rt.find(t=>t.fontFamily===e)??null:null;var fr="_1qkyw7q0",pr="_1qkyw7q1",mr="_1qkyw7q3",xr="_1qkyw7q4",vr="_1qkyw7q5";const Ni=({editor:e,currentFontFamily:t,isOpen:n,onOpenChange:o})=>{const s=Fi(t)??rt[0],a=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return r.jsxs(R.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(R.Menu.Trigger,{render:r.jsx(E.Toolbar.Button,{}),"aria-label":"Font family",className:fr,onMouseDown:c=>c.preventDefault(),children:[r.jsx("span",{className:pr,style:{fontFamily:s?.fontFamily},children:s?.preview}),r.jsx(hr,{size:"sm"})]}),r.jsx(R.Menu.Portal,{container:ae(),children:r.jsx(se,{children:r.jsx(R.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:mr,children:r.jsx(R.Menu.Popup,{className:xr,onMouseDown:c=>c.preventDefault(),children:rt.map(c=>r.jsx(R.Menu.Item,{className:vr,"data-selected":c.id===s?.id,onClick:()=>a(c),children:r.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},yr={id:"text",label:"Text",previewFont:l.fontTextEditorBody},Pt=[{id:"caption",label:"Caption",previewFont:l.fontTextEditorH6},yr,{id:"h3",label:"Heading 3",previewFont:l.fontTextEditorH3},{id:"h2",label:"Heading 2",previewFont:l.fontTextEditorH2},{id:"h1",label:"Heading 1",previewFont:l.fontTextEditorH1}],Hi=({editor:e,activeStyle:t,isOpen:n,onOpenChange:o})=>{const s=Pt.find(a=>a.id===t)??yr;return r.jsxs(R.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(R.Menu.Trigger,{render:r.jsx(E.Toolbar.Button,{}),"aria-label":"Text style",className:fr,onMouseDown:a=>a.preventDefault(),children:[r.jsx("span",{className:pr,children:s.label}),r.jsx(hr,{size:"sm"})]}),r.jsx(R.Menu.Portal,{container:ae(),children:r.jsx(se,{children:r.jsx(R.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:mr,children:r.jsx(R.Menu.Popup,{className:xr,onMouseDown:a=>a.preventDefault(),children:Pt.map(a=>r.jsx(R.Menu.Item,{className:vr,"data-selected":a.id===s.id,onClick:()=>Ri(e,a.id),children:r.jsx(Bi,{font:a.previewFont,children:a.label})},a.id))})})})})]})},Ri=(e,t)=>{switch(t){case"caption":{e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return}case"text":{e.chain().focus().setNode("paragraph",{variant:null}).run();return}case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},Bi=({font:e,children:t})=>r.jsx("span",{style:{font:e,margin:0},children:t}),Ii=e=>r.jsx(U,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})})}),Oi=e=>r.jsx(U,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),r.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),Di=e=>r.jsx(U,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 6 6 18"}),r.jsx("path",{d:"m6 6 12 12"})]})}),zi=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Gi=e=>{const{$from:t}=e.state.selection,n=t.parent.textContent,o=t.parentOffset,s=t.start();let a=o;for(;a>0&&Ft(n[a-1]);)a-=1;let c=o;for(;c<n.length&&Ft(n[c]);)c+=1;return{from:s+a,to:s+c}},Ft=e=>e!==void 0&&/\S/.test(e);var Wi="b5kquu0",$i="b5kquu1",Xi="b5kquu2",qi="b5kquu3",Nt="b5kquu4";const Yi=({editor:e,currentUrl:t,isActive:n,isOpen:o,onOpenChange:s})=>{const[a,c]=g.useState(""),i=g.useRef(null);g.useEffect(()=>{o&&c(t??"")},[o,t]);const d=()=>{Vi(e,a),s(!1)},u=()=>{c(""),s(!1)},h=p=>{c(p.target.value)},m=p=>{p.key==="Enter"&&(p.preventDefault(),d())};return r.jsxs(_.Popover.Root,{open:o,onOpenChange:s,children:[r.jsx(_.Popover.Trigger,{render:r.jsx(E.Toolbar.Button,{}),"aria-label":"Link","data-active":n,className:Wi,onMouseDown:p=>p.preventDefault(),children:r.jsx(Oi,{})}),r.jsx(_.Popover.Portal,{container:ae(),children:r.jsx(se,{children:r.jsx(_.Popover.Positioner,{sideOffset:6,align:"end",className:$i,children:r.jsxs(_.Popover.Popup,{className:Xi,initialFocus:i,onMouseDown:p=>p.preventDefault(),children:[r.jsx("input",{ref:i,type:"url",value:a,placeholder:"Type or paste a link...","aria-label":"Link URL",className:qi,onMouseDown:p=>p.stopPropagation(),onChange:h,onKeyDown:m}),r.jsx("button",{type:"button","aria-label":"Cancel",className:Nt,onClick:u,children:r.jsx(Di,{})}),r.jsx("button",{type:"button","aria-label":"Apply link",className:Nt,onClick:d,children:r.jsx(Ii,{})})]})})})})]})},Vi=(e,t)=>{const n=t.trim(),{selection:o}=e.state;if(!n){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:n}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:n}).run();return}const s=Gi(e);e.chain().focus().setTextSelection(s).setLink({href:n}).run()},Ui=e=>r.jsx(U,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M17 12H7"}),r.jsx("path",{d:"M19 19H5"})]})}),Ki=e=>r.jsx(U,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M21 12H9"}),r.jsx("path",{d:"M21 19H7"})]})}),Zi=e=>r.jsx(U,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M15 12H3"}),r.jsx("path",{d:"M17 19H3"})]})});var Ji="k91gos0",Qi="k91gos1";const el=6,de=({label:e,isActive:t,onToggle:n,children:o})=>{const s=a=>a.preventDefault();return r.jsxs(le.Tooltip.Root,{children:[r.jsx(le.Tooltip.Trigger,{render:r.jsx($r.Toggle,{render:r.jsx(E.Toolbar.Button,{}),pressed:t,onPressedChange:()=>n()}),"aria-label":e,className:Ji,onMouseDown:s,children:o}),r.jsx(le.Tooltip.Portal,{container:ae(),children:r.jsx(se,{children:r.jsx(le.Tooltip.Positioner,{sideOffset:el,children:r.jsx(le.Tooltip.Popup,{className:Qi,children:e})})})})]})},tl=({editor:e,activeAlignment:t="left"})=>r.jsxs(r.Fragment,{children:[r.jsx(de,{label:"Align left",isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:r.jsx(Zi,{})}),r.jsx(de,{label:"Align center",isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:r.jsx(Ui,{})}),r.jsx(de,{label:"Align right",isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:r.jsx(Ki,{})})]});var nl="_1bp10ig0",me="_1bp10ig1",_e="_1bp10ig2";const rl=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:ol(e),textAlign:sl(e)}),ol=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",sl=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",al=8,il=8,ll=({editor:e})=>{const[t,n]=g.useState(!1),[o,s]=g.useState(null),a=o!==null,c=x=>v=>{s(v?x:null)},{refs:i,floatingStyles:d}=F.useFloating({placement:"top-start",strategy:"fixed",middleware:[F.offset(al),F.flip(),F.shift({padding:il})],whileElementsMounted:F.autoUpdate}),u=g.useRef(null),h=at.useEditorState({editor:e,selector:rl}),m=g.useCallback(x=>{u.current=x,i.setFloating(x)},[i]);if(g.useEffect(()=>{e&&i.setReference(e.view.dom)},[e,i]),g.useEffect(()=>{if(!e)return;const x=()=>n(!0),v=({event:y})=>{const{relatedTarget:L,currentTarget:j}=y,C=L instanceof Node&&u.current?.contains(L),T=L instanceof Node&&j instanceof Node&&j.contains(L);!C&&!T&&n(!1)};return e.on("focus",x),e.on("blur",v),()=>{e.off("focus",x),e.off("blur",v)}},[e]),!e||!t&&!a)return null;const p=ae();return p?sn.createPortal(r.jsx(se,{children:r.jsx(le.Tooltip.Provider,{children:r.jsxs(E.Toolbar.Root,{ref:m,className:nl,style:d,children:[r.jsxs(E.Toolbar.Group,{className:me,children:[r.jsx(Li,{editor:e,currentColor:h?.color??null,isOpen:o==="color",onOpenChange:c("color")}),r.jsx(Ni,{editor:e,currentFontFamily:h?.fontFamily??null,isOpen:o==="fontFamily",onOpenChange:c("fontFamily")})]}),r.jsx(E.Toolbar.Separator,{className:_e}),r.jsx(E.Toolbar.Group,{className:me,children:r.jsx(Hi,{editor:e,activeStyle:h?.fontSize??"text",isOpen:o==="fontSize",onOpenChange:c("fontSize")})}),r.jsx(E.Toolbar.Separator,{className:_e}),r.jsxs(E.Toolbar.Group,{className:me,children:[r.jsx(de,{label:"Bold",isActive:h?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:r.jsx("strong",{children:"B"})}),r.jsx(de,{label:"Italic",isActive:h?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:r.jsx("em",{children:"I"})}),r.jsx(de,{label:"Underline",isActive:h?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:r.jsx("u",{children:"U"})})]}),r.jsx(E.Toolbar.Separator,{className:_e}),r.jsx(E.Toolbar.Group,{className:me,children:r.jsx(tl,{editor:e,activeAlignment:h?.textAlign})}),r.jsx(E.Toolbar.Separator,{className:_e}),r.jsx(E.Toolbar.Group,{className:me,children:r.jsx(Yi,{editor:e,currentUrl:h?.linkUrl??null,isActive:h?.isLink??!1,isOpen:o==="link",onOpenChange:c("link")})})]})})}),p):null};var cl="_2ngohc0";const br=({editor:e,ariaLabel:t})=>r.jsxs("div",{className:cl,children:[r.jsx(ll,{editor:e}),r.jsx(at.EditorContent,{editor:e,"aria-label":t})]}),dl=(e,t)=>{const n=g.useRef(e);n.current=e;const o=g.useRef(t);o.current=t;const s=g.useRef(null),a=g.useRef(null),c=g.useMemo(()=>{const i=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null),s.current=null},d=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null);const h=s.current;h!==null&&(s.current=null,n.current(...h))};return{run:(...h)=>{if(o.current<=0){n.current(...h);return}s.current=h,a.current!==null&&clearTimeout(a.current),a.current=setTimeout(d,o.current)},flush:d,cancel:i}},[]);return g.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),c},ul=200,Sr=({content:e,extensions:t,isEditable:n,onUpdate:o,updateDebounceMs:s=ul})=>{const a=g.useRef(Ht(e)),c=g.useRef(!1),i=dl(u=>{c.current=!0,o?.(u)},s),d=at.useEditor({extensions:t,content:a.current,editable:n,immediatelyRender:!1,onUpdate:({editor:u})=>i.run(u.getJSON())});return g.useEffect(()=>{d?.setEditable(n)},[d,n]),g.useEffect(()=>{if(!d)return;if(c.current){c.current=!1;return}const u=Ht(e),h=d.getJSON();hl(h,u)||(i.cancel(),d.commands.setContent(u,{emitUpdate:!1}))},[d,e,i]),g.useEffect(()=>()=>i.flush(),[i]),d},Ht=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,hl=(e,t)=>JSON.stringify(e)===JSON.stringify(t),gl=/^(?:https?:|mailto:)/i,Lr=e=>{if(typeof e!="string")return!1;const t=e.replace(/^[\x00-\x20]+/,"");return t.length===0?!1:gl.test(t)};var fl="_1cocly40";const pl={modern:"'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",timeless:"'Noto Serif', Georgia, 'Times New Roman', serif",fresh:"'Aeonik', 'Aeonik Fallback', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif",technical:"'PT Mono', 'Courier New', monospace",handwritten:"'Permanent Marker', cursive",fineliner:"'Intruding Cat', cursive",brand:"var(--brand-font-family), 'Aeonik', 'Inter', sans-serif"},He=({content:e})=>r.jsx(r.Fragment,{children:jr(e.content??[e])}),jr=e=>e.map((t,n)=>ml(t,n)),ml=(e,t)=>{if(e.type==="text")return xl(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return r.jsx("br",{},t);const n=e.content?jr(e.content):null;switch(e.type){case"doc":return r.jsx(g.Fragment,{children:n},t);case"heading":{const o=Sl(e.attrs?.level);return Ll(o,t,n,Bt(e.attrs))}case"paragraph":{const o=ue(e.attrs?.variant);return r.jsx("p",{"data-variant":o??void 0,style:Cr(Bt(e.attrs)),children:n},t)}case"blockquote":return r.jsx("blockquote",{children:n},t);case"bulletList":case"bullet_list":return r.jsx("ul",{children:n},t);case"orderedList":case"ordered_list":return r.jsx("ol",{children:n},t);case"listItem":case"list_item":return r.jsx("li",{children:n},t);default:return r.jsx("span",{children:n},t)}},xl=(e,t)=>{const n=e.text??"";return!e.marks||e.marks.length===0?r.jsx("span",{children:n},t):e.marks.reduceRight((o,s,a)=>vl(s,o,`${t}-${a}`),n)},vl=(e,t,n)=>{switch(e.type){case"bold":case"strong":return r.jsx("strong",{children:t},n);case"italic":case"em":return r.jsx("em",{children:t},n);case"underline":return r.jsx("u",{children:t},n);case"strike":case"strikethrough":case"s":return r.jsx("s",{children:t},n);case"code":return r.jsx("code",{children:t},n);case"link":{const o=ue(e.attrs?.href);return Lr(o)?r.jsx("a",{className:fl,href:o,rel:"noopener noreferrer",target:"_blank",children:t},n):r.jsx("span",{children:t},n)}case"textStyle":{const o=yl(e.attrs);return o?r.jsx("span",{style:o,children:t},n):r.jsx("span",{children:t},n)}default:return r.jsx("span",{children:t},n)}},Rt=e=>{const t=ue(e&&typeof e=="object"?e.fontFamily:e);if(t)return pl[t]??t},yl=e=>{if(!e)return null;const t={},n=ue(e.color);n&&(t.color=n);const o=Rt(e.font)??Rt(e.fontFamily);o&&(t.fontFamily=o);const s=bl(e.fontSize);return s&&(t.fontSize=s),Object.keys(t).length>0?t:null},bl=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:ue(e),ue=e=>typeof e=="string"&&e.length>0?e:void 0,Sl=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),Ll=(e,t,n,o)=>{const s=Cr(o);switch(e){case 1:return r.jsx("h1",{style:s,children:n},t);case 2:return r.jsx("h2",{style:s,children:n},t);case 3:return r.jsx("h3",{style:s,children:n},t)}},Bt=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},Cr=e=>e?{textAlign:e}:void 0;var jl="_4dlrid0",Tr="_4dlrid1",Cl="xfz7dq0",Tl="xfz7dq1",kl="xfz7dq2",wl="xfz7dq3",Al="xfz7dq4";const El=({ref:e,footerRect:t,mode:n="readonly"})=>{const{caption:o,isCaptionVisible:s,source:a,isSourceVisible:c}=k(H.useShallow(h=>({caption:h.config.content.caption,isCaptionVisible:h.config.content.isCaptionVisible,source:h.config.content.source,isSourceVisible:h.config.content.isSourceVisible}))),i=n==="editable",d=s&&(i||o!==null),u=c&&a!==null&&Fl(a);return!d&&!u?null:r.jsxs("div",{ref:e,className:Cl,style:{left:t.x,top:t.y,width:t.width},children:[d?i?r.jsx(Nl,{caption:o}):r.jsx(_l,{caption:o}):null,u&&r.jsx(Ml,{source:a})]})},_l=({caption:e})=>e===null?null:typeof e=="string"?r.jsx("p",{className:Tr,children:e}):r.jsx(He,{content:e}),Ml=({source:e})=>{const t=Lr(e.url)?e.url:void 0,n=e.label??(t!==void 0?Pl(t):"");return n===""&&t===void 0?null:r.jsxs("div",{className:Tl,children:[r.jsx("span",{className:wl,children:"Source:"}),t!==void 0?r.jsx("a",{className:kl,href:t,target:"_blank",rel:"noopener noreferrer",children:n}):r.jsx("span",{className:Al,children:n})]})},Pl=e=>{try{return new URL(e).hostname}catch{return e}},Fl=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",Nl=({caption:e})=>{const t=lt(),n=g.useMemo(()=>Ia({placeholder:"Add caption"}),[]),o=Sr({content:e,extensions:n,isEditable:!0,onUpdate:s=>{const a=zi(s)?null:s;t(new f.SetContentCaptionCommand({caption:a}))}});return r.jsx(br,{editor:o,ariaLabel:"Chart caption"})};var Hl="_1k4qtbg0";const Rl=3,Bl=({title:e,isTitleVisible:t,subtitle:n,isSubtitleVisible:o})=>{const s=[];return t&&s.push({type:"heading",attrs:{level:Rl},content:Ol(e)}),o&&s.push(...Dl(n)),{type:"doc",content:s}},Il=e=>{const t=e.content??[],[n,...o]=t;return{title:zl(n?.content??[]),subtitle:Gl(o)}},ft=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(ft)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Ol=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Dl=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(It):[It(e)],It=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},zl=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(ft)}},Gl=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[n]=t;if(n&&t.length===1&&n.type==="paragraph"){const o=n.content??[],[s]=o;if(s&&o.length===1&&s.type==="text"&&(!s.marks||s.marks.length===0))return s.text??null}return{type:"doc",content:t.map(ft)}},Wl=({ref:e,headerRect:t,mode:n="readonly"})=>{const{title:o,isTitleVisible:s,subtitle:a,isSubtitleVisible:c}=k(H.useShallow(h=>({isTitleVisible:h.config.content.isTitleVisible,isSubtitleVisible:h.config.content.isSubtitleVisible,title:h.config.content.title,subtitle:h.config.content.subtitle}))),i=n==="editable";return!(s&&(i||o!==null))&&!(c&&(i||a!==null))?null:r.jsx("div",{ref:e,className:Hl,style:{left:t.x,top:t.y,width:t.width},children:i?r.jsx(Xl,{title:o,isTitleVisible:s,isSubtitleVisible:c,subtitle:a},[s?"title":"",c?"subtitle":""].join("-")):r.jsx($l,{title:o,isTitleVisible:s,isSubtitleVisible:c,subtitle:a})})},$l=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const s=t&&e!==null,a=n&&o!==null;return r.jsxs(r.Fragment,{children:[s&&(typeof e=="string"?r.jsx("h1",{className:jl,children:e}):r.jsx(He,{content:e})),a&&(typeof o=="string"?r.jsx("p",{className:Tr,children:o}):r.jsx(He,{content:o}))]})},Xl=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const s=lt(),a=g.useMemo(()=>Ba({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:n}),[t,n]),c=g.useMemo(()=>Bl({title:e,isTitleVisible:t,subtitle:o,isSubtitleVisible:n}),[e,t,o,n]),i=Sr({content:c,extensions:a,isEditable:!0,onUpdate:d=>{const u=Il(d);t&&s(new f.SetContentTitleCommand({title:u.title})),n&&s(new f.SetContentSubtitleCommand({subtitle:u.subtitle}))}});return r.jsx(br,{editor:i,ariaLabel:"Chart title and subtitle"})};var ql="_1u9qprb0",Yl="_1u9qprb1",Vl="_9aen060",Ul="_9aen061",Kl="_9aen062",kr="_9aen063";const Zl=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Kl,item:kr,trendRow:Ul,valueRow:Vl},Symbol.toStringTag,{value:"Module"})),Jl=e=>r.jsx(U,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7-7 7 7"}),r.jsx("path",{d:"M12 19V5"})]})}),Ql=e=>r.jsx(U,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M5 12h14"})})});var wr="n7clvo0",ec="n7clvo1",tc="n7clvo2",nc="n7clvo3",Ar={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},rc={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},oc={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},sc={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const ac=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return r.jsx(be,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return r.jsx("div",{className:sc[e.direction],children:e.direction==="flat"?r.jsx(Ql,{size:"xs",title:""}):r.jsx(Jl,{size:"xs",title:""})});const n=e.fontRole==="value"?Ar[t]:rc[t];return r.jsx("span",{className:N.clsx(ic(e),n),children:e.text})},ic=e=>{switch(e.textRole){case"value":return wr;case"observation":return ec;case"trendPercentage":return oc[e.trendDirection??"up"];case"trendReference":return tc;case"label":return nc}},lc=({item:e,resolvedSize:t})=>r.jsx("div",{className:kr,children:On(e).map(n=>r.jsx(cc,{row:n,resolvedSize:t},n.role))}),cc=({row:e,resolvedSize:t})=>{const n=e.role==="trendRow";return r.jsx("div",{className:Zl[e.role],"data-testid":n?"headline-trend":void 0,"data-direction":n?dc(e):void 0,role:n?"img":void 0,"aria-label":n?e.ariaLabel:void 0,children:e.segments.map((o,s)=>r.jsx(ac,{segment:o,resolvedSize:t},s))})},dc=e=>{const t=e.segments.find(n=>n.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},uc=({headline:e,rect:t,resolvedSize:n,visibleItemCount:o})=>{const s={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?r.jsx("div",{className:Yl,style:s,children:r.jsx("span",{className:N.clsx(wr,Ar[n]),children:e.value})}):r.jsx("div",{className:ql,style:s,children:e.items.slice(0,o).map((a,c)=>r.jsx(lc,{item:a,resolvedSize:n},`${a.label}-${c}`))})};var hc="_1oj6yix0",gc="_1oj6yix1",fc="_1oj6yix2";const pc=8,mc=16,xc=2,vc=({legends:e,containerRect:t,textScale:n})=>{const{lineBoxHeight:o}=Zn(n),{placements:s,hasOverlap:a}=yc(e,t,o);if(s.length===0)return null;const c=a?mc:pc,i=c-xc;return r.jsxs("div",{className:hc,children:[a&&r.jsx("svg",{className:gc,width:t.width,height:t.height,children:s.map(d=>r.jsx(bc,{anchorY:d.anchorY,labelY:d.y,endX:i,color:d.payload.color},d.payload.key))}),s.map(d=>r.jsx("span",{className:fc,style:{left:c,top:d.y,color:d.payload.color},children:d.payload.label},d.payload.key))]})},yc=(e,t,n)=>g.useMemo(()=>{const o=[];for(const s of e)for(const a of s.items){if(a.normalizedY===null)continue;const c=typeof a.visual.color=="string"?a.visual.color:void 0;o.push({normalizedY:a.normalizedY,payload:{key:String(o.length),label:a.formattedLabel,color:c}})}return o.length===0||t.height<=0?{placements:[],hasOverlap:!1}:f.computeDirectLabelsLayout({items:o,containerHeight:t.height,labelHeight:n})},[e,t.height,n]),bc=({anchorY:e,labelY:t,endX:n,color:o})=>{const s=n/2;return r.jsx("path",{d:`M0,${e} C${s},${e} ${s},${t} ${n},${t}`,fill:"none",stroke:o??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var Sc="_6a636s0",Lc="_1kjk02r0",jc="_1kjk02r1",Cc="_1kjk02r2",Tc="_1kjk02r3",kc="_1kjk02r4",wc="_1kjk02r5",Ac="_1kjk02r6",Ec="_1kjk02r7",_c="_1kjk02r8",Mc="_1kjk02r9",Pc="_1kjk02ra",Fc="_1kjk02rb",Nc="_1dw9dgx0";const Hc="#9ca3af",Ve="\0",Rc=e=>{const t=[];return e.forEach((n,o)=>{const s=n.aesthetics.includes("size");for(const a of n.items){if(s){const u=Number(a.visual.size);if(!Number.isFinite(u)||u<=0)continue}const c=a.visual.color??"",i=s?`${Ve}${Number(a.visual.size)}`:"",d=a.visual.lineType;t.push({key:`${o}${Ve}${String(a.value)}${Ve}${c}${i}`,formattedLabel:a.formattedLabel,visual:a.visual,swatchShape:a.swatchShape,isBubble:s,primaryLineType:d})}}),t},Er=({pill:e})=>e.isBubble?r.jsx(Oc,{pill:e}):r.jsx(Ic,{pill:e}),Bc=({color:e,lineType:t,shape:n})=>e?r.jsx(be,{shape:n,color:e,lineType:t,width:Gn,height:dt}):null,Ic=({pill:e})=>r.jsxs(r.Fragment,{children:[r.jsx(Bc,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),r.jsx("span",{children:e.formattedLabel})]}),Oc=({pill:e})=>{const t=Number(e.visual.size);return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:Nc,style:{width:t,height:t,backgroundColor:e.visual.color??Hc}}),r.jsx("span",{children:e.formattedLabel})]})},Dc=({hiddenPills:e,placement:t})=>{const[n,o]=g.useState(!1),{refs:s,floatingStyles:a}=F.useFloating({open:n,placement:t,middleware:[F.offset(4),F.flip(),F.shift({padding:8})]});g.useEffect(()=>{if(!n)return;const u=m=>{const p=m.target;if(!p)return;const x=s.reference.current,v=s.floating.current;x instanceof Element&&x.contains(p)||v instanceof Element&&v.contains(p)||o(!1)},h=m=>{m.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",h)}},[n,s.floating,s.reference]);const c=t==="left"||t==="right",i=Math.min(e.length-1,Xn),d=Array.from({length:i},(u,h)=>i-h);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:s.setReference,className:N.clsx(Lc,{[Cc]:c,[jc]:!c}),children:[d.map(u=>r.jsx("span",{className:N.clsx(Tc,{[wc]:c,[kc]:!c}),style:zc(u,c),"aria-hidden":!0},u)),r.jsx("button",{type:"button",className:N.clsx(Ac,{[Ec]:n}),onClick:()=>o(u=>!u),"aria-haspopup":"dialog","aria-expanded":n,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:r.jsxs("span",{className:_c,children:["+",e.length]})})]}),n&&r.jsx("div",{ref:s.setFloating,role:"dialog","aria-label":"Hidden legend items",className:Mc,style:a,children:r.jsx("ul",{className:Pc,children:e.map(u=>r.jsx("li",{className:Fc,children:r.jsx(Er,{pill:u})},u.key))})})]})},zc=(e,t)=>{const n=-e*qn;return{transform:t?`translateY(${n}px)`:`translateX(${n}px)`}};var Gc="_1cecisi0",Wc="_1cecisi1",$c="_1cecisi2",Xc="_1cecisi3";const qc=({edge:e,formattedLegends:t,containerWidth:n,containerHeight:o,textScale:s})=>{const a=re(),c=g.useMemo(()=>Rc(t),[t]),i=e==="left"||e==="right",d=i?o:n,u=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(d<=0)return{visibleCount:c.length,hasOverflow:!1};const x=V(Yn,s),v={family:Un,size:x},y=x*Vn,L=P=>i?Yc(P,y):Ot({label:P.formattedLabel,swatchInlineSize:Vc(P),textMeasurer:a,font:v}),j=c.map(L),T=(i?y+ut:Ot({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:a,font:v}))+Ma;return Kc({pillSizes:j,overflowPillSize:T,containerSize:d,gap:Aa})},[c,d,i,a,s]);if(c.length===0)return null;const h=c.slice(0,u.visibleCount),m=c.slice(u.visibleCount),p=u.hasOverflow&&m.length>0;return r.jsxs("div",{className:N.clsx(Gc,{[$c]:i,[Wc]:!i}),children:[h.map(x=>r.jsx("div",{className:Xc,children:r.jsx(Er,{pill:x})},x.key)),p&&r.jsx(Dc,{hiddenPills:m,placement:Zc(e)})]})},Ot=({label:e,swatchInlineSize:t,textMeasurer:n,font:o})=>{const s=n.measureText(e,o).width,a=t>0?Wn:0;return t+a+s+Kn},Yc=(e,t)=>{const n=Uc(e);return Math.max(t,n)+ut},Vc=e=>e.isBubble?Number(e.visual.size):Jn(e.visual.color),Uc=e=>e.isBubble?Number(e.visual.size):dt,Kc=({pillSizes:e,overflowPillSize:t,containerSize:n,gap:o})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let s=0;for(let i=0;i<e.length;i+=1)i>0&&(s+=o),s+=e[i]??0;if(s<=n)return{visibleCount:e.length,hasOverflow:!1};let a=0,c=0;for(const i of e){const d=a+(c>0?o:0)+i;if(d+o+t>n)break;a=d,c+=1}return{visibleCount:c,hasOverflow:!0}},Zc=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Jc=g.memo(function({formattedLegends:t,rects:n,textScale:o}){const s=g.useMemo(()=>{const a=new Map;for(const c of t){let i=a.get(c.position);i||(i={pill:[],direct:[]},a.set(c.position,i)),c.display==="pill"?i.pill.push(c):i.direct.push(c)}return a},[t]);return r.jsx(r.Fragment,{children:Array.from(s,([a,c])=>{const i=n[a];return i===void 0?null:r.jsxs("div",{className:Sc,style:{left:i.x,top:i.y,width:i.width,height:i.height},children:[r.jsx(qc,{edge:a,formattedLegends:c.pill,containerWidth:i.width,containerHeight:i.height,textScale:o}),r.jsx(vc,{legends:c.direct,containerRect:i,textScale:o})]},a)})})}),Qc=(e,t,n)=>{const o=e.filter(a=>a.interactive);if(o.length===0)return null;const s=o.map(a=>n(a,t)).filter(a=>a!==null).map(a=>a.guideMode);return s.length===0?null:s.some(a=>a==="bar")?"bar":s.every(a=>a==="continuous")?"continuous":null};function ed(e,t){const n=f.getMainAxisCoordinate(e.mainAxis,t);if(e.mainAxis==="y"){const s=b(z(n));return{x1:0,x2:"100%",y1:s,y2:s}}const o=b(n);return{x1:o,x2:o,y1:0,y2:"100%"}}function td(e,t,n){const o=e.mainAxis==="y"?f.getY(n.observation):f.getX(n.observation);if(o===null)return null;const s=e.mainAxis==="y"?rd(n):nd(n),c=(t.x?.kind==="position"?t.x:null)?.bandwidth??s;if(c===null||c<=0)return null;const i=c/2;if(e.mainAxis==="y"){const h=b(z(o+i)),m=b(c);return{x:0,y:h,width:"100%",height:m}}const d=b(o-i),u=b(c);return{x:d,y:0,width:u,height:"100%"}}function nd(e){const t=f.getXMin(e.observation),n=f.getXMax(e.observation);return t===null||n===null?null:n-t}function rd(e){const t=f.getYMin(e.observation),n=f.getYMax(e.observation);return t===null||n===null?null:n-t}const od=1,sd="4 3",ad=({panelRect:e})=>{const{coordSystem:t,layers:n,scales:o}=k(H.useShallow(i=>({coordSystem:i.coordSystem,layers:i.layers,scales:i.scales}))),s=Le(i=>i.hover.primary),a=Se();if(t.type!=="cartesian"||n.length===0||s===null)return null;const c=Qc(n,t,a);return c===null?null:c==="bar"?r.jsx(ld,{coordSystem:t,scales:o,primary:s,panelRect:e}):r.jsx(id,{coordSystem:t,primary:s,panelRect:e})},id=({coordSystem:e,primary:t,panelRect:n})=>{const o=ed(e,t);return r.jsx(_r,{panelRect:n,children:r.jsx("line",{...o,stroke:l.hoverGuideLineColor,strokeWidth:od,strokeDasharray:sd,strokeLinecap:"round","data-testid":"hover-guide-line"})})},ld=({coordSystem:e,scales:t,primary:n,panelRect:o})=>{const s=td(e,t,n);return s===null?null:r.jsx(_r,{panelRect:o,children:r.jsx("rect",{...s,fill:l.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},_r=({panelRect:e,children:t})=>r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,style:{overflow:"visible",pointerEvents:"none"},"data-testid":"hover-guide",children:t}),cd=200,dd=({engine:e,store:t,overlayRef:n,setCursor:o=ud})=>{g.useEffect(()=>{const s=n.current;if(!s)return;const a=hd(s,e),c=gd(s,e,t,o);return()=>{c(),a()}},[e,t,n,o])},ud=()=>{},hd=(e,t)=>{const n=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let o=null;const s=()=>{o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,n()},cd)},a=new ResizeObserver(s);return a.observe(e),n(),()=>{a.disconnect(),o!==null&&clearTimeout(o)}},gd=(e,t,n,o)=>{let s=null,a=null;const c=()=>{a=null;const u=s;if(s=null,!u)return;o({clientX:u.clientX,clientY:u.clientY});const h=e.getBoundingClientRect();if(h.width===0||h.height===0)return;const m={x:(u.clientX-h.left)/h.width,y:1-(u.clientY-h.top)/h.height};n.getState().setHoverState(t.query(m))},i=u=>{s=u,a===null&&(a=requestAnimationFrame(c))},d=()=>{s=null,a!==null&&(cancelAnimationFrame(a),a=null),o(null);const u=n.getState();u.hover.primary!==null&&u.setHoverState(f.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",i),e.addEventListener("pointerleave",d),()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerleave",d),a!==null&&cancelAnimationFrame(a),s=null}},fd=({panelRect:e})=>{const{engine:t,store:n,overlayRef:o,setCursor:s}=ge();return dd({engine:t,store:n,overlayRef:o,setCursor:s}),r.jsx("rect",{ref:o,x:e.x,y:e.y,width:e.width,height:e.height,fill:"transparent",pointerEvents:"all","data-testid":"pointer-capture-layer"})},Ue="data-hover-active",pd=e=>{const{store:t}=ge(),n=ve.useStore(t,o=>o.hover.primary!==null);g.useEffect(()=>{const o=e.current;if(o)return n?o.setAttribute(Ue,"true"):o.removeAttribute(Ue),()=>{o.removeAttribute(Ue)}},[e,n])},Dt=({panelRect:e,zOrder:t})=>{const n=k(c=>c.annotations.custom),o=js(),s=n.filter(c=>{const i=o(c.type);return i!==null&&(c.zOrder??i.zOrder)===t});if(s.length===0)return null;const a={width:e.width,height:e.height};return r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`custom-annotations-${t}`,children:s.map(c=>{const i=o(c.type);return i===null?null:r.jsx("g",{"data-annotation-type":c.type,children:i.draw({targets:c.targets,area:a,params:c.params})},c.id)})})},Mr=M.xs,ot=O,Pr=Y.medium,md=Y.semibold,Fr=6,Nr=2,xd=4,vd=2,zt=4;var yd="_1agclyl0",bd="_1agclyl1",Sd="_1agclyl2",Ld={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},jd="_1agclyl6 _1agclyl3";const Hr=({x:e,y:t,width:n,height:o,text:s,isRotated:a,target:c,position:i,coordType:d})=>{const u=a?`rotate(-90 ${e} ${t})`:void 0,h=c==="aggregate"?jd:Ld[i],m=Cd(c,i,d);return r.jsxs("g",{transform:u,children:[m&&r.jsx("rect",{className:m,x:e-n/2,y:t-o/2,width:n,height:o,rx:zt,ry:zt}),r.jsx("text",{className:h,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:s})]})},Cd=(e,t,n)=>{if(e==="aggregate")return Sd;if(t==="outside"&&n==="cartesian")return bd},Td={dataLabel:{x:Fr,y:Nr},stackTotal:{x:xd,y:vd}},kd=({panelRect:e,formattingLocale:t})=>{const n=re(),o=k(H.useShallow(i=>({layers:i.layers,coordSystem:i.coordSystem,axes:i.guides.axes,numberFormat:i.config.numberFormat,parsingLocale:i.config.parsingLocale,textScale:i.config.appearance.textScale}))),s=g.useMemo(()=>{const i=V(Mr,o.textScale);return{dataLabel:{family:ot,size:i,weight:Pr},stackTotal:{family:ot,size:i,weight:md}}},[o.textScale]),a=g.useMemo(()=>(i,d)=>{const u=n.measureText(d,s[i]),h=Td[i];return{...u,width:u.width+h.x*2,height:u.height+h.y*2}},[n,s]),c=g.useMemo(()=>f.buildDataLabelsContent({...o,panelRect:e,measureDataLabel:a,formattingLocale:t}),[o,e,a,t]);return r.jsx("g",{className:yd,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(i=>r.jsx(Hr,{x:i.x,y:i.y,width:i.width,height:i.height,text:i.text,isRotated:i.isRotated,target:i.target,position:i.position,coordType:o.coordSystem.type},i.key))})},wd=({linePath:e,arrowheadPath:t,stroke:n,strokeWidth:o})=>{const s={stroke:n,strokeWidth:o,strokeLinecap:"round",fill:"none"};return r.jsxs("g",{children:[r.jsx("path",{d:e,...s}),r.jsx("path",{d:t,...s,strokeLinejoin:"round"})]})},Ad=({x:e,y:t,text:n,lineHeight:o,paddingX:s,paddingY:a,strokeWidth:c,strokeColor:i,fontWeight:d})=>{const u=re(),m=g.useMemo(()=>u.measureText(n,{family:O,size:o,weight:d}),[u,n,o,d]).width+s*2,p=o+a*2;return r.jsxs("g",{style:{pointerEvents:"none"},children:[r.jsx("rect",{x:e-m/2,y:t-p/2,width:m,height:p,rx:4,fill:l.graphBackground,stroke:i,strokeWidth:c}),r.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:l.textPrimary,style:{fontFamily:O,fontSize:o,fontWeight:d},children:n})]})},Ed=({panelRect:e,formattingLocale:t})=>{const n=k(H.useShallow(s=>({differenceArrows:s.annotations.differenceArrows,mainAxis:s.coordSystem.type==="cartesian"?s.coordSystem.mainAxis:"x",textScale:s.config.appearance.textScale}))),o=g.useMemo(()=>n.differenceArrows.map(s=>f.computeDifferenceArrow({arrow:s,mainAxis:n.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:n.textScale,locale:t})),[n,e.width,e.height,t]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:o.map(({color:s,id:a,linePath:c,arrowheadPath:i,strokeWidth:d,labelPosition:u,labelText:h,labelLineHeight:m,labelPaddingX:p,labelPaddingY:x,labelStrokeWidth:v,labelFontWeight:y})=>{const L=s??l.defaultAnnotationArrowStroke;return r.jsxs(g.Fragment,{children:[r.jsx(wd,{linePath:c,arrowheadPath:i,stroke:L,strokeWidth:d}),r.jsx(Ad,{x:u.x,y:u.y,text:h,lineHeight:m,paddingX:p,paddingY:x,strokeWidth:v,strokeColor:L,fontWeight:y})]},a)})})},_d=0,Md=1.15,Gt=1.15,Pd="rgba(0, 0, 0, 0.16)",Wt=2,Fd=1.4,Nd=({arrow:e,fallbackColor:t,stickerOutlineColor:n,stickerOutlineColorInverse:o})=>{const s=g.useId(),a=e.color??t,c=Hd(e.color,n,o),i=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},d=e.arrowheadExtent+e.strokeWidth+Wt+Gt,u={x:Math.min(e.startX,e.endX)-d,y:Math.min(e.startY,e.endY)-d,width:Math.abs(e.endX-e.startX)+2*d,height:Math.abs(e.endY-e.startY)+2*d},h=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(m=>m.length>0).join(" ");return r.jsxs("g",{children:[e.hasStickerStyle&&r.jsx("defs",{children:r.jsx("filter",{id:s,filterUnits:"userSpaceOnUse",...u,children:r.jsx("feDropShadow",{dx:_d,dy:Md,stdDeviation:Gt,floodColor:Pd})})}),r.jsxs("g",{filter:e.hasStickerStyle?`url(#${s})`:void 0,children:[e.hasStickerStyle&&r.jsx("path",{d:h,stroke:c,strokeWidth:e.strokeWidth+2*Wt,strokeLinecap:"round",fill:"none"}),r.jsx("path",{d:e.linePath,stroke:a,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...i}),e.startArrowheadPath.length>0&&r.jsx("path",{d:e.startArrowheadPath,stroke:a,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&r.jsx("path",{d:e.endArrowheadPath,stroke:a,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},Hd=(e,t,n)=>{if(e===null)return n;try{return Ze.getContrast(e,t)<Fd?n:t}catch{return n}},Rd=({panelRect:e})=>{const{themeValues:t}=gt(),n=k(s=>s.annotations.freeformArrows),o=g.useMemo(()=>n.map(s=>f.computeFreeformArrow({arrow:s,panelWidth:e.width,panelHeight:e.height})).filter(s=>s!==null),[n,e.width,e.height]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:o.map(s=>r.jsx(Nd,{arrow:s,fallbackColor:l.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},s.id))})},Bd=({edge:e,areTicksVisible:t,position:n,labelRotation:o,label:s})=>{const a=b(n),c=t?1:0,i={style:{font:l.fontTickLabel},fill:l.textSecondary},d=o!==0&&(e==="top"||e==="bottom"),u=e==="top";return d?r.jsx("svg",{x:a,y:u?"100%":0,style:{overflow:"visible"},children:r.jsx("text",{...Od(u,c,o),...i,children:s})}):r.jsx("text",{...Id(e,a,c),...i,children:s})},Id=(e,t,n)=>{switch(e){case"bottom":return{x:t,y:Q*n,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-Q*n,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-Q*n,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:Q*n,y:t,textAnchor:"start",dominantBaseline:"central"}}},Od=(e,t,n)=>{const o=Q*t,s=e?-o:o;return{x:0,y:s,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${n}, 0, ${s})`}},Dd=({formattedAxis:e,rect:t})=>{const n=e.position==="bottom"||e.position==="top";return r.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[In,e.ticks.map((o,s)=>{const a=o.formattedLabel,c=n?o.position:1-o.position,i=zd(e.position,c,t);return r.jsxs("g",{children:[e.ticksVisible&&r.jsx("line",{...i,stroke:l.gridLineColor,strokeWidth:1}),r.jsx(Bd,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:a})]},s)})]})},zd=(e,t,n)=>{const o=b(t);switch(e){case"bottom":return{x1:o,y1:0,x2:o,y2:Ae};case"top":return{x1:o,y1:n.height,x2:o,y2:n.height-Ae};case"left":return{x1:n.width,y1:o,x2:n.width-Ae,y2:o};case"right":return{x1:0,y1:o,x2:Ae,y2:o}}},Gd=({formattedAxes:e,rects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];return!o||!n.isVisible?null:r.jsx(Dd,{formattedAxis:n,rect:o},n.scaleAestheticKey)})}),Wd=({axes:e,rects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];if(!o||!n.isVisible)return null;const s=$d(n.position,o);return r.jsxs("g",{transform:`translate(${o.x}, ${o.y})`,children:[In,r.jsx("text",{style:{font:l.fontAxisLabel},fill:l.textPrimary,...s,children:n.label})]},`axis-label-${n.position}`)})}),$d=(e,t)=>{const n={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(n.x=0,n.textAnchor="start"):e==="right"&&(n.x=t.width,n.textAnchor="end"),n},$t={strokeWidth:1,strokeDashoffset:"0",strokeDasharray:"2 3",strokeLinecap:"round"},Xd=({axes:e,panel:t,panelRect:n})=>r.jsxs("svg",{x:n.x,y:n.y,width:n.width,height:n.height,style:{overflow:"visible"},children:[t.border.isVisible&&r.jsx("rect",{x:0,y:0,width:n.width,height:n.height,fill:"none",stroke:l.gridLineColor,rx:8,ry:8,...$t}),e.map(o=>{if(!o.gridVisible)return null;const s=o.position==="bottom"||o.position==="top";return r.jsx("g",{children:o.ticks.map((a,c)=>{if(a.position<=0||a.position>=1)return null;const i=s?a.position:1-a.position,d=b(i),u=s?{x1:d,y1:0,x2:d,y2:"100%"}:{x1:0,y1:d,x2:"100%",y2:d};return r.jsx("line",{...u,...$t,stroke:l.gridLineColor},c)})},o.scaleAestheticKey)})]}),Xt=8,qt=.5,Yt={strokeWidth:1,strokeLinecap:"round"},qd=({axes:e,panelRect:t,coordSystem:n})=>{const o=e.find(y=>y.geometry==="circular"),s=e.find(y=>y.geometry==="radial");if(!o||o.ticks.length===0)return null;const a=t.x+t.width/2,c=t.y+t.height/2,i=Math.min(t.width,t.height)/2,{startAngle:d,innerRadius:u}=n,h=y=>y*2*Math.PI+d,m=(y,L)=>{const j=a+L*Math.sin(y),C=c-L*Math.cos(y);return`${j.toFixed(2)},${C.toFixed(2)}`},p=o.ticks.map(y=>h(y.position)),x=y=>`${p.map((L,j)=>`${j===0?"M":"L"} ${m(L,y)}`).join(" ")} Z`,v=(s?.ticks??[]).map(y=>(u+y.position*(1-u))*i).filter(y=>y>qt);return v.some(y=>Math.abs(y-i)<qt)||v.push(i),r.jsxs("g",{"data-guide":"polar",style:{overflow:"visible"},children:[v.map((y,L)=>r.jsx("path",{d:x(y),fill:"none",stroke:l.gridLineColor,...Yt},`ring-${L}`)),p.map((y,L)=>r.jsx("line",{x1:a,y1:c,x2:a+i*Math.sin(y),y2:c-i*Math.cos(y),stroke:l.gridLineColor,...Yt},`spoke-${L}`)),o.ticks.map((y,L)=>{const j=h(y.position),C=Math.sin(j),T=-Math.cos(j);return r.jsx("text",{x:a+C*(i+Xt),y:c+T*(i+Xt),textAnchor:C>.1?"start":C<-.1?"end":"middle",dominantBaseline:T>.1?"hanging":T<-.1?"auto":"central",style:{font:l.fontTickLabel},fill:l.textSecondary,children:y.formattedLabel},`label-${L}`)})]})},Vt=({panelRect:e,zOrder:t})=>{const o=k(s=>s.annotations.shapes).filter(s=>s.zOrder===t);return o.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:o.map(({id:s,x:a,y:c,width:i,height:d,fillColor:u,fillOpacity:h,strokeWidth:m,strokeColor:p})=>r.jsx("rect",{x:b(a),y:b(c),width:b(i),height:b(d),fill:u,fillOpacity:h,stroke:m>0?p??l.defaultAnnotationShapeStroke:"none",strokeWidth:m},s))})};var Yd="_120wioc0";const Vd=({panelRect:e})=>{const t=k(n=>n.annotations.textAnnotations);return t.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(n=>r.jsx("foreignObject",{x:b(n.x),y:b(n.y),width:b(n.width),height:b(1-n.y),overflow:"visible",children:r.jsx("div",{className:Yd,style:Ud(n.backgroundColor,n.backgroundColorStyle),children:r.jsx(He,{content:n.content})})},n.id))})},Ud=(e,t)=>e===null||e==="transparent"?{color:l.textPrimary}:t==="fade"?{color:l.textPrimary,backgroundColor:tt(e,l.grey100,.5),boxShadow:`0 0 0 1.5px ${tt(e,l.grey0,.2)}`}:{color:l.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${ze(e,.1)}`};var Kd="usd3ea0",Zd="usd3ea1";const Jd=({layer:e,coordSystem:t,isAnimated:n,isDimmed:o,highlightStyle:s,formattingLocale:a})=>{const i=Se()(e,t);return i===null?r.jsxs("text",{children:[e.geom," not implemented"]}):r.jsx("g",{className:N({[Zd]:o&&s==="desaturate",[Kd]:o&&s==="dim"}),children:i.render({layer:e,coordSystem:t,isAnimated:n,formattingLocale:a})})};function Qd({plugin:e,layer:t,coordSystem:n,candidates:o}){if(e?.getOverlayAnchor===void 0||o.length===0)return[];const s=[];for(const{observation:a,observationIndex:c}of o){const i=e.getOverlayAnchor({layer:t,coordSystem:n,observation:a});i!==null&&s.push({observation:a,observationIndex:c,anchor:i})}return s}const eu=4,tu=({plugin:e,layer:t,matchedLayer:n,overlayCandidates:o,coordSystem:s,isAnimated:a,panelRect:c,formattingLocale:i})=>{const{numberFormat:d,textScale:u}=k(H.useShallow(v=>({numberFormat:v.config.numberFormat,textScale:v.config.appearance.textScale}))),h=g.useMemo(()=>Qd({plugin:e,layer:t,coordSystem:s,candidates:o}),[e,t,s,o]),m=g.useMemo(()=>f.createSegmentYReader(t),[t]),p=g.useMemo(()=>f.buildLayerYValueFormatter({layer:t,numberFormat:d,locale:i}),[d,t,i]),x=Mr*yn*u;return e===null||n===null&&h.length===0?null:r.jsxs(r.Fragment,{children:[n?e.render({layer:n,coordSystem:s,isAnimated:a,formattingLocale:i}):null,h.map(({observation:v,observationIndex:y,anchor:L})=>r.jsx(nu,{observation:v,anchor:L,panelRect:c,readSegmentY:m,formatYValue:p,labelFontSizePx:x},ru(v,y)))]})},nu=({observation:e,anchor:t,panelRect:n,readSegmentY:o,formatYValue:s,labelFontSizePx:a})=>{const c=re(),i=t.x,d=z(t.y),u=(f.getSize(e)??ln)/2,h=o(e),m=f.isDefined(h)?s(h,e):null,p=g.useMemo(()=>{if(m===null)return null;const x=c.measureText(m,{family:ot,size:a,weight:Pr});return{width:x.width+Fr*2,height:x.height+Nr*2}},[m,c,a]);return r.jsxs(r.Fragment,{children:[r.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:b(i),cy:b(d),r:u,fill:f.getColor(e)}),m!==null&&p!==null&&r.jsx(Hr,{x:i*n.width,y:d*n.height-u-eu-p.height/2,width:p.width,height:p.height,text:m,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},ru=(e,t)=>{const n=e[f.GROUP_VARIABLES.group];return`${String(n??"")}\0${t}`},ou=({layer:e,coordSystem:t,panelRect:n})=>{const o=Se(),{primary:s,group:a,related:c}=Le(H.useShallow(u=>({primary:u.hover.primary,group:u.hover.group,related:u.hover.related})));if(s===null)return null;const i=o(e,t);if(i===null)return null;const d=c.get(e.id)??[];return s.layerId===e.id?i.renderHover({layer:e,coordSystem:t,primary:s,group:a,related:d,panelRect:n}):d.length===0?null:i.renderHoverCompanions({layer:e,primary:s,related:d})};var su="to1jkx0",au="to1jkx1";const iu=({shouldAnimate:e,panelRect:t,formattingLocale:n})=>{const{layers:o,coordSystem:s,highlightStyle:a}=k(H.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return r.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:su,"data-testid":"geom-layers",children:o.map(c=>r.jsxs(g.Fragment,{children:[r.jsx(du,{layer:c,coordSystem:s,highlightStyle:a,shouldAnimate:e,panelRect:t,formattingLocale:n}),r.jsx(ou,{layer:c,coordSystem:s,panelRect:t})]},`${c.id}-${lu(s)}`))})},lu=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,cu=e=>{if(e.highlight!==null)return au},du=({layer:e,coordSystem:t,highlightStyle:n,shouldAnimate:o,panelRect:s,formattingLocale:a})=>{const c=Se(),i=g.useMemo(()=>c(e,t),[c,e,t]),d=e.highlight;return r.jsxs("g",{className:cu(e),children:[r.jsx(Jd,{layer:e,coordSystem:t,isAnimated:o,isDimmed:d?.composition.isDimmed??!1,highlightStyle:n,formattingLocale:a}),d!==null&&r.jsx(tu,{plugin:i,layer:e,matchedLayer:d.composition.matchedLayer,overlayCandidates:d.composition.overlayCandidates,coordSystem:t,isAnimated:o,panelRect:s,formattingLocale:a})]})};var uu="_17uhij30";const hu=({formattedAxes:e,formattedPolarAxes:t,plotRect:n,panelRect:o,axisRects:s,axisLabelRects:a,shouldAnimate:c,formattingLocale:i})=>{const d=g.useRef(null);pd(d);const{axes:u,panelGuide:h,coordSystem:m}=k(H.useShallow(L=>({axes:L.guides.axes,panelGuide:L.guides.panel,coordSystem:L.coordSystem}))),p=g.useMemo(()=>Rr(o,n),[o,n]),x=g.useMemo(()=>Ut(s,n),[s,n]),v=g.useMemo(()=>Ut(a,n),[a,n]),y=g.useMemo(()=>u.filter(L=>L.geometry==="linear"),[u]);return r.jsxs("svg",{ref:d,className:uu,width:n.width,height:n.height,style:{transform:`translate(${n.x}px, ${n.y}px)`},"data-testid":"plot",children:[r.jsx(Xd,{axes:e,panel:h,panelRect:p}),m.type==="polar"&&r.jsx(qd,{axes:t,panelRect:p,coordSystem:m}),r.jsx(ad,{panelRect:p}),r.jsx(Gd,{formattedAxes:e,rects:x}),r.jsx(Wd,{axes:y,rects:v}),r.jsx(Vt,{panelRect:p,zOrder:"background"}),r.jsx(Dt,{panelRect:p,zOrder:"background"}),r.jsx(iu,{shouldAnimate:c,panelRect:p,formattingLocale:i}),r.jsx(kd,{panelRect:p,formattingLocale:i}),r.jsx(Ed,{panelRect:p,formattingLocale:i}),r.jsx(Vt,{panelRect:p,zOrder:"foreground"}),r.jsx(Dt,{panelRect:p,zOrder:"foreground"}),r.jsx(Rd,{panelRect:p}),r.jsx(Vd,{panelRect:p}),r.jsx(fd,{panelRect:p})]})},Rr=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),Ut=(e,t)=>{const n={};for(const[o,s]of Object.entries(e))n[o]=Rr(s,t);return n},Ke={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},gu=()=>{const[e,t]=g.useState(null),[n,o]=g.useState(null),[s,a]=g.useState(Ke);return g.useEffect(()=>{const c=()=>{const d=e?{width:e.offsetWidth,height:e.offsetHeight}:Ke.headerSize,u=n?{width:n.offsetWidth,height:n.offsetHeight}:Ke.footerSize;a(h=>fu(h,{headerSize:d,footerSize:u})?{headerSize:d,footerSize:u}:h)};c();const i=new ResizeObserver(c);return e&&i.observe(e),n&&i.observe(n),()=>i.disconnect()},[e,n]),{headerRef:t,footerRef:o,measurements:s}},fu=(e,t)=>e.headerSize.width!==t.headerSize.width||e.headerSize.height!==t.headerSize.height||e.footerSize.width!==t.footerSize.width||e.footerSize.height!==t.footerSize.height,pu=({appearance:e,isEditable:t,editorId:n,style:o,children:s})=>{const{theme:a,themeClass:c,inlineVarsStyle:i}=gt(),d=ti(e.border),u=Math.max(0,e.cornerRadius),h=u===0?0:u+d,m=g.useMemo(()=>{const v={...o,borderRadius:`${h}px`,...i},y=ei(e.border,a);return y!==null&&(v.background=y),v},[o,h,i,e.border,a]),p=g.useMemo(()=>({inset:`${d}px`,borderRadius:`${u}px`}),[d,u]),x=t&&e.background.type==="solid"&&e.background.color==="transparent";return r.jsx("div",{"data-testid":"graph-wrapper","data-graphy-id":n,className:N(si,c),style:m,children:r.jsx("div",{"data-testid":"graph-inner",className:N(ii,{[li]:x}),style:p,children:s})})},mu=e=>r.jsx(Nn,{children:r.jsx(Ln,{children:r.jsx(xu,{...e})})}),xu=({width:e,height:t,isAnimated:n,showTooltips:o=!0,mode:s="readonly"})=>{const{axes:a,legends:c,numberFormat:i,parsingLocale:d,appearance:u,annotations:h,coordSystem:m,headline:p,headlineConfig:x}=k(H.useShallow(X=>({axes:X.guides.axes,legends:X.guides.legends,numberFormat:X.config.numberFormat,parsingLocale:X.config.parsingLocale,appearance:X.config.appearance,annotations:X.annotations,coordSystem:X.coordSystem,headline:X.guides.headline,headlineConfig:X.config.headline}))),v=A.useReducedMotion(),{headerRef:y,footerRef:L,measurements:j}=gu(),{formattingLocale:C,theme:T,themeOverrides:P,id:G}=oe(),D=g.useMemo(()=>f.formatLegends({legends:c,numberFormat:i,parsingLocale:d,formattingLocale:C}),[c,i,d,C]),W=g.useMemo(()=>f.formatHeadline({headline:p,show:x.show,numberFormat:i,parsingLocale:d,formattingLocale:C}),[p,x.show,i,d,C]),K=re(),Z=u.border.type==="none"?0:u.border.width,J=g.useMemo(()=>({width:Math.max(0,e-2*Z),height:Math.max(0,t-2*Z)}),[e,t,Z]),je=g.useMemo(()=>W?{formatted:W,size:x.size,position:x.position,innerRadius:m.type==="polar"?m.innerRadius:0}:void 0,[W,x.size,x.position,m]),Ce=Na(K,u.textScale),fe=Ha({measurer:Ce,axes:a,numberFormat:i,parsingLocale:d,formattedLegends:D,containerSize:J,externalMeasurements:j,headline:je,formattingLocale:C,annotations:h,coordSystem:m,textScale:u.textScale}),Te=g.useMemo(()=>!fe||!je||!Ce?null:f.resolveHeadlinePlacement({headline:je,layout:fe.layout,containerSize:J,measurer:Ce,itemGap:Pn}),[fe,je,J,Ce]);if(!fe)return null;const{layout:ee,formattedAxes:Ir,formattedPolarAxes:Or}=fe;return r.jsx(ir,{theme:T,themeOverrides:P,appearance:u,children:r.jsxs(pu,{appearance:u,isEditable:s==="editable",editorId:G,style:{width:e,height:t},children:[r.jsx(Wl,{ref:y,headerRect:ee.header,mode:s}),r.jsx(hu,{formattedAxes:Ir,formattedPolarAxes:Or,plotRect:ee.plot,panelRect:ee.panel,axisRects:ee.axes,axisLabelRects:ee.axisLabels,shouldAnimate:n??!v,formattingLocale:C??d}),r.jsx(El,{ref:L,footerRect:ee.footer,mode:s}),r.jsx(Jc,{formattedLegends:D,rects:ee.legends,textScale:u.textScale}),W&&Te&&r.jsx(uc,{headline:W,rect:Te.rect,resolvedSize:Te.resolvedSize,visibleItemCount:Te.visibleItemCount}),o&&r.jsx(fa,{})]})})};function vu(e,t){return{type:e.type,zOrder:t.zOrder,draw:t.draw}}const yu=2147483646;function bu(){const e=g.useRef(null),[t,n]=g.useState(null),o=g.useCallback(()=>{const a=e.current;if(!a)return;const c=a.getBoundingClientRect(),i={left:c.left,top:c.top,width:c.width,height:c.height};n(d=>d&&Lu(d,i)?d:i)},[]),s=g.useCallback(a=>{e.current=a},[]);return g.useLayoutEffect(()=>{if(!e.current)return;o();const a=new ResizeObserver(o);return a.observe(e.current),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{a.disconnect(),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]),{ref:s,rect:t}}function Su({rect:e,children:t}){return sn.createPortal(r.jsx("div",{style:{position:"fixed",left:e.left,top:e.top,width:e.width,height:e.height,pointerEvents:"none",zIndex:yu,overflow:"visible"},children:t}),document.body)}function Lu(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function*ju(e,t){for(const n of e)yield{kind:n[t],observation:n}}function Cu(e,t,n,o){return e>=n&&t>=o}const Tu=({children:e,style:t,...n})=>r.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 1 1",preserveAspectRatio:"none",...n,style:{overflow:"visible",...t},children:e});function ku(){return g.useMemo(()=>{const e=f.DEFAULT_COLOR_PALETTE;return t=>e[t%e.length]??e[0]??"#000000"},[])}function wu(e,t){const{hitTesterRegistry:n}=ge(),o=g.useRef(t);o.current=t,g.useLayoutEffect(()=>{const s=a=>o.current(a);return n.set(e,s),()=>{n.delete(e)}},[n,e])}function Au(e){const{engine:t,store:n,setCursor:o}=ge();return g.useCallback((s,a)=>{if(s===null){n.getState().setHoverState(f.RESTING_HOVER_STATE),o(null);return}n.getState().setHoverState(t.hoverByKey(e,s)),a&&o(a)},[t,n,o,e])}function Br(e,t,n){const o=Kt(e),s=Kt(t),a=(c,i)=>Math.round(c+(i-c)*n);return`rgb(${a(o.red,s.red)}, ${a(o.green,s.green)}, ${a(o.blue,s.blue)})`}function Eu(e,t){return Br(e,"#ffffff",t)}function Kt(e){const t=e.replace("#","");return{red:Number.parseInt(t.slice(0,2),16),green:Number.parseInt(t.slice(2,4),16),blue:Number.parseInt(t.slice(4,6),16)}}exports.CanvasTextMeasurer=De;exports.CompanionDot=ne;exports.DevToolsPanel=zs;exports.GraphProvider=Ls;exports.GraphRenderer=mu;exports.HoverProvider=Nn;exports.PanelOverlayPortal=Su;exports.PrimaryDot=Oe;exports.Swatch=be;exports.TextMeasurerProvider=Ln;exports.ThemeProvider=ir;exports.TooltipBody=Hn;exports.TooltipRowView=Rn;exports.UnitSpaceSvg=Tu;exports.darkTheme=ar;exports.defineAnnotationRenderer=vu;exports.defineGeomPlugin=to;exports.defineGeomRenderer=no;exports.emToPx=V;exports.fitsLabel=Cu;exports.lightTheme=sr;exports.lighten=Eu;exports.mixColor=Br;exports.partitionByKind=ju;exports.toPercent=b;exports.toViewBoxX=so;exports.toViewBoxY=z;exports.useCategoricalColor=ku;exports.useCompiledSelector=k;exports.useGeomHitTest=wu;exports.useGeomHover=Au;exports.useGraphCommandDispatcher=lt;exports.useHoverState=Le;exports.usePanelScreenRect=bu;exports.useSvgPathMorph=Pe;exports.useTextMeasurer=re;exports.vars=l;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),H=require("clsx"),g=require("react"),be=require("zustand"),f=require("@graphysdk/viz-engine"),st=require("zustand/vanilla"),_=require("motion/react"),ne=require("d3-shape"),Gr=require("d3-interpolate-path"),R=require("zustand/react/shallow"),Ze=require("color2k"),N=require("@floating-ui/react-dom"),$r=require("@tiptap/core"),Kt=require("@tiptap/extension-bold"),Je=require("@tiptap/extension-document"),Zt=require("@tiptap/extension-hard-break"),Jt=require("@tiptap/extension-heading"),Qt=require("@tiptap/extension-italic"),en=require("@tiptap/extension-link"),tn=require("@tiptap/extension-text"),nn=require("@tiptap/extension-text-align"),ue=require("@tiptap/extension-text-style"),rn=require("@tiptap/extension-underline"),Me=require("@tiptap/extensions"),Wr=require("@tiptap/extension-paragraph"),at=require("@tiptap/react"),M=require("@base-ui/react/toolbar"),de=require("@base-ui/react/tooltip"),on=require("react-dom"),Xr=require("@vanilla-extract/dynamic"),P=require("@base-ui/react/popover"),pt=require("react-colorful"),B=require("@base-ui/react/menu"),qr=require("@base-ui/react/toggle");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-plugins.9");const Yr=(e=[])=>{const t=new Map;for(const n of e)t.set(n.type,n);return n=>t.get(n)??null},Vr=5,Ur=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>Zr,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let n=null;return{emit:o=>{const s=e.getLastCompile();if(s){n=o;for(const a of t)a(o,s)}},subscribe:o=>(t.add(o),()=>{t.delete(o)}),getLastTrigger:()=>n,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Kr=()=>st.createStore(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,n)=>e(o=>{if(o.lastSnapshot===n)return o;const s={id:o.nextId,label:Jr(t),stages:n.stages,durationMs:n.durationMs};return{lastCompile:s,history:Qr(o.history,s,Vr),nextId:o.nextId+1,lastSnapshot:n}})})),Zr=()=>{},Jr=e=>{switch(e.kind){case"init":return"init";case"input":return"input change";case"data":return"data change";case"command":return e.command.metadata.description}},Qr=(e,t,n)=>{const o=e.length>=n?e.length-(n-1):0;return[...e.slice(o),t]},eo="graphy-editor",to="graphy-editor-host";function no({id:e,store:t,dispatch:n}){const o=g.useRef(n);o.current=n;const[s]=g.useState(ro);g.useEffect(()=>{if(!e||!s)return;const a=()=>{const u=f.convertSpecToInput(t.getState().compiled.spec);window.parent.postMessage({source:eo,type:"spec",id:e,input:u},"*")};let c=t.getState().compiled.spec;a();const i=t.subscribe(u=>{u.compiled.spec!==c&&(c=u.compiled.spec,a())}),d=u=>{const h=u.data;if(!(!h||h.source!==to)&&h.type==="command"&&h.id===e){const p=h.command;o.current(f.commandRegistry.deserialize({type:p.type,params:p.params,metadata:f.createCommandMetadata({description:p.type})}))}};return window.addEventListener("message",d),()=>{i(),window.removeEventListener("message",d)}},[e,t,s])}function ro(){if(typeof window>"u"||window.parent===window)return!1;try{return new URLSearchParams(window.location.search).has("graphyEditor")}catch{return!1}}function oo(e){return e}function so(e,t){return{...t,geom:e.type,highlightStrategy:e.highlightStrategy}}var sn=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],l={white:"var(--graphy-white)",black:"var(--graphy-black)",transparent:"var(--graphy-transparent)",grey100:"var(--graphy-grey-100)",grey95:"var(--graphy-grey-95)",grey90:"var(--graphy-grey-90)",grey85:"var(--graphy-grey-85)",grey80:"var(--graphy-grey-80)",grey75:"var(--graphy-grey-75)",grey70:"var(--graphy-grey-70)",grey60:"var(--graphy-grey-60)",grey50:"var(--graphy-grey-50)",grey0:"var(--graphy-grey-0)",greyGradient80:"var(--graphy-grey-gradient-80)",green60:"var(--graphy-green-60)",green50:"var(--graphy-green-50)",red60:"var(--graphy-red-60)",red50:"var(--graphy-red-50)",amber70:"var(--graphy-amber-70)",amber50:"var(--graphy-amber-50)",amber40:"var(--graphy-amber-40)",amber30:"var(--graphy-amber-30)",blue80:"var(--graphy-blue-80)",blue60:"var(--graphy-blue-60)",purple50:"var(--graphy-purple-50)",purple30:"var(--graphy-purple-30)",brand:"var(--graphy-brand)",success:"var(--graphy-success)",warning:"var(--graphy-warning)",alert:"var(--graphy-alert)",textPrimary:"var(--graphy-text-primary)",textSecondary:"var(--graphy-text-secondary)",textDisabled:"var(--graphy-text-disabled)",iconPrimary:"var(--graphy-icon-primary)",iconSecondary:"var(--graphy-icon-secondary)",iconStickerBackground:"var(--graphy-icon-sticker-background)",border100:"var(--graphy-border-100)",border50:"var(--graphy-border-50)",border10:"var(--graphy-border-10)",sunkenBackground:"var(--graphy-sunken-background)",defaultBackground:"var(--graphy-default-background)",raisedBackground:"var(--graphy-raised-background)",overlayBackground:"var(--graphy-overlay-background)",overlayBorderGradient:"var(--graphy-overlay-border-gradient)",graphBackground:"var(--graphy-graph-background)",gridLineColor:"var(--graphy-grid-line-color)",originLineColor:"var(--graphy-origin-line-color)",targetLineColor:"var(--graphy-target-line-color)",targetLineMarkerColor:"var(--graphy-target-line-marker-color)",targetLineLabelTextColor:"var(--graphy-target-line-label-text-color)",legendBackground:"var(--graphy-legend-background)",legendBorderColor:"var(--graphy-legend-border-color)",legendFocusOutlineColor:"var(--graphy-legend-focus-outline-color)",legendTextColor:"var(--graphy-legend-text-color)",dimmedSeriesLabelTextColor:"var(--graphy-dimmed-series-label-text-color)",dimmedSeriesLabelLineColor:"var(--graphy-dimmed-series-label-line-color)",trendNegativeColor:"var(--graphy-trend-negative-color)",trendPositiveColor:"var(--graphy-trend-positive-color)",trendNeutralColor:"var(--graphy-trend-neutral-color)",defaultAnnotationArrowStroke:"var(--graphy-default-annotation-arrow-stroke)",defaultAnnotationShapeStroke:"var(--graphy-default-annotation-shape-stroke)",defaultAnnotationShapeFill:"var(--graphy-default-annotation-shape-fill)",arrowAnnotationStickerOutlineColor:"var(--graphy-arrow-annotation-sticker-outline-color)",arrowAnnotationStickerOutlineColorInverse:"var(--graphy-arrow-annotation-sticker-outline-color-inverse)",annotationFrameBorderColor:"var(--graphy-annotation-frame-border-color)",annotationMenuTriggerIconColor:"var(--graphy-annotation-menu-trigger-icon-color)",heatmapEmptyTileBackground:"var(--graphy-heatmap-empty-tile-background)",dataLabelOutsideBackground:"var(--graphy-data-label-outside-background)",canvasDefault:"var(--graphy-canvas-default)",canvasBlue:"var(--graphy-canvas-blue)",canvasCyan:"var(--graphy-canvas-cyan)",canvasGreen:"var(--graphy-canvas-green)",canvasYellow:"var(--graphy-canvas-yellow)",canvasOrange:"var(--graphy-canvas-orange)",canvasRed:"var(--graphy-canvas-red)",canvasPink:"var(--graphy-canvas-pink)",canvasPurple:"var(--graphy-canvas-purple)",canvasGray:"var(--graphy-canvas-gray)",canvasInverse:"var(--graphy-canvas-inverse)",elevationXs:"var(--graphy-elevation-xs)",elevationSm:"var(--graphy-elevation-sm)",elevationMd:"var(--graphy-elevation-md)",elevationLg:"var(--graphy-elevation-lg)",radiiXs:"var(--graphy-radii-xs)",radiiSm:"var(--graphy-radii-sm)",radiiMd:"var(--graphy-radii-md)",radiiLg:"var(--graphy-radii-lg)",spaceXxs:"var(--graphy-space-xxs)",spaceXs:"var(--graphy-space-xs)",spaceSm:"var(--graphy-space-sm)",spaceMd:"var(--graphy-space-md)",spaceLg:"var(--graphy-space-lg)",spaceXl:"var(--graphy-space-xl)",zIndexToolbar:"var(--graphy-z-index-toolbar)",zIndexToolbarTooltip:"var(--graphy-z-index-toolbar-tooltip)",zIndexToolbarPopover:"var(--graphy-z-index-toolbar-popover)",toolbarBackgroundColor:"var(--graphy-toolbar-background-color)",toolbarButtonBackgroundColor:"var(--graphy-toolbar-button-background-color)",toolbarButtonBackgroundColorHovered:"var(--graphy-toolbar-button-background-color-hovered)",toolbarButtonBackgroundColorSelected:"var(--graphy-toolbar-button-background-color-selected)",toolbarSeparatorColor:"var(--graphy-toolbar-separator-color)",tooltipBackground:"var(--graphy-tooltip-background)",tooltipBorderColor:"var(--graphy-tooltip-border-color)",tooltipHeadingTextColor:"var(--graphy-tooltip-heading-text-color)",tooltipLabelTextColor:"var(--graphy-tooltip-label-text-color)",tooltipValueTextColor:"var(--graphy-tooltip-value-text-color)",tooltipPrimaryRowColor:"var(--graphy-tooltip-primary-row-color)",hoverGuideLineColor:"var(--graphy-hover-guide-line-color)",hoverGuideFillColor:"var(--graphy-hover-guide-fill-color)",hoveredBarBorderColor:"var(--graphy-hovered-bar-border-color)",hoveredPointRingColor:"var(--graphy-hovered-point-ring-color)",pointStrokeColor:"var(--graphy-point-stroke-color)",stackedBarHoverBorderColor:"var(--graphy-stacked-bar-hover-border-color)",fontFamilyDefault:"var(--graphy-font-family-default)",fontFamilyHeading:"var(--graphy-font-family-heading)",fontWeightRegular:"var(--graphy-font-weight-regular)",fontWeightMedium:"var(--graphy-font-weight-medium)",fontWeightSemibold:"var(--graphy-font-weight-semibold)",fontWeightBold:"var(--graphy-font-weight-bold)",fontWeightExtraBold:"var(--graphy-font-weight-extra-bold)",fontWeightBlack:"var(--graphy-font-weight-black)",textScale:"var(--graphy-text-scale)",fontSizeXxs:"var(--graphy-font-size-xxs)",fontSizeXs:"var(--graphy-font-size-xs)",fontSizeSm:"var(--graphy-font-size-sm)",fontSizeMd:"var(--graphy-font-size-md)",fontSizeLg:"var(--graphy-font-size-lg)",fontSizeXl:"var(--graphy-font-size-xl)",fontLineHeightXxs:"var(--graphy-font-line-height-xxs)",fontLineHeightXs:"var(--graphy-font-line-height-xs)",fontLineHeightSm:"var(--graphy-font-line-height-sm)",fontLineHeightMd:"var(--graphy-font-line-height-md)",fontLineHeightLg:"var(--graphy-font-line-height-lg)",fontLineHeightXl:"var(--graphy-font-line-height-xl)",fontSizeEditorBody:"var(--graphy-font-size-editor-body)",fontSizeHeadingSm:"var(--graphy-font-size-heading-sm)",fontSizeHeadingMd:"var(--graphy-font-size-heading-md)",fontSizeHeadingLg:"var(--graphy-font-size-heading-lg)",fontLineHeightEditorBody:"var(--graphy-font-line-height-editor-body)",fontLineHeightHeadingSm:"var(--graphy-font-line-height-heading-sm)",fontLineHeightHeadingMd:"var(--graphy-font-line-height-heading-md)",fontLineHeightHeadingLg:"var(--graphy-font-line-height-heading-lg)",fontTickLabel:"var(--graphy-font-tick-label)",fontAxisLabel:"var(--graphy-font-axis-label)",fontDataLabel:"var(--graphy-font-data-label)",fontStackTotal:"var(--graphy-font-stack-total)",fontLegendLabel:"var(--graphy-font-legend-label)",fontSeriesLabel:"var(--graphy-font-series-label)",fontTooltipLabel:"var(--graphy-font-tooltip-label)",fontTooltipHeading:"var(--graphy-font-tooltip-heading)",fontTooltipFooter:"var(--graphy-font-tooltip-footer)",fontJumboTooltipLabel:"var(--graphy-font-jumbo-tooltip-label)",fontJumboTooltip:"var(--graphy-font-jumbo-tooltip)",fontMiniTooltipLabel:"var(--graphy-font-mini-tooltip-label)",fontMiniTooltipFooter:"var(--graphy-font-mini-tooltip-footer)",fontTooltipCaption:"var(--graphy-font-tooltip-caption)",fontTooltipCaptionSmall:"var(--graphy-font-tooltip-caption-small)",fontTrendTag:"var(--graphy-font-trend-tag)",fontTrendTagSmall:"var(--graphy-font-trend-tag-small)",fontGoalLineLabel:"var(--graphy-font-goal-line-label)",fontPieLabel:"var(--graphy-font-pie-label)",fontPieChartTotal:"var(--graphy-font-pie-chart-total)",fontDifferenceArrowSmall:"var(--graphy-font-difference-arrow-small)",fontDifferenceArrowMedium:"var(--graphy-font-difference-arrow-medium)",fontDifferenceArrowLarge:"var(--graphy-font-difference-arrow-large)",fontButton:"var(--graphy-font-button)",fontInput:"var(--graphy-font-input)",fontInputLabel:"var(--graphy-font-input-label)",fontSelectLabel:"var(--graphy-font-select-label)",fontSelectDescription:"var(--graphy-font-select-description)",fontColorSelectLabel:"var(--graphy-font-color-select-label)",fontMenuTitle:"var(--graphy-font-menu-title)",fontMenuGroupTitle:"var(--graphy-font-menu-group-title)",fontMenuItemLabel:"var(--graphy-font-menu-item-label)",fontMenuItemLabelSecondary:"var(--graphy-font-menu-item-label-secondary)",fontUITooltip:"var(--graphy-font-uitooltip)",fontUITooltipSecondary:"var(--graphy-font-uitooltip-secondary)",fontErrorBoundaryTitle:"var(--graphy-font-error-boundary-title)",fontErrorBoundaryMessage:"var(--graphy-font-error-boundary-message)",fontTableCell:"var(--graphy-font-table-cell)",fontTableHeaderCell:"var(--graphy-font-table-header-cell)",fontSourceLabel:"var(--graphy-font-source-label)",fontSourceLink:"var(--graphy-font-source-link)",fontTextEditorH1:"var(--graphy-font-text-editor-h1)",fontTextEditorH2:"var(--graphy-font-text-editor-h2)",fontTextEditorH3:"var(--graphy-font-text-editor-h3)",fontTextEditorH6:"var(--graphy-font-text-editor-h6)",fontTextEditorBody:"var(--graphy-font-text-editor-body)",fontTextEditorLink:"var(--graphy-font-text-editor-link)",fontHighlightModeTitle:"var(--graphy-font-highlight-mode-title)",fontHighlightModeSubtitle:"var(--graphy-font-highlight-mode-subtitle)"};const it=1,an=8,ao=12;l.pointStrokeColor;const io=1;function lo(e){return e}function z(e){return 1-e}const b=e=>`${Number.parseFloat((e*100).toFixed(4))}%`,co=2,uo=.7,re=({hit:e})=>{const t=f.getColor(e.observation),n=(f.getAlpha(e.observation)??it)*uo,o=(f.getSize(e.observation)??an)/2;return r.jsx("circle",{cx:b(e.x),cy:b(z(e.y)),r:o,fill:t,opacity:n,stroke:l.hoveredPointRingColor,strokeWidth:co,"data-testid":"companion-point"})},ln=.3,cn=1,D={type:"spring",stiffness:500,damping:60,mass:1},dn=1,ho=2,un=e=>e==="catmull-rom"?ne.curveCatmullRom:ne.curveLinear,Re=e=>{switch(e){case"dashed":return"8 4";case"dotted":return"2 2";case"solid":return}},Be=(e,t)=>t.lineWidth!=="auto"?t.lineWidth:f.getStrokeWidth(e)??ho,Ie=e=>t=>`${e}:${f.getIdentityKey(t)}`,Pe=(e,t)=>{const n=_.useMotionValue(e);return g.useEffect(()=>{const o=Gr.interpolatePath(n.get(),e);_.animate(0,1,{...t,onUpdate:s=>{const a=o(s);return n.set(a)}})},[t,e,n]),n};var fe="_1d8mpa10";const hn=(e,t)=>{const n=un(t.interpolate),o=ne.area().curve(n),s=ne.line().curve(n);if(e.mainAxis==="y"){const a=d=>z(f.getY(d)??0),c=d=>f.getXMin(d)??0,i=d=>f.getXMax(d)??f.getX(d)??0;o.y(a).x0(c).x1(i),s.y(a).x(i)}else{const a=d=>f.getX(d)??0,c=d=>z(f.getYMin(d)??0),i=d=>z(f.getYMax(d)??f.getY(d)??0);o.x(a).y0(c).y1(i),s.x(a).y(i)}if(t.missingValues==="gap"){const a=c=>f.getX(c)!==null&&f.getY(c)!==null;o.defined(a),s.defined(a)}return{lineGenerator:s,areaGenerator:o}},gn=(e,t)=>t!=="connect"?e:e.filter(n=>f.getX(n)!==null&&f.getY(n)!==null),go=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const{lineGenerator:s,areaGenerator:a}=g.useMemo(()=>hn(n,t.params),[t.params,n]),c=g.useMemo(()=>{const i=Ie(t.id),d=[];return t.data.groupBy(f.GROUP_VARIABLES.group).forEach(u=>{const h=gn([...u],t.params.missingValues),p=a(h),m=s(h);if(!p||!m)return;const x=h[0];if(!x)return;const v=f.getColor(x),y=f.getAlpha(x),j=Be(x,t.params),C=Re(f.getLineType(x));d.push({key:i(x),areaPath:p,linePath:m,color:v,fillOpacity:y??ln,strokeWidth:j,strokeOpacity:cn,strokeDasharray:C})}),d},[a,s,t.data,t.id,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:fe,children:c.map(i=>r.jsx(fo,{areaPath:i.areaPath,linePath:i.linePath,color:i.color,fillOpacity:i.fillOpacity,strokeWidth:i.strokeWidth,strokeOpacity:i.strokeOpacity,strokeDasharray:i.strokeDasharray,isAnimated:o},i.key))})}),fo=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:s,strokeOpacity:a,strokeDasharray:c,isAnimated:i})=>i?r.jsx(po,{areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:s,strokeOpacity:a,strokeDasharray:c}):r.jsxs("g",{children:[r.jsx("path",{d:e,fill:n,fillOpacity:o,stroke:"none"}),r.jsx("path",{d:t,fill:"none",stroke:n,strokeWidth:s,strokeOpacity:a,strokeDasharray:c,vectorEffect:"non-scaling-stroke"})]}),po=({areaPath:e,linePath:t,color:n,fillOpacity:o,strokeWidth:s,strokeOpacity:a,strokeDasharray:c})=>{const i=Pe(e,D),d=Pe(t,D);return r.jsxs("g",{children:[r.jsx(_.motion.path,{d:i,fill:n,fillOpacity:o,stroke:"none"}),r.jsx(_.motion.path,{d,fill:"none",stroke:n,strokeWidth:s,strokeOpacity:a,strokeDasharray:c,vectorEffect:"non-scaling-stroke"})]})};var mo="_46ebsf0";const Ge=1,xo=2,vo=1,yo=ao/2,bo=2.25,De=({hit:e,...t})=>{const n=So(e.observation),o=f.getColor(e.observation),s=f.getAlpha(e.observation)??it,a=b(e.x),c=b(z(e.y)),d=n+Ge/2+vo+Ge/2;return r.jsxs("g",{...t,className:mo,children:[r.jsx("circle",{cx:a,cy:c,r:d,fill:"none",stroke:l.hoveredPointRingColor,strokeWidth:xo}),r.jsx("circle",{cx:a,cy:c,r:n,fill:o,opacity:s,stroke:l.hoveredPointRingColor,strokeWidth:Ge})]})},So=e=>{const t=f.getSize(e);return f.isDefined(t)?t/bo:yo},jo=({layer:e,coordSystem:t,primary:n,companions:o})=>{const s=f.getGroup(n.observation),a=g.useMemo(()=>{const m=e.data.filter(f.GROUP_VARIABLES.group,"eq",s);return gn([...m],e.params.missingValues)},[e.data,e.params.missingValues,s]),{areaPath:c,linePath:i}=g.useMemo(()=>{const{lineGenerator:m,areaGenerator:x}=hn(t,e.params);return{areaPath:x(a)??"",linePath:m(a)??""}},[t,e.params,a]);if(!c||!i)return null;const d=f.getColor(n.observation),u=f.getAlpha(n.observation)??ln,h=Be(n.observation,e.params),p=Re(f.getLineType(n.observation));return r.jsxs("g",{"data-testid":"hovered-area",children:[r.jsxs("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"area",className:fe,children:[r.jsx("path",{d:c,fill:d,fillOpacity:u,stroke:"none","data-testid":"hovered-area-fill"}),r.jsx("path",{d:i,fill:"none",stroke:d,strokeWidth:h,strokeOpacity:cn,strokeDasharray:p,vectorEffect:"non-scaling-stroke","data-testid":"hovered-area-edge"})]}),o.map(m=>r.jsx(re,{hit:m},`companion-${m.layerId}-${m.pointIndex}`)),r.jsx(De,{hit:n,"data-testid":"hovered-area-point"})]})},Co={geom:"area",coord:"cartesian",highlightStrategy:"overlay-anchor",guideMode:"continuous",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(go,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({layer:e,coordSystem:t,primary:n,group:o,related:s})=>r.jsx(jo,{layer:e,coordSystem:t,primary:n,companions:[...o,...s]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(re,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e,coordSystem:t})=>{if(t.mainAxis==="x"){const s=f.getX(e),a=f.getYMax(e)??f.getY(e);return s===null||a===null?null:{x:s,y:a}}const n=f.getY(e),o=f.getXMax(e)??f.getX(e);return n===null||o===null?null:{x:o,y:n}}},fn=1,Se=4,pn=(e,t)=>{const n=f.getXMin(t),o=f.getXMax(t),s=f.getYMin(t),a=f.getYMax(t)??f.getY(t);if(n===null||o===null||s===null||a===null)return null;if(e==="x"){let d=1-a,u=a-s;return u<0&&(d+=u,u=-u),{x:n,y:d,width:o-n,height:u}}let c=n,i=o-n;return i<0&&(c+=i,i=-i),{x:c,y:1-a,width:i,height:a-s}},Lo=g.memo(function({layer:t,coordSystem:n,isAnimated:o}){const s=g.useId(),a=g.useMemo(()=>{const i=Ie(t.id),d=new Map;for(const u of t.data){const h=pn(n.mainAxis,u);if(!h)continue;const p=To(n.mainAxis,h),m=d.get(p),x={key:i(u),...h,fill:f.getColor(u),opacity:f.getAlpha(u)??fn};m?m.push(x):d.set(p,[x])}return[...d.entries()].map(([u,h])=>({id:`${s}${u}`,bars:h,...wo(h)}))},[s,n.mainAxis,t]),c=a.filter(i=>i.bars.length>1);return r.jsxs(r.Fragment,{children:[c.length>0&&r.jsx("defs",{children:c.map(i=>r.jsx("clipPath",{id:i.id,children:r.jsx(ko,{column:i,isAnimated:o})},i.id))}),a.map(i=>{const[d]=i.bars;if(i.bars.length===1&&d!==void 0){const{key:u,...h}=d;return r.jsx(mt,{...h,rx:Se,isAnimated:o},u)}return r.jsx("g",{clipPath:`url(#${i.id})`,children:i.bars.map(u=>{const{key:h,...p}=u;return r.jsx(mt,{...p,isAnimated:o},h)})},i.id)})]})}),mt=({isAnimated:e,rx:t,...n})=>e?r.jsx(_.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:D,fill:n.fill,opacity:n.opacity,rx:t,animate:{x:b(n.x),y:b(n.y),width:b(n.width),height:b(n.height),opacity:n.opacity}}):r.jsx("rect",{style:{transformBox:"view-box"},x:b(n.x),y:b(n.y),width:b(n.width),height:b(n.height),fill:n.fill,opacity:n.opacity,rx:t}),ko=({column:e,isAnimated:t})=>t?r.jsx(_.motion.rect,{initial:!1,style:{transformBox:"view-box"},transition:D,rx:Se,animate:{x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height)}}):r.jsx("rect",{x:b(e.x),y:b(e.y),width:b(e.width),height:b(e.height),rx:Se}),To=(e,t)=>e==="x"?`${t.x}-${t.width}`:`${t.y}-${t.height}`,wo=e=>{let t=1/0,n=1/0,o=-1/0,s=-1/0;for(const a of e)a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x+a.width>o&&(o=a.x+a.width),a.y+a.height>s&&(s=a.y+a.height);return{x:t,y:n,width:o-t,height:s-n}};var Ao="_1i6dtb60";const xe=3,Eo=({coordSystem:e,primary:t,panelRect:n})=>{const o=pn(e.mainAxis,t.observation);if(!o)return null;const s=o.x*n.width,a=o.y*n.height,c=o.width*n.width,i=o.height*n.height,d=s-xe,u=a-xe,h=c+xe*2,p=i+xe*2,m=Se+xe,x=f.getColor(t.observation),v=f.getAlpha(t.observation)??fn;return r.jsxs("g",{"data-testid":"hovered-bar",children:[r.jsx("rect",{x:d,y:u,width:h,height:p,rx:m,fill:l.hoveredBarBorderColor,className:Ao,"data-testid":"hovered-bar-border"}),r.jsx("rect",{x:b(o.x),y:b(o.y),width:b(o.width),height:b(o.height),fill:x,opacity:v,rx:Se,"data-testid":"hovered-bar-fill"})]})},_o={geom:"bar",coord:"cartesian",highlightStrategy:"observation-rerender",guideMode:"bar",render:({layer:e,coordSystem:t,isAnimated:n})=>r.jsx(Lo,{layer:e,coordSystem:t,isAnimated:n}),renderHover:({coordSystem:e,primary:t,panelRect:n})=>r.jsx(Eo,{coordSystem:e,primary:t,panelRect:n}),renderHoverCompanions:()=>null},mn=e=>{const t=ne.line().x(n=>f.getX(n)??0).y(n=>z(f.getY(n)??0)).curve(un(e.interpolate));return e.missingValues==="gap"&&t.defined(n=>f.getX(n)!==null&&f.getY(n)!==null),t},xn=(e,t)=>t!=="connect"?e:e.filter(n=>f.getX(n)!==null&&f.getY(n)!==null),Mo=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>mn(t.params),[t.params]),s=g.useMemo(()=>{const a=Ie(t.id),c=[];return t.data.groupBy(f.GROUP_VARIABLES.group).forEach(i=>{const d=xn([...i],t.params.missingValues),u=o(d);if(!u)return;const h=d[0];if(!h)return;const p=f.getColor(h),m=f.getAlpha(h),x=Be(h,t.params),v=Re(f.getLineType(h));c.push({key:a(h),pathData:u,color:p,opacity:m??dn,strokeWidth:x,strokeDasharray:v})}),c},[o,t.data,t.id,t.params]);return r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:fe,children:s.map(a=>r.jsx(Po,{pathData:a.pathData,color:a.color,strokeWidth:a.strokeWidth,opacity:a.opacity,strokeDasharray:a.strokeDasharray,isAnimated:n},a.key))})}),Po=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:s,isAnimated:a})=>a?r.jsx(Fo,{pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:s}):r.jsx("path",{d:e,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:s,vectorEffect:"non-scaling-stroke"}),Fo=({pathData:e,color:t,strokeWidth:n,opacity:o,strokeDasharray:s})=>{const a=Pe(e,D);return r.jsx(_.motion.path,{d:a,fill:"none",stroke:t,strokeWidth:n,opacity:o,strokeDasharray:s,vectorEffect:"non-scaling-stroke"})},No=({layer:e,primary:t,companions:n})=>{const o=f.getGroup(t.observation),s=g.useMemo(()=>{const h=e.data.filter(f.GROUP_VARIABLES.group,"eq",o);return xn([...h],e.params.missingValues)},[e.data,e.params.missingValues,o]),a=g.useMemo(()=>mn(e.params)(s),[e.params,s]);if(!a)return null;const c=f.getColor(t.observation),i=f.getAlpha(t.observation)??dn,d=Be(t.observation,e.params),u=Re(f.getLineType(t.observation));return r.jsxs("g",{"data-testid":"hovered-line",children:[r.jsx("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%","data-geom":"line",className:fe,children:r.jsx("path",{d:a,fill:"none",stroke:c,strokeWidth:d,opacity:i,strokeDasharray:u,vectorEffect:"non-scaling-stroke","data-testid":"hovered-line-path"})}),n.map(h=>r.jsx(re,{hit:h},`companion-${h.layerId}-${h.pointIndex}`)),r.jsx(De,{hit:t,"data-testid":"hovered-line-point"})]})},Ho={geom:"line",coord:"cartesian",highlightStrategy:"overlay-anchor",guideMode:"continuous",render:({layer:e,isAnimated:t})=>r.jsx(Mo,{layer:e,isAnimated:t}),renderHover:({layer:e,primary:t,group:n,related:o})=>r.jsx(No,{layer:e,primary:t,companions:[...n,...o]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(re,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=f.getX(e),n=f.getY(e);return t===null||n===null?null:{x:t,y:n}}},Ro=g.memo(function({layer:t,isAnimated:n}){const o=g.useMemo(()=>{const s=[];for(const a of t.data){const c=f.getX(a),i=f.getY(a);if(c===null||i===null)continue;const d=f.getColor(a),u=f.getAlpha(a),h=f.getSize(a),p=f.getStrokeWidth(a);s.push({key:f.getIdentityKey(a),cx:c,cy:z(i),radius:(h??t.params.size)/2,fill:d,stroke:l.pointStrokeColor,opacity:u??it,strokeWidth:p??io})}return s},[t.data,t.params.size]);return r.jsx(r.Fragment,{children:o.map(s=>n?r.jsx(_.motion.circle,{initial:!1,transition:D,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth,animate:{cx:b(s.cx),cy:b(s.cy),r:s.radius,opacity:s.opacity}},s.key):r.jsx("circle",{cx:b(s.cx),cy:b(s.cy),r:s.radius,fill:s.fill,opacity:s.opacity,stroke:s.stroke,strokeWidth:s.strokeWidth},s.key))})}),Bo={geom:"point",coord:"cartesian",highlightStrategy:"overlay-anchor",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(Ro,{layer:e,isAnimated:t}),renderHover:({primary:e,group:t,related:n})=>r.jsxs("g",{"data-testid":"hovered-point",children:[[...t,...n].map(o=>r.jsx(re,{hit:o},`companion-${o.layerId}-${o.pointIndex}`)),r.jsx(De,{hit:e})]}),renderHoverCompanions:({related:e})=>r.jsx(r.Fragment,{children:e.map(t=>r.jsx(re,{hit:t},`companion-${t.layerId}-${t.pointIndex}`))}),getOverlayAnchor:({observation:e})=>{const t=f.getX(e),n=f.getY(e);return t===null||n===null?null:{x:t,y:n}}},vn=10,K=(e,t)=>e*vn*t,Io=/\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu,yn="😀";class Oe{constructor(){this.emojiCorrections=new Map,this.currentFont="";const n=new OffscreenCanvas(1,1).getContext("2d");if(!n)throw new Error("Failed to create OffscreenCanvas 2D context");this.ctx=n}static async create(){return typeof document<"u"&&"fonts"in document&&await document.fonts.ready,new Oe}measureText(t,n){const o=f.buildFontString(n);this.setFont(o);const{width:s,fontBoundingBoxAscent:a,fontBoundingBoxDescent:c}=this.ctx.measureText(t);let i=s;const d=Do(t);if(d>0){const u=this.getEmojiCorrection(o);i-=u*d}return{width:i,height:a+c,ascent:a,descent:c}}setFont(t){this.currentFont!==t&&(this.ctx.font=t,this.currentFont=t)}getEmojiCorrection(t){const n=this.emojiCorrections.get(t);if(n!==void 0)return n;this.setFont(t);const o=this.ctx.measureText(yn).width,s=Oo(t);let a=0;if(s!==null){const c=o-s;a=c>.5?c:0}return this.emojiCorrections.set(t,a),a}}let V=null;const Do=e=>{const t=e.match(Io);return t?t.length:0},Oo=e=>{const t=zo();return t?(t.style.font=e,t.getBoundingClientRect().width):null},zo=()=>typeof document>"u"?null:(V||(V=document.createElement("span"),V.style.position="absolute",V.style.visibility="hidden",V.style.whiteSpace="nowrap",V.style.left="-9999px",V.textContent=yn,document.body.appendChild(V)),V),bn=g.createContext(null),Sn=({children:e,measurer:t})=>{const[n,o]=g.useState(null);g.useEffect(()=>{if(t!==void 0)return;let a=!1;const c=()=>{a||o(Go())};return(async()=>{typeof document<"u"&&"fonts"in document&&await document.fonts.ready,c()})(),typeof document<"u"&&"fonts"in document&&document.fonts.addEventListener("loadingdone",c),()=>{a=!0,typeof document<"u"&&"fonts"in document&&document.fonts.removeEventListener("loadingdone",c)}},[t]);const s=t??n;return s===null?null:r.jsx(bn.Provider,{value:s,children:e})},oe=()=>{const e=g.useContext(bn);if(e===null)throw new Error("useTextMeasurer must be used inside a <TextMeasurerProvider>.");return e},Go=()=>{try{return new f.CachedTextMeasurer(new Oe)}catch{return new f.CachedTextMeasurer(new f.HeuristicTextMeasurer)}},O=`'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu',
3
+ 'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`,$o=O,U={regular:400,medium:500,semibold:600,bold:700,extraBold:800,black:900},F={xxs:1,xs:1.1,sm:1.2,md:1.4,lg:1.6,xl:2,editorBody:1.5,headingSm:1.8,headingMd:2.2,headingLg:2.8},I={xxs:1,xs:1,sm:1.3,md:1.43,lg:1,xl:1,editorBody:1.47,headingSm:1.25,headingMd:1.41,headingLg:1.29},Wo=`var(--typography-chart-font-family, ${l.fontFamilyDefault})`,$e=`var(--typography-chart-heading-font-family, ${l.fontFamilyHeading})`,W=e=>`${e}em`,jn={textScale:"1",fontFamilyDefault:O,fontFamilyHeading:$o,fontWeightRegular:U.regular.toString(),fontWeightMedium:U.medium.toString(),fontWeightSemibold:U.semibold.toString(),fontWeightBold:U.bold.toString(),fontWeightExtraBold:U.extraBold.toString(),fontWeightBlack:U.black.toString(),fontSizeXxs:W(F.xxs),fontSizeXs:W(F.xs),fontSizeSm:W(F.sm),fontSizeMd:W(F.md),fontSizeLg:W(F.lg),fontSizeXl:W(F.xl),fontLineHeightXxs:I.xxs.toString(),fontLineHeightXs:I.xs.toString(),fontLineHeightSm:I.sm.toString(),fontLineHeightMd:I.md.toString(),fontLineHeightLg:I.lg.toString(),fontLineHeightXl:I.xl.toString()},Cn={fontSizeEditorBody:W(F.editorBody),fontSizeHeadingSm:W(F.headingSm),fontSizeHeadingMd:W(F.headingMd),fontSizeHeadingLg:W(F.headingLg),fontLineHeightEditorBody:I.editorBody.toString(),fontLineHeightHeadingSm:I.headingSm.toString(),fontLineHeightHeadingMd:I.headingMd.toString(),fontLineHeightHeadingLg:I.headingLg.toString()},S=(e,t,n,o=Wo)=>`${e} ${t}/${n} ${o}`,Ln={fontTickLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontAxisLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontDataLabel:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontStackTotal:S(l.fontWeightSemibold,l.fontSizeXs,l.fontLineHeightXs),fontLegendLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontSeriesLabel:S(l.fontWeightSemibold,l.fontSizeSm,l.fontLineHeightSm),fontTooltipLabel:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTooltipHeading:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTooltipFooter:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontJumboTooltipLabel:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontJumboTooltip:S(l.fontWeightMedium,l.fontSizeHeadingMd,l.fontLineHeightHeadingMd),fontMiniTooltipLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontMiniTooltipFooter:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontTooltipCaption:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTooltipCaptionSmall:S(l.fontWeightMedium,l.fontSizeXxs,l.fontLineHeightXxs),fontUITooltip:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontUITooltipSecondary:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTrendTag:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTrendTagSmall:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontGoalLineLabel:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontPieLabel:S(l.fontWeightMedium,l.fontSizeXs,l.fontLineHeightXs),fontPieChartTotal:S(l.fontWeightBold,l.fontSizeHeadingLg,l.fontLineHeightHeadingLg),fontDifferenceArrowSmall:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontDifferenceArrowMedium:S(l.fontWeightMedium,l.fontSizeLg,l.fontLineHeightLg),fontDifferenceArrowLarge:S(l.fontWeightSemibold,l.fontSizeXl,l.fontLineHeightXl),fontButton:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontInput:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontInputLabel:S(l.fontWeightMedium,l.fontSizeXxs,l.fontLineHeightXxs),fontSelectLabel:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontSelectDescription:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontColorSelectLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontMenuTitle:S(l.fontWeightSemibold,l.fontSizeMd,l.fontLineHeightMd),fontMenuGroupTitle:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontMenuItemLabel:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontMenuItemLabelSecondary:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontErrorBoundaryTitle:S(l.fontWeightSemibold,l.fontSizeHeadingSm,l.fontLineHeightHeadingSm),fontErrorBoundaryMessage:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTableCell:S(l.fontWeightMedium,l.fontSizeMd,l.fontLineHeightMd),fontTableHeaderCell:S(l.fontWeightSemibold,l.fontSizeSm,l.fontLineHeightSm),fontSourceLabel:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontSourceLink:S(l.fontWeightRegular,l.fontSizeSm,l.fontLineHeightSm),fontTextEditorH1:S(l.fontWeightBold,l.fontSizeHeadingLg,l.fontLineHeightHeadingLg,$e),fontTextEditorH2:S(l.fontWeightBold,l.fontSizeHeadingMd,l.fontLineHeightHeadingMd,$e),fontTextEditorH3:S(l.fontWeightSemibold,l.fontSizeHeadingSm,l.fontLineHeightHeadingSm,$e),fontTextEditorH6:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm),fontTextEditorBody:S(l.fontWeightMedium,l.fontSizeEditorBody,l.fontLineHeightEditorBody),fontTextEditorLink:S(l.fontWeightRegular,l.fontSizeMd,l.fontLineHeightMd),fontHighlightModeTitle:S(l.fontWeightBold,l.fontSizeMd,l.fontLineHeightMd),fontHighlightModeSubtitle:S(l.fontWeightMedium,l.fontSizeSm,l.fontLineHeightSm)},Xo=11.7,qo=F.xs,Yo=O,Vo=U.medium,ye=5,Uo=5,xt=10,vt=10,Ko=4,Fe=13,kn=6,We=12,yt=21.6,Zo="0 0 10 18",Jo="M2.48935 16.9323L9.07098 9.82964C9.51595 9.34944 9.51504 8.60728 9.0689 8.12818L2.48866 1.06172C1.85811 0.384586 0.974477 0 0.049217 0H0V18H0.0443689C0.972463 18 1.85854 17.6131 2.48935 16.9323Z",bt="#FFFFFF",Xe="#1A1A1A";var Qo="_16vokpr0";const es=(e,t)=>{const n=e.mapping.y!==void 0,o=t.mainAxis==="y";return n!==o},ts=(e,t)=>{const n=b(e?1-t:t);return e?{x1:"0%",y1:n,x2:"100%",y2:n}:{x1:n,y1:"0%",x2:n,y2:"100%"}},ns=(e,t)=>e==="solid"?{}:e==="dotted"?{strokeDasharray:`0 ${t*2}`,strokeLinecap:"round"}:{strokeDasharray:`${t*2} ${t*3}`,strokeLinecap:"round",strokeMiterlimit:16},rs=e=>{const t=e.params.color,n=t??l.targetLineColor;let o=l.targetLineLabelTextColor;if(t!==void 0)try{o=Ze.getContrast(t,bt)>Ze.getContrast(t,Xe)?bt:Xe}catch{o=Xe}return{lineColor:n,labelTextColor:o}},os=(e,t)=>Te(e)&&Te(t)?`${e}: ${t}`:Te(e)?e:Te(t)?t:null,Te=e=>e!=null&&e.trim()!=="";var ss="_2qyyu60";const St=2,as=12,is=12,jt=1,Ct=2,ls=4,je=({shape:e,color:t,lineType:n="solid",width:o=as,height:s=is})=>r.jsx("svg",{className:ss,width:o,height:s,viewBox:`0 0 ${o} ${s}`,"aria-hidden":!0,"data-testid":"chart-swatch","data-shape":e,children:cs({shape:e,color:t,lineType:n,width:o,height:s})}),cs=({shape:e,color:t,lineType:n,width:o,height:s})=>{const a=ds(n,o);switch(e){case"square":return r.jsx("rect",{x:1,y:1,width:o-2,height:s-2,rx:2,fill:t});case"line":return r.jsx("line",{x1:a.x1,y1:s/2,x2:a.x2,y2:s/2,stroke:t,strokeWidth:St,strokeLinecap:a.linecap,strokeDasharray:a.dashArray});case"circle":{const c=(Math.min(o,s)-2)/2;return r.jsx("circle",{cx:o/2,cy:s/2,r:c,fill:t})}case"area":{const c=s/2-1;return r.jsxs(r.Fragment,{children:[r.jsx("rect",{x:1,y:c,width:o-2,height:s-c-1,fill:t,opacity:.45}),r.jsx("line",{x1:a.x1,y1:c,x2:a.x2,y2:c,stroke:t,strokeWidth:St,strokeLinecap:a.linecap,strokeDasharray:a.dashArray})]})}case"slice":return r.jsx("path",{d:`M 0 ${s} L ${o} ${s} A ${o} ${s} 0 0 0 0 0 Z`,fill:t})}},ds=(e,t)=>{if(e==="solid")return{x1:0,x2:t,dashArray:void 0,linecap:"round"};if(e==="dashed"){const o=(t-jt*(Ct-1))/Ct;return{x1:0,x2:t,dashArray:`${o} ${jt}`,linecap:"butt"}}const n=t/(ls-1);return{x1:0,x2:t,dashArray:`1 ${n}`,linecap:"round"}},us=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:s,text:a,isAnimated:c})=>{const i=e==="start",d=i?-Fe:-(o-Fe),u=i?d+o-ye:d+ye-We,h=i?void 0:`rotate(180 ${u+We/2} ${s/2})`,p=i?"0%":"100%",m=b(1-t),x=r.jsxs("g",{transform:`translate(0, ${-s/2})`,pointerEvents:"none",children:[r.jsx("rect",{x:d,y:0,width:o,height:s,rx:kn,fill:n}),r.jsx("g",{transform:h,children:r.jsx("svg",{x:u,y:(s-yt)/2,width:We,height:yt,viewBox:Zo,overflow:"visible",children:r.jsx("path",{d:Jo,fill:n})})}),r.jsx("g",{transform:`translate(${d+ye}, ${s/2})`,children:a})]});return c?r.jsx(_.motion.svg,{initial:!1,transition:D,x:p,animate:{y:m},overflow:"visible",children:x}):r.jsx("svg",{x:p,y:m,overflow:"visible",children:x})},hs=({labelPosition:e,linePosition:t,color:n,pillWidth:o,pillHeight:s,text:a,isAnimated:c})=>{const i=e==="start",d=i?-Fe:-(s-Fe),u=b(t),h=i?"100%":"0%",p=r.jsxs("g",{transform:`translate(${-o/2}, 0)`,pointerEvents:"none",children:[r.jsx("rect",{x:0,y:d,width:o,height:s,rx:kn,fill:n}),r.jsx("g",{transform:`translate(${ye}, ${d+s/2})`,children:a})]});return c?r.jsx(_.motion.svg,{initial:!1,transition:D,y:h,animate:{x:u},overflow:"visible",children:p}):r.jsx("svg",{x:u,y:h,overflow:"visible",children:p})},gs=({label:e,textWidth:t,labelPosition:n,isHorizontalLine:o,position:s,color:a,textColor:c,symbolShape:i,symbolColor:d,isAnimated:u})=>{const h=i===null?0:xt+Ko,p=t+h+ye*2,m=Xo+Uo*2,x=r.jsxs(r.Fragment,{children:[i!==null&&d!==null&&r.jsx("g",{transform:`translate(0, ${-vt/2})`,children:r.jsx(je,{shape:i,color:d,width:xt,height:vt})}),r.jsx("text",{x:h,textAnchor:"start",dominantBaseline:"central",fill:c,style:{font:l.fontGoalLineLabel},children:e})]});return o?r.jsx(us,{labelPosition:n,linePosition:s,color:a,pillWidth:p,pillHeight:m,text:x,isAnimated:u}):r.jsx(hs,{labelPosition:n,linePosition:s,color:a,pillWidth:p,pillHeight:m,text:x,isAnimated:u})},fs=({layer:e,isHorizontalLine:t,position:n,lineColor:o,isAnimated:s})=>{const a=ts(t,n),c=ns(e.params.lineType,e.params.strokeWidth);return s?r.jsx(_.motion.line,{initial:!1,transition:D,animate:{x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},...c,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"}):r.jsx("line",{...a,...c,stroke:o,strokeWidth:e.params.strokeWidth,vectorEffect:"non-scaling-stroke"})},ps=g.memo(function({layer:t,coordSystem:n,formattingLocale:o,isAnimated:s}){const a=oe(),{guides:c,numberFormat:i,textScale:d,layers:u,compiledLayers:h,colorScale:p}=T(R.useShallow(A=>({guides:A.guides,numberFormat:A.config.numberFormat,textScale:A.config.appearance.textScale,layers:A.spec.layers,compiledLayers:A.layers,colorScale:A.scales.color}))),m=g.useMemo(()=>f.buildAverageLineSymbols(u,h,p,n).get(t.id)??null,[u,h,p,n,t.id]),x=g.useMemo(()=>os(t.params.label,f.formatRuleValue({guides:c,numberFormat:i,layer:t,locale:o})),[c,i,o,t]),v=g.useMemo(()=>({family:Yo,size:K(qo,d),weight:Vo}),[d]),y=g.useMemo(()=>x===null?0:a.measureText(x,v).width,[x,v,a]),j=t.data.getFirst();if(!j)return null;const{lineColor:C,labelTextColor:L}=rs(t),k=es(t,n),w=k?f.getY(j):f.getX(j);return w===null?null:r.jsxs("g",{"data-geom":"rule",className:Qo,children:[r.jsx(fs,{layer:t,isHorizontalLine:k,position:w,lineColor:C,isAnimated:s}),x!==null&&r.jsx(gs,{label:x,textWidth:y,labelPosition:t.params.labelPosition,isHorizontalLine:k,position:w,color:C,textColor:L,symbolShape:m?.shape??null,symbolColor:m?.color??null,isAnimated:s})]})}),ms={geom:"rule",coord:"cartesian",highlightStrategy:null,guideMode:null,render:({layer:e,coordSystem:t,formattingLocale:n,isAnimated:o})=>r.jsx(ps,{layer:e,coordSystem:t,formattingLocale:n,isAnimated:o}),renderHover:()=>null,renderHoverCompanions:()=>null},Tn=1,Qe=ne.arc(),Lt=Math.PI*2,xs=g.memo(function({layer:t,isAnimated:n}){const o=g.useRef(!1);g.useEffect(()=>{o.current=!0},[]);const s=g.useMemo(()=>{const a=Ie(t.id),c=[];for(const i of t.data){const d=a(i),{startAngle:u,endAngle:h}=f.getAngleExtent(i),{innerRadius:p,outerRadius:m}=f.getRadiusExtent(i);u===null||h===null||p===null||m===null||c.push({key:d,startAngle:u,endAngle:h,innerRadius:p,outerRadius:m,fill:f.getColor(i),opacity:f.getAlpha(i)??Tn})}return c},[t]);return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"bar",className:fe,children:s.map(a=>{if(n){const{key:c,...i}=a;return r.jsx(vs,{isInitialRender:!o.current,...i},c)}return r.jsx("path",{d:Qe({startAngle:a.startAngle,endAngle:a.endAngle,innerRadius:a.innerRadius,outerRadius:a.outerRadius})??void 0,fill:a.fill,opacity:a.opacity},a.key)})})}),vs=({startAngle:e,endAngle:t,innerRadius:n,outerRadius:o,fill:s,opacity:a,isInitialRender:c})=>{const i=c?e:Lt,d=c?t:Lt,u=_.useSpring(i,D),h=_.useSpring(d,D),p=_.useMotionValue(Qe({startAngle:i,endAngle:d,innerRadius:n,outerRadius:o})??"");return g.useEffect(()=>{u.set(e),h.set(t)},[u,h,e,t]),g.useEffect(()=>{const m=()=>{const y=u.get(),j=h.get();p.set(Qe({startAngle:y,endAngle:j,innerRadius:n,outerRadius:o})??"")},x=u.on("change",m),v=h.on("change",m);return()=>{x(),v()}},[u,h,n,o,p]),r.jsx(_.motion.path,{d:p,fill:s,opacity:a,transition:D})},ys=ne.arc(),bs=({primary:e})=>{const{startAngle:t,endAngle:n}=f.getAngleExtent(e.observation),{innerRadius:o,outerRadius:s}=f.getRadiusExtent(e.observation);if(t===null||n===null||o===null||s===null)return null;const a=ys({startAngle:t,endAngle:n,innerRadius:o,outerRadius:s});if(!a)return null;const c=f.getColor(e.observation),i=f.getAlpha(e.observation)??Tn;return r.jsx("svg",{viewBox:"-1 -1 2 2",preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%","data-geom":"arc","data-testid":"hovered-arc",className:fe,children:r.jsx("path",{d:a,fill:c,opacity:i})})},Ss={geom:"bar",coord:"polar",highlightStrategy:"observation-rerender",guideMode:null,render:({layer:e,isAnimated:t})=>r.jsx(xs,{layer:e,isAnimated:t}),renderHover:({primary:e})=>r.jsx(bs,{primary:e}),renderHoverCompanions:()=>null},kt={bar:{cartesian:_o,polar:Ss},line:{cartesian:Ho},area:{cartesian:Co},point:{cartesian:Bo},rule:{cartesian:ms}},js=(e=[])=>{const t={};for(const n of Object.keys(kt))t[n]={...kt[n]};for(const n of e){const o=t[n.geom]??{};o[n.coord]=n,t[n.geom]=o}return(n,o)=>t[n.geom]?.[o.type]??null},Cs=e=>st.createStore(t=>({compiled:e,setCompiled:n=>t(o=>o.compiled===n?o:{compiled:n})}));function Ls(e,t){const n=f.isGraphConfig(e)?e.themeOverrides:void 0;return g.useMemo(()=>({...t,...n}),[t,n])}var ks="_118r5t40",Ts="_118r5t41",ws="_118r5t42";function As(e=[],t=[]){return e.length===t.length&&e.every((n,o)=>Object.is(n,t[o]))}class Es extends g.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("Chart failed to render:",t.message,n.componentStack)}componentDidUpdate(t){this.state.error&&!As(t.resetKeys,this.props.resetKeys)&&this.setState({error:null})}render(){const{error:t}=this.state;return t?r.jsxs("div",{role:"alert",className:ks,children:[r.jsx("strong",{className:Ts,children:"This chart could not be rendered."}),r.jsx("pre",{className:ws,children:t.message})]}):this.props.children}}const wn=g.createContext(null),_s=e=>r.jsx(Es,{resetKeys:[e.input,e.data],children:r.jsx(Ps,{...e})}),se=()=>{const e=g.useContext(wn);if(!e)throw new Error("useGraph* hooks must be used inside a <GraphProvider>");return e},T=e=>{const{store:t}=se();return be.useStore(t,n=>e(n.compiled))},lt=()=>{const{dispatch:e}=se();return e},Ce=()=>{const{resolvePlugin:e}=se();return e},Ms=()=>{const{resolveAnnotationPlugin:e}=se();return e},Ps=({data:e,input:t,formattingLocale:n,onChange:o,customPalettes:s,theme:a="light",themeOverrides:c,geoms:i,stats:d,transforms:u,plugins:h,annotationPlugins:p,id:m,children:x})=>{const[v]=g.useState(()=>f.createCompiler({geoms:i,stats:d,transforms:u})),[y]=g.useState(()=>Ur(v)),j=g.useMemo(()=>js(h),[h]),C=g.useMemo(()=>Yr(p),[p]),L=Ls(t,c),k=g.useMemo(()=>({customPalettes:s,theme:a}),[s,a]),[w]=g.useState(()=>{const G=v.compile({input:t,data:e,ctx:k});return y.emit({kind:"init"}),Cs(G)}),A=g.useRef({input:t,data:e,ctx:k});g.useEffect(()=>{const G=t!==A.current.input,J=e!==A.current.data,$=k!==A.current.ctx;if(!G&&!J&&!$)return;const X=w.getState(),q=G||$?v.compile({input:t,data:e,ctx:k}):v.recompile({spec:X.compiled.spec,data:e});A.current={input:t,data:e,ctx:k},X.setCompiled(q),y.emit({kind:G?"input":"data"})},[t,e,k,v,w,y]);const le=g.useCallback(G=>{const J=w.getState(),$=G.apply(J.compiled.spec);if(!$)return;const X=v.recompile({spec:$.spec});if(J.setCompiled(X),y.emit({kind:"command",command:G}),!o)return;const q=f.convertSpecToInput($.spec);A.current={input:q,data:A.current.data,ctx:A.current.ctx},o(q)},[o,v,y,w]);no({id:m,store:w,dispatch:le});const ee=g.useMemo(()=>({store:w,dispatch:le,formattingLocale:n,compileBus:y,theme:a,themeOverrides:L,resolvePlugin:j,resolveAnnotationPlugin:C,id:m}),[w,le,n,y,a,L,j,C,m]);return r.jsx(wn.Provider,{value:ee,children:x})};var Fs="drqe3u0",Ns="drqe3u1",Hs="drqe3u2",Rs="drqe3u3",we="drqe3u4",Bs="drqe3u5",Is="drqe3u6",Ds="drqe3u7",qe="drqe3u8",Os="drqe3u9",zs="drqe3ua",Gs="drqe3ub",$s="drqe3uc",Ws="drqe3ud",Xs="drqe3ue",qs="drqe3uf",Ys="drqe3ug",Vs="drqe3uh",Us="drqe3ui",Tt={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},wt={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},An={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const Ks=({width:e=380,style:t,className:n}={})=>{const{compileBus:o}=se(),[s]=g.useState(()=>Kr()),[a,c]=g.useState(!1),[i,d]=g.useState(f.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:v}=s.getState(),y=o.getLastTrigger(),j=o.getLastCompile();return y&&j&&v(y,j),o.subscribe(v)},[s,o]);const u=be.useStore(s,v=>v.lastCompile),h=be.useStore(s,v=>v.history),p=o.getCacheStats(),m=u===null&&h.length===0,x=()=>{d(v=>{const y=!v;return f.setCompilerCachingEnabled(y),y})};return r.jsxs("div",{className:H(zs,n),style:{width:e,...t},children:[r.jsxs("div",{className:Fs,children:[r.jsxs("div",{children:[r.jsx("div",{className:Ns,children:"compile cache"}),r.jsx("div",{className:Xs,children:m?"production: stats disabled":u?`last: ${u.label} · ${En(u.durationMs)}`:"awaiting first compile…"})]}),r.jsx("button",{type:"button",onClick:()=>c(v=>!v),className:qs,children:a?"▾":"▴"})]}),!a&&r.jsxs("div",{className:Gs,children:[r.jsxs("button",{type:"button",onClick:x,className:i?Tt.enabled:Tt.disabled,"aria-pressed":i,children:["cache ",i?"enabled":"disabled"]}),r.jsx("span",{className:Ys,children:"next compile reflects this toggle"})]}),!a&&!m&&r.jsxs(r.Fragment,{children:[r.jsx(Zs,{delta:u?.stages,cumulative:p}),r.jsx(Js,{entries:h})]})]})},Zs=({delta:e,cumulative:t})=>r.jsxs("table",{className:Hs,children:[r.jsx("thead",{children:r.jsxs("tr",{className:Vs,children:[r.jsx("th",{className:Rs,children:"stage"}),r.jsx("th",{className:we,children:"Δ miss"}),r.jsx("th",{className:we,children:"Δ hit"}),r.jsx("th",{className:we,children:"total miss"}),r.jsx("th",{className:we,children:"total hit"})]})}),r.jsx("tbody",{children:f.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],s=Qs(o);return r.jsxs("tr",{className:$s,children:[r.jsxs("td",{className:Bs,children:[r.jsx("span",{className:An[s],"aria-hidden":!0})," ",n]}),r.jsx("td",{className:s==="ran"?wt.ran:wt.dim,children:o?.misses??0}),r.jsx("td",{className:qe,children:o?.hits??0}),r.jsx("td",{className:qe,children:t[n].misses}),r.jsx("td",{className:qe,children:t[n].hits})]},n)})})]}),Js=({entries:e})=>e.length===0?null:r.jsxs("div",{className:Ws,children:[r.jsx("div",{className:Us,children:"recent compiles"}),e.map(t=>{const n=ea(t.stages,a=>a.misses>0),o=f.COMPILER_STAGE_KEYS.length,s=n===0?"cached":"ran";return r.jsxs("div",{className:Is,children:[r.jsx("span",{className:An[s],"aria-hidden":!0}),r.jsx("span",{className:Ds,title:t.label,children:t.label}),r.jsxs("span",{className:Os,children:[n,"/",o," ran · ",En(t.durationMs)]})]},t.id)})]}),Qs=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",ea=(e,t)=>{let n=0;for(const o of f.COMPILER_STAGE_KEYS)t(e[o])&&(n+=1);return n},En=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,ta={small:1.9,medium:2.3,large:2.6},na={small:1,medium:1,large:1.2},ra=O,_n=I.sm,oa=12,sa=4,aa=4,ia=12,la=4,ca=2,Mn=24,da=()=>st.createStore(e=>({hover:f.RESTING_HOVER_STATE,isPointerInside:!1,setHoverState:t=>e(n=>n.hover===t?n:{hover:t}),setPointerInside:t=>e(n=>n.isPointerInside===t?n:{isPointerInside:t})})),ua=(e,t)=>{const n=g.useMemo(()=>({layers:e,coordSystem:t}),[e,t]),o=g.useRef(null);o.current===null&&(o.current=new f.HoverEngine(n));const s=o.current,a=g.useRef(!1);return g.useEffect(()=>{if(!a.current){a.current=!0;return}s.update(n)},[s,n]),s},Pn=g.createContext(null),Fn=({children:e})=>{const{layers:t,coordSystem:n}=T(R.useShallow(d=>({layers:d.layers,coordSystem:d.coordSystem}))),o=ua(t,n),[s]=g.useState(()=>da()),a=g.useRef(null),c=g.useRef(null);if(c.current===null){const d=new Map,u={current:null},h=new Set,p=x=>{if(u.current=x,s.getState().setPointerInside(x!==null),x!==null)for(const v of h)v()},m=x=>(h.add(x),()=>{h.delete(x)});c.current={engine:o,store:s,overlayRef:a,hitTesterRegistry:d,cursorRef:u,setCursor:p,subscribeCursorMove:m}}const{hitTesterRegistry:i}=c.current;return g.useEffect(()=>{o.setHitTesters(i)},[o,i]),r.jsx(Pn.Provider,{value:c.current,children:e})},pe=()=>{const e=g.useContext(Pn);if(e===null)throw new Error("useHoverContext must be used inside a <HoverProvider>.");return e};function Le(e){const{store:t}=pe();return be.useStore(t,e)}var ha="_19519k80",ga="_19519k81",fa="_19519k82",pa="_19519k83",ma="_19519k86",xa="_19519k87",va="_19519k88";const Nn=({content:e})=>r.jsxs(r.Fragment,{children:[e.header!==null&&r.jsx("div",{className:ha,children:e.header}),r.jsx("div",{className:ga,children:e.rows.map(t=>r.jsx(Hn,{row:t,shouldHighlight:t.isPrimary&&e.rows.length>1},t.key))})]}),Hn=({row:e,shouldHighlight:t})=>r.jsxs("div",{className:H(fa,{[pa]:t}),"data-testid":"chart-tooltip-row",children:[e.swatchColor!==null?r.jsx(je,{shape:e.swatchShape,color:e.swatchColor,lineType:e.swatchLineType}):null,r.jsx("span",{className:ma,children:e.label}),r.jsx("span",{className:xa,children:e.value})]}),ya=e=>{const{cursorRef:t,subscribeCursorMove:n}=pe(),o=Le(a=>a.isPointerInside),s=g.useRef(e);return s.current=e,g.useEffect(()=>n(()=>s.current?.()),[n]),{cursorRef:t,isInside:o}},ba=16,Sa=8,ja={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Ca=()=>{const e=T(R.useShallow(C=>({layers:C.layers,coordSystem:C.coordSystem,scales:C.scales,guides:C.guides,numberFormat:C.config.numberFormat,parsingLocale:C.config.parsingLocale}))),{formattingLocale:t}=se(),n=Le(C=>C.hover),o=Ce(),s=g.useRef(()=>{}),{cursorRef:a,isInside:c}=ya(()=>s.current()),i=g.useMemo(()=>f.buildTooltipContent({...e,hover:n,formattingLocale:t}),[e,n,t]),d=i!==null&&c,u=g.useMemo(()=>({getBoundingClientRect:()=>{const C=a.current;return C===null?ja:La(C)}}),[a]),{refs:h,floatingStyles:p,update:m}=N.useFloating({open:d,placement:"right",middleware:[N.offset(ba),N.flip(),N.shift({padding:Sa})],elements:{reference:u}});if(s.current=m,!d)return null;const x=n.primary,v=x===null?null:e.layers.find(C=>C.id===x.layerId)??null,y=v===null?null:o(v,e.coordSystem),j=x!==null&&v!==null&&y?.renderTooltip?y.renderTooltip({content:i,layer:v,coordSystem:e.coordSystem,primary:x,group:n.group,related:n.related}):null;return r.jsx("div",{ref:h.setFloating,role:"tooltip",className:va,style:p,"data-testid":"chart-tooltip",children:j??r.jsx(Nn,{content:i})})},La=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),ct=F.sm,Rn=O,Bn=!1,Ae=6,Q=10,ka=(e,t)=>n=>{if(!n.isVisible||n.ticks.length===0)return 0;const o=n.position==="top"||n.position==="bottom",s=n.ticks.map(i=>e.measureText(i.formattedLabel,{family:Rn,size:K(ct,t)})),a=n.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(o){if(n.labelRotation!==0){const i=s.map(u=>u.width);return At(i,a)+2*Q}return Math.max(...s.map(i=>i.height))+Q}return At(s.map(i=>i.width),a)+Q},At=(e,t)=>Math.min(Math.max(...e),t),Ta=e=>()=>K(ct,e),wa=(e,t)=>(n,o)=>{const{labelLineHeight:s,labelFontWeight:a}=f.getDifferenceArrowDimensions(o,t);return e.measureText(n,{family:O,size:s,weight:a})},In=e=>{const{value:t,observationLabel:n,comparison:o,swatch:s,label:a}=e;return[{role:"valueRow",gap:aa,segments:Ye([Ee("value","value",t??"–"),Ee("observation","label",n)])},{role:"trendRow",gap:la,ariaLabel:o===null?void 0:Ma(o),segments:Ye([Ea(o),_a(o),Ee("trendReference","label",o?.reference??null)])},{role:"groupRow",gap:sa,segments:Ye([Aa(s),Ee("label","label",a)])}].filter(i=>i.segments.length>0)},Ee=(e,t,n)=>n===null?null:{kind:"text",textRole:e,fontRole:t,text:n},Aa=e=>e===null?null:{kind:"swatch",swatch:e,size:oa},Ea=e=>e===null?null:{kind:"trendArrow",direction:e.direction,size:ia},_a=e=>e===null?null:{kind:"text",textRole:"trendPercentage",fontRole:"label",text:e.percentage,trendDirection:e.direction},Ma=e=>{switch(e.direction){case"up":return`Increased ${e.percentage} ${e.reference}`;case"down":return`Decreased ${e.percentage} ${e.reference}`;case"flat":return`No change ${e.reference}`}},Ye=e=>e.filter(t=>t!==null),Pa=(e,t)=>(n,o)=>{const s=Dn(n,o,e,t),a=On(s.map(i=>i.width)),c=Math.max(0,s.length-1)*Mn;return{width:a+c,height:Math.max(0,...s.map(i=>i.height))}},Fa=(e,t)=>(n,o)=>Dn(n,o,e,t).map(s=>s.width),Na=(e,t)=>(n,o)=>{const s=et("value",o,t);return{width:e.measureText(n,s).width,height:s.size*_n}},Ha=(e,t)=>{const n=Pa(e,t),o=Na(e,t);return(s,a)=>s.kind==="perGroup"?n(s,a):o(s.value,a)},Dn=(e,t,n,o)=>{const s={value:et("value",t,o),label:et("label",t,o)},a=c=>Ra(c,s,n);return e.items.map(c=>{const i=In(c).map(a),d=Math.max(0,i.length-1)*ca;return{width:Math.max(0,...i.map(u=>u.width)),height:On(i.map(u=>u.height))+d}})},Ra=(e,t,n)=>{let o=0,s=0;for(const a of e.segments)if(a.kind==="text"){const c=t[a.fontRole];o+=n.measureText(a.text,c).width,s=Math.max(s,c.size*_n)}else o+=a.size,s=Math.max(s,a.size);return{width:o+Math.max(0,e.segments.length-1)*e.gap,height:s}},et=(e,t,n)=>{const o=e==="value"?ta[t]:na[t];return{family:ra,size:K(o,n)}},On=e=>e.reduce((t,n)=>t+n,0),dt=12,zn=10,Gn=8,Ba=8,Ia=8,Da=2,$n=1,Wn=2,Xn=4,qn=F.sm,Yn=I.sm,Vn=O,Un=2*(Ia+$n),ut=2*(Da+$n),Oa=Wn*Xn,Kn=e=>{const t=K(qn,e);return{fontSizePx:t,lineBoxHeight:t*Yn}},Zn=e=>e?zn:0,za=(e,t)=>n=>{if(n.items.length===0)return 0;const{fontSizePx:o,lineBoxHeight:s}=Kn(t),a={family:Vn,size:o};if(n.position==="top"||n.position==="bottom")return Math.max(s,dt)+ut;const i=n.items.map(d=>{const u=e.measureText(d.formattedLabel,a).width,h=Zn(d.visual.color);return h+(h>0?Gn:0)+u});return Math.max(...i)+Un},Ga=(e,t)=>n=>e.measureText(n,{family:Rn,size:K(ct,t)}),$a=(e,t)=>g.useMemo(()=>e?{measureAxis:ka(e,t),measureAxisLabel:Ta(t),measureLegend:za(e,t),measureHeadline:Ha(e,t),measureHeadlineItemWidths:Fa(e,t),measureTickLabel:Ga(e,t),measureDifferenceArrowLabel:wa(e,t)}:null,[e,t]),Wa=({measurer:e,axes:t,numberFormat:n,parsingLocale:o,formattedLegends:s,containerSize:a,externalMeasurements:c,headline:i,formattingLocale:d,annotations:u,coordSystem:h,textScale:p})=>g.useMemo(()=>e?new f.LayoutCompiler(e).compile({axes:t,numberFormat:n,parsingLocale:o,formattedLegends:s,containerSize:a,externalMeasurements:c,headline:i,formattingLocale:d,annotations:u,coordSystem:h,textScale:p}):null,[t,n,o,s,a,c,i,d,u,h,p,e]),Et="data-variant",Jn=Wr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(Et)??null,renderHTML:e=>e.variant?{[Et]:e.variant}:{}}}}}),Xa=$r.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{isTitleVisible:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.isTitleVisible)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:n}=t;return n.depth!==1||n.parentOffset!==0?!1:n.index(0)===1}}}}),qa=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:n,isSubtitleVisible:o})=>[Va({isTitleVisible:n,isSubtitleVisible:o}),Jn,tn.Text,Me.UndoRedo,Jt.Heading.configure({levels:[1,2,3]}),Kt.Bold,Qt.Italic,rn.Underline,nn.TextAlign.configure({types:["heading","paragraph"]}),en.Link.configure({openOnClick:!1,autolink:!0}),ue.TextStyle,ue.Color,ue.FontFamily,Zt.HardBreak,Xa.configure({isTitleVisible:n}),Me.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:s,editor:a})=>{if(n&&s===0)return e;const c=n?a.state.doc.firstChild?.nodeSize??-1:0;return o&&s===c?t:""}})],Ya=({placeholder:e})=>[Je.Document,Jn,tn.Text,Me.UndoRedo,Jt.Heading.configure({levels:[1,2,3]}),Kt.Bold,Qt.Italic,rn.Underline,nn.TextAlign.configure({types:["heading","paragraph"]}),en.Link.configure({openOnClick:!1,autolink:!0}),ue.TextStyle,ue.Color,ue.FontFamily,Zt.HardBreak,Me.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Va=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?Je.Document.extend({content:"block{2,}"}):Je.Document,E=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,ze=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,Qn=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,tt=(e,t,n)=>`color-mix(in srgb, ${e}, ${t} ${n*100}%)`,Ua=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),Ka=e=>e.length===0?!1:typeof CSS<"u"&&typeof CSS.supports=="function"?CSS.supports("color",e):/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(e),er={elevationXs:"0 0 2px rgba(15, 15, 24, 0.12), 0 2px 2px rgba(14, 14, 52, 0.08)",elevationSm:"0 0 4px rgba(15, 15, 24, 0.12), 0 4px 4px rgba(14, 14, 52, 0.08)",elevationMd:"0 0 8px rgba(15, 15, 24, 0.12), 0 8px 8px rgba(14, 14, 52, 0.08)",elevationLg:"0 0 16px rgba(15, 15, 24, 0.12), 0 16px 16px rgba(14, 14, 52, 0.08)"},tr={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},nr={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},Za=8,ce=e=>`${Za*e}px`,rr={spaceXxs:ce(.25),spaceXs:ce(.5),spaceSm:ce(.75),spaceMd:ce(1),spaceLg:ce(1.5),spaceXl:ce(2)},Ja={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#000000",grey95:"#0D0D0D",grey90:"#1A1A1A",grey85:"#1F1F1F",grey80:"#2A2A2A",grey75:"#2e2e2e",grey70:"#353535",grey60:"#494949",grey50:"#6F6F6F",grey0:"#FFFFFF",red60:"#CB3333",red50:"#F93939",amber70:"#F48135",amber50:"#FEAE47",amber40:"#FFC849",amber30:"#ffd061",green60:"#0AC600",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #222429, #31353f)"},Qa={textPrimary:l.grey0,textSecondary:E(l.textPrimary,.8),textDisabled:E(l.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:E(l.textPrimary,.6),iconStickerBackground:l.grey70,border100:l.grey0,border50:E(l.grey0,.5),border10:E(l.grey0,.1),brand:l.purple50,success:l.green50,warning:l.amber50,alert:l.red50,sunkenBackground:l.grey100,defaultBackground:l.grey90,raisedBackground:l.grey80,overlayBackground:l.grey90,overlayBorderGradient:l.greyGradient80},ei={graphBackground:l.grey90,gridLineColor:l.border10,originLineColor:l.grey0,targetLineColor:l.border100,targetLineMarkerColor:l.border100,targetLineLabelTextColor:l.grey100,legendBackground:l.defaultBackground,legendBorderColor:l.border10,legendFocusOutlineColor:l.border50,legendTextColor:l.textPrimary,dimmedSeriesLabelTextColor:l.textDisabled,dimmedSeriesLabelLineColor:l.grey60,trendNegativeColor:l.red60,trendPositiveColor:l.green60,trendNeutralColor:l.textSecondary,toolbarBackgroundColor:l.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:l.grey80,toolbarButtonBackgroundColorSelected:l.grey60,toolbarSeparatorColor:l.grey60,tooltipBackground:l.grey70,tooltipBorderColor:l.grey60,tooltipHeadingTextColor:l.textPrimary,tooltipLabelTextColor:l.textSecondary,tooltipValueTextColor:l.textPrimary,tooltipPrimaryRowColor:l.grey60,hoverGuideLineColor:E(l.white,.08),hoverGuideFillColor:E(l.white,.06),hoveredBarBorderColor:l.white,hoveredPointRingColor:l.white,pointStrokeColor:l.white,stackedBarHoverBorderColor:l.grey0,heatmapEmptyTileBackground:l.grey80,dataLabelOutsideBackground:E(l.textPrimary,.1),defaultAnnotationArrowStroke:l.white,defaultAnnotationShapeStroke:l.white,defaultAnnotationShapeFill:l.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:l.blue60,annotationMenuTriggerIconColor:l.white},ti={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},ni={...Ja,...Qa,...er,...tr,...rr,...nr,...ei,...ti,...jn,...Cn,...Ln},ri={transparent:"transparent",white:"#FFFFFF",black:"#000000",grey100:"#FFFFFF",grey95:"#FCFCFC",grey90:"#FAFAFA",grey85:"#F5F5F5",grey80:"#F0F0F0",grey75:"#E8E8E8",grey70:"#E5E5E5",grey60:"#CCCCCC",grey50:"#C4C4C4",grey0:"#1D2129",red60:"#E14B49",red50:"#F93939",amber70:"#FFBA8C",amber50:"#FFC849",amber40:"#FEAE47",amber30:"#E7A816",green60:"#06B299",green50:"#42CD69",blue80:"#2E62FF",blue60:"#3D70FF",purple50:"#7B56EA",purple30:"#E093FE",greyGradient80:"linear-gradient(to top, #F0F0F1, #F9F9FF)"},oi={textPrimary:l.black,textSecondary:E(l.textPrimary,.6),textDisabled:E(l.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:E(l.textPrimary,.6),iconStickerBackground:l.grey100,brand:l.purple50,success:l.green50,warning:l.amber50,alert:l.red50,border100:l.grey0,border50:E(l.grey0,.5),border10:E(l.grey0,.1),sunkenBackground:l.grey90,defaultBackground:l.grey100,raisedBackground:l.grey85,overlayBackground:l.grey100,overlayBorderGradient:l.border10},si={graphBackground:l.grey100,gridLineColor:l.border10,originLineColor:l.grey0,targetLineColor:l.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:l.grey100,legendBackground:l.defaultBackground,legendBorderColor:l.border10,legendFocusOutlineColor:l.border50,legendTextColor:l.textPrimary,dimmedSeriesLabelTextColor:l.textDisabled,dimmedSeriesLabelLineColor:l.grey60,trendNegativeColor:l.red60,trendPositiveColor:l.green60,trendNeutralColor:l.textSecondary,toolbarBackgroundColor:l.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:l.grey80,toolbarButtonBackgroundColorSelected:l.grey60,toolbarSeparatorColor:l.grey60,tooltipBackground:l.white,tooltipBorderColor:l.border10,tooltipHeadingTextColor:l.textPrimary,tooltipLabelTextColor:l.textSecondary,tooltipValueTextColor:l.textPrimary,tooltipPrimaryRowColor:l.grey80,hoverGuideLineColor:E(l.black,.08),hoverGuideFillColor:E(l.black,.04),hoveredBarBorderColor:l.white,hoveredPointRingColor:l.white,pointStrokeColor:l.white,stackedBarHoverBorderColor:l.grey0,heatmapEmptyTileBackground:l.grey80,dataLabelOutsideBackground:E(l.textPrimary,.1),defaultAnnotationArrowStroke:l.black,defaultAnnotationShapeStroke:l.black,defaultAnnotationShapeFill:l.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:l.blue60,annotationMenuTriggerIconColor:"#3d414c"},ai={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},ii={...ri,...oi,...er,...tr,...rr,...nr,...si,...ai,...jn,...Cn,...Ln},Ne=.1,li={light:.05,dark:.1},ci=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return hi(e.color,t);case"gradient":return gi(e.color,t);case"preset":return f.BORDER_PRESET_GRADIENTS[e.preset]}},di=e=>e.type==="none"?0:e.width,ui=(e,t,n)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return tt(n,e.color,li[t])},hi=(e,t)=>t==="dark"?ze(e,Ne):Qn(e,Ne),gi=(e,t,n=90)=>{const o=e,s=t==="dark"?ze(e,Ne):Qn(e,Ne);return`linear-gradient(${n}deg, ${o} 0%, ${s} 100%)`};var fi="bow4tg0",pi="bow4tg1",mi="bow4tg2",xi="bow4tg3",or="_1ii3bsb0",sr="_1ii3bsb1";const ht=g.createContext(null),gt=()=>{const e=g.useContext(ht);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},ar=({theme:e,themeOverrides:t={},appearance:n,children:o})=>{const s=g.useMemo(()=>({...e==="dark"?ni:ii,...t}),[e,t]),a=g.useMemo(()=>{const i={[l.textScale]:String(n.textScale)};for(const[u,h]of Object.entries(t))i[l[u]]=h;const d=ui(n.background,e,s.graphBackground);return d!==void 0&&(i[l.graphBackground]=d),Xr.assignInlineVars(i)},[n.textScale,n.background,e,s.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?sr:or,inlineVarsStyle:a,themeValues:s}),[e,a,s]);return r.jsx(ht.Provider,{value:c,children:o})},ae=({children:e,className:t,style:n})=>{const o=g.useContext(ht),s=o?H(o.themeClass,pi):void 0,a=o?{...o.inlineVarsStyle,...n}:n;return r.jsx("div",{className:H(s,t),style:a,children:e})},vi="graphy_root",ie=()=>typeof document>"u"?null:document.getElementById(vi)??document.body;var yi="yp3g0k0",bi="yp3g0k1",ir="yp3g0k3",Si="yp3g0k4",lr="yp3g0k5",nt="yp3g0k6",ji="yp3g0k7",Ci="yp3g0k8",cr="yp3g0k9",Li="yp3g0ka",ki="yp3g0kb",Ti="yp3g0kc",wi="yp3g0kd",Ai="yp3g0ke";const Ei=sn.map(e=>l[e]),_i=Object.fromEntries(sn.map(e=>[l[e],e])),Mi=({editor:e,currentColor:t,isOpen:n,onOpenChange:o})=>{const s=Fi(),a=g.useCallback(i=>{e.chain().setColor(i).run()},[e]),c=i=>{e.chain().focus().setColor(i).run(),o(!1)};return r.jsxs(P.Popover.Root,{open:n,onOpenChange:o,children:[r.jsx(P.Popover.Trigger,{render:r.jsx(M.Toolbar.Button,{}),"aria-label":"Text color",className:yi,onMouseDown:i=>i.preventDefault(),children:r.jsx("span",{className:bi,style:{background:t??"transparent"}})}),r.jsx(P.Popover.Portal,{container:ie(),children:r.jsx(ae,{children:r.jsx(P.Popover.Positioner,{sideOffset:6,align:"start",className:ir,children:r.jsxs(P.Popover.Popup,{className:Si,onMouseDown:i=>i.preventDefault(),children:[r.jsx(_t,{title:"Colors",colors:Ei,currentColor:t,onPick:c}),s.length>0&&r.jsx(_t,{title:"Chart colors",colors:s,currentColor:t,onPick:c}),r.jsx(Pi,{value:t??"#000000",onChange:a})]})})})})]})},_t=({title:e,colors:t,currentColor:n,onPick:o})=>r.jsxs("div",{className:lr,children:[r.jsx("div",{className:nt,children:e}),r.jsx("div",{className:ji,children:t.map(s=>r.jsx("button",{type:"button","aria-label":s,className:Ci,"data-active":Hi(s,n),onMouseDown:a=>a.preventDefault(),onClick:()=>o(s),children:r.jsx("span",{className:cr,style:dr(s)})},s))})]}),Pi=({value:e,onChange:t})=>{const[n,o]=g.useState(!1),s=Ka(e)?e:"#000000",a=Ni(s);return r.jsxs(P.Popover.Root,{open:n,onOpenChange:o,children:[r.jsxs("div",{className:lr,children:[r.jsx("div",{className:nt,children:"Custom"}),r.jsxs(P.Popover.Trigger,{className:Li,onMouseDown:c=>c.preventDefault(),"aria-label":"Pick custom color",children:[r.jsx("span",{className:cr,style:dr(s)}),r.jsx("span",{className:ki,children:a})]})]}),r.jsx(P.Popover.Portal,{container:ie(),children:r.jsx(ae,{children:r.jsx(P.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:ir,children:r.jsxs(P.Popover.Popup,{className:Ti,onMouseDown:c=>c.preventDefault(),children:[r.jsx("div",{className:nt,children:"Pick color"}),r.jsx(pt.HexColorPicker,{color:a,onChange:t,className:wi}),r.jsx(pt.HexColorInput,{color:a,onChange:t,prefixed:!0,className:Ai,onMouseDown:c=>c.stopPropagation()})]})})})})]})},Fi=()=>{const e=T(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const n of e.domain){const o=e.map(n);typeof o=="string"&&t.add(o)}return[...t]},[e])},dr=e=>({background:e,border:`1px solid ${ze(e,.1)}`}),Ni=e=>{const{themeValues:t}=gt();if(Ua(e))return e.toUpperCase();const n=_i[e];return n?t[n].toUpperCase():"#000000"},Hi=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),Ri={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var Bi={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const Z=({children:e,title:t,variant:n="primary",size:o="sm",...s})=>{const a=g.useId(),c=Ri[o];return r.jsxs("svg",{className:Bi[n],"aria-labelledby":t?a:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...s,children:[t&&r.jsx("title",{id:a,children:t}),e]})},ur=e=>r.jsx(Z,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})}),Ii="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",hr=`'Aeonik', 'Aeonik Fallback', ${O}`,Di="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",Oi="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",zi=`var(--brand-font-family), ${hr}`,rt=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:O},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:hr},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:Ii},{id:"technical",label:"Technical",preview:"00",fontFamily:Di},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:Oi},{id:"brand",label:"Brand",preview:"Aa",fontFamily:zi}],Gi=e=>e?rt.find(t=>t.fontFamily===e)??null:null;var gr="_1qkyw7q0",fr="_1qkyw7q1",pr="_1qkyw7q3",mr="_1qkyw7q4",xr="_1qkyw7q5";const $i=({editor:e,currentFontFamily:t,isOpen:n,onOpenChange:o})=>{const s=Gi(t)??rt[0],a=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return r.jsxs(B.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(B.Menu.Trigger,{render:r.jsx(M.Toolbar.Button,{}),"aria-label":"Font family",className:gr,onMouseDown:c=>c.preventDefault(),children:[r.jsx("span",{className:fr,style:{fontFamily:s?.fontFamily},children:s?.preview}),r.jsx(ur,{size:"sm"})]}),r.jsx(B.Menu.Portal,{container:ie(),children:r.jsx(ae,{children:r.jsx(B.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:pr,children:r.jsx(B.Menu.Popup,{className:mr,onMouseDown:c=>c.preventDefault(),children:rt.map(c=>r.jsx(B.Menu.Item,{className:xr,"data-selected":c.id===s?.id,onClick:()=>a(c),children:r.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},vr={id:"text",label:"Text",previewFont:l.fontTextEditorBody},Mt=[{id:"caption",label:"Caption",previewFont:l.fontTextEditorH6},vr,{id:"h3",label:"Heading 3",previewFont:l.fontTextEditorH3},{id:"h2",label:"Heading 2",previewFont:l.fontTextEditorH2},{id:"h1",label:"Heading 1",previewFont:l.fontTextEditorH1}],Wi=({editor:e,activeStyle:t,isOpen:n,onOpenChange:o})=>{const s=Mt.find(a=>a.id===t)??vr;return r.jsxs(B.Menu.Root,{open:n,onOpenChange:o,children:[r.jsxs(B.Menu.Trigger,{render:r.jsx(M.Toolbar.Button,{}),"aria-label":"Text style",className:gr,onMouseDown:a=>a.preventDefault(),children:[r.jsx("span",{className:fr,children:s.label}),r.jsx(ur,{size:"sm"})]}),r.jsx(B.Menu.Portal,{container:ie(),children:r.jsx(ae,{children:r.jsx(B.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:pr,children:r.jsx(B.Menu.Popup,{className:mr,onMouseDown:a=>a.preventDefault(),children:Mt.map(a=>r.jsx(B.Menu.Item,{className:xr,"data-selected":a.id===s.id,onClick:()=>Xi(e,a.id),children:r.jsx(qi,{font:a.previewFont,children:a.label})},a.id))})})})})]})},Xi=(e,t)=>{switch(t){case"caption":{e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return}case"text":{e.chain().focus().setNode("paragraph",{variant:null}).run();return}case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},qi=({font:e,children:t})=>r.jsx("span",{style:{font:e,margin:0},children:t}),Yi=e=>r.jsx(Z,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})})}),Vi=e=>r.jsx(Z,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),r.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),Ui=e=>r.jsx(Z,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 6 6 18"}),r.jsx("path",{d:"m6 6 12 12"})]})}),Ki=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Zi=e=>{const{$from:t}=e.state.selection,n=t.parent.textContent,o=t.parentOffset,s=t.start();let a=o;for(;a>0&&Pt(n[a-1]);)a-=1;let c=o;for(;c<n.length&&Pt(n[c]);)c+=1;return{from:s+a,to:s+c}},Pt=e=>e!==void 0&&/\S/.test(e);var Ji="b5kquu0",Qi="b5kquu1",el="b5kquu2",tl="b5kquu3",Ft="b5kquu4";const nl=({editor:e,currentUrl:t,isActive:n,isOpen:o,onOpenChange:s})=>{const[a,c]=g.useState(""),i=g.useRef(null);g.useEffect(()=>{o&&c(t??"")},[o,t]);const d=()=>{rl(e,a),s(!1)},u=()=>{c(""),s(!1)},h=m=>{c(m.target.value)},p=m=>{m.key==="Enter"&&(m.preventDefault(),d())};return r.jsxs(P.Popover.Root,{open:o,onOpenChange:s,children:[r.jsx(P.Popover.Trigger,{render:r.jsx(M.Toolbar.Button,{}),"aria-label":"Link","data-active":n,className:Ji,onMouseDown:m=>m.preventDefault(),children:r.jsx(Vi,{})}),r.jsx(P.Popover.Portal,{container:ie(),children:r.jsx(ae,{children:r.jsx(P.Popover.Positioner,{sideOffset:6,align:"end",className:Qi,children:r.jsxs(P.Popover.Popup,{className:el,initialFocus:i,onMouseDown:m=>m.preventDefault(),children:[r.jsx("input",{ref:i,type:"url",value:a,placeholder:"Type or paste a link...","aria-label":"Link URL",className:tl,onMouseDown:m=>m.stopPropagation(),onChange:h,onKeyDown:p}),r.jsx("button",{type:"button","aria-label":"Cancel",className:Ft,onClick:u,children:r.jsx(Ui,{})}),r.jsx("button",{type:"button","aria-label":"Apply link",className:Ft,onClick:d,children:r.jsx(Yi,{})})]})})})})]})},rl=(e,t)=>{const n=t.trim(),{selection:o}=e.state;if(!n){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:n}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:n}).run();return}const s=Zi(e);e.chain().focus().setTextSelection(s).setLink({href:n}).run()},ol=e=>r.jsx(Z,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M17 12H7"}),r.jsx("path",{d:"M19 19H5"})]})}),sl=e=>r.jsx(Z,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M21 12H9"}),r.jsx("path",{d:"M21 19H7"})]})}),al=e=>r.jsx(Z,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M21 5H3"}),r.jsx("path",{d:"M15 12H3"}),r.jsx("path",{d:"M17 19H3"})]})});var il="k91gos0",ll="k91gos1";const cl=6,he=({label:e,isActive:t,onToggle:n,children:o})=>{const s=a=>a.preventDefault();return r.jsxs(de.Tooltip.Root,{children:[r.jsx(de.Tooltip.Trigger,{render:r.jsx(qr.Toggle,{render:r.jsx(M.Toolbar.Button,{}),pressed:t,onPressedChange:()=>n()}),"aria-label":e,className:il,onMouseDown:s,children:o}),r.jsx(de.Tooltip.Portal,{container:ie(),children:r.jsx(ae,{children:r.jsx(de.Tooltip.Positioner,{sideOffset:cl,children:r.jsx(de.Tooltip.Popup,{className:ll,children:e})})})})]})},dl=({editor:e,activeAlignment:t="left"})=>r.jsxs(r.Fragment,{children:[r.jsx(he,{label:"Align left",isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:r.jsx(al,{})}),r.jsx(he,{label:"Align center",isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:r.jsx(ol,{})}),r.jsx(he,{label:"Align right",isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:r.jsx(sl,{})})]});var ul="_1bp10ig0",ve="_1bp10ig1",_e="_1bp10ig2";const hl=({editor:e})=>({isBold:e?.isActive("bold")??!1,isItalic:e?.isActive("italic")??!1,isUnderline:e?.isActive("underline")??!1,isLink:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:gl(e),textAlign:fl(e)}),gl=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",fl=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",pl=8,ml=8,xl=({editor:e})=>{const[t,n]=g.useState(!1),[o,s]=g.useState(null),a=o!==null,c=x=>v=>{s(v?x:null)},{refs:i,floatingStyles:d}=N.useFloating({placement:"top-start",strategy:"fixed",middleware:[N.offset(pl),N.flip(),N.shift({padding:ml})],whileElementsMounted:N.autoUpdate}),u=g.useRef(null),h=at.useEditorState({editor:e,selector:hl}),p=g.useCallback(x=>{u.current=x,i.setFloating(x)},[i]);if(g.useEffect(()=>{e&&i.setReference(e.view.dom)},[e,i]),g.useEffect(()=>{if(!e)return;const x=()=>n(!0),v=({event:y})=>{const{relatedTarget:j,currentTarget:C}=y,L=j instanceof Node&&u.current?.contains(j),k=j instanceof Node&&C instanceof Node&&C.contains(j);!L&&!k&&n(!1)};return e.on("focus",x),e.on("blur",v),()=>{e.off("focus",x),e.off("blur",v)}},[e]),!e||!t&&!a)return null;const m=ie();return m?on.createPortal(r.jsx(ae,{children:r.jsx(de.Tooltip.Provider,{children:r.jsxs(M.Toolbar.Root,{ref:p,className:ul,style:d,children:[r.jsxs(M.Toolbar.Group,{className:ve,children:[r.jsx(Mi,{editor:e,currentColor:h?.color??null,isOpen:o==="color",onOpenChange:c("color")}),r.jsx($i,{editor:e,currentFontFamily:h?.fontFamily??null,isOpen:o==="fontFamily",onOpenChange:c("fontFamily")})]}),r.jsx(M.Toolbar.Separator,{className:_e}),r.jsx(M.Toolbar.Group,{className:ve,children:r.jsx(Wi,{editor:e,activeStyle:h?.fontSize??"text",isOpen:o==="fontSize",onOpenChange:c("fontSize")})}),r.jsx(M.Toolbar.Separator,{className:_e}),r.jsxs(M.Toolbar.Group,{className:ve,children:[r.jsx(he,{label:"Bold",isActive:h?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:r.jsx("strong",{children:"B"})}),r.jsx(he,{label:"Italic",isActive:h?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:r.jsx("em",{children:"I"})}),r.jsx(he,{label:"Underline",isActive:h?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:r.jsx("u",{children:"U"})})]}),r.jsx(M.Toolbar.Separator,{className:_e}),r.jsx(M.Toolbar.Group,{className:ve,children:r.jsx(dl,{editor:e,activeAlignment:h?.textAlign})}),r.jsx(M.Toolbar.Separator,{className:_e}),r.jsx(M.Toolbar.Group,{className:ve,children:r.jsx(nl,{editor:e,currentUrl:h?.linkUrl??null,isActive:h?.isLink??!1,isOpen:o==="link",onOpenChange:c("link")})})]})})}),m):null};var vl="_2ngohc0";const yr=({editor:e,ariaLabel:t})=>r.jsxs("div",{className:vl,children:[r.jsx(xl,{editor:e}),r.jsx(at.EditorContent,{editor:e,"aria-label":t})]}),br=(e,t)=>{const n=g.useRef(e);n.current=e;const o=g.useRef(t);o.current=t;const s=g.useRef(null),a=g.useRef(null),c=g.useMemo(()=>{const i=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null),s.current=null},d=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null);const h=s.current;h!==null&&(s.current=null,n.current(...h))};return{run:(...h)=>{if(o.current<=0){n.current(...h);return}s.current=h,a.current!==null&&clearTimeout(a.current),a.current=setTimeout(d,o.current)},flush:d,cancel:i}},[]);return g.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),c},yl=200,Sr=({content:e,extensions:t,isEditable:n,onUpdate:o,updateDebounceMs:s=yl})=>{const a=g.useRef(Nt(e)),c=g.useRef(!1),i=br(u=>{c.current=!0,o?.(u)},s),d=at.useEditor({extensions:t,content:a.current,editable:n,immediatelyRender:!1,onUpdate:({editor:u})=>i.run(u.getJSON())});return g.useEffect(()=>{d?.setEditable(n)},[d,n]),g.useEffect(()=>{if(!d)return;if(c.current){c.current=!1;return}const u=Nt(e),h=d.getJSON();bl(h,u)||(i.cancel(),d.commands.setContent(u,{emitUpdate:!1}))},[d,e,i]),g.useEffect(()=>()=>i.flush(),[i]),d},Nt=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,bl=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Sl=/^(?:https?:|mailto:)/i,jr=e=>{if(typeof e!="string")return!1;const t=e.replace(/^[\x00-\x20]+/,"");return t.length===0?!1:Sl.test(t)};var jl="_1cocly40";const Cl={modern:"'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif",timeless:"'Noto Serif', Georgia, 'Times New Roman', serif",fresh:"'Aeonik', 'Aeonik Fallback', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif",technical:"'PT Mono', 'Courier New', monospace",handwritten:"'Permanent Marker', cursive",fineliner:"'Intruding Cat', cursive",brand:"var(--brand-font-family), 'Aeonik', 'Inter', sans-serif"},He=({content:e})=>r.jsx(r.Fragment,{children:Cr(e.content??[e])}),Cr=e=>e.map((t,n)=>Ll(t,n)),Ll=(e,t)=>{if(e.type==="text")return kl(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return r.jsx("br",{},t);const n=e.content?Cr(e.content):null;switch(e.type){case"doc":return r.jsx(g.Fragment,{children:n},t);case"heading":{const o=El(e.attrs?.level);return _l(o,t,n,Rt(e.attrs))}case"paragraph":{const o=ge(e.attrs?.variant);return r.jsx("p",{"data-variant":o??void 0,style:Lr(Rt(e.attrs)),children:n},t)}case"blockquote":return r.jsx("blockquote",{children:n},t);case"bulletList":case"bullet_list":return r.jsx("ul",{children:n},t);case"orderedList":case"ordered_list":return r.jsx("ol",{children:n},t);case"listItem":case"list_item":return r.jsx("li",{children:n},t);default:return r.jsx("span",{children:n},t)}},kl=(e,t)=>{const n=e.text??"";return!e.marks||e.marks.length===0?r.jsx("span",{children:n},t):e.marks.reduceRight((o,s,a)=>Tl(s,o,`${t}-${a}`),n)},Tl=(e,t,n)=>{switch(e.type){case"bold":case"strong":return r.jsx("strong",{children:t},n);case"italic":case"em":return r.jsx("em",{children:t},n);case"underline":return r.jsx("u",{children:t},n);case"strike":case"strikethrough":case"s":return r.jsx("s",{children:t},n);case"code":return r.jsx("code",{children:t},n);case"link":{const o=ge(e.attrs?.href);return jr(o)?r.jsx("a",{className:jl,href:o,rel:"noopener noreferrer",target:"_blank",children:t},n):r.jsx("span",{children:t},n)}case"textStyle":{const o=wl(e.attrs);return o?r.jsx("span",{style:o,children:t},n):r.jsx("span",{children:t},n)}default:return r.jsx("span",{children:t},n)}},Ht=e=>{const t=ge(e&&typeof e=="object"?e.fontFamily:e);if(t)return Cl[t]??t},wl=e=>{if(!e)return null;const t={},n=ge(e.color);n&&(t.color=n);const o=Ht(e.font)??Ht(e.fontFamily);o&&(t.fontFamily=o);const s=Al(e.fontSize);return s&&(t.fontSize=s),Object.keys(t).length>0?t:null},Al=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:ge(e),ge=e=>typeof e=="string"&&e.length>0?e:void 0,El=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),_l=(e,t,n,o)=>{const s=Lr(o);switch(e){case 1:return r.jsx("h1",{style:s,children:n},t);case 2:return r.jsx("h2",{style:s,children:n},t);case 3:return r.jsx("h3",{style:s,children:n},t)}},Rt=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},Lr=e=>e?{textAlign:e}:void 0;var Ml="_4dlrid0",kr="_4dlrid1",Pl="xfz7dq0",Fl="xfz7dq1",Nl="xfz7dq2",Hl="xfz7dq3",Rl="xfz7dq4";const Bl=({ref:e,footerRect:t,mode:n="readonly"})=>{const{caption:o,isCaptionVisible:s,source:a,isSourceVisible:c}=T(R.useShallow(h=>({caption:h.config.content.caption,isCaptionVisible:h.config.content.isCaptionVisible,source:h.config.content.source,isSourceVisible:h.config.content.isSourceVisible}))),i=n==="editable",d=s&&(i||o!==null),u=c&&a!==null&&zl(a);return!d&&!u?null:r.jsxs("div",{ref:e,className:Pl,style:{left:t.x,top:t.y,width:t.width},children:[d?i?r.jsx(Gl,{caption:o}):r.jsx(Il,{caption:o}):null,u&&r.jsx(Dl,{source:a})]})},Il=({caption:e})=>e===null?null:typeof e=="string"?r.jsx("p",{className:kr,children:e}):r.jsx(He,{content:e}),Dl=({source:e})=>{const t=jr(e.url)?e.url:void 0,n=e.label??(t!==void 0?Ol(t):"");return n===""&&t===void 0?null:r.jsxs("div",{className:Fl,children:[r.jsx("span",{className:Hl,children:"Source:"}),t!==void 0?r.jsx("a",{className:Nl,href:t,target:"_blank",rel:"noopener noreferrer",children:n}):r.jsx("span",{className:Rl,children:n})]})},Ol=e=>{try{return new URL(e).hostname}catch{return e}},zl=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",Gl=({caption:e})=>{const t=lt(),n=g.useMemo(()=>Ya({placeholder:"Add caption"}),[]),o=Sr({content:e,extensions:n,isEditable:!0,onUpdate:s=>{const a=Ki(s)?null:s;t(new f.SetContentCaptionCommand({caption:a}))}});return r.jsx(yr,{editor:o,ariaLabel:"Chart caption"})};var $l="_1k4qtbg0";const Wl=3,Xl=({title:e,isTitleVisible:t,subtitle:n,isSubtitleVisible:o})=>{const s=[];return t&&s.push({type:"heading",attrs:{level:Wl},content:Yl(e)}),o&&s.push(...Vl(n)),{type:"doc",content:s}},ql=e=>{const t=e.content??[],[n,...o]=t;return{title:Ul(n?.content??[]),subtitle:Kl(o)}},ft=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(ft)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Yl=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Vl=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(Bt):[Bt(e)],Bt=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Ul=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(ft)}},Kl=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[n]=t;if(n&&t.length===1&&n.type==="paragraph"){const o=n.content??[],[s]=o;if(s&&o.length===1&&s.type==="text"&&(!s.marks||s.marks.length===0))return s.text??null}return{type:"doc",content:t.map(ft)}},Zl=({ref:e,headerRect:t,mode:n="readonly"})=>{const{title:o,isTitleVisible:s,subtitle:a,isSubtitleVisible:c}=T(R.useShallow(h=>({isTitleVisible:h.config.content.isTitleVisible,isSubtitleVisible:h.config.content.isSubtitleVisible,title:h.config.content.title,subtitle:h.config.content.subtitle}))),i=n==="editable";return!(s&&(i||o!==null))&&!(c&&(i||a!==null))?null:r.jsx("div",{ref:e,className:$l,style:{left:t.x,top:t.y,width:t.width},children:i?r.jsx(Ql,{title:o,isTitleVisible:s,isSubtitleVisible:c,subtitle:a},[s?"title":"",c?"subtitle":""].join("-")):r.jsx(Jl,{title:o,isTitleVisible:s,isSubtitleVisible:c,subtitle:a})})},Jl=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const s=t&&e!==null,a=n&&o!==null;return r.jsxs(r.Fragment,{children:[s&&(typeof e=="string"?r.jsx("h1",{className:Ml,children:e}):r.jsx(He,{content:e})),a&&(typeof o=="string"?r.jsx("p",{className:kr,children:o}):r.jsx(He,{content:o}))]})},Ql=({title:e,isTitleVisible:t,isSubtitleVisible:n,subtitle:o})=>{const s=lt(),a=g.useMemo(()=>qa({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:n}),[t,n]),c=g.useMemo(()=>Xl({title:e,isTitleVisible:t,subtitle:o,isSubtitleVisible:n}),[e,t,o,n]),i=Sr({content:c,extensions:a,isEditable:!0,onUpdate:d=>{const u=ql(d);t&&s(new f.SetContentTitleCommand({title:u.title})),n&&s(new f.SetContentSubtitleCommand({subtitle:u.subtitle}))}});return r.jsx(yr,{editor:i,ariaLabel:"Chart title and subtitle"})};var ec="_1u9qprb0",tc="_1u9qprb1",nc="_9aen060",rc="_9aen061",oc="_9aen062",Tr="_9aen063";const sc=Object.freeze(Object.defineProperty({__proto__:null,groupRow:oc,item:Tr,trendRow:rc,valueRow:nc},Symbol.toStringTag,{value:"Module"})),ac=e=>r.jsx(Z,{...e,children:r.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"m5 12 7-7 7 7"}),r.jsx("path",{d:"M12 19V5"})]})}),ic=e=>r.jsx(Z,{...e,children:r.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"M5 12h14"})})});var wr="n7clvo0",lc="n7clvo1",cc="n7clvo2",dc="n7clvo3",Ar={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},uc={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},hc={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},gc={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const fc=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return r.jsx(je,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return r.jsx("div",{className:gc[e.direction],children:e.direction==="flat"?r.jsx(ic,{size:"xs",title:""}):r.jsx(ac,{size:"xs",title:""})});const n=e.fontRole==="value"?Ar[t]:uc[t];return r.jsx("span",{className:H.clsx(pc(e),n),children:e.text})},pc=e=>{switch(e.textRole){case"value":return wr;case"observation":return lc;case"trendPercentage":return hc[e.trendDirection??"up"];case"trendReference":return cc;case"label":return dc}},mc=({item:e,resolvedSize:t})=>r.jsx("div",{className:Tr,children:In(e).map(n=>r.jsx(xc,{row:n,resolvedSize:t},n.role))}),xc=({row:e,resolvedSize:t})=>{const n=e.role==="trendRow";return r.jsx("div",{className:sc[e.role],"data-testid":n?"headline-trend":void 0,"data-direction":n?vc(e):void 0,role:n?"img":void 0,"aria-label":n?e.ariaLabel:void 0,children:e.segments.map((o,s)=>r.jsx(fc,{segment:o,resolvedSize:t},s))})},vc=e=>{const t=e.segments.find(n=>n.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},yc=({headline:e,rect:t,resolvedSize:n,visibleItemCount:o})=>{const s={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?r.jsx("div",{className:tc,style:s,children:r.jsx("span",{className:H.clsx(wr,Ar[n]),children:e.value})}):r.jsx("div",{className:ec,style:s,children:e.items.slice(0,o).map((a,c)=>r.jsx(mc,{item:a,resolvedSize:n},`${a.label}-${c}`))})};var bc="_1oj6yix0",Sc="_1oj6yix1",jc="_1oj6yix2";const Cc=8,Lc=16,kc=2,Tc=({legends:e,containerRect:t,textScale:n})=>{const{lineBoxHeight:o}=Kn(n),{placements:s,hasOverlap:a}=wc(e,t,o);if(s.length===0)return null;const c=a?Lc:Cc,i=c-kc;return r.jsxs("div",{className:bc,children:[a&&r.jsx("svg",{className:Sc,width:t.width,height:t.height,children:s.map(d=>r.jsx(Ac,{anchorY:d.anchorY,labelY:d.y,endX:i,color:d.payload.color},d.payload.key))}),s.map(d=>r.jsx("span",{className:jc,style:{left:c,top:d.y,color:d.payload.color},children:d.payload.label},d.payload.key))]})},wc=(e,t,n)=>g.useMemo(()=>{const o=[];for(const s of e)for(const a of s.items){if(a.normalizedY===null)continue;const c=typeof a.visual.color=="string"?a.visual.color:void 0;o.push({normalizedY:a.normalizedY,payload:{key:String(o.length),label:a.formattedLabel,color:c}})}return o.length===0||t.height<=0?{placements:[],hasOverlap:!1}:f.computeDirectLabelsLayout({items:o,containerHeight:t.height,labelHeight:n})},[e,t.height,n]),Ac=({anchorY:e,labelY:t,endX:n,color:o})=>{const s=n/2;return r.jsx("path",{d:`M0,${e} C${s},${e} ${s},${t} ${n},${t}`,fill:"none",stroke:o??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var Ec="_6a636s0",_c="_1kjk02r0",Mc="_1kjk02r1",Pc="_1kjk02r2",Fc="_1kjk02r3",Nc="_1kjk02r4",Hc="_1kjk02r5",Rc="_1kjk02r6",Bc="_1kjk02r7",Ic="_1kjk02r8",Dc="_1kjk02r9",Oc="_1kjk02ra",zc="_1kjk02rb",Gc="_1dw9dgx0";const $c="#9ca3af",Ve="\0",Wc=e=>{const t=[];return e.forEach((n,o)=>{const s=n.aesthetics.includes("size");for(const a of n.items){if(s){const u=Number(a.visual.size);if(!Number.isFinite(u)||u<=0)continue}const c=a.visual.color??"",i=s?`${Ve}${Number(a.visual.size)}`:"",d=a.visual.lineType;t.push({key:`${o}${Ve}${String(a.value)}${Ve}${c}${i}`,formattedLabel:a.formattedLabel,visual:a.visual,swatchShape:a.swatchShape,isBubble:s,primaryLineType:d})}}),t},Er=({pill:e})=>e.isBubble?r.jsx(Yc,{pill:e}):r.jsx(qc,{pill:e}),Xc=({color:e,lineType:t,shape:n})=>e?r.jsx(je,{shape:n,color:e,lineType:t,width:zn,height:dt}):null,qc=({pill:e})=>r.jsxs(r.Fragment,{children:[r.jsx(Xc,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),r.jsx("span",{children:e.formattedLabel})]}),Yc=({pill:e})=>{const t=Number(e.visual.size);return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:Gc,style:{width:t,height:t,backgroundColor:e.visual.color??$c}}),r.jsx("span",{children:e.formattedLabel})]})},Vc=({hiddenPills:e,placement:t})=>{const[n,o]=g.useState(!1),{refs:s,floatingStyles:a}=N.useFloating({open:n,placement:t,middleware:[N.offset(4),N.flip(),N.shift({padding:8})]});g.useEffect(()=>{if(!n)return;const u=p=>{const m=p.target;if(!m)return;const x=s.reference.current,v=s.floating.current;x instanceof Element&&x.contains(m)||v instanceof Element&&v.contains(m)||o(!1)},h=p=>{p.key==="Escape"&&o(!1)};return document.addEventListener("pointerdown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",h)}},[n,s.floating,s.reference]);const c=t==="left"||t==="right",i=Math.min(e.length-1,Wn),d=Array.from({length:i},(u,h)=>i-h);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:s.setReference,className:H.clsx(_c,{[Pc]:c,[Mc]:!c}),children:[d.map(u=>r.jsx("span",{className:H.clsx(Fc,{[Hc]:c,[Nc]:!c}),style:Uc(u,c),"aria-hidden":!0},u)),r.jsx("button",{type:"button",className:H.clsx(Rc,{[Bc]:n}),onClick:()=>o(u=>!u),"aria-haspopup":"dialog","aria-expanded":n,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:r.jsxs("span",{className:Ic,children:["+",e.length]})})]}),n&&r.jsx("div",{ref:s.setFloating,role:"dialog","aria-label":"Hidden legend items",className:Dc,style:a,children:r.jsx("ul",{className:Oc,children:e.map(u=>r.jsx("li",{className:zc,children:r.jsx(Er,{pill:u})},u.key))})})]})},Uc=(e,t)=>{const n=-e*Xn;return{transform:t?`translateY(${n}px)`:`translateX(${n}px)`}};var Kc="_1cecisi0",Zc="_1cecisi1",Jc="_1cecisi2",Qc="_1cecisi3";const ed=({edge:e,formattedLegends:t,containerWidth:n,containerHeight:o,textScale:s})=>{const a=oe(),c=g.useMemo(()=>Wc(t),[t]),i=e==="left"||e==="right",d=i?o:n,u=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(d<=0)return{visibleCount:c.length,hasOverflow:!1};const x=K(qn,s),v={family:Vn,size:x},y=x*Yn,j=w=>i?td(w,y):It({label:w.formattedLabel,swatchInlineSize:nd(w),textMeasurer:a,font:v}),C=c.map(j),k=(i?y+ut:It({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:a,font:v}))+Oa;return od({pillSizes:C,overflowPillSize:k,containerSize:d,gap:Ba})},[c,d,i,a,s]);if(c.length===0)return null;const h=c.slice(0,u.visibleCount),p=c.slice(u.visibleCount),m=u.hasOverflow&&p.length>0;return r.jsxs("div",{className:H.clsx(Kc,{[Jc]:i,[Zc]:!i}),children:[h.map(x=>r.jsx("div",{className:Qc,children:r.jsx(Er,{pill:x})},x.key)),m&&r.jsx(Vc,{hiddenPills:p,placement:sd(e)})]})},It=({label:e,swatchInlineSize:t,textMeasurer:n,font:o})=>{const s=n.measureText(e,o).width,a=t>0?Gn:0;return t+a+s+Un},td=(e,t)=>{const n=rd(e);return Math.max(t,n)+ut},nd=e=>e.isBubble?Number(e.visual.size):Zn(e.visual.color),rd=e=>e.isBubble?Number(e.visual.size):dt,od=({pillSizes:e,overflowPillSize:t,containerSize:n,gap:o})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let s=0;for(let i=0;i<e.length;i+=1)i>0&&(s+=o),s+=e[i]??0;if(s<=n)return{visibleCount:e.length,hasOverflow:!1};let a=0,c=0;for(const i of e){const d=a+(c>0?o:0)+i;if(d+o+t>n)break;a=d,c+=1}return{visibleCount:c,hasOverflow:!0}},sd=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},ad=g.memo(function({formattedLegends:t,rects:n,textScale:o}){const s=g.useMemo(()=>{const a=new Map;for(const c of t){let i=a.get(c.position);i||(i={pill:[],direct:[]},a.set(c.position,i)),c.display==="pill"?i.pill.push(c):i.direct.push(c)}return a},[t]);return r.jsx(r.Fragment,{children:Array.from(s,([a,c])=>{const i=n[a];return i===void 0?null:r.jsxs("div",{className:Ec,style:{left:i.x,top:i.y,width:i.width,height:i.height},children:[r.jsx(ed,{edge:a,formattedLegends:c.pill,containerWidth:i.width,containerHeight:i.height,textScale:o}),r.jsx(Tc,{legends:c.direct,containerRect:i,textScale:o})]},a)})})}),id=(e,t,n)=>{const o=e.filter(a=>a.interactive);if(o.length===0)return null;const s=o.map(a=>n(a,t)).filter(a=>a!==null).map(a=>a.guideMode);return s.length===0?null:s.some(a=>a==="bar")?"bar":s.every(a=>a==="continuous")?"continuous":null};function ld(e,t){const n=f.getMainAxisCoordinate(e.mainAxis,t);if(e.mainAxis==="y"){const s=b(z(n));return{x1:0,x2:"100%",y1:s,y2:s}}const o=b(n);return{x1:o,x2:o,y1:0,y2:"100%"}}function cd(e,t,n){const o=e.mainAxis==="y"?f.getY(n.observation):f.getX(n.observation);if(o===null)return null;const s=e.mainAxis==="y"?ud(n):dd(n),c=(t.x?.kind==="position"?t.x:null)?.bandwidth??s;if(c===null||c<=0)return null;const i=c/2;if(e.mainAxis==="y"){const h=b(z(o+i)),p=b(c);return{x:0,y:h,width:"100%",height:p}}const d=b(o-i),u=b(c);return{x:d,y:0,width:u,height:"100%"}}function dd(e){const t=f.getXMin(e.observation),n=f.getXMax(e.observation);return t===null||n===null?null:n-t}function ud(e){const t=f.getYMin(e.observation),n=f.getYMax(e.observation);return t===null||n===null?null:n-t}const hd=1,gd="4 3",fd=({panelRect:e})=>{const{coordSystem:t,layers:n,scales:o}=T(R.useShallow(i=>({coordSystem:i.coordSystem,layers:i.layers,scales:i.scales}))),s=Le(i=>i.hover.primary),a=Ce();if(t.type!=="cartesian"||n.length===0||s===null)return null;const c=id(n,t,a);return c===null?null:c==="bar"?r.jsx(md,{coordSystem:t,scales:o,primary:s,panelRect:e}):r.jsx(pd,{coordSystem:t,primary:s,panelRect:e})},pd=({coordSystem:e,primary:t,panelRect:n})=>{const o=ld(e,t);return r.jsx(_r,{panelRect:n,children:r.jsx("line",{...o,stroke:l.hoverGuideLineColor,strokeWidth:hd,strokeDasharray:gd,strokeLinecap:"round","data-testid":"hover-guide-line"})})},md=({coordSystem:e,scales:t,primary:n,panelRect:o})=>{const s=cd(e,t,n);return s===null?null:r.jsx(_r,{panelRect:o,children:r.jsx("rect",{...s,fill:l.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},_r=({panelRect:e,children:t})=>r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,style:{overflow:"visible",pointerEvents:"none"},"data-testid":"hover-guide",children:t}),xd=200,vd=({engine:e,store:t,overlayRef:n,setCursor:o=yd})=>{g.useEffect(()=>{const s=n.current;if(!s)return;const a=bd(s,e),c=Sd(s,e,t,o);return()=>{c(),a()}},[e,t,n,o])},yd=()=>{},bd=(e,t)=>{const n=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let o=null;const s=()=>{o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,n()},xd)},a=new ResizeObserver(s);return a.observe(e),n(),()=>{a.disconnect(),o!==null&&clearTimeout(o)}},Sd=(e,t,n,o)=>{let s=null,a=null;const c=()=>{a=null;const u=s;if(s=null,!u)return;o({clientX:u.clientX,clientY:u.clientY});const h=e.getBoundingClientRect();if(h.width===0||h.height===0)return;const p={x:(u.clientX-h.left)/h.width,y:1-(u.clientY-h.top)/h.height};n.getState().setHoverState(t.query(p))},i=u=>{s=u,a===null&&(a=requestAnimationFrame(c))},d=()=>{s=null,a!==null&&(cancelAnimationFrame(a),a=null),o(null);const u=n.getState();u.hover.primary!==null&&u.setHoverState(f.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",i),e.addEventListener("pointerleave",d),()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerleave",d),a!==null&&cancelAnimationFrame(a),s=null}},jd=({panelRect:e})=>{const{engine:t,store:n,overlayRef:o,setCursor:s}=pe();return vd({engine:t,store:n,overlayRef:o,setCursor:s}),r.jsx("rect",{ref:o,x:e.x,y:e.y,width:e.width,height:e.height,fill:"transparent",pointerEvents:"all","data-testid":"pointer-capture-layer"})},Ue="data-hover-active",Cd=e=>{const{store:t}=pe(),n=be.useStore(t,o=>o.hover.primary!==null);g.useEffect(()=>{const o=e.current;if(o)return n?o.setAttribute(Ue,"true"):o.removeAttribute(Ue),()=>{o.removeAttribute(Ue)}},[e,n])},Dt=({panelRect:e,zOrder:t})=>{const n=T(c=>c.annotations.custom),o=Ms(),s=n.filter(c=>{const i=o(c.type);return i!==null&&(c.zOrder??i.zOrder)===t});if(s.length===0)return null;const a={width:e.width,height:e.height};return r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`custom-annotations-${t}`,children:s.map(c=>{const i=o(c.type);return i===null?null:r.jsx("g",{"data-annotation-type":c.type,children:i.draw({targets:c.targets,area:a,params:c.params})},c.id)})})},Mr=F.xs,ot=O,Pr=U.medium,Ld=U.semibold,Fr=6,Nr=2,kd=4,Td=2,Ot=4;var wd="_1agclyl0",Ad="_1agclyl1",Ed="_1agclyl2",_d={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},Md="_1agclyl6 _1agclyl3";const Hr=({x:e,y:t,width:n,height:o,text:s,isRotated:a,target:c,position:i,coordType:d})=>{const u=a?`rotate(-90 ${e} ${t})`:void 0,h=c==="aggregate"?Md:_d[i],p=Pd(c,i,d);return r.jsxs("g",{transform:u,children:[p&&r.jsx("rect",{className:p,x:e-n/2,y:t-o/2,width:n,height:o,rx:Ot,ry:Ot}),r.jsx("text",{className:h,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:s})]})},Pd=(e,t,n)=>{if(e==="aggregate")return Ed;if(t==="outside"&&n==="cartesian")return Ad},Fd={dataLabel:{x:Fr,y:Nr},stackTotal:{x:kd,y:Td}},Nd=({panelRect:e,formattingLocale:t})=>{const n=oe(),o=T(R.useShallow(i=>({layers:i.layers,coordSystem:i.coordSystem,axes:i.guides.axes,numberFormat:i.config.numberFormat,parsingLocale:i.config.parsingLocale,textScale:i.config.appearance.textScale}))),s=g.useMemo(()=>{const i=K(Mr,o.textScale);return{dataLabel:{family:ot,size:i,weight:Pr},stackTotal:{family:ot,size:i,weight:Ld}}},[o.textScale]),a=g.useMemo(()=>(i,d)=>{const u=n.measureText(d,s[i]),h=Fd[i];return{...u,width:u.width+h.x*2,height:u.height+h.y*2}},[n,s]),c=g.useMemo(()=>f.buildDataLabelsContent({...o,panelRect:e,measureDataLabel:a,formattingLocale:t}),[o,e,a,t]);return r.jsx("g",{className:wd,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(i=>r.jsx(Hr,{x:i.x,y:i.y,width:i.width,height:i.height,text:i.text,isRotated:i.isRotated,target:i.target,position:i.position,coordType:o.coordSystem.type},i.key))})},Hd=({linePath:e,arrowheadPath:t,stroke:n,strokeWidth:o})=>{const s={stroke:n,strokeWidth:o,strokeLinecap:"round",fill:"none"};return r.jsxs("g",{children:[r.jsx("path",{d:e,...s}),r.jsx("path",{d:t,...s,strokeLinejoin:"round"})]})},Rd=({x:e,y:t,text:n,lineHeight:o,paddingX:s,paddingY:a,strokeWidth:c,strokeColor:i,fontWeight:d})=>{const u=oe(),p=g.useMemo(()=>u.measureText(n,{family:O,size:o,weight:d}),[u,n,o,d]).width+s*2,m=o+a*2;return r.jsxs("g",{style:{pointerEvents:"none"},children:[r.jsx("rect",{x:e-p/2,y:t-m/2,width:p,height:m,rx:4,fill:l.graphBackground,stroke:i,strokeWidth:c}),r.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:l.textPrimary,style:{fontFamily:O,fontSize:o,fontWeight:d},children:n})]})},Bd=({panelRect:e,formattingLocale:t})=>{const n=T(R.useShallow(s=>({differenceArrows:s.annotations.differenceArrows,mainAxis:s.coordSystem.type==="cartesian"?s.coordSystem.mainAxis:"x",textScale:s.config.appearance.textScale}))),o=g.useMemo(()=>n.differenceArrows.map(s=>f.computeDifferenceArrow({arrow:s,mainAxis:n.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:n.textScale,locale:t})),[n,e.width,e.height,t]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:o.map(({color:s,id:a,linePath:c,arrowheadPath:i,strokeWidth:d,labelPosition:u,labelText:h,labelLineHeight:p,labelPaddingX:m,labelPaddingY:x,labelStrokeWidth:v,labelFontWeight:y})=>{const j=s??l.defaultAnnotationArrowStroke;return r.jsxs(g.Fragment,{children:[r.jsx(Hd,{linePath:c,arrowheadPath:i,stroke:j,strokeWidth:d}),r.jsx(Rd,{x:u.x,y:u.y,text:h,lineHeight:p,paddingX:m,paddingY:x,strokeWidth:v,strokeColor:j,fontWeight:y})]},a)})})},Id=0,Dd=1.15,zt=1.15,Od="rgba(0, 0, 0, 0.16)",Gt=2,zd=1.4,Gd=({arrow:e,fallbackColor:t,stickerOutlineColor:n,stickerOutlineColorInverse:o})=>{const s=g.useId(),a=e.color??t,c=$d(e.color,n,o),i=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},d=e.arrowheadExtent+e.strokeWidth+Gt+zt,u={x:Math.min(e.startX,e.endX)-d,y:Math.min(e.startY,e.endY)-d,width:Math.abs(e.endX-e.startX)+2*d,height:Math.abs(e.endY-e.startY)+2*d},h=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(p=>p.length>0).join(" ");return r.jsxs("g",{children:[e.hasStickerStyle&&r.jsx("defs",{children:r.jsx("filter",{id:s,filterUnits:"userSpaceOnUse",...u,children:r.jsx("feDropShadow",{dx:Id,dy:Dd,stdDeviation:zt,floodColor:Od})})}),r.jsxs("g",{filter:e.hasStickerStyle?`url(#${s})`:void 0,children:[e.hasStickerStyle&&r.jsx("path",{d:h,stroke:c,strokeWidth:e.strokeWidth+2*Gt,strokeLinecap:"round",fill:"none"}),r.jsx("path",{d:e.linePath,stroke:a,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...i}),e.startArrowheadPath.length>0&&r.jsx("path",{d:e.startArrowheadPath,stroke:a,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&r.jsx("path",{d:e.endArrowheadPath,stroke:a,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},$d=(e,t,n)=>{if(e===null)return n;try{return Ze.getContrast(e,t)<zd?n:t}catch{return n}},Wd=({panelRect:e})=>{const{themeValues:t}=gt(),n=T(s=>s.annotations.freeformArrows),o=g.useMemo(()=>n.map(s=>f.computeFreeformArrow({arrow:s,panelWidth:e.width,panelHeight:e.height})).filter(s=>s!==null),[n,e.width,e.height]);return o.length===0?null:r.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:o.map(s=>r.jsx(Gd,{arrow:s,fallbackColor:l.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},s.id))})},Xd=({edge:e,areTicksVisible:t,position:n,labelRotation:o,label:s})=>{const a=b(n),c=t?1:0,i={style:{font:l.fontTickLabel},fill:l.textSecondary},d=o!==0&&(e==="top"||e==="bottom"),u=e==="top";return d?r.jsx("svg",{x:a,y:u?"100%":0,style:{overflow:"visible"},children:r.jsx("text",{...Yd(u,c,o),...i,children:s})}):r.jsx("text",{...qd(e,a,c),...i,children:s})},qd=(e,t,n)=>{switch(e){case"bottom":return{x:t,y:Q*n,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-Q*n,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-Q*n,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:Q*n,y:t,textAnchor:"start",dominantBaseline:"central"}}},Yd=(e,t,n)=>{const o=Q*t,s=e?-o:o;return{x:0,y:s,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${n}, 0, ${s})`}},Vd=({formattedAxis:e,rect:t})=>{const n=e.position==="bottom"||e.position==="top";return r.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[Bn,e.ticks.map((o,s)=>{const a=o.formattedLabel,c=n?o.position:1-o.position,i=Ud(e.position,c,t);return r.jsxs("g",{children:[e.ticksVisible&&r.jsx("line",{...i,stroke:l.gridLineColor,strokeWidth:1}),r.jsx(Xd,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:a})]},s)})]})},Ud=(e,t,n)=>{const o=b(t);switch(e){case"bottom":return{x1:o,y1:0,x2:o,y2:Ae};case"top":return{x1:o,y1:n.height,x2:o,y2:n.height-Ae};case"left":return{x1:n.width,y1:o,x2:n.width-Ae,y2:o};case"right":return{x1:0,y1:o,x2:Ae,y2:o}}},Kd=({formattedAxes:e,rects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];return!o||!n.isVisible?null:r.jsx(Vd,{formattedAxis:n,rect:o},n.scaleAestheticKey)})}),Zd=({axes:e,rects:t})=>r.jsx(r.Fragment,{children:e.map(n=>{const o=t[n.position];if(!o||!n.isVisible)return null;const s=Jd(n.position,o);return r.jsxs("g",{transform:`translate(${o.x}, ${o.y})`,children:[Bn,r.jsx("text",{style:{font:l.fontAxisLabel},fill:l.textPrimary,...s,children:n.label})]},`axis-label-${n.position}`)})}),Jd=(e,t)=>{const n={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(n.x=0,n.textAnchor="start"):e==="right"&&(n.x=t.width,n.textAnchor="end"),n},$t={strokeWidth:1,strokeDashoffset:"0",strokeDasharray:"2 3",strokeLinecap:"round"},Qd=({axes:e,panel:t,panelRect:n})=>r.jsxs("svg",{x:n.x,y:n.y,width:n.width,height:n.height,style:{overflow:"visible"},children:[t.border.isVisible&&r.jsx("rect",{x:0,y:0,width:n.width,height:n.height,fill:"none",stroke:l.gridLineColor,rx:8,ry:8,...$t}),e.map(o=>{if(!o.gridVisible)return null;const s=o.position==="bottom"||o.position==="top";return r.jsx("g",{children:o.ticks.map((a,c)=>{if(a.position<=0||a.position>=1)return null;const i=s?a.position:1-a.position,d=b(i),u=s?{x1:d,y1:0,x2:d,y2:"100%"}:{x1:0,y1:d,x2:"100%",y2:d};return r.jsx("line",{...u,...$t,stroke:l.gridLineColor},c)})},o.scaleAestheticKey)})]}),Wt=8,Xt=.5,qt={strokeWidth:1,strokeLinecap:"round"},eu=({axes:e,panelRect:t,coordSystem:n})=>{const o=e.find(y=>y.geometry==="circular"),s=e.find(y=>y.geometry==="radial");if(!o||o.ticks.length===0)return null;const a=t.x+t.width/2,c=t.y+t.height/2,i=Math.min(t.width,t.height)/2,{startAngle:d,innerRadius:u}=n,h=y=>y*2*Math.PI+d,p=(y,j)=>{const C=a+j*Math.sin(y),L=c-j*Math.cos(y);return`${C.toFixed(2)},${L.toFixed(2)}`},m=o.ticks.map(y=>h(y.position)),x=y=>`${m.map((j,C)=>`${C===0?"M":"L"} ${p(j,y)}`).join(" ")} Z`,v=(s?.ticks??[]).map(y=>(u+y.position*(1-u))*i).filter(y=>y>Xt);return v.some(y=>Math.abs(y-i)<Xt)||v.push(i),r.jsxs("g",{"data-guide":"polar",style:{overflow:"visible"},children:[v.map((y,j)=>r.jsx("path",{d:x(y),fill:"none",stroke:l.gridLineColor,...qt},`ring-${j}`)),m.map((y,j)=>r.jsx("line",{x1:a,y1:c,x2:a+i*Math.sin(y),y2:c-i*Math.cos(y),stroke:l.gridLineColor,...qt},`spoke-${j}`)),o.ticks.map((y,j)=>{const C=h(y.position),L=Math.sin(C),k=-Math.cos(C);return r.jsx("text",{x:a+L*(i+Wt),y:c+k*(i+Wt),textAnchor:L>.1?"start":L<-.1?"end":"middle",dominantBaseline:k>.1?"hanging":k<-.1?"auto":"central",style:{font:l.fontTickLabel},fill:l.textSecondary,children:y.formattedLabel},`label-${j}`)})]})},Yt=({panelRect:e,zOrder:t})=>{const o=T(s=>s.annotations.shapes).filter(s=>s.zOrder===t);return o.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:o.map(({id:s,x:a,y:c,width:i,height:d,fillColor:u,fillOpacity:h,strokeWidth:p,strokeColor:m})=>r.jsx("rect",{x:b(a),y:b(c),width:b(i),height:b(d),fill:u,fillOpacity:h,stroke:p>0?m??l.defaultAnnotationShapeStroke:"none",strokeWidth:p},s))})};var tu="_120wioc0";const nu=({panelRect:e})=>{const t=T(n=>n.annotations.textAnnotations);return t.length===0?null:r.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(n=>r.jsx("foreignObject",{x:b(n.x),y:b(n.y),width:b(n.width),height:b(1-n.y),overflow:"visible",children:r.jsx("div",{className:tu,style:ru(n.backgroundColor,n.backgroundColorStyle),children:r.jsx(He,{content:n.content})})},n.id))})},ru=(e,t)=>e===null||e==="transparent"?{color:l.textPrimary}:t==="fade"?{color:l.textPrimary,backgroundColor:tt(e,l.grey100,.5),boxShadow:`0 0 0 1.5px ${tt(e,l.grey0,.2)}`}:{color:l.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${ze(e,.1)}`};var ou="usd3ea0",su="usd3ea1";const au=({layer:e,coordSystem:t,isAnimated:n,isDimmed:o,highlightStyle:s,formattingLocale:a})=>{const i=Ce()(e,t);return i===null?r.jsxs("text",{children:[e.geom," not implemented"]}):r.jsx("g",{className:H({[su]:o&&s==="desaturate",[ou]:o&&s==="dim"}),children:i.render({layer:e,coordSystem:t,isAnimated:n,formattingLocale:a})})};function iu({plugin:e,layer:t,coordSystem:n,candidates:o}){if(e?.getOverlayAnchor===void 0||o.length===0)return[];const s=[];for(const{observation:a,observationIndex:c}of o){const i=e.getOverlayAnchor({layer:t,coordSystem:n,observation:a});i!==null&&s.push({observation:a,observationIndex:c,anchor:i})}return s}const lu=4,cu=({plugin:e,layer:t,matchedLayer:n,overlayCandidates:o,coordSystem:s,isAnimated:a,panelRect:c,formattingLocale:i})=>{const{numberFormat:d,textScale:u}=T(R.useShallow(v=>({numberFormat:v.config.numberFormat,textScale:v.config.appearance.textScale}))),h=g.useMemo(()=>iu({plugin:e,layer:t,coordSystem:s,candidates:o}),[e,t,s,o]),p=g.useMemo(()=>f.createSegmentYReader(t),[t]),m=g.useMemo(()=>f.buildLayerYValueFormatter({layer:t,numberFormat:d,locale:i}),[d,t,i]),x=Mr*vn*u;return e===null||n===null&&h.length===0?null:r.jsxs(r.Fragment,{children:[n?e.render({layer:n,coordSystem:s,isAnimated:a,formattingLocale:i}):null,h.map(({observation:v,observationIndex:y,anchor:j})=>r.jsx(du,{observation:v,anchor:j,panelRect:c,readSegmentY:p,formatYValue:m,labelFontSizePx:x},uu(v,y)))]})},du=({observation:e,anchor:t,panelRect:n,readSegmentY:o,formatYValue:s,labelFontSizePx:a})=>{const c=oe(),i=t.x,d=z(t.y),u=(f.getSize(e)??an)/2,h=o(e),p=f.isDefined(h)?s(h,e):null,m=g.useMemo(()=>{if(p===null)return null;const x=c.measureText(p,{family:ot,size:a,weight:Pr});return{width:x.width+Fr*2,height:x.height+Nr*2}},[p,c,a]);return r.jsxs(r.Fragment,{children:[r.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:b(i),cy:b(d),r:u,fill:f.getColor(e)}),p!==null&&m!==null&&r.jsx(Hr,{x:i*n.width,y:d*n.height-u-lu-m.height/2,width:m.width,height:m.height,text:p,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},uu=(e,t)=>{const n=e[f.GROUP_VARIABLES.group];return`${String(n??"")}\0${t}`},hu=({layer:e,coordSystem:t,panelRect:n})=>{const o=Ce(),{primary:s,group:a,related:c}=Le(R.useShallow(u=>({primary:u.hover.primary,group:u.hover.group,related:u.hover.related})));if(s===null)return null;const i=o(e,t);if(i===null)return null;const d=c.get(e.id)??[];return s.layerId===e.id?i.renderHover({layer:e,coordSystem:t,primary:s,group:a,related:d,panelRect:n}):d.length===0?null:i.renderHoverCompanions({layer:e,primary:s,related:d})};var gu="to1jkx0",fu="to1jkx1";const pu=({shouldAnimate:e,panelRect:t,formattingLocale:n})=>{const{layers:o,coordSystem:s,highlightStyle:a}=T(R.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return r.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:gu,"data-testid":"geom-layers",children:o.map(c=>r.jsxs(g.Fragment,{children:[r.jsx(vu,{layer:c,coordSystem:s,highlightStyle:a,shouldAnimate:e,panelRect:t,formattingLocale:n}),r.jsx(hu,{layer:c,coordSystem:s,panelRect:t})]},`${c.id}-${mu(s)}`))})},mu=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,xu=e=>{if(e.highlight!==null)return fu},vu=({layer:e,coordSystem:t,highlightStyle:n,shouldAnimate:o,panelRect:s,formattingLocale:a})=>{const c=Ce(),i=g.useMemo(()=>c(e,t),[c,e,t]),d=e.highlight;return r.jsxs("g",{className:xu(e),children:[r.jsx(au,{layer:e,coordSystem:t,isAnimated:o,isDimmed:d?.composition.isDimmed??!1,highlightStyle:n,formattingLocale:a}),d!==null&&r.jsx(cu,{plugin:i,layer:e,matchedLayer:d.composition.matchedLayer,overlayCandidates:d.composition.overlayCandidates,coordSystem:t,isAnimated:o,panelRect:s,formattingLocale:a})]})};var yu="_17uhij30";const bu=({formattedAxes:e,formattedPolarAxes:t,plotRect:n,panelRect:o,axisRects:s,axisLabelRects:a,shouldAnimate:c,formattingLocale:i})=>{const d=g.useRef(null);Cd(d);const{axes:u,panelGuide:h,coordSystem:p}=T(R.useShallow(j=>({axes:j.guides.axes,panelGuide:j.guides.panel,coordSystem:j.coordSystem}))),m=g.useMemo(()=>Rr(o,n),[o,n]),x=g.useMemo(()=>Vt(s,n),[s,n]),v=g.useMemo(()=>Vt(a,n),[a,n]),y=g.useMemo(()=>u.filter(j=>j.geometry==="linear"),[u]);return r.jsxs("svg",{ref:d,className:yu,width:n.width,height:n.height,style:{transform:`translate(${n.x}px, ${n.y}px)`},"data-testid":"plot",children:[r.jsx(Qd,{axes:e,panel:h,panelRect:m}),p.type==="polar"&&r.jsx(eu,{axes:t,panelRect:m,coordSystem:p}),r.jsx(fd,{panelRect:m}),r.jsx(Kd,{formattedAxes:e,rects:x}),r.jsx(Zd,{axes:y,rects:v}),r.jsx(Yt,{panelRect:m,zOrder:"background"}),r.jsx(Dt,{panelRect:m,zOrder:"background"}),r.jsx(pu,{shouldAnimate:c,panelRect:m,formattingLocale:i}),r.jsx(Nd,{panelRect:m,formattingLocale:i}),r.jsx(Bd,{panelRect:m,formattingLocale:i}),r.jsx(Yt,{panelRect:m,zOrder:"foreground"}),r.jsx(Dt,{panelRect:m,zOrder:"foreground"}),r.jsx(Wd,{panelRect:m}),r.jsx(nu,{panelRect:m}),r.jsx(jd,{panelRect:m})]})},Rr=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),Vt=(e,t)=>{const n={};for(const[o,s]of Object.entries(e))n[o]=Rr(s,t);return n},Su={width:0,height:0,isDefault:!0},Br=({debounce:e=0,onResize:t}={})=>{const[n,o]=g.useReducer((d,u)=>d.width===u.width&&d.height===u.height?d:u,Su),s=br(d=>{t?.(d),o(d)},e),a=g.useRef(null),c=g.useRef(null),i=g.useCallback(d=>{!d||a.current===d||(c.current??=new ResizeObserver(([u])=>{if(!u)return;const h=Math.round(u.contentBoxSize[0]?.inlineSize??u.contentRect.width),p=Math.round(u.contentBoxSize[0]?.blockSize??u.contentRect.height);s.run({width:h,height:p,isDefault:!1})}),a.current&&c.current.unobserve(a.current),a.current=d,c.current.observe(d))},[s]);return{...n,setElement:i}},Ir=e=>{let t,n;return"aspectRatio"in e?"intrinsicWidth"in e?(t=e.intrinsicWidth,n=t/e.aspectRatio):(n=e.intrinsicHeight,t=n*e.aspectRatio):(t=e.intrinsicWidth,n=e.intrinsicHeight),{width:t,height:n}},ju=(e,t)=>{const n=Br({onResize:t});return g.useMemo(()=>{if(e.mode!=="keepAspectRatio")return{setContainer:n.setElement,canRender:!1,outerStyles:{},innerStyles:{}};const o=Ir(e),s=n.width>0&&o.width>0?n.width/o.width:1;return{setContainer:n.setElement,canRender:!n.isDefault,outerStyles:{width:"100%",...n.isDefault?{aspectRatio:`${o.width} / ${o.height}`}:{height:o.height*s}},innerStyles:{transformOrigin:"top left",transform:`scale(${s})`,width:o.width,height:o.height}}},[e,n.width,n.setElement,n.isDefault])},Cu=({sizing:e,onResize:t,children:n})=>{const o=Br({onResize:t}),s=ju(e,t);if(e.mode==="keepAspectRatio")return r.jsx("div",{ref:s.setContainer,style:s.outerStyles,"data-testid":"graph-sizer",children:s.canRender&&r.jsx("div",{style:s.innerStyles,children:n(Ir(e))})});if(e.mode==="fixed")return r.jsx("div",{ref:o.setElement,style:{width:e.width,height:e.height},"data-testid":"graph-sizer",children:n({width:e.width,height:e.height})});const a=!o.isDefault&&o.width>0&&o.height>0;return r.jsx("div",{ref:o.setElement,style:{width:"100%",height:"100%"},"data-testid":"graph-sizer",children:a&&n({width:o.width,height:o.height})})},Lu={mode:"responsive"},Ke={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},ku=()=>{const[e,t]=g.useState(null),[n,o]=g.useState(null),[s,a]=g.useState(Ke);return g.useEffect(()=>{const c=()=>{const d=e?{width:e.offsetWidth,height:e.offsetHeight}:Ke.headerSize,u=n?{width:n.offsetWidth,height:n.offsetHeight}:Ke.footerSize;a(h=>Tu(h,{headerSize:d,footerSize:u})?{headerSize:d,footerSize:u}:h)};c();const i=new ResizeObserver(c);return e&&i.observe(e),n&&i.observe(n),()=>i.disconnect()},[e,n]),{headerRef:t,footerRef:o,measurements:s}},Tu=(e,t)=>e.headerSize.width!==t.headerSize.width||e.headerSize.height!==t.headerSize.height||e.footerSize.width!==t.footerSize.width||e.footerSize.height!==t.footerSize.height,wu=({appearance:e,isEditable:t,editorId:n,style:o,children:s})=>{const{theme:a,themeClass:c,inlineVarsStyle:i}=gt(),d=di(e.border),u=Math.max(0,e.cornerRadius),h=u===0?0:u+d,p=g.useMemo(()=>{const v={...o,borderRadius:`${h}px`,...i},y=ci(e.border,a);return y!==null&&(v.background=y),v},[o,h,i,e.border,a]),m=g.useMemo(()=>({inset:`${d}px`,borderRadius:`${u}px`}),[d,u]),x=t&&e.background.type==="solid"&&e.background.color==="transparent";return r.jsx("div",{"data-testid":"graph-wrapper","data-graphy-id":n,className:H(fi,c),style:p,children:r.jsx("div",{"data-testid":"graph-inner",className:H(mi,{[xi]:x}),style:m,children:s})})},Au=({sizing:e=Lu,onResize:t,...n})=>r.jsx(Fn,{children:r.jsx(Sn,{children:r.jsx(Cu,{sizing:e,onResize:t,children:({width:o,height:s})=>r.jsx(Eu,{width:o,height:s,...n})})})}),Eu=({width:e,height:t,isAnimated:n,showTooltips:o=!0,mode:s="readonly"})=>{const{axes:a,legends:c,numberFormat:i,parsingLocale:d,appearance:u,annotations:h,coordSystem:p,headline:m,headlineConfig:x}=T(R.useShallow(Y=>({axes:Y.guides.axes,legends:Y.guides.legends,numberFormat:Y.config.numberFormat,parsingLocale:Y.config.parsingLocale,appearance:Y.config.appearance,annotations:Y.annotations,coordSystem:Y.coordSystem,headline:Y.guides.headline,headlineConfig:Y.config.headline}))),v=_.useReducedMotion(),{headerRef:y,footerRef:j,measurements:C}=ku(),{formattingLocale:L,theme:k,themeOverrides:w,id:A}=se(),le=g.useMemo(()=>f.formatLegends({legends:c,numberFormat:i,parsingLocale:d,formattingLocale:L}),[c,i,d,L]),ee=g.useMemo(()=>f.formatHeadline({headline:m,show:x.show,numberFormat:i,parsingLocale:d,formattingLocale:L}),[m,x.show,i,d,L]),G=oe(),J=u.border.type==="none"?0:u.border.width,$=g.useMemo(()=>({width:Math.max(0,e-2*J),height:Math.max(0,t-2*J)}),[e,t,J]),X=g.useMemo(()=>ee?{formatted:ee,size:x.size,position:x.position,innerRadius:p.type==="polar"?p.innerRadius:0}:void 0,[ee,x.size,x.position,p]),q=$a(G,u.textScale),me=Wa({measurer:q,axes:a,numberFormat:i,parsingLocale:d,formattedLegends:le,containerSize:$,externalMeasurements:C,headline:X,formattingLocale:L,annotations:h,coordSystem:p,textScale:u.textScale}),ke=g.useMemo(()=>!me||!X||!q?null:f.resolveHeadlinePlacement({headline:X,layout:me.layout,containerSize:$,measurer:q,itemGap:Mn}),[me,X,$,q]);if(!me)return null;const{layout:te,formattedAxes:Or,formattedPolarAxes:zr}=me;return r.jsx(ar,{theme:k,themeOverrides:w,appearance:u,children:r.jsxs(wu,{appearance:u,isEditable:s==="editable",editorId:A,style:{width:"100%",height:"100%"},children:[r.jsx(Zl,{ref:y,headerRect:te.header,mode:s}),r.jsx(bu,{formattedAxes:Or,formattedPolarAxes:zr,plotRect:te.plot,panelRect:te.panel,axisRects:te.axes,axisLabelRects:te.axisLabels,shouldAnimate:n??!v,formattingLocale:L??d}),r.jsx(Bl,{ref:j,footerRect:te.footer,mode:s}),r.jsx(ad,{formattedLegends:le,rects:te.legends,textScale:u.textScale}),ee&&ke&&r.jsx(yc,{headline:ee,rect:ke.rect,resolvedSize:ke.resolvedSize,visibleItemCount:ke.visibleItemCount}),o&&r.jsx(Ca,{})]})})};function _u(e,t){return{type:e.type,zOrder:t.zOrder,draw:t.draw}}const Mu=2147483646;function Pu(){const e=g.useRef(null),[t,n]=g.useState(null),o=g.useCallback(()=>{const a=e.current;if(!a)return;const c=a.getBoundingClientRect(),i={left:c.left,top:c.top,width:c.width,height:c.height};n(d=>d&&Nu(d,i)?d:i)},[]),s=g.useCallback(a=>{e.current=a},[]);return g.useLayoutEffect(()=>{if(!e.current)return;o();const a=new ResizeObserver(o);return a.observe(e.current),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{a.disconnect(),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]),{ref:s,rect:t}}function Fu({rect:e,children:t}){return on.createPortal(r.jsx("div",{style:{position:"fixed",left:e.left,top:e.top,width:e.width,height:e.height,pointerEvents:"none",zIndex:Mu,overflow:"visible"},children:t}),document.body)}function Nu(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function*Hu(e,t){for(const n of e)yield{kind:n[t],observation:n}}function Ru(e,t,n,o){return e>=n&&t>=o}const Bu=({children:e,style:t,...n})=>r.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 1 1",preserveAspectRatio:"none",...n,style:{overflow:"visible",...t},children:e});function Iu(){return g.useMemo(()=>{const e=f.DEFAULT_COLOR_PALETTE;return t=>e[t%e.length]??e[0]??"#000000"},[])}function Du(e,t){const{hitTesterRegistry:n}=pe(),o=g.useRef(t);o.current=t,g.useLayoutEffect(()=>{const s=a=>o.current(a);return n.set(e,s),()=>{n.delete(e)}},[n,e])}function Ou(e){const{engine:t,store:n,setCursor:o}=pe();return g.useCallback((s,a)=>{if(s===null){n.getState().setHoverState(f.RESTING_HOVER_STATE),o(null);return}n.getState().setHoverState(t.hoverByKey(e,s)),a&&o(a)},[t,n,o,e])}function Dr(e,t,n){const o=Ut(e),s=Ut(t),a=(c,i)=>Math.round(c+(i-c)*n);return`rgb(${a(o.red,s.red)}, ${a(o.green,s.green)}, ${a(o.blue,s.blue)})`}function zu(e,t){return Dr(e,"#ffffff",t)}function Ut(e){const t=e.replace("#","");return{red:Number.parseInt(t.slice(0,2),16),green:Number.parseInt(t.slice(2,4),16),blue:Number.parseInt(t.slice(4,6),16)}}exports.CanvasTextMeasurer=Oe;exports.CompanionDot=re;exports.DevToolsPanel=Ks;exports.GraphProvider=_s;exports.GraphRenderer=Au;exports.HoverProvider=Fn;exports.PanelOverlayPortal=Fu;exports.PrimaryDot=De;exports.Swatch=je;exports.TextMeasurerProvider=Sn;exports.ThemeProvider=ar;exports.TooltipBody=Nn;exports.TooltipRowView=Hn;exports.UnitSpaceSvg=Bu;exports.darkTheme=sr;exports.defineAnnotationRenderer=_u;exports.defineGeomPlugin=oo;exports.defineGeomRenderer=so;exports.emToPx=K;exports.fitsLabel=Ru;exports.lightTheme=or;exports.lighten=zu;exports.mixColor=Dr;exports.partitionByKind=Hu;exports.toPercent=b;exports.toViewBoxX=lo;exports.toViewBoxY=z;exports.useCategoricalColor=Iu;exports.useCompiledSelector=T;exports.useGeomHitTest=Du;exports.useGeomHover=Ou;exports.useGraphCommandDispatcher=lt;exports.useHoverState=Le;exports.usePanelScreenRect=Pu;exports.useSvgPathMorph=Pe;exports.useTextMeasurer=oe;exports.vars=l;