@graphysdk/react-renderer 0.0.1-plugins.0 → 0.0.1-plugins.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  require('./index.css');
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),A=require("clsx"),g=require("react"),ee=require("zustand"),v=require("@graphysdk/viz-engine"),a=require("./tooltip-body-B4Mj-oru.cjs"),ir=require("motion/react"),E=require("zustand/react/shallow"),k=require("@floating-ui/react-dom"),lr=require("@tiptap/core"),Ye=require("@tiptap/extension-bold"),he=require("@tiptap/extension-document"),Ue=require("@tiptap/extension-hard-break"),Xe=require("@tiptap/extension-heading"),Ke=require("@tiptap/extension-italic"),Ze=require("@tiptap/extension-link"),Je=require("@tiptap/extension-text"),Qe=require("@tiptap/extension-text-align"),B=require("@tiptap/extension-text-style"),et=require("@tiptap/extension-underline"),te=require("@tiptap/extensions"),cr=require("@tiptap/extension-paragraph"),ve=require("@tiptap/react"),C=require("@base-ui/react/toolbar"),M=require("@base-ui/react/tooltip"),ur=require("react-dom"),dr=require("@vanilla-extract/dynamic"),S=require("@base-ui/react/popover"),we=require("react-colorful"),w=require("@base-ui/react/menu"),hr=require("@base-ui/react/toggle"),gr=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-plugins.0");var fr="drqe3u0",xr="drqe3u1",pr="drqe3u2",mr="drqe3u3",K="drqe3u4",vr="drqe3u5",yr="drqe3u6",br="drqe3u7",ie="drqe3u8",jr="drqe3u9",Tr="drqe3ua",Cr="drqe3ub",Sr="drqe3uc",kr="drqe3ud",wr="drqe3ue",Ar="drqe3uf",Er="drqe3ug",_r="drqe3uh",Lr="drqe3ui",Ae={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},Ee={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},tt={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const Fr=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=a.useGraphContext(),[o]=g.useState(()=>a.createDevToolsStore()),[i,c]=g.useState(!1),[l,u]=g.useState(v.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:m}=o.getState(),b=s.getLastTrigger(),j=s.getLastCompile();return b&&j&&m(b,j),s.subscribe(m)},[o,s]);const d=ee.useStore(o,m=>m.lastCompile),h=ee.useStore(o,m=>m.history),f=s.getCacheStats(),x=d===null&&h.length===0,p=()=>{u(m=>{const b=!m;return v.setCompilerCachingEnabled(b),b})};return n.jsxs("div",{className:A(Tr,r),style:{width:e,...t},children:[n.jsxs("div",{className:fr,children:[n.jsxs("div",{children:[n.jsx("div",{className:xr,children:"compile cache"}),n.jsx("div",{className:wr,children:x?"production: stats disabled":d?`last: ${d.label} · ${rt(d.durationMs)}`:"awaiting first compile…"})]}),n.jsx("button",{type:"button",onClick:()=>c(m=>!m),className:Ar,children:i?"▾":"▴"})]}),!i&&n.jsxs("div",{className:Cr,children:[n.jsxs("button",{type:"button",onClick:p,className:l?Ae.enabled:Ae.disabled,"aria-pressed":l,children:["cache ",l?"enabled":"disabled"]}),n.jsx("span",{className:Er,children:"next compile reflects this toggle"})]}),!i&&!x&&n.jsxs(n.Fragment,{children:[n.jsx(Nr,{delta:d?.stages,cumulative:f}),n.jsx(Pr,{entries:h})]})]})},Nr=({delta:e,cumulative:t})=>n.jsxs("table",{className:pr,children:[n.jsx("thead",{children:n.jsxs("tr",{className:_r,children:[n.jsx("th",{className:mr,children:"stage"}),n.jsx("th",{className:K,children:"Δ miss"}),n.jsx("th",{className:K,children:"Δ hit"}),n.jsx("th",{className:K,children:"total miss"}),n.jsx("th",{className:K,children:"total hit"})]})}),n.jsx("tbody",{children:v.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Dr(s);return n.jsxs("tr",{className:Sr,children:[n.jsxs("td",{className:vr,children:[n.jsx("span",{className:tt[o],"aria-hidden":!0})," ",r]}),n.jsx("td",{className:o==="ran"?Ee.ran:Ee.dim,children:s?.misses??0}),n.jsx("td",{className:ie,children:s?.hits??0}),n.jsx("td",{className:ie,children:t[r].misses}),n.jsx("td",{className:ie,children:t[r].hits})]},r)})})]}),Pr=({entries:e})=>e.length===0?null:n.jsxs("div",{className:kr,children:[n.jsx("div",{className:Lr,children:"recent compiles"}),e.map(t=>{const r=Or(t.stages,i=>i.misses>0),s=v.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return n.jsxs("div",{className:yr,children:[n.jsx("span",{className:tt[o],"aria-hidden":!0}),n.jsx("span",{className:br,title:t.label,children:t.label}),n.jsxs("span",{className:jr,children:[r,"/",s," ran · ",rt(t.durationMs)]})]},t.id)})]}),Dr=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Or=(e,t)=>{let r=0;for(const s of v.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},rt=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Ir={small:1.9,medium:2.3,large:2.6},Mr={small:1,medium:1,large:1.2},Br=a.DEFAULT_FONT_FAMILY,nt=a.FONT_LINE_HEIGHT.sm,Rr=12,Hr=4,Gr=4,zr=12,$r=4,qr=2,st=24;function W(e){const{store:t}=a.useHoverContext();return ee.useStore(t,e)}const Vr=e=>{const{cursorRef:t,subscribeCursorMove:r}=a.useHoverContext(),s=W(i=>i.isPointerInside),o=g.useRef(e);return o.current=e,g.useEffect(()=>r(()=>o.current?.()),[r]),{cursorRef:t,isInside:s}},Wr=16,Yr=8,Ur={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Xr=()=>{const e=a.useCompiledSelector(E.useShallow(y=>({layers:y.layers,coordSystem:y.coordSystem,scales:y.scales,guides:y.guides,numberFormat:y.config.numberFormat,parsingLocale:y.config.parsingLocale}))),{formattingLocale:t}=a.useGraphContext(),r=W(y=>y.hover),s=a.useResolveGeomPlugin(),o=g.useRef(()=>{}),{cursorRef:i,isInside:c}=Vr(()=>o.current()),l=g.useMemo(()=>v.buildTooltipContent({...e,hover:r,formattingLocale:t}),[e,r,t]),u=l!==null&&c,d=g.useMemo(()=>({getBoundingClientRect:()=>{const y=i.current;return y===null?Ur:Kr(y)}}),[i]),{refs:h,floatingStyles:f,update:x}=k.useFloating({open:u,placement:"right",middleware:[k.offset(Wr),k.flip(),k.shift({padding:Yr})],elements:{reference:d}});if(o.current=x,!u)return null;const p=r.primary,m=p===null?null:e.layers.find(y=>y.id===p.layerId)??null,b=m===null?null:s(m,e.coordSystem),j=p!==null&&m!==null&&b?.renderTooltip?b.renderTooltip({content:l,layer:m,coordSystem:e.coordSystem,primary:p,group:r.group,related:r.related}):null;return n.jsx("div",{ref:h.setFloating,role:"tooltip",className:a.root,style:f,"data-testid":"chart-tooltip",children:j??n.jsx(a.TooltipBody,{content:l})})},Kr=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),ye=a.FONT_SIZE_EM.sm,ot=a.DEFAULT_FONT_FAMILY,at=!1,Z=6,N=10,Zr=(e,t)=>r=>{if(!r.isVisible||r.ticks.length===0)return 0;const s=r.position==="top"||r.position==="bottom",o=r.ticks.map(l=>e.measureText(l.formattedLabel,{family:ot,size:a.emToPx(ye,t)})),i=r.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(s){if(r.labelRotation!==0){const l=o.map(d=>d.width);return _e(l,i)+2*N}return Math.max(...o.map(l=>l.height))+N}return _e(o.map(l=>l.width),i)+N},_e=(e,t)=>Math.min(Math.max(...e),t),Jr=e=>()=>a.emToPx(ye,e),Qr=(e,t)=>(r,s)=>{const{labelLineHeight:o,labelFontWeight:i}=v.getDifferenceArrowDimensions(s,t);return e.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:o,weight:i})},it=e=>{const{value:t,observationLabel:r,comparison:s,swatch:o,label:i}=e;return[{role:"valueRow",gap:Gr,segments:le([J("value","value",t??"–"),J("observation","label",r)])},{role:"trendRow",gap:$r,ariaLabel:s===null?void 0:nn(s),segments:le([tn(s),rn(s),J("trendReference","label",s?.reference??null)])},{role:"groupRow",gap:Hr,segments:le([en(o),J("label","label",i)])}].filter(l=>l.segments.length>0)},J=(e,t,r)=>r===null?null:{kind:"text",textRole:e,fontRole:t,text:r},en=e=>e===null?null:{kind:"swatch",swatch:e,size:Rr},tn=e=>e===null?null:{kind:"trendArrow",direction:e.direction,size:zr},rn=e=>e===null?null:{kind:"text",textRole:"trendPercentage",fontRole:"label",text:e.percentage,trendDirection:e.direction},nn=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}`}},le=e=>e.filter(t=>t!==null),sn=(e,t)=>(r,s)=>{const o=lt(r,s,e,t),i=ct(o.map(l=>l.width)),c=Math.max(0,o.length-1)*st;return{width:i+c,height:Math.max(0,...o.map(l=>l.height))}},on=(e,t)=>(r,s)=>lt(r,s,e,t).map(o=>o.width),an=(e,t)=>(r,s)=>{const o=ge("value",s,t);return{width:e.measureText(r,o).width,height:o.size*nt}},ln=(e,t)=>{const r=sn(e,t),s=an(e,t);return(o,i)=>o.kind==="perGroup"?r(o,i):s(o.value,i)},lt=(e,t,r,s)=>{const o={value:ge("value",t,s),label:ge("label",t,s)},i=c=>cn(c,o,r);return e.items.map(c=>{const l=it(c).map(i),u=Math.max(0,l.length-1)*qr;return{width:Math.max(0,...l.map(d=>d.width)),height:ct(l.map(d=>d.height))+u}})},cn=(e,t,r)=>{let s=0,o=0;for(const i of e.segments)if(i.kind==="text"){const c=t[i.fontRole];s+=r.measureText(i.text,c).width,o=Math.max(o,c.size*nt)}else s+=i.size,o=Math.max(o,i.size);return{width:s+Math.max(0,e.segments.length-1)*e.gap,height:o}},ge=(e,t,r)=>{const s=e==="value"?Ir[t]:Mr[t];return{family:Br,size:a.emToPx(s,r)}},ct=e=>e.reduce((t,r)=>t+r,0),be=12,ut=10,dt=8,un=8,dn=8,hn=2,ht=1,gt=2,ft=4,xt=a.FONT_SIZE_EM.sm,pt=a.FONT_LINE_HEIGHT.sm,mt=a.DEFAULT_FONT_FAMILY,vt=2*(dn+ht),je=2*(hn+ht),gn=gt*ft,yt=e=>{const t=a.emToPx(xt,e);return{fontSizePx:t,lineBoxHeight:t*pt}},bt=e=>e?ut:0,fn=(e,t)=>r=>{if(r.items.length===0)return 0;const{fontSizePx:s,lineBoxHeight:o}=yt(t),i={family:mt,size:s};if(r.position==="top"||r.position==="bottom")return Math.max(o,be)+je;const l=r.items.map(u=>{const d=e.measureText(u.formattedLabel,i).width,h=bt(u.visual.color);return h+(h>0?dt:0)+d});return Math.max(...l)+vt},xn=(e,t)=>r=>e.measureText(r,{family:ot,size:a.emToPx(ye,t)}),pn=(e,t)=>g.useMemo(()=>e?{measureAxis:Zr(e,t),measureAxisLabel:Jr(t),measureLegend:fn(e,t),measureHeadline:ln(e,t),measureHeadlineItemWidths:on(e,t),measureTickLabel:xn(e,t),measureDifferenceArrowLabel:Qr(e,t)}:null,[e,t]),mn=({measurer:e,axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f})=>g.useMemo(()=>e?new v.LayoutCompiler(e).compile({axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f}):null,[t,r,s,o,i,c,l,u,d,h,f,e]),Le="data-variant",jt=cr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(Le)??null,renderHTML:e=>e.variant?{[Le]:e.variant}:{}}}}}),vn=lr.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:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),yn=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:r,isSubtitleVisible:s})=>[jn({isTitleVisible:r,isSubtitleVisible:s}),jt,Je.Text,te.UndoRedo,Xe.Heading.configure({levels:[1,2,3]}),Ye.Bold,Ke.Italic,et.Underline,Qe.TextAlign.configure({types:["heading","paragraph"]}),Ze.Link.configure({openOnClick:!1,autolink:!0}),B.TextStyle,B.Color,B.FontFamily,Ue.HardBreak,vn.configure({isTitleVisible:r}),te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const c=r?i.state.doc.firstChild?.nodeSize??-1:0;return s&&o===c?t:""}})],bn=({placeholder:e})=>[he.Document,jt,Je.Text,te.UndoRedo,Xe.Heading.configure({levels:[1,2,3]}),Ye.Bold,Ke.Italic,et.Underline,Qe.TextAlign.configure({types:["heading","paragraph"]}),Ze.Link.configure({openOnClick:!1,autolink:!0}),B.TextStyle,B.Color,B.FontFamily,Ue.HardBreak,te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],jn=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?he.Document.extend({content:"block{2,}"}):he.Document,T=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,se=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,Tt=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,fe=(e,t,r)=>`color-mix(in srgb, ${e}, ${t} ${r*100}%)`,Tn=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),Cn=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),Ct={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)"},St={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},kt={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},Sn=8,I=e=>`${Sn*e}px`,wt={spaceXxs:I(.25),spaceXs:I(.5),spaceSm:I(.75),spaceMd:I(1),spaceLg:I(1.5),spaceXl:I(2)},kn={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)"},wn={textPrimary:a.vars.grey0,textSecondary:T(a.vars.textPrimary,.8),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey70,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,sunkenBackground:a.vars.grey100,defaultBackground:a.vars.grey90,raisedBackground:a.vars.grey80,overlayBackground:a.vars.grey90,overlayBorderGradient:a.vars.greyGradient80},An={graphBackground:a.vars.grey90,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:a.vars.border100,targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.grey70,tooltipBorderColor:a.vars.grey60,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey60,hoverGuideLineColor:T(a.vars.white,.08),hoverGuideFillColor:T(a.vars.white,.06),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.white,defaultAnnotationShapeStroke:a.vars.white,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:a.vars.white},En={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},_n={...kn,...wn,...Ct,...St,...wt,...kt,...An,...En,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},Ln={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)"},Fn={textPrimary:a.vars.black,textSecondary:T(a.vars.textPrimary,.6),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey100,brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),sunkenBackground:a.vars.grey90,defaultBackground:a.vars.grey100,raisedBackground:a.vars.grey85,overlayBackground:a.vars.grey100,overlayBorderGradient:a.vars.border10},Nn={graphBackground:a.vars.grey100,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.white,tooltipBorderColor:a.vars.border10,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey80,hoverGuideLineColor:T(a.vars.black,.08),hoverGuideFillColor:T(a.vars.black,.04),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.black,defaultAnnotationShapeStroke:a.vars.black,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:"#3d414c"},Pn={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},Dn={...Ln,...Fn,...Ct,...St,...wt,...kt,...Nn,...Pn,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},re=.1,On={light:.05,dark:.1},In=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return Rn(e.color,t);case"gradient":return Hn(e.color,t);case"preset":return v.BORDER_PRESET_GRADIENTS[e.preset]}},Mn=e=>e.type==="none"?0:e.width,Bn=(e,t,r)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return fe(r,e.color,On[t])},Rn=(e,t)=>t==="dark"?se(e,re):Tt(e,re),Hn=(e,t,r=90)=>{const s=e,o=t==="dark"?se(e,re):Tt(e,re);return`linear-gradient(${r}deg, ${s} 0%, ${o} 100%)`};var Gn="bow4tg0",zn="bow4tg1",$n="bow4tg2",qn="bow4tg3",At="_1ii3bsb0",Et="_1ii3bsb1";const Te=g.createContext(null),Ce=()=>{const e=g.useContext(Te);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},_t=({theme:e,themeOverrides:t={},appearance:r,children:s})=>{const o=g.useMemo(()=>({...e==="dark"?_n:Dn,...t}),[e,t]),i=g.useMemo(()=>{const l={[a.vars.textScale]:String(r.textScale)};for(const[d,h]of Object.entries(t))l[a.vars[d]]=h;const u=Bn(r.background,e,o.graphBackground);return u!==void 0&&(l[a.vars.graphBackground]=u),dr.assignInlineVars(l)},[r.textScale,r.background,e,o.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?Et:At,inlineVarsStyle:i,themeValues:o}),[e,i,o]);return n.jsx(Te.Provider,{value:c,children:s})},D=({children:e,className:t,style:r})=>{const s=g.useContext(Te),o=s?A(s.themeClass,zn):void 0,i=s?{...s.inlineVarsStyle,...r}:r;return n.jsx("div",{className:A(o,t),style:i,children:e})},Vn="graphy_root",O=()=>typeof document>"u"?null:document.getElementById(Vn)??document.body;var Wn="yp3g0k0",Yn="yp3g0k1",Lt="yp3g0k3",Un="yp3g0k4",Ft="yp3g0k5",xe="yp3g0k6",Xn="yp3g0k7",Kn="yp3g0k8",Nt="yp3g0k9",Zn="yp3g0ka",Jn="yp3g0kb",Qn="yp3g0kc",es="yp3g0kd",ts="yp3g0ke";const rs=a.CANVAS_COLOR_KEYS.map(e=>a.vars[e]),ns=Object.fromEntries(a.CANVAS_COLOR_KEYS.map(e=>[a.vars[e],e])),ss=({editor:e,currentColor:t,isOpen:r,onOpenChange:s})=>{const o=as(),i=g.useCallback(l=>{e.chain().setColor(l).run()},[e]),c=l=>{e.chain().focus().setColor(l).run(),s(!1)};return n.jsxs(S.Popover.Root,{open:r,onOpenChange:s,children:[n.jsx(S.Popover.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Text color",className:Wn,onMouseDown:l=>l.preventDefault(),children:n.jsx("span",{className:Yn,style:{background:t??"transparent"}})}),n.jsx(S.Popover.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(S.Popover.Positioner,{sideOffset:6,align:"start",className:Lt,children:n.jsxs(S.Popover.Popup,{className:Un,onMouseDown:l=>l.preventDefault(),children:[n.jsx(Fe,{title:"Colors",colors:rs,currentColor:t,onPick:c}),o.length>0&&n.jsx(Fe,{title:"Chart colors",colors:o,currentColor:t,onPick:c}),n.jsx(os,{value:t??"#000000",onChange:i})]})})})})]})},Fe=({title:e,colors:t,currentColor:r,onPick:s})=>n.jsxs("div",{className:Ft,children:[n.jsx("div",{className:xe,children:e}),n.jsx("div",{className:Xn,children:t.map(o=>n.jsx("button",{type:"button","aria-label":o,className:Kn,"data-active":ls(o,r),onMouseDown:i=>i.preventDefault(),onClick:()=>s(o),children:n.jsx("span",{className:Nt,style:Pt(o)})},o))})]}),os=({value:e,onChange:t})=>{const[r,s]=g.useState(!1),o=Cn(e)?e:"#000000",i=is(o);return n.jsxs(S.Popover.Root,{open:r,onOpenChange:s,children:[n.jsxs("div",{className:Ft,children:[n.jsx("div",{className:xe,children:"Custom"}),n.jsxs(S.Popover.Trigger,{className:Zn,onMouseDown:c=>c.preventDefault(),"aria-label":"Pick custom color",children:[n.jsx("span",{className:Nt,style:Pt(o)}),n.jsx("span",{className:Jn,children:i})]})]}),n.jsx(S.Popover.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(S.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Lt,children:n.jsxs(S.Popover.Popup,{className:Qn,onMouseDown:c=>c.preventDefault(),children:[n.jsx("div",{className:xe,children:"Pick color"}),n.jsx(we.HexColorPicker,{color:i,onChange:t,className:es}),n.jsx(we.HexColorInput,{color:i,onChange:t,prefixed:!0,className:ts,onMouseDown:c=>c.stopPropagation()})]})})})})]})},as=()=>{const e=a.useCompiledSelector(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const s=e.map(r);typeof s=="string"&&t.add(s)}return[...t]},[e])},Pt=e=>({background:e,border:`1px solid ${se(e,.1)}`}),is=e=>{const{themeValues:t}=Ce();if(Tn(e))return e.toUpperCase();const r=ns[e];return r?t[r].toUpperCase():"#000000"},ls=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),cs={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var us={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const F=({children:e,title:t,variant:r="primary",size:s="sm",...o})=>{const i=g.useId(),c=cs[s];return n.jsxs("svg",{className:us[r],"aria-labelledby":t?i:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...o,children:[t&&n.jsx("title",{id:i,children:t}),e]})},Dt=e=>n.jsx(F,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"m6 9 6 6 6-6"})})}),ds="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Ot=`'Aeonik', 'Aeonik Fallback', ${a.DEFAULT_FONT_FAMILY}`,hs="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",gs="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",fs=`var(--brand-font-family), ${Ot}`,pe=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:a.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Ot},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:ds},{id:"technical",label:"Technical",preview:"00",fontFamily:hs},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:gs},{id:"brand",label:"Brand",preview:"Aa",fontFamily:fs}],xs=e=>e?pe.find(t=>t.fontFamily===e)??null:null;var It="_1qkyw7q0",Mt="_1qkyw7q1",Bt="_1qkyw7q3",Rt="_1qkyw7q4",Ht="_1qkyw7q5";const ps=({editor:e,currentFontFamily:t,isOpen:r,onOpenChange:s})=>{const o=xs(t)??pe[0],i=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return n.jsxs(w.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(w.Menu.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Font family",className:It,onMouseDown:c=>c.preventDefault(),children:[n.jsx("span",{className:Mt,style:{fontFamily:o?.fontFamily},children:o?.preview}),n.jsx(Dt,{size:"sm"})]}),n.jsx(w.Menu.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(w.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Bt,children:n.jsx(w.Menu.Popup,{className:Rt,onMouseDown:c=>c.preventDefault(),children:pe.map(c=>n.jsx(w.Menu.Item,{className:Ht,"data-selected":c.id===o?.id,onClick:()=>i(c),children:n.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Gt={id:"text",label:"Text",previewFont:a.vars.fontTextEditorBody},Ne=[{id:"caption",label:"Caption",previewFont:a.vars.fontTextEditorH6},Gt,{id:"h3",label:"Heading 3",previewFont:a.vars.fontTextEditorH3},{id:"h2",label:"Heading 2",previewFont:a.vars.fontTextEditorH2},{id:"h1",label:"Heading 1",previewFont:a.vars.fontTextEditorH1}],ms=({editor:e,activeStyle:t,isOpen:r,onOpenChange:s})=>{const o=Ne.find(i=>i.id===t)??Gt;return n.jsxs(w.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(w.Menu.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Text style",className:It,onMouseDown:i=>i.preventDefault(),children:[n.jsx("span",{className:Mt,children:o.label}),n.jsx(Dt,{size:"sm"})]}),n.jsx(w.Menu.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(w.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Bt,children:n.jsx(w.Menu.Popup,{className:Rt,onMouseDown:i=>i.preventDefault(),children:Ne.map(i=>n.jsx(w.Menu.Item,{className:Ht,"data-selected":i.id===o.id,onClick:()=>vs(e,i.id),children:n.jsx(ys,{font:i.previewFont,children:i.label})},i.id))})})})})]})},vs=(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()}},ys=({font:e,children:t})=>n.jsx("span",{style:{font:e,margin:0},children:t}),bs=e=>n.jsx(F,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M20 6 9 17l-5-5"})})}),js=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.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"})]})}),Ts=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 6 6 18"}),n.jsx("path",{d:"m6 6 12 12"})]})}),Cs=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Ss=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,s=t.parentOffset,o=t.start();let i=s;for(;i>0&&Pe(r[i-1]);)i-=1;let c=s;for(;c<r.length&&Pe(r[c]);)c+=1;return{from:o+i,to:o+c}},Pe=e=>e!==void 0&&/\S/.test(e);var ks="b5kquu0",ws="b5kquu1",As="b5kquu2",Es="b5kquu3",De="b5kquu4";const _s=({editor:e,currentUrl:t,isActive:r,isOpen:s,onOpenChange:o})=>{const[i,c]=g.useState(""),l=g.useRef(null);g.useEffect(()=>{s&&c(t??"")},[s,t]);const u=()=>{Ls(e,i),o(!1)},d=()=>{c(""),o(!1)},h=x=>{c(x.target.value)},f=x=>{x.key==="Enter"&&(x.preventDefault(),u())};return n.jsxs(S.Popover.Root,{open:s,onOpenChange:o,children:[n.jsx(S.Popover.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Link","data-active":r,className:ks,onMouseDown:x=>x.preventDefault(),children:n.jsx(js,{})}),n.jsx(S.Popover.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(S.Popover.Positioner,{sideOffset:6,align:"end",className:ws,children:n.jsxs(S.Popover.Popup,{className:As,initialFocus:l,onMouseDown:x=>x.preventDefault(),children:[n.jsx("input",{ref:l,type:"url",value:i,placeholder:"Type or paste a link...","aria-label":"Link URL",className:Es,onMouseDown:x=>x.stopPropagation(),onChange:h,onKeyDown:f}),n.jsx("button",{type:"button","aria-label":"Cancel",className:De,onClick:d,children:n.jsx(Ts,{})}),n.jsx("button",{type:"button","aria-label":"Apply link",className:De,onClick:u,children:n.jsx(bs,{})})]})})})})]})},Ls=(e,t)=>{const r=t.trim(),{selection:s}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!s.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=Ss(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Fs=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M17 12H7"}),n.jsx("path",{d:"M19 19H5"})]})}),Ns=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M21 12H9"}),n.jsx("path",{d:"M21 19H7"})]})}),Ps=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M15 12H3"}),n.jsx("path",{d:"M17 19H3"})]})});var Ds="k91gos0",Os="k91gos1";const Is=6,R=({label:e,isActive:t,onToggle:r,children:s})=>{const o=i=>i.preventDefault();return n.jsxs(M.Tooltip.Root,{children:[n.jsx(M.Tooltip.Trigger,{render:n.jsx(hr.Toggle,{render:n.jsx(C.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:Ds,onMouseDown:o,children:s}),n.jsx(M.Tooltip.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(M.Tooltip.Positioner,{sideOffset:Is,children:n.jsx(M.Tooltip.Popup,{className:Os,children:e})})})})]})},Ms=({editor:e,activeAlignment:t="left"})=>n.jsxs(n.Fragment,{children:[n.jsx(R,{label:"Align left",isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:n.jsx(Ps,{})}),n.jsx(R,{label:"Align center",isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:n.jsx(Fs,{})}),n.jsx(R,{label:"Align right",isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:n.jsx(Ns,{})})]});var Bs="_1bp10ig0",V="_1bp10ig1",Q="_1bp10ig2";const Rs=({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:Hs(e),textAlign:Gs(e)}),Hs=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",Gs=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",zs=8,$s=8,qs=({editor:e})=>{const[t,r]=g.useState(!1),[s,o]=g.useState(null),i=s!==null,c=p=>m=>{o(m?p:null)},{refs:l,floatingStyles:u}=k.useFloating({placement:"top-start",strategy:"fixed",middleware:[k.offset(zs),k.flip(),k.shift({padding:$s})],whileElementsMounted:k.autoUpdate}),d=g.useRef(null),h=ve.useEditorState({editor:e,selector:Rs}),f=g.useCallback(p=>{d.current=p,l.setFloating(p)},[l]);if(g.useEffect(()=>{e&&l.setReference(e.view.dom)},[e,l]),g.useEffect(()=>{if(!e)return;const p=()=>r(!0),m=({event:b})=>{const{relatedTarget:j,currentTarget:y}=b,_=j instanceof Node&&d.current?.contains(j),G=j instanceof Node&&y instanceof Node&&y.contains(j);!_&&!G&&r(!1)};return e.on("focus",p),e.on("blur",m),()=>{e.off("focus",p),e.off("blur",m)}},[e]),!e||!t&&!i)return null;const x=O();return x?ur.createPortal(n.jsx(D,{children:n.jsx(M.Tooltip.Provider,{children:n.jsxs(C.Toolbar.Root,{ref:f,className:Bs,style:u,children:[n.jsxs(C.Toolbar.Group,{className:V,children:[n.jsx(ss,{editor:e,currentColor:h?.color??null,isOpen:s==="color",onOpenChange:c("color")}),n.jsx(ps,{editor:e,currentFontFamily:h?.fontFamily??null,isOpen:s==="fontFamily",onOpenChange:c("fontFamily")})]}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsx(C.Toolbar.Group,{className:V,children:n.jsx(ms,{editor:e,activeStyle:h?.fontSize??"text",isOpen:s==="fontSize",onOpenChange:c("fontSize")})}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsxs(C.Toolbar.Group,{className:V,children:[n.jsx(R,{label:"Bold",isActive:h?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:n.jsx("strong",{children:"B"})}),n.jsx(R,{label:"Italic",isActive:h?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:n.jsx("em",{children:"I"})}),n.jsx(R,{label:"Underline",isActive:h?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:n.jsx("u",{children:"U"})})]}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsx(C.Toolbar.Group,{className:V,children:n.jsx(Ms,{editor:e,activeAlignment:h?.textAlign})}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsx(C.Toolbar.Group,{className:V,children:n.jsx(_s,{editor:e,currentUrl:h?.linkUrl??null,isActive:h?.isLink??!1,isOpen:s==="link",onOpenChange:c("link")})})]})})}),x):null};var Vs="_2ngohc0";const zt=({editor:e,ariaLabel:t})=>n.jsxs("div",{className:Vs,children:[n.jsx(qs,{editor:e}),n.jsx(ve.EditorContent,{editor:e,"aria-label":t})]}),Ws=(e,t)=>{const r=g.useRef(e);r.current=e;const s=g.useRef(t);s.current=t;const o=g.useRef(null),i=g.useRef(null),c=g.useMemo(()=>{const l=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null),o.current=null},u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null);const h=o.current;h!==null&&(o.current=null,r.current(...h))};return{run:(...h)=>{if(s.current<=0){r.current(...h);return}o.current=h,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(u,s.current)},flush:u,cancel:l}},[]);return g.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]),c},Ys=200,$t=({content:e,extensions:t,isEditable:r,onUpdate:s,updateDebounceMs:o=Ys})=>{const i=g.useRef(Oe(e)),c=g.useRef(!1),l=Ws(d=>{c.current=!0,s?.(d)},o),u=ve.useEditor({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:d})=>l.run(d.getJSON())});return g.useEffect(()=>{u?.setEditable(r)},[u,r]),g.useEffect(()=>{if(!u)return;if(c.current){c.current=!1;return}const d=Oe(e),h=u.getJSON();Us(h,d)||(l.cancel(),u.commands.setContent(d,{emitUpdate:!1}))},[u,e,l]),g.useEffect(()=>()=>l.flush(),[l]),u},Oe=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Us=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Xs=/^(?:https?:|mailto:)/i,qt=e=>{if(typeof e!="string")return!1;const t=e.replace(/^[\x00-\x20]+/,"");return t.length===0?!1:Xs.test(t)};var Ks="_1cocly40";const Zs={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"},ne=({content:e})=>n.jsx(n.Fragment,{children:Vt(e.content??[e])}),Vt=e=>e.map((t,r)=>Js(t,r)),Js=(e,t)=>{if(e.type==="text")return Qs(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return n.jsx("br",{},t);const r=e.content?Vt(e.content):null;switch(e.type){case"doc":return n.jsx(g.Fragment,{children:r},t);case"heading":{const s=no(e.attrs?.level);return so(s,t,r,Me(e.attrs))}case"paragraph":{const s=H(e.attrs?.variant);return n.jsx("p",{"data-variant":s??void 0,style:Wt(Me(e.attrs)),children:r},t)}case"blockquote":return n.jsx("blockquote",{children:r},t);case"bulletList":case"bullet_list":return n.jsx("ul",{children:r},t);case"orderedList":case"ordered_list":return n.jsx("ol",{children:r},t);case"listItem":case"list_item":return n.jsx("li",{children:r},t);default:return n.jsx("span",{children:r},t)}},Qs=(e,t)=>{const r=e.text??"";return!e.marks||e.marks.length===0?n.jsx("span",{children:r},t):e.marks.reduceRight((s,o,i)=>eo(o,s,`${t}-${i}`),r)},eo=(e,t,r)=>{switch(e.type){case"bold":case"strong":return n.jsx("strong",{children:t},r);case"italic":case"em":return n.jsx("em",{children:t},r);case"underline":return n.jsx("u",{children:t},r);case"strike":case"strikethrough":case"s":return n.jsx("s",{children:t},r);case"code":return n.jsx("code",{children:t},r);case"link":{const s=H(e.attrs?.href);return qt(s)?n.jsx("a",{className:Ks,href:s,rel:"noopener noreferrer",target:"_blank",children:t},r):n.jsx("span",{children:t},r)}case"textStyle":{const s=to(e.attrs);return s?n.jsx("span",{style:s,children:t},r):n.jsx("span",{children:t},r)}default:return n.jsx("span",{children:t},r)}},Ie=e=>{const t=H(e&&typeof e=="object"?e.fontFamily:e);if(t)return Zs[t]??t},to=e=>{if(!e)return null;const t={},r=H(e.color);r&&(t.color=r);const s=Ie(e.font)??Ie(e.fontFamily);s&&(t.fontFamily=s);const o=ro(e.fontSize);return o&&(t.fontSize=o),Object.keys(t).length>0?t:null},ro=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:H(e),H=e=>typeof e=="string"&&e.length>0?e:void 0,no=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),so=(e,t,r,s)=>{const o=Wt(s);switch(e){case 1:return n.jsx("h1",{style:o,children:r},t);case 2:return n.jsx("h2",{style:o,children:r},t);case 3:return n.jsx("h3",{style:o,children:r},t)}},Me=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},Wt=e=>e?{textAlign:e}:void 0;var oo="_4dlrid0",Yt="_4dlrid1",ao="xfz7dq0",io="xfz7dq1",lo="xfz7dq2",co="xfz7dq3",uo="xfz7dq4";const ho=({ref:e,footerRect:t,mode:r="readonly"})=>{const{caption:s,isCaptionVisible:o,source:i,isSourceVisible:c}=a.useCompiledSelector(E.useShallow(h=>({caption:h.config.content.caption,isCaptionVisible:h.config.content.isCaptionVisible,source:h.config.content.source,isSourceVisible:h.config.content.isSourceVisible}))),l=r==="editable",u=o&&(l||s!==null),d=c&&i!==null&&po(i);return!u&&!d?null:n.jsxs("div",{ref:e,className:ao,style:{left:t.x,top:t.y,width:t.width},children:[u?l?n.jsx(mo,{caption:s}):n.jsx(go,{caption:s}):null,d&&n.jsx(fo,{source:i})]})},go=({caption:e})=>e===null?null:typeof e=="string"?n.jsx("p",{className:Yt,children:e}):n.jsx(ne,{content:e}),fo=({source:e})=>{const t=qt(e.url)?e.url:void 0,r=e.label??(t!==void 0?xo(t):"");return r===""&&t===void 0?null:n.jsxs("div",{className:io,children:[n.jsx("span",{className:co,children:"Source:"}),t!==void 0?n.jsx("a",{className:lo,href:t,target:"_blank",rel:"noopener noreferrer",children:r}):n.jsx("span",{className:uo,children:r})]})},xo=e=>{try{return new URL(e).hostname}catch{return e}},po=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",mo=({caption:e})=>{const t=a.useGraphCommandDispatcher(),r=g.useMemo(()=>bn({placeholder:"Add caption"}),[]),s=$t({content:e,extensions:r,isEditable:!0,onUpdate:o=>{const i=Cs(o)?null:o;t(new v.SetContentCaptionCommand({caption:i}))}});return n.jsx(zt,{editor:s,ariaLabel:"Chart caption"})};var vo="_1k4qtbg0";const yo=3,bo=({title:e,isTitleVisible:t,subtitle:r,isSubtitleVisible:s})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:yo},content:To(e)}),s&&o.push(...Co(r)),{type:"doc",content:o}},jo=e=>{const t=e.content??[],[r,...s]=t;return{title:So(r?.content??[]),subtitle:ko(s)}},Se=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(Se)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),To=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??[],Co=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(Be):[Be(e)],Be=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},So=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(Se)}},ko=e=>{const t=e.filter(s=>(s.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const s=r.content??[],[o]=s;if(o&&s.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(Se)}},wo=({ref:e,headerRect:t,mode:r="readonly"})=>{const{title:s,isTitleVisible:o,subtitle:i,isSubtitleVisible:c}=a.useCompiledSelector(E.useShallow(h=>({isTitleVisible:h.config.content.isTitleVisible,isSubtitleVisible:h.config.content.isSubtitleVisible,title:h.config.content.title,subtitle:h.config.content.subtitle}))),l=r==="editable";return!(o&&(l||s!==null))&&!(c&&(l||i!==null))?null:n.jsx("div",{ref:e,className:vo,style:{left:t.x,top:t.y,width:t.width},children:l?n.jsx(Eo,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i},[o?"title":"",c?"subtitle":""].join("-")):n.jsx(Ao,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i})})},Ao=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=t&&e!==null,i=r&&s!==null;return n.jsxs(n.Fragment,{children:[o&&(typeof e=="string"?n.jsx("h1",{className:oo,children:e}):n.jsx(ne,{content:e})),i&&(typeof s=="string"?n.jsx("p",{className:Yt,children:s}):n.jsx(ne,{content:s}))]})},Eo=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=a.useGraphCommandDispatcher(),i=g.useMemo(()=>yn({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:r}),[t,r]),c=g.useMemo(()=>bo({title:e,isTitleVisible:t,subtitle:s,isSubtitleVisible:r}),[e,t,s,r]),l=$t({content:c,extensions:i,isEditable:!0,onUpdate:u=>{const d=jo(u);t&&o(new v.SetContentTitleCommand({title:d.title})),r&&o(new v.SetContentSubtitleCommand({subtitle:d.subtitle}))}});return n.jsx(zt,{editor:l,ariaLabel:"Chart title and subtitle"})};var _o="_1u9qprb0",Lo="_1u9qprb1",Fo="_9aen060",No="_9aen061",Po="_9aen062",Ut="_9aen063";const Do=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Po,item:Ut,trendRow:No,valueRow:Fo},Symbol.toStringTag,{value:"Module"})),Oo=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"m5 12 7-7 7 7"}),n.jsx("path",{d:"M12 19V5"})]})}),Io=e=>n.jsx(F,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M5 12h14"})})});var Xt="n7clvo0",Mo="n7clvo1",Bo="n7clvo2",Ro="n7clvo3",Kt={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},Ho={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Go={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},zo={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const $o=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return n.jsx(a.Swatch,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return n.jsx("div",{className:zo[e.direction],children:e.direction==="flat"?n.jsx(Io,{size:"xs",title:""}):n.jsx(Oo,{size:"xs",title:""})});const r=e.fontRole==="value"?Kt[t]:Ho[t];return n.jsx("span",{className:A.clsx(qo(e),r),children:e.text})},qo=e=>{switch(e.textRole){case"value":return Xt;case"observation":return Mo;case"trendPercentage":return Go[e.trendDirection??"up"];case"trendReference":return Bo;case"label":return Ro}},Vo=({item:e,resolvedSize:t})=>n.jsx("div",{className:Ut,children:it(e).map(r=>n.jsx(Wo,{row:r,resolvedSize:t},r.role))}),Wo=({row:e,resolvedSize:t})=>{const r=e.role==="trendRow";return n.jsx("div",{className:Do[e.role],"data-testid":r?"headline-trend":void 0,"data-direction":r?Yo(e):void 0,role:r?"img":void 0,"aria-label":r?e.ariaLabel:void 0,children:e.segments.map((s,o)=>n.jsx($o,{segment:s,resolvedSize:t},o))})},Yo=e=>{const t=e.segments.find(r=>r.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},Uo=({headline:e,rect:t,resolvedSize:r,visibleItemCount:s})=>{const o={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?n.jsx("div",{className:Lo,style:o,children:n.jsx("span",{className:A.clsx(Xt,Kt[r]),children:e.value})}):n.jsx("div",{className:_o,style:o,children:e.items.slice(0,s).map((i,c)=>n.jsx(Vo,{item:i,resolvedSize:r},`${i.label}-${c}`))})};var Xo="_1oj6yix0",Ko="_1oj6yix1",Zo="_1oj6yix2";const Jo=8,Qo=16,ea=2,ta=({legends:e,containerRect:t,textScale:r})=>{const{lineBoxHeight:s}=yt(r),{placements:o,hasOverlap:i}=ra(e,t,s);if(o.length===0)return null;const c=i?Qo:Jo,l=c-ea;return n.jsxs("div",{className:Xo,children:[i&&n.jsx("svg",{className:Ko,width:t.width,height:t.height,children:o.map(u=>n.jsx(na,{anchorY:u.anchorY,labelY:u.y,endX:l,color:u.payload.color},u.payload.key))}),o.map(u=>n.jsx("span",{className:Zo,style:{left:c,top:u.y,color:u.payload.color},children:u.payload.label},u.payload.key))]})},ra=(e,t,r)=>g.useMemo(()=>{const s=[];for(const o of e)for(const i of o.items){if(i.normalizedY===null)continue;const c=typeof i.visual.color=="string"?i.visual.color:void 0;s.push({normalizedY:i.normalizedY,payload:{key:String(s.length),label:i.formattedLabel,color:c}})}return s.length===0||t.height<=0?{placements:[],hasOverlap:!1}:v.computeDirectLabelsLayout({items:s,containerHeight:t.height,labelHeight:r})},[e,t.height,r]),na=({anchorY:e,labelY:t,endX:r,color:s})=>{const o=r/2;return n.jsx("path",{d:`M0,${e} C${o},${e} ${o},${t} ${r},${t}`,fill:"none",stroke:s??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var sa="_6a636s0",oa="_1kjk02r0",aa="_1kjk02r1",ia="_1kjk02r2",la="_1kjk02r3",ca="_1kjk02r4",ua="_1kjk02r5",da="_1kjk02r6",ha="_1kjk02r7",ga="_1kjk02r8",fa="_1kjk02r9",xa="_1kjk02ra",pa="_1kjk02rb",ma="_1dw9dgx0";const va="#9ca3af",ce="\0",ya=e=>{const t=[];return e.forEach((r,s)=>{const o=r.aesthetics.includes("size");for(const i of r.items){if(o){const d=Number(i.visual.size);if(!Number.isFinite(d)||d<=0)continue}const c=i.visual.color??"",l=o?`${ce}${Number(i.visual.size)}`:"",u=i.visual.lineType;t.push({key:`${s}${ce}${String(i.value)}${ce}${c}${l}`,formattedLabel:i.formattedLabel,visual:i.visual,swatchShape:i.swatchShape,isBubble:o,primaryLineType:u})}}),t},Zt=({pill:e})=>e.isBubble?n.jsx(Ta,{pill:e}):n.jsx(ja,{pill:e}),ba=({color:e,lineType:t,shape:r})=>e?n.jsx(a.Swatch,{shape:r,color:e,lineType:t,width:ut,height:be}):null,ja=({pill:e})=>n.jsxs(n.Fragment,{children:[n.jsx(ba,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),n.jsx("span",{children:e.formattedLabel})]}),Ta=({pill:e})=>{const t=Number(e.visual.size);return n.jsxs(n.Fragment,{children:[n.jsx("span",{className:ma,style:{width:t,height:t,backgroundColor:e.visual.color??va}}),n.jsx("span",{children:e.formattedLabel})]})},Ca=({hiddenPills:e,placement:t})=>{const[r,s]=g.useState(!1),{refs:o,floatingStyles:i}=k.useFloating({open:r,placement:t,middleware:[k.offset(4),k.flip(),k.shift({padding:8})]});g.useEffect(()=>{if(!r)return;const d=f=>{const x=f.target;if(!x)return;const p=o.reference.current,m=o.floating.current;p instanceof Element&&p.contains(x)||m instanceof Element&&m.contains(x)||s(!1)},h=f=>{f.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",d),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("keydown",h)}},[r,o.floating,o.reference]);const c=t==="left"||t==="right",l=Math.min(e.length-1,gt),u=Array.from({length:l},(d,h)=>l-h);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{ref:o.setReference,className:A.clsx(oa,{[ia]:c,[aa]:!c}),children:[u.map(d=>n.jsx("span",{className:A.clsx(la,{[ua]:c,[ca]:!c}),style:Sa(d,c),"aria-hidden":!0},d)),n.jsx("button",{type:"button",className:A.clsx(da,{[ha]:r}),onClick:()=>s(d=>!d),"aria-haspopup":"dialog","aria-expanded":r,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:n.jsxs("span",{className:ga,children:["+",e.length]})})]}),r&&n.jsx("div",{ref:o.setFloating,role:"dialog","aria-label":"Hidden legend items",className:fa,style:i,children:n.jsx("ul",{className:xa,children:e.map(d=>n.jsx("li",{className:pa,children:n.jsx(Zt,{pill:d})},d.key))})})]})},Sa=(e,t)=>{const r=-e*ft;return{transform:t?`translateY(${r}px)`:`translateX(${r}px)`}};var ka="_1cecisi0",wa="_1cecisi1",Aa="_1cecisi2",Ea="_1cecisi3";const _a=({edge:e,formattedLegends:t,containerWidth:r,containerHeight:s,textScale:o})=>{const i=a.useTextMeasurer(),c=g.useMemo(()=>ya(t),[t]),l=e==="left"||e==="right",u=l?s:r,d=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(u<=0)return{visibleCount:c.length,hasOverflow:!1};const p=a.emToPx(xt,o),m={family:mt,size:p},b=p*pt,j=z=>l?La(z,b):Re({label:z.formattedLabel,swatchInlineSize:Fa(z),textMeasurer:i,font:m}),y=c.map(j),G=(l?b+je:Re({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:i,font:m}))+gn;return Pa({pillSizes:y,overflowPillSize:G,containerSize:u,gap:un})},[c,u,l,i,o]);if(c.length===0)return null;const h=c.slice(0,d.visibleCount),f=c.slice(d.visibleCount),x=d.hasOverflow&&f.length>0;return n.jsxs("div",{className:A.clsx(ka,{[Aa]:l,[wa]:!l}),children:[h.map(p=>n.jsx("div",{className:Ea,children:n.jsx(Zt,{pill:p})},p.key)),x&&n.jsx(Ca,{hiddenPills:f,placement:Da(e)})]})},Re=({label:e,swatchInlineSize:t,textMeasurer:r,font:s})=>{const o=r.measureText(e,s).width,i=t>0?dt:0;return t+i+o+vt},La=(e,t)=>{const r=Na(e);return Math.max(t,r)+je},Fa=e=>e.isBubble?Number(e.visual.size):bt(e.visual.color),Na=e=>e.isBubble?Number(e.visual.size):be,Pa=({pillSizes:e,overflowPillSize:t,containerSize:r,gap:s})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let o=0;for(let l=0;l<e.length;l+=1)l>0&&(o+=s),o+=e[l]??0;if(o<=r)return{visibleCount:e.length,hasOverflow:!1};let i=0,c=0;for(const l of e){const u=i+(c>0?s:0)+l;if(u+s+t>r)break;i=u,c+=1}return{visibleCount:c,hasOverflow:!0}},Da=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Oa=g.memo(function({formattedLegends:t,rects:r,textScale:s}){const o=g.useMemo(()=>{const i=new Map;for(const c of t){let l=i.get(c.position);l||(l={pill:[],direct:[]},i.set(c.position,l)),c.display==="pill"?l.pill.push(c):l.direct.push(c)}return i},[t]);return n.jsx(n.Fragment,{children:Array.from(o,([i,c])=>{const l=r[i];return l===void 0?null:n.jsxs("div",{className:sa,style:{left:l.x,top:l.y,width:l.width,height:l.height},children:[n.jsx(_a,{edge:i,formattedLegends:c.pill,containerWidth:l.width,containerHeight:l.height,textScale:s}),n.jsx(ta,{legends:c.direct,containerRect:l,textScale:s})]},i)})})}),Ia=(e,t,r)=>{const s=e.filter(i=>i.interactive);if(s.length===0)return null;const o=s.map(i=>r(i,t)).filter(i=>i!==null).map(i=>i.guideMode);return o.length===0?null:o.some(i=>i==="bar")?"bar":o.every(i=>i==="continuous")?"continuous":null};function Ma(e,t){const r=v.getMainAxisCoordinate(e.mainAxis,t);if(e.mainAxis==="y"){const o=a.toPercent(a.toViewBoxY(r));return{x1:0,x2:"100%",y1:o,y2:o}}const s=a.toPercent(a.toViewBoxX(r));return{x1:s,x2:s,y1:0,y2:"100%"}}function Ba(e,t,r){const s=e.mainAxis==="y"?v.getY(r.observation):v.getX(r.observation);if(s===null)return null;const o=e.mainAxis==="y"?Ha(r):Ra(r),c=(t.x?.kind==="position"?t.x:null)?.bandwidth??o;if(c===null||c<=0)return null;const l=c/2;if(e.mainAxis==="y"){const h=a.toPercent(a.toViewBoxY(s+l)),f=a.toPercent(c);return{x:0,y:h,width:"100%",height:f}}const u=a.toPercent(a.toViewBoxX(s-l)),d=a.toPercent(c);return{x:u,y:0,width:d,height:"100%"}}function Ra(e){const t=v.getXMin(e.observation),r=v.getXMax(e.observation);return t===null||r===null?null:r-t}function Ha(e){const t=v.getYMin(e.observation),r=v.getYMax(e.observation);return t===null||r===null?null:r-t}const Ga=1,za="4 3",$a=({panelRect:e})=>{const{coordSystem:t,layers:r,scales:s}=a.useCompiledSelector(E.useShallow(l=>({coordSystem:l.coordSystem,layers:l.layers,scales:l.scales}))),o=W(l=>l.hover.primary),i=a.useResolveGeomPlugin();if(t.type!=="cartesian"||r.length===0||o===null)return null;const c=Ia(r,t,i);return c===null?null:c==="bar"?n.jsx(Va,{coordSystem:t,scales:s,primary:o,panelRect:e}):n.jsx(qa,{coordSystem:t,primary:o,panelRect:e})},qa=({coordSystem:e,primary:t,panelRect:r})=>{const s=Ma(e,t);return n.jsx(Jt,{panelRect:r,children:n.jsx("line",{...s,stroke:a.vars.hoverGuideLineColor,strokeWidth:Ga,strokeDasharray:za,strokeLinecap:"round","data-testid":"hover-guide-line"})})},Va=({coordSystem:e,scales:t,primary:r,panelRect:s})=>{const o=Ba(e,t,r);return o===null?null:n.jsx(Jt,{panelRect:s,children:n.jsx("rect",{...o,fill:a.vars.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},Jt=({panelRect:e,children:t})=>n.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}),Wa=200,Ya=({engine:e,store:t,overlayRef:r,setCursor:s=Ua})=>{g.useEffect(()=>{const o=r.current;if(!o)return;const i=Xa(o,e),c=Ka(o,e,t,s);return()=>{c(),i()}},[e,t,r,s])},Ua=()=>{},Xa=(e,t)=>{const r=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let s=null;const o=()=>{s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,r()},Wa)},i=new ResizeObserver(o);return i.observe(e),r(),()=>{i.disconnect(),s!==null&&clearTimeout(s)}},Ka=(e,t,r,s)=>{let o=null,i=null;const c=()=>{i=null;const d=o;if(o=null,!d)return;s({clientX:d.clientX,clientY:d.clientY});const h=e.getBoundingClientRect();if(h.width===0||h.height===0)return;const f={x:(d.clientX-h.left)/h.width,y:1-(d.clientY-h.top)/h.height};r.getState().setHoverState(t.query(f))},l=d=>{o=d,i===null&&(i=requestAnimationFrame(c))},u=()=>{o=null,i!==null&&(cancelAnimationFrame(i),i=null),s(null);const d=r.getState();d.hover.primary!==null&&d.setHoverState(v.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",l),e.addEventListener("pointerleave",u),()=>{e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",u),i!==null&&cancelAnimationFrame(i),o=null}},Za=({panelRect:e})=>{const{engine:t,store:r,overlayRef:s,setCursor:o}=a.useHoverContext();return Ya({engine:t,store:r,overlayRef:s,setCursor:o}),n.jsx("rect",{ref:s,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",Ja=e=>{const{store:t}=a.useHoverContext(),r=ee.useStore(t,s=>s.hover.primary!==null);g.useEffect(()=>{const s=e.current;if(s)return r?s.setAttribute(ue,"true"):s.removeAttribute(ue),()=>{s.removeAttribute(ue)}},[e,r])},He=({panelRect:e,zOrder:t})=>{const r=a.useCompiledSelector(c=>c.annotations.custom),s=a.useResolveAnnotationPlugin(),o=r.filter(c=>{const l=s(c.type);return l!==null&&(c.zOrder??l.zOrder)===t});if(o.length===0)return null;const i={width:e.width,height:e.height};return n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`custom-annotations-${t}`,children:o.map(c=>{const l=s(c.type);return l===null?null:n.jsx("g",{"data-annotation-type":c.type,children:l.draw({targets:c.targets,area:i,params:c.params})},c.id)})})},Qt=a.FONT_SIZE_EM.xs,me=a.DEFAULT_FONT_FAMILY,er=a.FONT_WEIGHT.medium,Qa=a.FONT_WEIGHT.semibold,tr=6,rr=2,ei=4,ti=2,Ge=4;var ri="_1agclyl0",ni="_1agclyl1",si="_1agclyl2",oi={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},ai="_1agclyl6 _1agclyl3";const nr=({x:e,y:t,width:r,height:s,text:o,isRotated:i,target:c,position:l,coordType:u})=>{const d=i?`rotate(-90 ${e} ${t})`:void 0,h=c==="aggregate"?ai:oi[l],f=ii(c,l,u);return n.jsxs("g",{transform:d,children:[f&&n.jsx("rect",{className:f,x:e-r/2,y:t-s/2,width:r,height:s,rx:Ge,ry:Ge}),n.jsx("text",{className:h,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:o})]})},ii=(e,t,r)=>{if(e==="aggregate")return si;if(t==="outside"&&r==="cartesian")return ni},li={dataLabel:{x:tr,y:rr},stackTotal:{x:ei,y:ti}},ci=({panelRect:e,formattingLocale:t})=>{const r=a.useTextMeasurer(),s=a.useCompiledSelector(E.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem,axes:l.guides.axes,numberFormat:l.config.numberFormat,parsingLocale:l.config.parsingLocale,textScale:l.config.appearance.textScale}))),o=g.useMemo(()=>{const l=a.emToPx(Qt,s.textScale);return{dataLabel:{family:me,size:l,weight:er},stackTotal:{family:me,size:l,weight:Qa}}},[s.textScale]),i=g.useMemo(()=>(l,u)=>{const d=r.measureText(u,o[l]),h=li[l];return{...d,width:d.width+h.x*2,height:d.height+h.y*2}},[r,o]),c=g.useMemo(()=>v.buildDataLabelsContent({...s,panelRect:e,measureDataLabel:i,formattingLocale:t}),[s,e,i,t]);return n.jsx("g",{className:ri,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(l=>n.jsx(nr,{x:l.x,y:l.y,width:l.width,height:l.height,text:l.text,isRotated:l.isRotated,target:l.target,position:l.position,coordType:s.coordSystem.type},l.key))})},ui=({linePath:e,arrowheadPath:t,stroke:r,strokeWidth:s})=>{const o={stroke:r,strokeWidth:s,strokeLinecap:"round",fill:"none"};return n.jsxs("g",{children:[n.jsx("path",{d:e,...o}),n.jsx("path",{d:t,...o,strokeLinejoin:"round"})]})},di=({x:e,y:t,text:r,lineHeight:s,paddingX:o,paddingY:i,strokeWidth:c,strokeColor:l,fontWeight:u})=>{const d=a.useTextMeasurer(),f=g.useMemo(()=>d.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:s,weight:u}),[d,r,s,u]).width+o*2,x=s+i*2;return n.jsxs("g",{style:{pointerEvents:"none"},children:[n.jsx("rect",{x:e-f/2,y:t-x/2,width:f,height:x,rx:4,fill:a.vars.graphBackground,stroke:l,strokeWidth:c}),n.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:a.vars.textPrimary,style:{fontFamily:a.DEFAULT_FONT_FAMILY,fontSize:s,fontWeight:u},children:r})]})},hi=({panelRect:e,formattingLocale:t})=>{const r=a.useCompiledSelector(E.useShallow(o=>({differenceArrows:o.annotations.differenceArrows,mainAxis:o.coordSystem.type==="cartesian"?o.coordSystem.mainAxis:"x",textScale:o.config.appearance.textScale}))),s=g.useMemo(()=>r.differenceArrows.map(o=>v.computeDifferenceArrow({arrow:o,mainAxis:r.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:r.textScale,locale:t})),[r,e.width,e.height,t]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:s.map(({color:o,id:i,linePath:c,arrowheadPath:l,strokeWidth:u,labelPosition:d,labelText:h,labelLineHeight:f,labelPaddingX:x,labelPaddingY:p,labelStrokeWidth:m,labelFontWeight:b})=>{const j=o??a.vars.defaultAnnotationArrowStroke;return n.jsxs(g.Fragment,{children:[n.jsx(ui,{linePath:c,arrowheadPath:l,stroke:j,strokeWidth:u}),n.jsx(di,{x:d.x,y:d.y,text:h,lineHeight:f,paddingX:x,paddingY:p,strokeWidth:m,strokeColor:j,fontWeight:b})]},i)})})},gi=0,fi=1.15,ze=1.15,xi="rgba(0, 0, 0, 0.16)",$e=2,pi=1.4,mi=({arrow:e,fallbackColor:t,stickerOutlineColor:r,stickerOutlineColorInverse:s})=>{const o=g.useId(),i=e.color??t,c=vi(e.color,r,s),l=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},u=e.arrowheadExtent+e.strokeWidth+$e+ze,d={x:Math.min(e.startX,e.endX)-u,y:Math.min(e.startY,e.endY)-u,width:Math.abs(e.endX-e.startX)+2*u,height:Math.abs(e.endY-e.startY)+2*u},h=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(f=>f.length>0).join(" ");return n.jsxs("g",{children:[e.hasStickerStyle&&n.jsx("defs",{children:n.jsx("filter",{id:o,filterUnits:"userSpaceOnUse",...d,children:n.jsx("feDropShadow",{dx:gi,dy:fi,stdDeviation:ze,floodColor:xi})})}),n.jsxs("g",{filter:e.hasStickerStyle?`url(#${o})`:void 0,children:[e.hasStickerStyle&&n.jsx("path",{d:h,stroke:c,strokeWidth:e.strokeWidth+2*$e,strokeLinecap:"round",fill:"none"}),n.jsx("path",{d:e.linePath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...l}),e.startArrowheadPath.length>0&&n.jsx("path",{d:e.startArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&n.jsx("path",{d:e.endArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},vi=(e,t,r)=>{if(e===null)return r;try{return gr.getContrast(e,t)<pi?r:t}catch{return r}},yi=({panelRect:e})=>{const{themeValues:t}=Ce(),r=a.useCompiledSelector(o=>o.annotations.freeformArrows),s=g.useMemo(()=>r.map(o=>v.computeFreeformArrow({arrow:o,panelWidth:e.width,panelHeight:e.height})).filter(o=>o!==null),[r,e.width,e.height]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:s.map(o=>n.jsx(mi,{arrow:o,fallbackColor:a.vars.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},o.id))})},bi=({edge:e,areTicksVisible:t,position:r,labelRotation:s,label:o})=>{const i=a.toPercent(r),c=t?1:0,l={style:{font:a.vars.fontTickLabel},fill:a.vars.textSecondary},u=s!==0&&(e==="top"||e==="bottom"),d=e==="top";return u?n.jsx("svg",{x:i,y:d?"100%":0,style:{overflow:"visible"},children:n.jsx("text",{...Ti(d,c,s),...l,children:o})}):n.jsx("text",{...ji(e,i,c),...l,children:o})},ji=(e,t,r)=>{switch(e){case"bottom":return{x:t,y:N*r,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-N*r,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-N*r,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:N*r,y:t,textAnchor:"start",dominantBaseline:"central"}}},Ti=(e,t,r)=>{const s=N*t,o=e?-s:s;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${r}, 0, ${o})`}},Ci=({formattedAxis:e,rect:t})=>{const r=e.position==="bottom"||e.position==="top";return n.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[at,e.ticks.map((s,o)=>{const i=s.formattedLabel,c=r?s.position:1-s.position,l=Si(e.position,c,t);return n.jsxs("g",{children:[e.ticksVisible&&n.jsx("line",{...l,stroke:a.vars.gridLineColor,strokeWidth:1}),n.jsx(bi,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:i})]},o)})]})},Si=(e,t,r)=>{const s=a.toPercent(t);switch(e){case"bottom":return{x1:s,y1:0,x2:s,y2:Z};case"top":return{x1:s,y1:r.height,x2:s,y2:r.height-Z};case"left":return{x1:r.width,y1:s,x2:r.width-Z,y2:s};case"right":return{x1:0,y1:s,x2:Z,y2:s}}},ki=({formattedAxes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];return!s||!r.isVisible?null:n.jsx(Ci,{formattedAxis:r,rect:s},r.scaleAestheticKey)})}),wi=({axes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];if(!s||!r.isVisible)return null;const o=Ai(r.position,s);return n.jsxs("g",{transform:`translate(${s.x}, ${s.y})`,children:[at,n.jsx("text",{style:{font:a.vars.fontAxisLabel},fill:a.vars.textPrimary,...o,children:r.label})]},`axis-label-${r.position}`)})}),Ai=(e,t)=>{const r={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(r.x=0,r.textAnchor="start"):e==="right"&&(r.x=t.width,r.textAnchor="end"),r},qe={strokeWidth:1,strokeDashoffset:"0",strokeDasharray:"2 3",strokeLinecap:"round"},Ei=({axes:e,panel:t,panelRect:r})=>n.jsxs("svg",{x:r.x,y:r.y,width:r.width,height:r.height,style:{overflow:"visible"},children:[t.border.isVisible&&n.jsx("rect",{x:0,y:0,width:r.width,height:r.height,fill:"none",stroke:a.vars.gridLineColor,rx:8,ry:8,...qe}),e.map(s=>{if(!s.gridVisible)return null;const o=s.position==="bottom"||s.position==="top";return n.jsx("g",{children:s.ticks.map((i,c)=>{if(i.position<=0||i.position>=1)return null;const l=o?i.position:1-i.position,u=a.toPercent(l),d=o?{x1:u,y1:0,x2:u,y2:"100%"}:{x1:0,y1:u,x2:"100%",y2:u};return n.jsx("line",{...d,...qe,stroke:a.vars.gridLineColor},c)})},s.scaleAestheticKey)})]}),Ve=({panelRect:e,zOrder:t})=>{const s=a.useCompiledSelector(o=>o.annotations.shapes).filter(o=>o.zOrder===t);return s.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:s.map(({id:o,x:i,y:c,width:l,height:u,fillColor:d,fillOpacity:h,strokeWidth:f,strokeColor:x})=>n.jsx("rect",{x:a.toPercent(i),y:a.toPercent(c),width:a.toPercent(l),height:a.toPercent(u),fill:d,fillOpacity:h,stroke:f>0?x??a.vars.defaultAnnotationShapeStroke:"none",strokeWidth:f},o))})};var _i="_120wioc0";const Li=({panelRect:e})=>{const t=a.useCompiledSelector(r=>r.annotations.textAnnotations);return t.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(r=>n.jsx("foreignObject",{x:a.toPercent(r.x),y:a.toPercent(r.y),width:a.toPercent(r.width),height:a.toPercent(1-r.y),overflow:"visible",children:n.jsx("div",{className:_i,style:Fi(r.backgroundColor,r.backgroundColorStyle),children:n.jsx(ne,{content:r.content})})},r.id))})},Fi=(e,t)=>e===null||e==="transparent"?{color:a.vars.textPrimary}:t==="fade"?{color:a.vars.textPrimary,backgroundColor:fe(e,a.vars.grey100,.5),boxShadow:`0 0 0 1.5px ${fe(e,a.vars.grey0,.2)}`}:{color:a.vars.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${se(e,.1)}`};var Ni="usd3ea0",Pi="usd3ea1";const Di=({layer:e,coordSystem:t,isAnimated:r,isDimmed:s,highlightStyle:o,formattingLocale:i})=>{const l=a.useResolveGeomPlugin()(e,t);return l===null?n.jsxs("text",{children:[e.geom," not implemented"]}):n.jsx("g",{className:A({[Pi]:s&&o==="desaturate",[Ni]:s&&o==="dim"}),children:l.render({layer:e,coordSystem:t,isAnimated:r,formattingLocale:i})})};function Oi({plugin:e,layer:t,coordSystem:r,candidates:s}){if(e?.getOverlayAnchor===void 0||s.length===0)return[];const o=[];for(const{observation:i,observationIndex:c}of s){const l=e.getOverlayAnchor({layer:t,coordSystem:r,observation:i});l!==null&&o.push({observation:i,observationIndex:c,anchor:l})}return o}const Ii=4,Mi=({plugin:e,layer:t,matchedLayer:r,overlayCandidates:s,coordSystem:o,isAnimated:i,panelRect:c,formattingLocale:l})=>{const{numberFormat:u,textScale:d}=a.useCompiledSelector(E.useShallow(m=>({numberFormat:m.config.numberFormat,textScale:m.config.appearance.textScale}))),h=g.useMemo(()=>Oi({plugin:e,layer:t,coordSystem:o,candidates:s}),[e,t,o,s]),f=g.useMemo(()=>v.createSegmentYReader(t),[t]),x=g.useMemo(()=>v.buildLayerYValueFormatter({layer:t,numberFormat:u,locale:l}),[u,t,l]),p=Qt*a.ROOT_FONT_SIZE_PX*d;return e===null||r===null&&h.length===0?null:n.jsxs(n.Fragment,{children:[r?e.render({layer:r,coordSystem:o,isAnimated:i,formattingLocale:l}):null,h.map(({observation:m,observationIndex:b,anchor:j})=>n.jsx(Bi,{observation:m,anchor:j,panelRect:c,readSegmentY:f,formatYValue:x,labelFontSizePx:p},Ri(m,b)))]})},Bi=({observation:e,anchor:t,panelRect:r,readSegmentY:s,formatYValue:o,labelFontSizePx:i})=>{const c=a.useTextMeasurer(),l=a.toViewBoxX(t.x),u=a.toViewBoxY(t.y),d=(v.getSize(e)??a.DEFAULT_POINT_SIZE)/2,h=s(e),f=v.isDefined(h)?o(h,e):null,x=g.useMemo(()=>{if(f===null)return null;const p=c.measureText(f,{family:me,size:i,weight:er});return{width:p.width+tr*2,height:p.height+rr*2}},[f,c,i]);return n.jsxs(n.Fragment,{children:[n.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:a.toPercent(l),cy:a.toPercent(u),r:d,fill:v.getColor(e)}),f!==null&&x!==null&&n.jsx(nr,{x:l*r.width,y:u*r.height-d-Ii-x.height/2,width:x.width,height:x.height,text:f,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},Ri=(e,t)=>{const r=e[v.GROUP_VARIABLES.group];return`${String(r??"")}\0${t}`},Hi=({layer:e,coordSystem:t,panelRect:r})=>{const s=a.useResolveGeomPlugin(),{primary:o,group:i,related:c}=W(E.useShallow(d=>({primary:d.hover.primary,group:d.hover.group,related:d.hover.related})));if(o===null)return null;const l=s(e,t);if(l===null)return null;const u=c.get(e.id)??[];return o.layerId===e.id?l.renderHover({layer:e,coordSystem:t,primary:o,group:i,related:u,panelRect:r}):u.length===0?null:l.renderHoverCompanions({layer:e,primary:o,related:u})};var Gi="to1jkx0",zi="to1jkx1";const $i=({shouldAnimate:e,panelRect:t,formattingLocale:r})=>{const{layers:s,coordSystem:o,highlightStyle:i}=a.useCompiledSelector(E.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return n.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:Gi,"data-testid":"geom-layers",children:s.map(c=>n.jsxs(g.Fragment,{children:[n.jsx(Wi,{layer:c,coordSystem:o,highlightStyle:i,shouldAnimate:e,panelRect:t,formattingLocale:r}),n.jsx(Hi,{layer:c,coordSystem:o,panelRect:t})]},`${c.id}-${qi(o)}`))})},qi=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,Vi=e=>{if(e.highlight!==null)return zi},Wi=({layer:e,coordSystem:t,highlightStyle:r,shouldAnimate:s,panelRect:o,formattingLocale:i})=>{const c=a.useResolveGeomPlugin(),l=g.useMemo(()=>c(e,t),[c,e,t]),u=e.highlight;return n.jsxs("g",{className:Vi(e),children:[n.jsx(Di,{layer:e,coordSystem:t,isAnimated:s,isDimmed:u?.composition.isDimmed??!1,highlightStyle:r,formattingLocale:i}),u!==null&&n.jsx(Mi,{plugin:l,layer:e,matchedLayer:u.composition.matchedLayer,overlayCandidates:u.composition.overlayCandidates,coordSystem:t,isAnimated:s,panelRect:o,formattingLocale:i})]})};var Yi="_17uhij30";const Ui=({formattedAxes:e,plotRect:t,panelRect:r,axisRects:s,axisLabelRects:o,shouldAnimate:i,formattingLocale:c})=>{const l=g.useRef(null);Ja(l);const{axes:u,panelGuide:d}=a.useCompiledSelector(E.useShallow(p=>({axes:p.guides.axes,panelGuide:p.guides.panel}))),h=g.useMemo(()=>sr(r,t),[r,t]),f=g.useMemo(()=>We(s,t),[s,t]),x=g.useMemo(()=>We(o,t),[o,t]);return n.jsxs("svg",{ref:l,className:Yi,width:t.width,height:t.height,style:{transform:`translate(${t.x}px, ${t.y}px)`},"data-testid":"plot",children:[n.jsx(Ei,{axes:e,panel:d,panelRect:h}),n.jsx($a,{panelRect:h}),n.jsx(ki,{formattedAxes:e,rects:f}),n.jsx(wi,{axes:u,rects:x}),n.jsx(Ve,{panelRect:h,zOrder:"background"}),n.jsx(He,{panelRect:h,zOrder:"background"}),n.jsx($i,{shouldAnimate:i,panelRect:h,formattingLocale:c}),n.jsx(ci,{panelRect:h,formattingLocale:c}),n.jsx(hi,{panelRect:h,formattingLocale:c}),n.jsx(Ve,{panelRect:h,zOrder:"foreground"}),n.jsx(He,{panelRect:h,zOrder:"foreground"}),n.jsx(yi,{panelRect:h}),n.jsx(Li,{panelRect:h}),n.jsx(Za,{panelRect:h})]})},sr=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),We=(e,t)=>{const r={};for(const[s,o]of Object.entries(e))r[s]=sr(o,t);return r},de={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},Xi=()=>{const[e,t]=g.useState(null),[r,s]=g.useState(null),[o,i]=g.useState(de);return g.useEffect(()=>{const c=()=>{const u=e?{width:e.offsetWidth,height:e.offsetHeight}:de.headerSize,d=r?{width:r.offsetWidth,height:r.offsetHeight}:de.footerSize;i(h=>Ki(h,{headerSize:u,footerSize:d})?{headerSize:u,footerSize:d}:h)};c();const l=new ResizeObserver(c);return e&&l.observe(e),r&&l.observe(r),()=>l.disconnect()},[e,r]),{headerRef:t,footerRef:s,measurements:o}},Ki=(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,Zi=({appearance:e,isEditable:t,style:r,children:s})=>{const{theme:o,themeClass:i,inlineVarsStyle:c}=Ce(),l=Mn(e.border),u=Math.max(0,e.cornerRadius),d=u===0?0:u+l,h=g.useMemo(()=>{const p={...r,borderRadius:`${d}px`,...c},m=In(e.border,o);return m!==null&&(p.background=m),p},[r,d,c,e.border,o]),f=g.useMemo(()=>({inset:`${l}px`,borderRadius:`${u}px`}),[l,u]),x=t&&e.background.type==="solid"&&e.background.color==="transparent";return n.jsx("div",{"data-testid":"graph-wrapper",className:A(Gn,i),style:h,children:n.jsx("div",{"data-testid":"graph-inner",className:A($n,{[qn]:x}),style:f,children:s})})},Ji=e=>n.jsx(a.HoverProvider,{children:n.jsx(a.TextMeasurerProvider,{children:n.jsx(Qi,{...e})})}),Qi=({width:e,height:t,isAnimated:r,showTooltips:s=!0,mode:o="readonly"})=>{const{axes:i,legends:c,numberFormat:l,parsingLocale:u,appearance:d,annotations:h,coordSystem:f,headline:x,headlineConfig:p}=a.useCompiledSelector(E.useShallow(L=>({axes:L.guides.axes,legends:L.guides.legends,numberFormat:L.config.numberFormat,parsingLocale:L.config.parsingLocale,appearance:L.config.appearance,annotations:L.annotations,coordSystem:L.coordSystem,headline:L.guides.headline,headlineConfig:L.config.headline}))),m=ir.useReducedMotion(),{headerRef:b,footerRef:j,measurements:y}=Xi(),{formattingLocale:_,theme:G,themeOverrides:z}=a.useGraphContext(),ke=g.useMemo(()=>v.formatLegends({legends:c,numberFormat:l,parsingLocale:u,formattingLocale:_}),[c,l,u,_]),$=g.useMemo(()=>v.formatHeadline({headline:x,show:p.show,numberFormat:l,parsingLocale:u,formattingLocale:_}),[x,p.show,l,u,_]),or=a.useTextMeasurer(),oe=d.border.type==="none"?0:d.border.width,ae=g.useMemo(()=>({width:Math.max(0,e-2*oe),height:Math.max(0,t-2*oe)}),[e,t,oe]),Y=g.useMemo(()=>$?{formatted:$,size:p.size,position:p.position,innerRadius:f.type==="polar"?f.innerRadius:0}:void 0,[$,p.size,p.position,f]),U=pn(or,d.textScale),q=mn({measurer:U,axes:i,numberFormat:l,parsingLocale:u,formattedLegends:ke,containerSize:ae,externalMeasurements:y,headline:Y,formattingLocale:_,annotations:h,coordSystem:f,textScale:d.textScale}),X=g.useMemo(()=>!q||!Y||!U?null:v.resolveHeadlinePlacement({headline:Y,layout:q.layout,containerSize:ae,measurer:U,itemGap:st}),[q,Y,ae,U]);if(!q)return null;const{layout:P,formattedAxes:ar}=q;return n.jsx(_t,{theme:G,themeOverrides:z,appearance:d,children:n.jsxs(Zi,{appearance:d,isEditable:o==="editable",style:{width:e,height:t},children:[n.jsx(wo,{ref:b,headerRect:P.header,mode:o}),n.jsx(Ui,{formattedAxes:ar,plotRect:P.plot,panelRect:P.panel,axisRects:P.axes,axisLabelRects:P.axisLabels,shouldAnimate:r??!m,formattingLocale:_??u}),n.jsx(ho,{ref:j,footerRect:P.footer,mode:o}),n.jsx(Oa,{formattedLegends:ke,rects:P.legends,textScale:d.textScale}),$&&X&&n.jsx(Uo,{headline:$,rect:X.rect,resolvedSize:X.resolvedSize,visibleItemCount:X.visibleItemCount}),s&&n.jsx(Xr,{})]})})};exports.CanvasTextMeasurer=a.CanvasTextMeasurer;exports.GraphProvider=a.GraphProvider;exports.HoverProvider=a.HoverProvider;exports.TextMeasurerProvider=a.TextMeasurerProvider;exports.useCompiledSelector=a.useCompiledSelector;exports.useGraphCommandDispatcher=a.useGraphCommandDispatcher;exports.useTextMeasurer=a.useTextMeasurer;exports.vars=a.vars;exports.DevToolsPanel=Fr;exports.GraphRenderer=Ji;exports.ThemeProvider=_t;exports.darkTheme=Et;exports.lightTheme=At;exports.useHoverState=W;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),A=require("clsx"),g=require("react"),ee=require("zustand"),v=require("@graphysdk/viz-engine"),a=require("./tooltip-body-B4Mj-oru.cjs"),ir=require("motion/react"),E=require("zustand/react/shallow"),k=require("@floating-ui/react-dom"),lr=require("@tiptap/core"),Ye=require("@tiptap/extension-bold"),he=require("@tiptap/extension-document"),Ue=require("@tiptap/extension-hard-break"),Xe=require("@tiptap/extension-heading"),Ke=require("@tiptap/extension-italic"),Ze=require("@tiptap/extension-link"),Je=require("@tiptap/extension-text"),Qe=require("@tiptap/extension-text-align"),B=require("@tiptap/extension-text-style"),et=require("@tiptap/extension-underline"),te=require("@tiptap/extensions"),cr=require("@tiptap/extension-paragraph"),ve=require("@tiptap/react"),C=require("@base-ui/react/toolbar"),M=require("@base-ui/react/tooltip"),ur=require("react-dom"),dr=require("@vanilla-extract/dynamic"),S=require("@base-ui/react/popover"),we=require("react-colorful"),w=require("@base-ui/react/menu"),hr=require("@base-ui/react/toggle"),gr=require("color2k");typeof window<"u"&&(window.__GRAPHY_SDK__??={},window.__GRAPHY_SDK__.reactRenderer="0.0.1-plugins.1");var fr="drqe3u0",xr="drqe3u1",pr="drqe3u2",mr="drqe3u3",K="drqe3u4",vr="drqe3u5",yr="drqe3u6",br="drqe3u7",ie="drqe3u8",jr="drqe3u9",Tr="drqe3ua",Cr="drqe3ub",Sr="drqe3uc",kr="drqe3ud",wr="drqe3ue",Ar="drqe3uf",Er="drqe3ug",_r="drqe3uh",Lr="drqe3ui",Ae={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},Ee={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},tt={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"};const Fr=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=a.useGraphContext(),[o]=g.useState(()=>a.createDevToolsStore()),[i,c]=g.useState(!1),[l,u]=g.useState(v.isCompilerCachingEnabled);g.useEffect(()=>{const{recordCompile:m}=o.getState(),b=s.getLastTrigger(),j=s.getLastCompile();return b&&j&&m(b,j),s.subscribe(m)},[o,s]);const d=ee.useStore(o,m=>m.lastCompile),h=ee.useStore(o,m=>m.history),f=s.getCacheStats(),x=d===null&&h.length===0,p=()=>{u(m=>{const b=!m;return v.setCompilerCachingEnabled(b),b})};return n.jsxs("div",{className:A(Tr,r),style:{width:e,...t},children:[n.jsxs("div",{className:fr,children:[n.jsxs("div",{children:[n.jsx("div",{className:xr,children:"compile cache"}),n.jsx("div",{className:wr,children:x?"production: stats disabled":d?`last: ${d.label} · ${rt(d.durationMs)}`:"awaiting first compile…"})]}),n.jsx("button",{type:"button",onClick:()=>c(m=>!m),className:Ar,children:i?"▾":"▴"})]}),!i&&n.jsxs("div",{className:Cr,children:[n.jsxs("button",{type:"button",onClick:p,className:l?Ae.enabled:Ae.disabled,"aria-pressed":l,children:["cache ",l?"enabled":"disabled"]}),n.jsx("span",{className:Er,children:"next compile reflects this toggle"})]}),!i&&!x&&n.jsxs(n.Fragment,{children:[n.jsx(Nr,{delta:d?.stages,cumulative:f}),n.jsx(Pr,{entries:h})]})]})},Nr=({delta:e,cumulative:t})=>n.jsxs("table",{className:pr,children:[n.jsx("thead",{children:n.jsxs("tr",{className:_r,children:[n.jsx("th",{className:mr,children:"stage"}),n.jsx("th",{className:K,children:"Δ miss"}),n.jsx("th",{className:K,children:"Δ hit"}),n.jsx("th",{className:K,children:"total miss"}),n.jsx("th",{className:K,children:"total hit"})]})}),n.jsx("tbody",{children:v.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Dr(s);return n.jsxs("tr",{className:Sr,children:[n.jsxs("td",{className:vr,children:[n.jsx("span",{className:tt[o],"aria-hidden":!0})," ",r]}),n.jsx("td",{className:o==="ran"?Ee.ran:Ee.dim,children:s?.misses??0}),n.jsx("td",{className:ie,children:s?.hits??0}),n.jsx("td",{className:ie,children:t[r].misses}),n.jsx("td",{className:ie,children:t[r].hits})]},r)})})]}),Pr=({entries:e})=>e.length===0?null:n.jsxs("div",{className:kr,children:[n.jsx("div",{className:Lr,children:"recent compiles"}),e.map(t=>{const r=Or(t.stages,i=>i.misses>0),s=v.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return n.jsxs("div",{className:yr,children:[n.jsx("span",{className:tt[o],"aria-hidden":!0}),n.jsx("span",{className:br,title:t.label,children:t.label}),n.jsxs("span",{className:jr,children:[r,"/",s," ran · ",rt(t.durationMs)]})]},t.id)})]}),Dr=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Or=(e,t)=>{let r=0;for(const s of v.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},rt=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Ir={small:1.9,medium:2.3,large:2.6},Mr={small:1,medium:1,large:1.2},Br=a.DEFAULT_FONT_FAMILY,nt=a.FONT_LINE_HEIGHT.sm,Rr=12,Hr=4,Gr=4,zr=12,$r=4,qr=2,st=24;function W(e){const{store:t}=a.useHoverContext();return ee.useStore(t,e)}const Vr=e=>{const{cursorRef:t,subscribeCursorMove:r}=a.useHoverContext(),s=W(i=>i.isPointerInside),o=g.useRef(e);return o.current=e,g.useEffect(()=>r(()=>o.current?.()),[r]),{cursorRef:t,isInside:s}},Wr=16,Yr=8,Ur={x:0,y:0,top:0,left:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})},Xr=()=>{const e=a.useCompiledSelector(E.useShallow(y=>({layers:y.layers,coordSystem:y.coordSystem,scales:y.scales,guides:y.guides,numberFormat:y.config.numberFormat,parsingLocale:y.config.parsingLocale}))),{formattingLocale:t}=a.useGraphContext(),r=W(y=>y.hover),s=a.useResolveGeomPlugin(),o=g.useRef(()=>{}),{cursorRef:i,isInside:c}=Vr(()=>o.current()),l=g.useMemo(()=>v.buildTooltipContent({...e,hover:r,formattingLocale:t}),[e,r,t]),u=l!==null&&c,d=g.useMemo(()=>({getBoundingClientRect:()=>{const y=i.current;return y===null?Ur:Kr(y)}}),[i]),{refs:h,floatingStyles:f,update:x}=k.useFloating({open:u,placement:"right",middleware:[k.offset(Wr),k.flip(),k.shift({padding:Yr})],elements:{reference:d}});if(o.current=x,!u)return null;const p=r.primary,m=p===null?null:e.layers.find(y=>y.id===p.layerId)??null,b=m===null?null:s(m,e.coordSystem),j=p!==null&&m!==null&&b?.renderTooltip?b.renderTooltip({content:l,layer:m,coordSystem:e.coordSystem,primary:p,group:r.group,related:r.related}):null;return n.jsx("div",{ref:h.setFloating,role:"tooltip",className:a.root,style:f,"data-testid":"chart-tooltip",children:j??n.jsx(a.TooltipBody,{content:l})})},Kr=e=>({x:e.clientX,y:e.clientY,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,width:0,height:0,toJSON:()=>({})}),ye=a.FONT_SIZE_EM.sm,ot=a.DEFAULT_FONT_FAMILY,at=!1,Z=6,N=10,Zr=(e,t)=>r=>{if(!r.isVisible||r.ticks.length===0)return 0;const s=r.position==="top"||r.position==="bottom",o=r.ticks.map(l=>e.measureText(l.formattedLabel,{family:ot,size:a.emToPx(ye,t)})),i=r.labelMaxWidthPx??Number.POSITIVE_INFINITY;if(s){if(r.labelRotation!==0){const l=o.map(d=>d.width);return _e(l,i)+2*N}return Math.max(...o.map(l=>l.height))+N}return _e(o.map(l=>l.width),i)+N},_e=(e,t)=>Math.min(Math.max(...e),t),Jr=e=>()=>a.emToPx(ye,e),Qr=(e,t)=>(r,s)=>{const{labelLineHeight:o,labelFontWeight:i}=v.getDifferenceArrowDimensions(s,t);return e.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:o,weight:i})},it=e=>{const{value:t,observationLabel:r,comparison:s,swatch:o,label:i}=e;return[{role:"valueRow",gap:Gr,segments:le([J("value","value",t??"–"),J("observation","label",r)])},{role:"trendRow",gap:$r,ariaLabel:s===null?void 0:nn(s),segments:le([tn(s),rn(s),J("trendReference","label",s?.reference??null)])},{role:"groupRow",gap:Hr,segments:le([en(o),J("label","label",i)])}].filter(l=>l.segments.length>0)},J=(e,t,r)=>r===null?null:{kind:"text",textRole:e,fontRole:t,text:r},en=e=>e===null?null:{kind:"swatch",swatch:e,size:Rr},tn=e=>e===null?null:{kind:"trendArrow",direction:e.direction,size:zr},rn=e=>e===null?null:{kind:"text",textRole:"trendPercentage",fontRole:"label",text:e.percentage,trendDirection:e.direction},nn=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}`}},le=e=>e.filter(t=>t!==null),sn=(e,t)=>(r,s)=>{const o=lt(r,s,e,t),i=ct(o.map(l=>l.width)),c=Math.max(0,o.length-1)*st;return{width:i+c,height:Math.max(0,...o.map(l=>l.height))}},on=(e,t)=>(r,s)=>lt(r,s,e,t).map(o=>o.width),an=(e,t)=>(r,s)=>{const o=ge("value",s,t);return{width:e.measureText(r,o).width,height:o.size*nt}},ln=(e,t)=>{const r=sn(e,t),s=an(e,t);return(o,i)=>o.kind==="perGroup"?r(o,i):s(o.value,i)},lt=(e,t,r,s)=>{const o={value:ge("value",t,s),label:ge("label",t,s)},i=c=>cn(c,o,r);return e.items.map(c=>{const l=it(c).map(i),u=Math.max(0,l.length-1)*qr;return{width:Math.max(0,...l.map(d=>d.width)),height:ct(l.map(d=>d.height))+u}})},cn=(e,t,r)=>{let s=0,o=0;for(const i of e.segments)if(i.kind==="text"){const c=t[i.fontRole];s+=r.measureText(i.text,c).width,o=Math.max(o,c.size*nt)}else s+=i.size,o=Math.max(o,i.size);return{width:s+Math.max(0,e.segments.length-1)*e.gap,height:o}},ge=(e,t,r)=>{const s=e==="value"?Ir[t]:Mr[t];return{family:Br,size:a.emToPx(s,r)}},ct=e=>e.reduce((t,r)=>t+r,0),be=12,ut=10,dt=8,un=8,dn=8,hn=2,ht=1,gt=2,ft=4,xt=a.FONT_SIZE_EM.sm,pt=a.FONT_LINE_HEIGHT.sm,mt=a.DEFAULT_FONT_FAMILY,vt=2*(dn+ht),je=2*(hn+ht),gn=gt*ft,yt=e=>{const t=a.emToPx(xt,e);return{fontSizePx:t,lineBoxHeight:t*pt}},bt=e=>e?ut:0,fn=(e,t)=>r=>{if(r.items.length===0)return 0;const{fontSizePx:s,lineBoxHeight:o}=yt(t),i={family:mt,size:s};if(r.position==="top"||r.position==="bottom")return Math.max(o,be)+je;const l=r.items.map(u=>{const d=e.measureText(u.formattedLabel,i).width,h=bt(u.visual.color);return h+(h>0?dt:0)+d});return Math.max(...l)+vt},xn=(e,t)=>r=>e.measureText(r,{family:ot,size:a.emToPx(ye,t)}),pn=(e,t)=>g.useMemo(()=>e?{measureAxis:Zr(e,t),measureAxisLabel:Jr(t),measureLegend:fn(e,t),measureHeadline:ln(e,t),measureHeadlineItemWidths:on(e,t),measureTickLabel:xn(e,t),measureDifferenceArrowLabel:Qr(e,t)}:null,[e,t]),mn=({measurer:e,axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f})=>g.useMemo(()=>e?new v.LayoutCompiler(e).compile({axes:t,numberFormat:r,parsingLocale:s,formattedLegends:o,containerSize:i,externalMeasurements:c,headline:l,formattingLocale:u,annotations:d,coordSystem:h,textScale:f}):null,[t,r,s,o,i,c,l,u,d,h,f,e]),Le="data-variant",jt=cr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute(Le)??null,renderHTML:e=>e.variant?{[Le]:e.variant}:{}}}}}),vn=lr.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:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),yn=({titlePlaceholder:e,subtitlePlaceholder:t,isTitleVisible:r,isSubtitleVisible:s})=>[jn({isTitleVisible:r,isSubtitleVisible:s}),jt,Je.Text,te.UndoRedo,Xe.Heading.configure({levels:[1,2,3]}),Ye.Bold,Ke.Italic,et.Underline,Qe.TextAlign.configure({types:["heading","paragraph"]}),Ze.Link.configure({openOnClick:!1,autolink:!0}),B.TextStyle,B.Color,B.FontFamily,Ue.HardBreak,vn.configure({isTitleVisible:r}),te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(r&&o===0)return e;const c=r?i.state.doc.firstChild?.nodeSize??-1:0;return s&&o===c?t:""}})],bn=({placeholder:e})=>[he.Document,jt,Je.Text,te.UndoRedo,Xe.Heading.configure({levels:[1,2,3]}),Ye.Bold,Ke.Italic,et.Underline,Qe.TextAlign.configure({types:["heading","paragraph"]}),Ze.Link.configure({openOnClick:!1,autolink:!0}),B.TextStyle,B.Color,B.FontFamily,Ue.HardBreak,te.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],jn=({isTitleVisible:e,isSubtitleVisible:t})=>e&&t?he.Document.extend({content:"block{2,}"}):he.Document,T=(e,t)=>`color-mix(in srgb, transparent, ${e} ${t*100}%)`,se=(e,t)=>`hsl(from ${e} h s calc(l * ${1-t}))`,Tt=(e,t)=>`hsl(from ${e} h s calc(l * ${1+t}))`,fe=(e,t,r)=>`color-mix(in srgb, ${e}, ${t} ${r*100}%)`,Tn=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),Cn=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),Ct={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)"},St={radiiXs:"4px",radiiSm:"6px",radiiMd:"8px",radiiLg:"12px"},kt={zIndexToolbar:"10",zIndexToolbarTooltip:"20",zIndexToolbarPopover:"30"},Sn=8,I=e=>`${Sn*e}px`,wt={spaceXxs:I(.25),spaceXs:I(.5),spaceSm:I(.75),spaceMd:I(1),spaceLg:I(1.5),spaceXl:I(2)},kn={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)"},wn={textPrimary:a.vars.grey0,textSecondary:T(a.vars.textPrimary,.8),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey70,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,sunkenBackground:a.vars.grey100,defaultBackground:a.vars.grey90,raisedBackground:a.vars.grey80,overlayBackground:a.vars.grey90,overlayBorderGradient:a.vars.greyGradient80},An={graphBackground:a.vars.grey90,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:a.vars.border100,targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.grey70,tooltipBorderColor:a.vars.grey60,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey60,hoverGuideLineColor:T(a.vars.white,.08),hoverGuideFillColor:T(a.vars.white,.06),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.white,defaultAnnotationShapeStroke:a.vars.white,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#FFFFFF",arrowAnnotationStickerOutlineColorInverse:"#1D2129",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:a.vars.white},En={canvasDefault:"#FFFFFF",canvasBlue:"#60a5fa",canvasCyan:"#22d3ee",canvasGreen:"#34d399",canvasYellow:"#FFC800",canvasOrange:"#fb923c",canvasRed:"#f87171",canvasPink:"#F979D9",canvasPurple:"#a78bfa",canvasGray:"#a8a29e",canvasInverse:"#000000"},_n={...kn,...wn,...Ct,...St,...wt,...kt,...An,...En,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},Ln={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)"},Fn={textPrimary:a.vars.black,textSecondary:T(a.vars.textPrimary,.6),textDisabled:T(a.vars.textPrimary,.5),iconPrimary:"currentColor",iconSecondary:T(a.vars.textPrimary,.6),iconStickerBackground:a.vars.grey100,brand:a.vars.purple50,success:a.vars.green50,warning:a.vars.amber50,alert:a.vars.red50,border100:a.vars.grey0,border50:T(a.vars.grey0,.5),border10:T(a.vars.grey0,.1),sunkenBackground:a.vars.grey90,defaultBackground:a.vars.grey100,raisedBackground:a.vars.grey85,overlayBackground:a.vars.grey100,overlayBorderGradient:a.vars.border10},Nn={graphBackground:a.vars.grey100,gridLineColor:a.vars.border10,originLineColor:a.vars.grey0,targetLineColor:a.vars.border100,targetLineMarkerColor:"#A0A6C5",targetLineLabelTextColor:a.vars.grey100,legendBackground:a.vars.defaultBackground,legendBorderColor:a.vars.border10,legendFocusOutlineColor:a.vars.border50,legendTextColor:a.vars.textPrimary,dimmedSeriesLabelTextColor:a.vars.textDisabled,dimmedSeriesLabelLineColor:a.vars.grey60,trendNegativeColor:a.vars.red60,trendPositiveColor:a.vars.green60,trendNeutralColor:a.vars.textSecondary,toolbarBackgroundColor:a.vars.overlayBackground,toolbarButtonBackgroundColor:"transparent",toolbarButtonBackgroundColorHovered:a.vars.grey80,toolbarButtonBackgroundColorSelected:a.vars.grey60,toolbarSeparatorColor:a.vars.grey60,tooltipBackground:a.vars.white,tooltipBorderColor:a.vars.border10,tooltipHeadingTextColor:a.vars.textPrimary,tooltipLabelTextColor:a.vars.textSecondary,tooltipValueTextColor:a.vars.textPrimary,tooltipPrimaryRowColor:a.vars.grey80,hoverGuideLineColor:T(a.vars.black,.08),hoverGuideFillColor:T(a.vars.black,.04),hoveredBarBorderColor:a.vars.white,hoveredPointRingColor:a.vars.white,pointStrokeColor:a.vars.white,stackedBarHoverBorderColor:a.vars.grey0,heatmapEmptyTileBackground:a.vars.grey80,dataLabelOutsideBackground:T(a.vars.textPrimary,.1),defaultAnnotationArrowStroke:a.vars.black,defaultAnnotationShapeStroke:a.vars.black,defaultAnnotationShapeFill:a.vars.canvasBlue,arrowAnnotationStickerOutlineColor:"#1D2129",arrowAnnotationStickerOutlineColorInverse:"#FFFFFF",annotationFrameBorderColor:a.vars.blue60,annotationMenuTriggerIconColor:"#3d414c"},Pn={canvasDefault:"#000000",canvasBlue:"#3b82f6",canvasCyan:"#06b6d4",canvasGreen:"#10b981",canvasYellow:"#E5B400",canvasOrange:"#f97316",canvasRed:"#ef4444",canvasPink:"#E845BF",canvasPurple:"#8b5cf6",canvasGray:"#78716c",canvasInverse:"#ffffff"},Dn={...Ln,...Fn,...Ct,...St,...wt,...kt,...Nn,...Pn,...a.baseTypographyTokens,...a.semanticTypographyTokens,...a.elementTypographyTokens},re=.1,On={light:.05,dark:.1},In=(e,t)=>{switch(e.type){case"none":return null;case"solid":return e.color;case"tinted":return Rn(e.color,t);case"gradient":return Hn(e.color,t);case"preset":return v.BORDER_PRESET_GRADIENTS[e.preset]}},Mn=e=>e.type==="none"?0:e.width,Bn=(e,t,r)=>{if(e.type==="solid")return e.color;if(e.type==="tinted")return fe(r,e.color,On[t])},Rn=(e,t)=>t==="dark"?se(e,re):Tt(e,re),Hn=(e,t,r=90)=>{const s=e,o=t==="dark"?se(e,re):Tt(e,re);return`linear-gradient(${r}deg, ${s} 0%, ${o} 100%)`};var Gn="bow4tg0",zn="bow4tg1",$n="bow4tg2",qn="bow4tg3",At="_1ii3bsb0",Et="_1ii3bsb1";const Te=g.createContext(null),Ce=()=>{const e=g.useContext(Te);if(!e)throw new Error("useThemeContext must be used inside a <ThemeProvider>.");return e},_t=({theme:e,themeOverrides:t={},appearance:r,children:s})=>{const o=g.useMemo(()=>({...e==="dark"?_n:Dn,...t}),[e,t]),i=g.useMemo(()=>{const l={[a.vars.textScale]:String(r.textScale)};for(const[d,h]of Object.entries(t))l[a.vars[d]]=h;const u=Bn(r.background,e,o.graphBackground);return u!==void 0&&(l[a.vars.graphBackground]=u),dr.assignInlineVars(l)},[r.textScale,r.background,e,o.graphBackground,t]),c=g.useMemo(()=>({theme:e,themeClass:e==="dark"?Et:At,inlineVarsStyle:i,themeValues:o}),[e,i,o]);return n.jsx(Te.Provider,{value:c,children:s})},D=({children:e,className:t,style:r})=>{const s=g.useContext(Te),o=s?A(s.themeClass,zn):void 0,i=s?{...s.inlineVarsStyle,...r}:r;return n.jsx("div",{className:A(o,t),style:i,children:e})},Vn="graphy_root",O=()=>typeof document>"u"?null:document.getElementById(Vn)??document.body;var Wn="yp3g0k0",Yn="yp3g0k1",Lt="yp3g0k3",Un="yp3g0k4",Ft="yp3g0k5",xe="yp3g0k6",Xn="yp3g0k7",Kn="yp3g0k8",Nt="yp3g0k9",Zn="yp3g0ka",Jn="yp3g0kb",Qn="yp3g0kc",es="yp3g0kd",ts="yp3g0ke";const rs=a.CANVAS_COLOR_KEYS.map(e=>a.vars[e]),ns=Object.fromEntries(a.CANVAS_COLOR_KEYS.map(e=>[a.vars[e],e])),ss=({editor:e,currentColor:t,isOpen:r,onOpenChange:s})=>{const o=as(),i=g.useCallback(l=>{e.chain().setColor(l).run()},[e]),c=l=>{e.chain().focus().setColor(l).run(),s(!1)};return n.jsxs(S.Popover.Root,{open:r,onOpenChange:s,children:[n.jsx(S.Popover.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Text color",className:Wn,onMouseDown:l=>l.preventDefault(),children:n.jsx("span",{className:Yn,style:{background:t??"transparent"}})}),n.jsx(S.Popover.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(S.Popover.Positioner,{sideOffset:6,align:"start",className:Lt,children:n.jsxs(S.Popover.Popup,{className:Un,onMouseDown:l=>l.preventDefault(),children:[n.jsx(Fe,{title:"Colors",colors:rs,currentColor:t,onPick:c}),o.length>0&&n.jsx(Fe,{title:"Chart colors",colors:o,currentColor:t,onPick:c}),n.jsx(os,{value:t??"#000000",onChange:i})]})})})})]})},Fe=({title:e,colors:t,currentColor:r,onPick:s})=>n.jsxs("div",{className:Ft,children:[n.jsx("div",{className:xe,children:e}),n.jsx("div",{className:Xn,children:t.map(o=>n.jsx("button",{type:"button","aria-label":o,className:Kn,"data-active":ls(o,r),onMouseDown:i=>i.preventDefault(),onClick:()=>s(o),children:n.jsx("span",{className:Nt,style:Pt(o)})},o))})]}),os=({value:e,onChange:t})=>{const[r,s]=g.useState(!1),o=Cn(e)?e:"#000000",i=is(o);return n.jsxs(S.Popover.Root,{open:r,onOpenChange:s,children:[n.jsxs("div",{className:Ft,children:[n.jsx("div",{className:xe,children:"Custom"}),n.jsxs(S.Popover.Trigger,{className:Zn,onMouseDown:c=>c.preventDefault(),"aria-label":"Pick custom color",children:[n.jsx("span",{className:Nt,style:Pt(o)}),n.jsx("span",{className:Jn,children:i})]})]}),n.jsx(S.Popover.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(S.Popover.Positioner,{side:"right",align:"start",sideOffset:18,className:Lt,children:n.jsxs(S.Popover.Popup,{className:Qn,onMouseDown:c=>c.preventDefault(),children:[n.jsx("div",{className:xe,children:"Pick color"}),n.jsx(we.HexColorPicker,{color:i,onChange:t,className:es}),n.jsx(we.HexColorInput,{color:i,onChange:t,prefixed:!0,className:ts,onMouseDown:c=>c.stopPropagation()})]})})})})]})},as=()=>{const e=a.useCompiledSelector(t=>t.scales.color);return g.useMemo(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const s=e.map(r);typeof s=="string"&&t.add(s)}return[...t]},[e])},Pt=e=>({background:e,border:`1px solid ${se(e,.1)}`}),is=e=>{const{themeValues:t}=Ce();if(Tn(e))return e.toUpperCase();const r=ns[e];return r?t[r].toUpperCase():"#000000"},ls=(e,t)=>t===null?!1:e.toLowerCase()===t.toLowerCase(),cs={xxs:8,xs:12,sm:16,md:20,lg:24,xl:36};var us={primary:"asohov1 asohov0",secondary:"asohov2 asohov0"};const F=({children:e,title:t,variant:r="primary",size:s="sm",...o})=>{const i=g.useId(),c=cs[s];return n.jsxs("svg",{className:us[r],"aria-labelledby":t?i:void 0,height:c,width:c,fill:"none",viewBox:"0 0 24 24",role:"img",...o,children:[t&&n.jsx("title",{id:i,children:t}),e]})},Dt=e=>n.jsx(F,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"m6 9 6 6 6-6"})})}),ds="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Ot=`'Aeonik', 'Aeonik Fallback', ${a.DEFAULT_FONT_FAMILY}`,hs="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",gs="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",fs=`var(--brand-font-family), ${Ot}`,pe=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:a.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Ot},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:ds},{id:"technical",label:"Technical",preview:"00",fontFamily:hs},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:gs},{id:"brand",label:"Brand",preview:"Aa",fontFamily:fs}],xs=e=>e?pe.find(t=>t.fontFamily===e)??null:null;var It="_1qkyw7q0",Mt="_1qkyw7q1",Bt="_1qkyw7q3",Rt="_1qkyw7q4",Ht="_1qkyw7q5";const ps=({editor:e,currentFontFamily:t,isOpen:r,onOpenChange:s})=>{const o=xs(t)??pe[0],i=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return n.jsxs(w.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(w.Menu.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Font family",className:It,onMouseDown:c=>c.preventDefault(),children:[n.jsx("span",{className:Mt,style:{fontFamily:o?.fontFamily},children:o?.preview}),n.jsx(Dt,{size:"sm"})]}),n.jsx(w.Menu.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(w.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Bt,children:n.jsx(w.Menu.Popup,{className:Rt,onMouseDown:c=>c.preventDefault(),children:pe.map(c=>n.jsx(w.Menu.Item,{className:Ht,"data-selected":c.id===o?.id,onClick:()=>i(c),children:n.jsx("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Gt={id:"text",label:"Text",previewFont:a.vars.fontTextEditorBody},Ne=[{id:"caption",label:"Caption",previewFont:a.vars.fontTextEditorH6},Gt,{id:"h3",label:"Heading 3",previewFont:a.vars.fontTextEditorH3},{id:"h2",label:"Heading 2",previewFont:a.vars.fontTextEditorH2},{id:"h1",label:"Heading 1",previewFont:a.vars.fontTextEditorH1}],ms=({editor:e,activeStyle:t,isOpen:r,onOpenChange:s})=>{const o=Ne.find(i=>i.id===t)??Gt;return n.jsxs(w.Menu.Root,{open:r,onOpenChange:s,children:[n.jsxs(w.Menu.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Text style",className:It,onMouseDown:i=>i.preventDefault(),children:[n.jsx("span",{className:Mt,children:o.label}),n.jsx(Dt,{size:"sm"})]}),n.jsx(w.Menu.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(w.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Bt,children:n.jsx(w.Menu.Popup,{className:Rt,onMouseDown:i=>i.preventDefault(),children:Ne.map(i=>n.jsx(w.Menu.Item,{className:Ht,"data-selected":i.id===o.id,onClick:()=>vs(e,i.id),children:n.jsx(ys,{font:i.previewFont,children:i.label})},i.id))})})})})]})},vs=(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()}},ys=({font:e,children:t})=>n.jsx("span",{style:{font:e,margin:0},children:t}),bs=e=>n.jsx(F,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M20 6 9 17l-5-5"})})}),js=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.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"})]})}),Ts=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 6 6 18"}),n.jsx("path",{d:"m6 6 12 12"})]})}),Cs=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),Ss=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,s=t.parentOffset,o=t.start();let i=s;for(;i>0&&Pe(r[i-1]);)i-=1;let c=s;for(;c<r.length&&Pe(r[c]);)c+=1;return{from:o+i,to:o+c}},Pe=e=>e!==void 0&&/\S/.test(e);var ks="b5kquu0",ws="b5kquu1",As="b5kquu2",Es="b5kquu3",De="b5kquu4";const _s=({editor:e,currentUrl:t,isActive:r,isOpen:s,onOpenChange:o})=>{const[i,c]=g.useState(""),l=g.useRef(null);g.useEffect(()=>{s&&c(t??"")},[s,t]);const u=()=>{Ls(e,i),o(!1)},d=()=>{c(""),o(!1)},h=x=>{c(x.target.value)},f=x=>{x.key==="Enter"&&(x.preventDefault(),u())};return n.jsxs(S.Popover.Root,{open:s,onOpenChange:o,children:[n.jsx(S.Popover.Trigger,{render:n.jsx(C.Toolbar.Button,{}),"aria-label":"Link","data-active":r,className:ks,onMouseDown:x=>x.preventDefault(),children:n.jsx(js,{})}),n.jsx(S.Popover.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(S.Popover.Positioner,{sideOffset:6,align:"end",className:ws,children:n.jsxs(S.Popover.Popup,{className:As,initialFocus:l,onMouseDown:x=>x.preventDefault(),children:[n.jsx("input",{ref:l,type:"url",value:i,placeholder:"Type or paste a link...","aria-label":"Link URL",className:Es,onMouseDown:x=>x.stopPropagation(),onChange:h,onKeyDown:f}),n.jsx("button",{type:"button","aria-label":"Cancel",className:De,onClick:d,children:n.jsx(Ts,{})}),n.jsx("button",{type:"button","aria-label":"Apply link",className:De,onClick:u,children:n.jsx(bs,{})})]})})})})]})},Ls=(e,t)=>{const r=t.trim(),{selection:s}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!s.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const o=Ss(e);e.chain().focus().setTextSelection(o).setLink({href:r}).run()},Fs=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M17 12H7"}),n.jsx("path",{d:"M19 19H5"})]})}),Ns=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M21 12H9"}),n.jsx("path",{d:"M21 19H7"})]})}),Ps=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 5H3"}),n.jsx("path",{d:"M15 12H3"}),n.jsx("path",{d:"M17 19H3"})]})});var Ds="k91gos0",Os="k91gos1";const Is=6,R=({label:e,isActive:t,onToggle:r,children:s})=>{const o=i=>i.preventDefault();return n.jsxs(M.Tooltip.Root,{children:[n.jsx(M.Tooltip.Trigger,{render:n.jsx(hr.Toggle,{render:n.jsx(C.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:Ds,onMouseDown:o,children:s}),n.jsx(M.Tooltip.Portal,{container:O(),children:n.jsx(D,{children:n.jsx(M.Tooltip.Positioner,{sideOffset:Is,children:n.jsx(M.Tooltip.Popup,{className:Os,children:e})})})})]})},Ms=({editor:e,activeAlignment:t="left"})=>n.jsxs(n.Fragment,{children:[n.jsx(R,{label:"Align left",isActive:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:n.jsx(Ps,{})}),n.jsx(R,{label:"Align center",isActive:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:n.jsx(Fs,{})}),n.jsx(R,{label:"Align right",isActive:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:n.jsx(Ns,{})})]});var Bs="_1bp10ig0",V="_1bp10ig1",Q="_1bp10ig2";const Rs=({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:Hs(e),textAlign:Gs(e)}),Hs=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",Gs=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",zs=8,$s=8,qs=({editor:e})=>{const[t,r]=g.useState(!1),[s,o]=g.useState(null),i=s!==null,c=p=>m=>{o(m?p:null)},{refs:l,floatingStyles:u}=k.useFloating({placement:"top-start",strategy:"fixed",middleware:[k.offset(zs),k.flip(),k.shift({padding:$s})],whileElementsMounted:k.autoUpdate}),d=g.useRef(null),h=ve.useEditorState({editor:e,selector:Rs}),f=g.useCallback(p=>{d.current=p,l.setFloating(p)},[l]);if(g.useEffect(()=>{e&&l.setReference(e.view.dom)},[e,l]),g.useEffect(()=>{if(!e)return;const p=()=>r(!0),m=({event:b})=>{const{relatedTarget:j,currentTarget:y}=b,_=j instanceof Node&&d.current?.contains(j),G=j instanceof Node&&y instanceof Node&&y.contains(j);!_&&!G&&r(!1)};return e.on("focus",p),e.on("blur",m),()=>{e.off("focus",p),e.off("blur",m)}},[e]),!e||!t&&!i)return null;const x=O();return x?ur.createPortal(n.jsx(D,{children:n.jsx(M.Tooltip.Provider,{children:n.jsxs(C.Toolbar.Root,{ref:f,className:Bs,style:u,children:[n.jsxs(C.Toolbar.Group,{className:V,children:[n.jsx(ss,{editor:e,currentColor:h?.color??null,isOpen:s==="color",onOpenChange:c("color")}),n.jsx(ps,{editor:e,currentFontFamily:h?.fontFamily??null,isOpen:s==="fontFamily",onOpenChange:c("fontFamily")})]}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsx(C.Toolbar.Group,{className:V,children:n.jsx(ms,{editor:e,activeStyle:h?.fontSize??"text",isOpen:s==="fontSize",onOpenChange:c("fontSize")})}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsxs(C.Toolbar.Group,{className:V,children:[n.jsx(R,{label:"Bold",isActive:h?.isBold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:n.jsx("strong",{children:"B"})}),n.jsx(R,{label:"Italic",isActive:h?.isItalic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:n.jsx("em",{children:"I"})}),n.jsx(R,{label:"Underline",isActive:h?.isUnderline??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:n.jsx("u",{children:"U"})})]}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsx(C.Toolbar.Group,{className:V,children:n.jsx(Ms,{editor:e,activeAlignment:h?.textAlign})}),n.jsx(C.Toolbar.Separator,{className:Q}),n.jsx(C.Toolbar.Group,{className:V,children:n.jsx(_s,{editor:e,currentUrl:h?.linkUrl??null,isActive:h?.isLink??!1,isOpen:s==="link",onOpenChange:c("link")})})]})})}),x):null};var Vs="_2ngohc0";const zt=({editor:e,ariaLabel:t})=>n.jsxs("div",{className:Vs,children:[n.jsx(qs,{editor:e}),n.jsx(ve.EditorContent,{editor:e,"aria-label":t})]}),Ws=(e,t)=>{const r=g.useRef(e);r.current=e;const s=g.useRef(t);s.current=t;const o=g.useRef(null),i=g.useRef(null),c=g.useMemo(()=>{const l=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null),o.current=null},u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null);const h=o.current;h!==null&&(o.current=null,r.current(...h))};return{run:(...h)=>{if(s.current<=0){r.current(...h);return}o.current=h,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(u,s.current)},flush:u,cancel:l}},[]);return g.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]),c},Ys=200,$t=({content:e,extensions:t,isEditable:r,onUpdate:s,updateDebounceMs:o=Ys})=>{const i=g.useRef(Oe(e)),c=g.useRef(!1),l=Ws(d=>{c.current=!0,s?.(d)},o),u=ve.useEditor({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:d})=>l.run(d.getJSON())});return g.useEffect(()=>{u?.setEditable(r)},[u,r]),g.useEffect(()=>{if(!u)return;if(c.current){c.current=!1;return}const d=Oe(e),h=u.getJSON();Us(h,d)||(l.cancel(),u.commands.setContent(d,{emitUpdate:!1}))},[u,e,l]),g.useEffect(()=>()=>l.flush(),[l]),u},Oe=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,Us=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Xs=/^(?:https?:|mailto:)/i,qt=e=>{if(typeof e!="string")return!1;const t=e.replace(/^[\x00-\x20]+/,"");return t.length===0?!1:Xs.test(t)};var Ks="_1cocly40";const Zs={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"},ne=({content:e})=>n.jsx(n.Fragment,{children:Vt(e.content??[e])}),Vt=e=>e.map((t,r)=>Js(t,r)),Js=(e,t)=>{if(e.type==="text")return Qs(e,t);if(e.type==="hardBreak"||e.type==="hard_break")return n.jsx("br",{},t);const r=e.content?Vt(e.content):null;switch(e.type){case"doc":return n.jsx(g.Fragment,{children:r},t);case"heading":{const s=no(e.attrs?.level);return so(s,t,r,Me(e.attrs))}case"paragraph":{const s=H(e.attrs?.variant);return n.jsx("p",{"data-variant":s??void 0,style:Wt(Me(e.attrs)),children:r},t)}case"blockquote":return n.jsx("blockquote",{children:r},t);case"bulletList":case"bullet_list":return n.jsx("ul",{children:r},t);case"orderedList":case"ordered_list":return n.jsx("ol",{children:r},t);case"listItem":case"list_item":return n.jsx("li",{children:r},t);default:return n.jsx("span",{children:r},t)}},Qs=(e,t)=>{const r=e.text??"";return!e.marks||e.marks.length===0?n.jsx("span",{children:r},t):e.marks.reduceRight((s,o,i)=>eo(o,s,`${t}-${i}`),r)},eo=(e,t,r)=>{switch(e.type){case"bold":case"strong":return n.jsx("strong",{children:t},r);case"italic":case"em":return n.jsx("em",{children:t},r);case"underline":return n.jsx("u",{children:t},r);case"strike":case"strikethrough":case"s":return n.jsx("s",{children:t},r);case"code":return n.jsx("code",{children:t},r);case"link":{const s=H(e.attrs?.href);return qt(s)?n.jsx("a",{className:Ks,href:s,rel:"noopener noreferrer",target:"_blank",children:t},r):n.jsx("span",{children:t},r)}case"textStyle":{const s=to(e.attrs);return s?n.jsx("span",{style:s,children:t},r):n.jsx("span",{children:t},r)}default:return n.jsx("span",{children:t},r)}},Ie=e=>{const t=H(e&&typeof e=="object"?e.fontFamily:e);if(t)return Zs[t]??t},to=e=>{if(!e)return null;const t={},r=H(e.color);r&&(t.color=r);const s=Ie(e.font)??Ie(e.fontFamily);s&&(t.fontFamily=s);const o=ro(e.fontSize);return o&&(t.fontSize=o),Object.keys(t).length>0?t:null},ro=e=>typeof e=="number"&&Number.isFinite(e)?`${e/10}em`:H(e),H=e=>typeof e=="string"&&e.length>0?e:void 0,no=e=>typeof e!="number"?3:e<1?1:e>3?3:Math.round(e),so=(e,t,r,s)=>{const o=Wt(s);switch(e){case 1:return n.jsx("h1",{style:o,children:r},t);case 2:return n.jsx("h2",{style:o,children:r},t);case 3:return n.jsx("h3",{style:o,children:r},t)}},Me=e=>{const t=e?.textAlign;if(t==="left"||t==="right"||t==="center"||t==="justify")return t},Wt=e=>e?{textAlign:e}:void 0;var oo="_4dlrid0",Yt="_4dlrid1",ao="xfz7dq0",io="xfz7dq1",lo="xfz7dq2",co="xfz7dq3",uo="xfz7dq4";const ho=({ref:e,footerRect:t,mode:r="readonly"})=>{const{caption:s,isCaptionVisible:o,source:i,isSourceVisible:c}=a.useCompiledSelector(E.useShallow(h=>({caption:h.config.content.caption,isCaptionVisible:h.config.content.isCaptionVisible,source:h.config.content.source,isSourceVisible:h.config.content.isSourceVisible}))),l=r==="editable",u=o&&(l||s!==null),d=c&&i!==null&&po(i);return!u&&!d?null:n.jsxs("div",{ref:e,className:ao,style:{left:t.x,top:t.y,width:t.width},children:[u?l?n.jsx(mo,{caption:s}):n.jsx(go,{caption:s}):null,d&&n.jsx(fo,{source:i})]})},go=({caption:e})=>e===null?null:typeof e=="string"?n.jsx("p",{className:Yt,children:e}):n.jsx(ne,{content:e}),fo=({source:e})=>{const t=qt(e.url)?e.url:void 0,r=e.label??(t!==void 0?xo(t):"");return r===""&&t===void 0?null:n.jsxs("div",{className:io,children:[n.jsx("span",{className:co,children:"Source:"}),t!==void 0?n.jsx("a",{className:lo,href:t,target:"_blank",rel:"noopener noreferrer",children:r}):n.jsx("span",{className:uo,children:r})]})},xo=e=>{try{return new URL(e).hostname}catch{return e}},po=e=>e.label!==void 0&&e.label!==""||e.url!==void 0&&e.url!=="",mo=({caption:e})=>{const t=a.useGraphCommandDispatcher(),r=g.useMemo(()=>bn({placeholder:"Add caption"}),[]),s=$t({content:e,extensions:r,isEditable:!0,onUpdate:o=>{const i=Cs(o)?null:o;t(new v.SetContentCaptionCommand({caption:i}))}});return n.jsx(zt,{editor:s,ariaLabel:"Chart caption"})};var vo="_1k4qtbg0";const yo=3,bo=({title:e,isTitleVisible:t,subtitle:r,isSubtitleVisible:s})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:yo},content:To(e)}),s&&o.push(...Co(r)),{type:"doc",content:o}},jo=e=>{const t=e.content??[],[r,...s]=t;return{title:So(r?.content??[]),subtitle:ko(s)}},Se=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(Se)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),To=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??[],Co=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(Be):[Be(e)],Be=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},So=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(Se)}},ko=e=>{const t=e.filter(s=>(s.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const s=r.content??[],[o]=s;if(o&&s.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(Se)}},wo=({ref:e,headerRect:t,mode:r="readonly"})=>{const{title:s,isTitleVisible:o,subtitle:i,isSubtitleVisible:c}=a.useCompiledSelector(E.useShallow(h=>({isTitleVisible:h.config.content.isTitleVisible,isSubtitleVisible:h.config.content.isSubtitleVisible,title:h.config.content.title,subtitle:h.config.content.subtitle}))),l=r==="editable";return!(o&&(l||s!==null))&&!(c&&(l||i!==null))?null:n.jsx("div",{ref:e,className:vo,style:{left:t.x,top:t.y,width:t.width},children:l?n.jsx(Eo,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i},[o?"title":"",c?"subtitle":""].join("-")):n.jsx(Ao,{title:s,isTitleVisible:o,isSubtitleVisible:c,subtitle:i})})},Ao=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=t&&e!==null,i=r&&s!==null;return n.jsxs(n.Fragment,{children:[o&&(typeof e=="string"?n.jsx("h1",{className:oo,children:e}):n.jsx(ne,{content:e})),i&&(typeof s=="string"?n.jsx("p",{className:Yt,children:s}):n.jsx(ne,{content:s}))]})},Eo=({title:e,isTitleVisible:t,isSubtitleVisible:r,subtitle:s})=>{const o=a.useGraphCommandDispatcher(),i=g.useMemo(()=>yn({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",isTitleVisible:t,isSubtitleVisible:r}),[t,r]),c=g.useMemo(()=>bo({title:e,isTitleVisible:t,subtitle:s,isSubtitleVisible:r}),[e,t,s,r]),l=$t({content:c,extensions:i,isEditable:!0,onUpdate:u=>{const d=jo(u);t&&o(new v.SetContentTitleCommand({title:d.title})),r&&o(new v.SetContentSubtitleCommand({subtitle:d.subtitle}))}});return n.jsx(zt,{editor:l,ariaLabel:"Chart title and subtitle"})};var _o="_1u9qprb0",Lo="_1u9qprb1",Fo="_9aen060",No="_9aen061",Po="_9aen062",Ut="_9aen063";const Do=Object.freeze(Object.defineProperty({__proto__:null,groupRow:Po,item:Ut,trendRow:No,valueRow:Fo},Symbol.toStringTag,{value:"Module"})),Oo=e=>n.jsx(F,{...e,children:n.jsxs("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"m5 12 7-7 7 7"}),n.jsx("path",{d:"M12 19V5"})]})}),Io=e=>n.jsx(F,{...e,children:n.jsx("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M5 12h14"})})});var Xt="n7clvo0",Mo="n7clvo1",Bo="n7clvo2",Ro="n7clvo3",Kt={small:"n7clvo4",medium:"n7clvo5",large:"n7clvo6"},Ho={small:"n7clvo7",medium:"n7clvo8",large:"n7clvo9"},Go={up:"n7clvoa",down:"n7clvob",flat:"n7clvoc"},zo={up:"n7clvoe n7clvod",down:"n7clvof n7clvod",flat:"n7clvog n7clvod"};const $o=({segment:e,resolvedSize:t})=>{if(e.kind==="swatch")return n.jsx(a.Swatch,{shape:e.swatch.shape,color:e.swatch.color,width:e.size,height:e.size});if(e.kind==="trendArrow")return n.jsx("div",{className:zo[e.direction],children:e.direction==="flat"?n.jsx(Io,{size:"xs",title:""}):n.jsx(Oo,{size:"xs",title:""})});const r=e.fontRole==="value"?Kt[t]:Ho[t];return n.jsx("span",{className:A.clsx(qo(e),r),children:e.text})},qo=e=>{switch(e.textRole){case"value":return Xt;case"observation":return Mo;case"trendPercentage":return Go[e.trendDirection??"up"];case"trendReference":return Bo;case"label":return Ro}},Vo=({item:e,resolvedSize:t})=>n.jsx("div",{className:Ut,children:it(e).map(r=>n.jsx(Wo,{row:r,resolvedSize:t},r.role))}),Wo=({row:e,resolvedSize:t})=>{const r=e.role==="trendRow";return n.jsx("div",{className:Do[e.role],"data-testid":r?"headline-trend":void 0,"data-direction":r?Yo(e):void 0,role:r?"img":void 0,"aria-label":r?e.ariaLabel:void 0,children:e.segments.map((s,o)=>n.jsx($o,{segment:s,resolvedSize:t},o))})},Yo=e=>{const t=e.segments.find(r=>r.kind==="trendArrow");return t?.kind==="trendArrow"?t.direction:void 0},Uo=({headline:e,rect:t,resolvedSize:r,visibleItemCount:s})=>{const o={left:t.x,top:t.y,width:t.width,height:t.height};return e.kind==="grandTotal"?n.jsx("div",{className:Lo,style:o,children:n.jsx("span",{className:A.clsx(Xt,Kt[r]),children:e.value})}):n.jsx("div",{className:_o,style:o,children:e.items.slice(0,s).map((i,c)=>n.jsx(Vo,{item:i,resolvedSize:r},`${i.label}-${c}`))})};var Xo="_1oj6yix0",Ko="_1oj6yix1",Zo="_1oj6yix2";const Jo=8,Qo=16,ea=2,ta=({legends:e,containerRect:t,textScale:r})=>{const{lineBoxHeight:s}=yt(r),{placements:o,hasOverlap:i}=ra(e,t,s);if(o.length===0)return null;const c=i?Qo:Jo,l=c-ea;return n.jsxs("div",{className:Xo,children:[i&&n.jsx("svg",{className:Ko,width:t.width,height:t.height,children:o.map(u=>n.jsx(na,{anchorY:u.anchorY,labelY:u.y,endX:l,color:u.payload.color},u.payload.key))}),o.map(u=>n.jsx("span",{className:Zo,style:{left:c,top:u.y,color:u.payload.color},children:u.payload.label},u.payload.key))]})},ra=(e,t,r)=>g.useMemo(()=>{const s=[];for(const o of e)for(const i of o.items){if(i.normalizedY===null)continue;const c=typeof i.visual.color=="string"?i.visual.color:void 0;s.push({normalizedY:i.normalizedY,payload:{key:String(s.length),label:i.formattedLabel,color:c}})}return s.length===0||t.height<=0?{placements:[],hasOverlap:!1}:v.computeDirectLabelsLayout({items:s,containerHeight:t.height,labelHeight:r})},[e,t.height,r]),na=({anchorY:e,labelY:t,endX:r,color:s})=>{const o=r/2;return n.jsx("path",{d:`M0,${e} C${o},${e} ${o},${t} ${r},${t}`,fill:"none",stroke:s??"currentColor",strokeWidth:1,strokeDasharray:"2 2"})};var sa="_6a636s0",oa="_1kjk02r0",aa="_1kjk02r1",ia="_1kjk02r2",la="_1kjk02r3",ca="_1kjk02r4",ua="_1kjk02r5",da="_1kjk02r6",ha="_1kjk02r7",ga="_1kjk02r8",fa="_1kjk02r9",xa="_1kjk02ra",pa="_1kjk02rb",ma="_1dw9dgx0";const va="#9ca3af",ce="\0",ya=e=>{const t=[];return e.forEach((r,s)=>{const o=r.aesthetics.includes("size");for(const i of r.items){if(o){const d=Number(i.visual.size);if(!Number.isFinite(d)||d<=0)continue}const c=i.visual.color??"",l=o?`${ce}${Number(i.visual.size)}`:"",u=i.visual.lineType;t.push({key:`${s}${ce}${String(i.value)}${ce}${c}${l}`,formattedLabel:i.formattedLabel,visual:i.visual,swatchShape:i.swatchShape,isBubble:o,primaryLineType:u})}}),t},Zt=({pill:e})=>e.isBubble?n.jsx(Ta,{pill:e}):n.jsx(ja,{pill:e}),ba=({color:e,lineType:t,shape:r})=>e?n.jsx(a.Swatch,{shape:r,color:e,lineType:t,width:ut,height:be}):null,ja=({pill:e})=>n.jsxs(n.Fragment,{children:[n.jsx(ba,{color:e.visual.color,lineType:e.primaryLineType,shape:e.swatchShape}),n.jsx("span",{children:e.formattedLabel})]}),Ta=({pill:e})=>{const t=Number(e.visual.size);return n.jsxs(n.Fragment,{children:[n.jsx("span",{className:ma,style:{width:t,height:t,backgroundColor:e.visual.color??va}}),n.jsx("span",{children:e.formattedLabel})]})},Ca=({hiddenPills:e,placement:t})=>{const[r,s]=g.useState(!1),{refs:o,floatingStyles:i}=k.useFloating({open:r,placement:t,middleware:[k.offset(4),k.flip(),k.shift({padding:8})]});g.useEffect(()=>{if(!r)return;const d=f=>{const x=f.target;if(!x)return;const p=o.reference.current,m=o.floating.current;p instanceof Element&&p.contains(x)||m instanceof Element&&m.contains(x)||s(!1)},h=f=>{f.key==="Escape"&&s(!1)};return document.addEventListener("pointerdown",d),document.addEventListener("keydown",h),()=>{document.removeEventListener("pointerdown",d),document.removeEventListener("keydown",h)}},[r,o.floating,o.reference]);const c=t==="left"||t==="right",l=Math.min(e.length-1,gt),u=Array.from({length:l},(d,h)=>l-h);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{ref:o.setReference,className:A.clsx(oa,{[ia]:c,[aa]:!c}),children:[u.map(d=>n.jsx("span",{className:A.clsx(la,{[ua]:c,[ca]:!c}),style:Sa(d,c),"aria-hidden":!0},d)),n.jsx("button",{type:"button",className:A.clsx(da,{[ha]:r}),onClick:()=>s(d=>!d),"aria-haspopup":"dialog","aria-expanded":r,"aria-label":`Show ${e.length} hidden legend ${e.length===1?"item":"items"}`,children:n.jsxs("span",{className:ga,children:["+",e.length]})})]}),r&&n.jsx("div",{ref:o.setFloating,role:"dialog","aria-label":"Hidden legend items",className:fa,style:i,children:n.jsx("ul",{className:xa,children:e.map(d=>n.jsx("li",{className:pa,children:n.jsx(Zt,{pill:d})},d.key))})})]})},Sa=(e,t)=>{const r=-e*ft;return{transform:t?`translateY(${r}px)`:`translateX(${r}px)`}};var ka="_1cecisi0",wa="_1cecisi1",Aa="_1cecisi2",Ea="_1cecisi3";const _a=({edge:e,formattedLegends:t,containerWidth:r,containerHeight:s,textScale:o})=>{const i=a.useTextMeasurer(),c=g.useMemo(()=>ya(t),[t]),l=e==="left"||e==="right",u=l?s:r,d=g.useMemo(()=>{if(c.length===0)return{visibleCount:0,hasOverflow:!1};if(u<=0)return{visibleCount:c.length,hasOverflow:!1};const p=a.emToPx(xt,o),m={family:mt,size:p},b=p*pt,j=z=>l?La(z,b):Re({label:z.formattedLabel,swatchInlineSize:Fa(z),textMeasurer:i,font:m}),y=c.map(j),G=(l?b+je:Re({label:`+${c.length}`,swatchInlineSize:0,textMeasurer:i,font:m}))+gn;return Pa({pillSizes:y,overflowPillSize:G,containerSize:u,gap:un})},[c,u,l,i,o]);if(c.length===0)return null;const h=c.slice(0,d.visibleCount),f=c.slice(d.visibleCount),x=d.hasOverflow&&f.length>0;return n.jsxs("div",{className:A.clsx(ka,{[Aa]:l,[wa]:!l}),children:[h.map(p=>n.jsx("div",{className:Ea,children:n.jsx(Zt,{pill:p})},p.key)),x&&n.jsx(Ca,{hiddenPills:f,placement:Da(e)})]})},Re=({label:e,swatchInlineSize:t,textMeasurer:r,font:s})=>{const o=r.measureText(e,s).width,i=t>0?dt:0;return t+i+o+vt},La=(e,t)=>{const r=Na(e);return Math.max(t,r)+je},Fa=e=>e.isBubble?Number(e.visual.size):bt(e.visual.color),Na=e=>e.isBubble?Number(e.visual.size):be,Pa=({pillSizes:e,overflowPillSize:t,containerSize:r,gap:s})=>{if(e.length===0)return{visibleCount:0,hasOverflow:!1};let o=0;for(let l=0;l<e.length;l+=1)l>0&&(o+=s),o+=e[l]??0;if(o<=r)return{visibleCount:e.length,hasOverflow:!1};let i=0,c=0;for(const l of e){const u=i+(c>0?s:0)+l;if(u+s+t>r)break;i=u,c+=1}return{visibleCount:c,hasOverflow:!0}},Da=e=>{switch(e){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}},Oa=g.memo(function({formattedLegends:t,rects:r,textScale:s}){const o=g.useMemo(()=>{const i=new Map;for(const c of t){let l=i.get(c.position);l||(l={pill:[],direct:[]},i.set(c.position,l)),c.display==="pill"?l.pill.push(c):l.direct.push(c)}return i},[t]);return n.jsx(n.Fragment,{children:Array.from(o,([i,c])=>{const l=r[i];return l===void 0?null:n.jsxs("div",{className:sa,style:{left:l.x,top:l.y,width:l.width,height:l.height},children:[n.jsx(_a,{edge:i,formattedLegends:c.pill,containerWidth:l.width,containerHeight:l.height,textScale:s}),n.jsx(ta,{legends:c.direct,containerRect:l,textScale:s})]},i)})})}),Ia=(e,t,r)=>{const s=e.filter(i=>i.interactive);if(s.length===0)return null;const o=s.map(i=>r(i,t)).filter(i=>i!==null).map(i=>i.guideMode);return o.length===0?null:o.some(i=>i==="bar")?"bar":o.every(i=>i==="continuous")?"continuous":null};function Ma(e,t){const r=v.getMainAxisCoordinate(e.mainAxis,t);if(e.mainAxis==="y"){const o=a.toPercent(a.toViewBoxY(r));return{x1:0,x2:"100%",y1:o,y2:o}}const s=a.toPercent(a.toViewBoxX(r));return{x1:s,x2:s,y1:0,y2:"100%"}}function Ba(e,t,r){const s=e.mainAxis==="y"?v.getY(r.observation):v.getX(r.observation);if(s===null)return null;const o=e.mainAxis==="y"?Ha(r):Ra(r),c=(t.x?.kind==="position"?t.x:null)?.bandwidth??o;if(c===null||c<=0)return null;const l=c/2;if(e.mainAxis==="y"){const h=a.toPercent(a.toViewBoxY(s+l)),f=a.toPercent(c);return{x:0,y:h,width:"100%",height:f}}const u=a.toPercent(a.toViewBoxX(s-l)),d=a.toPercent(c);return{x:u,y:0,width:d,height:"100%"}}function Ra(e){const t=v.getXMin(e.observation),r=v.getXMax(e.observation);return t===null||r===null?null:r-t}function Ha(e){const t=v.getYMin(e.observation),r=v.getYMax(e.observation);return t===null||r===null?null:r-t}const Ga=1,za="4 3",$a=({panelRect:e})=>{const{coordSystem:t,layers:r,scales:s}=a.useCompiledSelector(E.useShallow(l=>({coordSystem:l.coordSystem,layers:l.layers,scales:l.scales}))),o=W(l=>l.hover.primary),i=a.useResolveGeomPlugin();if(t.type!=="cartesian"||r.length===0||o===null)return null;const c=Ia(r,t,i);return c===null?null:c==="bar"?n.jsx(Va,{coordSystem:t,scales:s,primary:o,panelRect:e}):n.jsx(qa,{coordSystem:t,primary:o,panelRect:e})},qa=({coordSystem:e,primary:t,panelRect:r})=>{const s=Ma(e,t);return n.jsx(Jt,{panelRect:r,children:n.jsx("line",{...s,stroke:a.vars.hoverGuideLineColor,strokeWidth:Ga,strokeDasharray:za,strokeLinecap:"round","data-testid":"hover-guide-line"})})},Va=({coordSystem:e,scales:t,primary:r,panelRect:s})=>{const o=Ba(e,t,r);return o===null?null:n.jsx(Jt,{panelRect:s,children:n.jsx("rect",{...o,fill:a.vars.hoverGuideFillColor,"data-testid":"hover-guide-rect"})})},Jt=({panelRect:e,children:t})=>n.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}),Wa=200,Ya=({engine:e,store:t,overlayRef:r,setCursor:s=Ua})=>{g.useEffect(()=>{const o=r.current;if(!o)return;const i=Xa(o,e),c=Ka(o,e,t,s);return()=>{c(),i()}},[e,t,r,s])},Ua=()=>{},Xa=(e,t)=>{const r=()=>{const c=e.getBoundingClientRect();c.width===0||c.height===0||t.setViewport({width:c.width,height:c.height})};let s=null;const o=()=>{s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,r()},Wa)},i=new ResizeObserver(o);return i.observe(e),r(),()=>{i.disconnect(),s!==null&&clearTimeout(s)}},Ka=(e,t,r,s)=>{let o=null,i=null;const c=()=>{i=null;const d=o;if(o=null,!d)return;s({clientX:d.clientX,clientY:d.clientY});const h=e.getBoundingClientRect();if(h.width===0||h.height===0)return;const f={x:(d.clientX-h.left)/h.width,y:1-(d.clientY-h.top)/h.height};r.getState().setHoverState(t.query(f))},l=d=>{o=d,i===null&&(i=requestAnimationFrame(c))},u=()=>{o=null,i!==null&&(cancelAnimationFrame(i),i=null),s(null);const d=r.getState();d.hover.primary!==null&&d.setHoverState(v.RESTING_HOVER_STATE)};return e.addEventListener("pointermove",l),e.addEventListener("pointerleave",u),()=>{e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",u),i!==null&&cancelAnimationFrame(i),o=null}},Za=({panelRect:e})=>{const{engine:t,store:r,overlayRef:s,setCursor:o}=a.useHoverContext();return Ya({engine:t,store:r,overlayRef:s,setCursor:o}),n.jsx("rect",{ref:s,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",Ja=e=>{const{store:t}=a.useHoverContext(),r=ee.useStore(t,s=>s.hover.primary!==null);g.useEffect(()=>{const s=e.current;if(s)return r?s.setAttribute(ue,"true"):s.removeAttribute(ue),()=>{s.removeAttribute(ue)}},[e,r])},He=({panelRect:e,zOrder:t})=>{const r=a.useCompiledSelector(c=>c.annotations.custom),s=a.useResolveAnnotationPlugin(),o=r.filter(c=>{const l=s(c.type);return l!==null&&(c.zOrder??l.zOrder)===t});if(o.length===0)return null;const i={width:e.width,height:e.height};return n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`custom-annotations-${t}`,children:o.map(c=>{const l=s(c.type);return l===null?null:n.jsx("g",{"data-annotation-type":c.type,children:l.draw({targets:c.targets,area:i,params:c.params})},c.id)})})},Qt=a.FONT_SIZE_EM.xs,me=a.DEFAULT_FONT_FAMILY,er=a.FONT_WEIGHT.medium,Qa=a.FONT_WEIGHT.semibold,tr=6,rr=2,ei=4,ti=2,Ge=4;var ri="_1agclyl0",ni="_1agclyl1",si="_1agclyl2",oi={inside:"_1agclyl4 _1agclyl3",outside:"_1agclyl5 _1agclyl3"},ai="_1agclyl6 _1agclyl3";const nr=({x:e,y:t,width:r,height:s,text:o,isRotated:i,target:c,position:l,coordType:u})=>{const d=i?`rotate(-90 ${e} ${t})`:void 0,h=c==="aggregate"?ai:oi[l],f=ii(c,l,u);return n.jsxs("g",{transform:d,children:[f&&n.jsx("rect",{className:f,x:e-r/2,y:t-s/2,width:r,height:s,rx:Ge,ry:Ge}),n.jsx("text",{className:h,x:e,y:t,textAnchor:"middle",dominantBaseline:"central",children:o})]})},ii=(e,t,r)=>{if(e==="aggregate")return si;if(t==="outside"&&r==="cartesian")return ni},li={dataLabel:{x:tr,y:rr},stackTotal:{x:ei,y:ti}},ci=({panelRect:e,formattingLocale:t})=>{const r=a.useTextMeasurer(),s=a.useCompiledSelector(E.useShallow(l=>({layers:l.layers,coordSystem:l.coordSystem,axes:l.guides.axes,numberFormat:l.config.numberFormat,parsingLocale:l.config.parsingLocale,textScale:l.config.appearance.textScale}))),o=g.useMemo(()=>{const l=a.emToPx(Qt,s.textScale);return{dataLabel:{family:me,size:l,weight:er},stackTotal:{family:me,size:l,weight:Qa}}},[s.textScale]),i=g.useMemo(()=>(l,u)=>{const d=r.measureText(u,o[l]),h=li[l];return{...d,width:d.width+h.x*2,height:d.height+h.y*2}},[r,o]),c=g.useMemo(()=>v.buildDataLabelsContent({...s,panelRect:e,measureDataLabel:i,formattingLocale:t}),[s,e,i,t]);return n.jsx("g",{className:ri,transform:`translate(${e.x}, ${e.y})`,"data-testid":"data-labels",children:c.labels.map(l=>n.jsx(nr,{x:l.x,y:l.y,width:l.width,height:l.height,text:l.text,isRotated:l.isRotated,target:l.target,position:l.position,coordType:s.coordSystem.type},l.key))})},ui=({linePath:e,arrowheadPath:t,stroke:r,strokeWidth:s})=>{const o={stroke:r,strokeWidth:s,strokeLinecap:"round",fill:"none"};return n.jsxs("g",{children:[n.jsx("path",{d:e,...o}),n.jsx("path",{d:t,...o,strokeLinejoin:"round"})]})},di=({x:e,y:t,text:r,lineHeight:s,paddingX:o,paddingY:i,strokeWidth:c,strokeColor:l,fontWeight:u})=>{const d=a.useTextMeasurer(),f=g.useMemo(()=>d.measureText(r,{family:a.DEFAULT_FONT_FAMILY,size:s,weight:u}),[d,r,s,u]).width+o*2,x=s+i*2;return n.jsxs("g",{style:{pointerEvents:"none"},children:[n.jsx("rect",{x:e-f/2,y:t-x/2,width:f,height:x,rx:4,fill:a.vars.graphBackground,stroke:l,strokeWidth:c}),n.jsx("text",{x:e,y:t,dominantBaseline:"central",textAnchor:"middle",fill:a.vars.textPrimary,style:{fontFamily:a.DEFAULT_FONT_FAMILY,fontSize:s,fontWeight:u},children:r})]})},hi=({panelRect:e,formattingLocale:t})=>{const r=a.useCompiledSelector(E.useShallow(o=>({differenceArrows:o.annotations.differenceArrows,mainAxis:o.coordSystem.type==="cartesian"?o.coordSystem.mainAxis:"x",textScale:o.config.appearance.textScale}))),s=g.useMemo(()=>r.differenceArrows.map(o=>v.computeDifferenceArrow({arrow:o,mainAxis:r.mainAxis,panelWidth:e.width,panelHeight:e.height,textScale:r.textScale,locale:t})),[r,e.width,e.height,t]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"difference-arrows",children:s.map(({color:o,id:i,linePath:c,arrowheadPath:l,strokeWidth:u,labelPosition:d,labelText:h,labelLineHeight:f,labelPaddingX:x,labelPaddingY:p,labelStrokeWidth:m,labelFontWeight:b})=>{const j=o??a.vars.defaultAnnotationArrowStroke;return n.jsxs(g.Fragment,{children:[n.jsx(ui,{linePath:c,arrowheadPath:l,stroke:j,strokeWidth:u}),n.jsx(di,{x:d.x,y:d.y,text:h,lineHeight:f,paddingX:x,paddingY:p,strokeWidth:m,strokeColor:j,fontWeight:b})]},i)})})},gi=0,fi=1.15,ze=1.15,xi="rgba(0, 0, 0, 0.16)",$e=2,pi=1.4,mi=({arrow:e,fallbackColor:t,stickerOutlineColor:r,stickerOutlineColorInverse:s})=>{const o=g.useId(),i=e.color??t,c=vi(e.color,r,s),l=e.dashArray?{strokeDasharray:e.dashArray,strokeDashoffset:e.dashOffset}:{},u=e.arrowheadExtent+e.strokeWidth+$e+ze,d={x:Math.min(e.startX,e.endX)-u,y:Math.min(e.startY,e.endY)-u,width:Math.abs(e.endX-e.startX)+2*u,height:Math.abs(e.endY-e.startY)+2*u},h=[e.linePath,e.startArrowheadPath,e.endArrowheadPath].filter(f=>f.length>0).join(" ");return n.jsxs("g",{children:[e.hasStickerStyle&&n.jsx("defs",{children:n.jsx("filter",{id:o,filterUnits:"userSpaceOnUse",...d,children:n.jsx("feDropShadow",{dx:gi,dy:fi,stdDeviation:ze,floodColor:xi})})}),n.jsxs("g",{filter:e.hasStickerStyle?`url(#${o})`:void 0,children:[e.hasStickerStyle&&n.jsx("path",{d:h,stroke:c,strokeWidth:e.strokeWidth+2*$e,strokeLinecap:"round",fill:"none"}),n.jsx("path",{d:e.linePath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none",...l}),e.startArrowheadPath.length>0&&n.jsx("path",{d:e.startArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"}),e.endArrowheadPath.length>0&&n.jsx("path",{d:e.endArrowheadPath,stroke:i,strokeWidth:e.strokeWidth,strokeLinecap:"round",fill:"none"})]})]})},vi=(e,t,r)=>{if(e===null)return r;try{return gr.getContrast(e,t)<pi?r:t}catch{return r}},yi=({panelRect:e})=>{const{themeValues:t}=Ce(),r=a.useCompiledSelector(o=>o.annotations.freeformArrows),s=g.useMemo(()=>r.map(o=>v.computeFreeformArrow({arrow:o,panelWidth:e.width,panelHeight:e.height})).filter(o=>o!==null),[r,e.width,e.height]);return s.length===0?null:n.jsx("g",{transform:`translate(${e.x}, ${e.y})`,"data-testid":"freeform-arrows",children:s.map(o=>n.jsx(mi,{arrow:o,fallbackColor:a.vars.defaultAnnotationArrowStroke,stickerOutlineColor:t.arrowAnnotationStickerOutlineColor,stickerOutlineColorInverse:t.arrowAnnotationStickerOutlineColorInverse},o.id))})},bi=({edge:e,areTicksVisible:t,position:r,labelRotation:s,label:o})=>{const i=a.toPercent(r),c=t?1:0,l={style:{font:a.vars.fontTickLabel},fill:a.vars.textSecondary},u=s!==0&&(e==="top"||e==="bottom"),d=e==="top";return u?n.jsx("svg",{x:i,y:d?"100%":0,style:{overflow:"visible"},children:n.jsx("text",{...Ti(d,c,s),...l,children:o})}):n.jsx("text",{...ji(e,i,c),...l,children:o})},ji=(e,t,r)=>{switch(e){case"bottom":return{x:t,y:N*r,textAnchor:"middle",dominantBaseline:"hanging"};case"top":return{x:t,y:"100%",dy:-N*r,textAnchor:"middle",dominantBaseline:"auto"};case"left":return{x:"100%",dx:-N*r,y:t,textAnchor:"end",dominantBaseline:"central"};case"right":return{x:N*r,y:t,textAnchor:"start",dominantBaseline:"central"}}},Ti=(e,t,r)=>{const s=N*t,o=e?-s:s;return{x:0,y:o,textAnchor:e?"start":"end",dominantBaseline:"central",transform:`rotate(${r}, 0, ${o})`}},Ci=({formattedAxis:e,rect:t})=>{const r=e.position==="bottom"||e.position==="top";return n.jsxs("svg",{x:t.x,y:t.y,width:t.width,height:t.height,style:{overflow:"visible"},children:[at,e.ticks.map((s,o)=>{const i=s.formattedLabel,c=r?s.position:1-s.position,l=Si(e.position,c,t);return n.jsxs("g",{children:[e.ticksVisible&&n.jsx("line",{...l,stroke:a.vars.gridLineColor,strokeWidth:1}),n.jsx(bi,{edge:e.position,areTicksVisible:e.ticksVisible,position:c,labelRotation:e.labelRotation,label:i})]},o)})]})},Si=(e,t,r)=>{const s=a.toPercent(t);switch(e){case"bottom":return{x1:s,y1:0,x2:s,y2:Z};case"top":return{x1:s,y1:r.height,x2:s,y2:r.height-Z};case"left":return{x1:r.width,y1:s,x2:r.width-Z,y2:s};case"right":return{x1:0,y1:s,x2:Z,y2:s}}},ki=({formattedAxes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];return!s||!r.isVisible?null:n.jsx(Ci,{formattedAxis:r,rect:s},r.scaleAestheticKey)})}),wi=({axes:e,rects:t})=>n.jsx(n.Fragment,{children:e.map(r=>{const s=t[r.position];if(!s||!r.isVisible)return null;const o=Ai(r.position,s);return n.jsxs("g",{transform:`translate(${s.x}, ${s.y})`,children:[at,n.jsx("text",{style:{font:a.vars.fontAxisLabel},fill:a.vars.textPrimary,...o,children:r.label})]},`axis-label-${r.position}`)})}),Ai=(e,t)=>{const r={x:t.width/2,y:t.height/2,textAnchor:"middle",dominantBaseline:"middle"};return e==="left"?(r.x=0,r.textAnchor="start"):e==="right"&&(r.x=t.width,r.textAnchor="end"),r},qe={strokeWidth:1,strokeDashoffset:"0",strokeDasharray:"2 3",strokeLinecap:"round"},Ei=({axes:e,panel:t,panelRect:r})=>n.jsxs("svg",{x:r.x,y:r.y,width:r.width,height:r.height,style:{overflow:"visible"},children:[t.border.isVisible&&n.jsx("rect",{x:0,y:0,width:r.width,height:r.height,fill:"none",stroke:a.vars.gridLineColor,rx:8,ry:8,...qe}),e.map(s=>{if(!s.gridVisible)return null;const o=s.position==="bottom"||s.position==="top";return n.jsx("g",{children:s.ticks.map((i,c)=>{if(i.position<=0||i.position>=1)return null;const l=o?i.position:1-i.position,u=a.toPercent(l),d=o?{x1:u,y1:0,x2:u,y2:"100%"}:{x1:0,y1:u,x2:"100%",y2:u};return n.jsx("line",{...d,...qe,stroke:a.vars.gridLineColor},c)})},s.scaleAestheticKey)})]}),Ve=({panelRect:e,zOrder:t})=>{const s=a.useCompiledSelector(o=>o.annotations.shapes).filter(o=>o.zOrder===t);return s.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":`shapes-${t}`,children:s.map(({id:o,x:i,y:c,width:l,height:u,fillColor:d,fillOpacity:h,strokeWidth:f,strokeColor:x})=>n.jsx("rect",{x:a.toPercent(i),y:a.toPercent(c),width:a.toPercent(l),height:a.toPercent(u),fill:d,fillOpacity:h,stroke:f>0?x??a.vars.defaultAnnotationShapeStroke:"none",strokeWidth:f},o))})};var _i="_120wioc0";const Li=({panelRect:e})=>{const t=a.useCompiledSelector(r=>r.annotations.textAnnotations);return t.length===0?null:n.jsx("svg",{x:e.x,y:e.y,width:e.width,height:e.height,overflow:"visible","data-testid":"text-annotations",children:t.map(r=>n.jsx("foreignObject",{x:a.toPercent(r.x),y:a.toPercent(r.y),width:a.toPercent(r.width),height:a.toPercent(1-r.y),overflow:"visible",children:n.jsx("div",{className:_i,style:Fi(r.backgroundColor,r.backgroundColorStyle),children:n.jsx(ne,{content:r.content})})},r.id))})},Fi=(e,t)=>e===null||e==="transparent"?{color:a.vars.textPrimary}:t==="fade"?{color:a.vars.textPrimary,backgroundColor:fe(e,a.vars.grey100,.5),boxShadow:`0 0 0 1.5px ${fe(e,a.vars.grey0,.2)}`}:{color:a.vars.textPrimary,backgroundColor:e,boxShadow:`0 0 0 1.5px ${se(e,.1)}`};var Ni="usd3ea0",Pi="usd3ea1";const Di=({layer:e,coordSystem:t,isAnimated:r,isDimmed:s,highlightStyle:o,formattingLocale:i})=>{const l=a.useResolveGeomPlugin()(e,t);return l===null?n.jsxs("text",{children:[e.geom," not implemented"]}):n.jsx("g",{className:A({[Pi]:s&&o==="desaturate",[Ni]:s&&o==="dim"}),children:l.render({layer:e,coordSystem:t,isAnimated:r,formattingLocale:i})})};function Oi({plugin:e,layer:t,coordSystem:r,candidates:s}){if(e?.getOverlayAnchor===void 0||s.length===0)return[];const o=[];for(const{observation:i,observationIndex:c}of s){const l=e.getOverlayAnchor({layer:t,coordSystem:r,observation:i});l!==null&&o.push({observation:i,observationIndex:c,anchor:l})}return o}const Ii=4,Mi=({plugin:e,layer:t,matchedLayer:r,overlayCandidates:s,coordSystem:o,isAnimated:i,panelRect:c,formattingLocale:l})=>{const{numberFormat:u,textScale:d}=a.useCompiledSelector(E.useShallow(m=>({numberFormat:m.config.numberFormat,textScale:m.config.appearance.textScale}))),h=g.useMemo(()=>Oi({plugin:e,layer:t,coordSystem:o,candidates:s}),[e,t,o,s]),f=g.useMemo(()=>v.createSegmentYReader(t),[t]),x=g.useMemo(()=>v.buildLayerYValueFormatter({layer:t,numberFormat:u,locale:l}),[u,t,l]),p=Qt*a.ROOT_FONT_SIZE_PX*d;return e===null||r===null&&h.length===0?null:n.jsxs(n.Fragment,{children:[r?e.render({layer:r,coordSystem:o,isAnimated:i,formattingLocale:l}):null,h.map(({observation:m,observationIndex:b,anchor:j})=>n.jsx(Bi,{observation:m,anchor:j,panelRect:c,readSegmentY:f,formatYValue:x,labelFontSizePx:p},Ri(m,b)))]})},Bi=({observation:e,anchor:t,panelRect:r,readSegmentY:s,formatYValue:o,labelFontSizePx:i})=>{const c=a.useTextMeasurer(),l=a.toViewBoxX(t.x),u=a.toViewBoxY(t.y),d=(v.getSize(e)??a.DEFAULT_POINT_SIZE)/2,h=s(e),f=v.isDefined(h)?o(h,e):null,x=g.useMemo(()=>{if(f===null)return null;const p=c.measureText(f,{family:me,size:i,weight:er});return{width:p.width+tr*2,height:p.height+rr*2}},[f,c,i]);return n.jsxs(n.Fragment,{children:[n.jsx("circle",{"data-testid":"highlight-overlay-dot",cx:a.toPercent(l),cy:a.toPercent(u),r:d,fill:v.getColor(e)}),f!==null&&x!==null&&n.jsx(nr,{x:l*r.width,y:u*r.height-d-Ii-x.height/2,width:x.width,height:x.height,text:f,isRotated:!1,target:"observation",position:"outside",coordType:"cartesian"})]})},Ri=(e,t)=>{const r=e[v.GROUP_VARIABLES.group];return`${String(r??"")}\0${t}`},Hi=({layer:e,coordSystem:t,panelRect:r})=>{const s=a.useResolveGeomPlugin(),{primary:o,group:i,related:c}=W(E.useShallow(d=>({primary:d.hover.primary,group:d.hover.group,related:d.hover.related})));if(o===null)return null;const l=s(e,t);if(l===null)return null;const u=c.get(e.id)??[];return o.layerId===e.id?l.renderHover({layer:e,coordSystem:t,primary:o,group:i,related:u,panelRect:r}):u.length===0?null:l.renderHoverCompanions({layer:e,primary:o,related:u})};var Gi="to1jkx0",zi="to1jkx1";const $i=({shouldAnimate:e,panelRect:t,formattingLocale:r})=>{const{layers:s,coordSystem:o,highlightStyle:i}=a.useCompiledSelector(E.useShallow(c=>({layers:c.layers,coordSystem:c.coordSystem,highlightStyle:c.config.appearance.highlightStyle})));return n.jsx("svg",{x:t.x,y:t.y,width:t.width,height:t.height,className:Gi,"data-testid":"geom-layers",children:s.map(c=>n.jsxs(g.Fragment,{children:[n.jsx(Wi,{layer:c,coordSystem:o,highlightStyle:i,shouldAnimate:e,panelRect:t,formattingLocale:r}),n.jsx(Hi,{layer:c,coordSystem:o,panelRect:t})]},`${c.id}-${qi(o)}`))})},qi=e=>e.type==="cartesian"?`cartesian-${e.mainAxis}`:e.type,Vi=e=>{if(e.highlight!==null)return zi},Wi=({layer:e,coordSystem:t,highlightStyle:r,shouldAnimate:s,panelRect:o,formattingLocale:i})=>{const c=a.useResolveGeomPlugin(),l=g.useMemo(()=>c(e,t),[c,e,t]),u=e.highlight;return n.jsxs("g",{className:Vi(e),children:[n.jsx(Di,{layer:e,coordSystem:t,isAnimated:s,isDimmed:u?.composition.isDimmed??!1,highlightStyle:r,formattingLocale:i}),u!==null&&n.jsx(Mi,{plugin:l,layer:e,matchedLayer:u.composition.matchedLayer,overlayCandidates:u.composition.overlayCandidates,coordSystem:t,isAnimated:s,panelRect:o,formattingLocale:i})]})};var Yi="_17uhij30";const Ui=({formattedAxes:e,plotRect:t,panelRect:r,axisRects:s,axisLabelRects:o,shouldAnimate:i,formattingLocale:c})=>{const l=g.useRef(null);Ja(l);const{axes:u,panelGuide:d}=a.useCompiledSelector(E.useShallow(p=>({axes:p.guides.axes,panelGuide:p.guides.panel}))),h=g.useMemo(()=>sr(r,t),[r,t]),f=g.useMemo(()=>We(s,t),[s,t]),x=g.useMemo(()=>We(o,t),[o,t]);return n.jsxs("svg",{ref:l,className:Yi,width:t.width,height:t.height,style:{transform:`translate(${t.x}px, ${t.y}px)`},"data-testid":"plot",children:[n.jsx(Ei,{axes:e,panel:d,panelRect:h}),n.jsx($a,{panelRect:h}),n.jsx(ki,{formattedAxes:e,rects:f}),n.jsx(wi,{axes:u,rects:x}),n.jsx(Ve,{panelRect:h,zOrder:"background"}),n.jsx(He,{panelRect:h,zOrder:"background"}),n.jsx($i,{shouldAnimate:i,panelRect:h,formattingLocale:c}),n.jsx(ci,{panelRect:h,formattingLocale:c}),n.jsx(hi,{panelRect:h,formattingLocale:c}),n.jsx(Ve,{panelRect:h,zOrder:"foreground"}),n.jsx(He,{panelRect:h,zOrder:"foreground"}),n.jsx(yi,{panelRect:h}),n.jsx(Li,{panelRect:h}),n.jsx(Za,{panelRect:h})]})},sr=(e,t)=>({x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}),We=(e,t)=>{const r={};for(const[s,o]of Object.entries(e))r[s]=sr(o,t);return r},de={headerSize:{width:0,height:0},footerSize:{width:0,height:0}},Xi=()=>{const[e,t]=g.useState(null),[r,s]=g.useState(null),[o,i]=g.useState(de);return g.useEffect(()=>{const c=()=>{const u=e?{width:e.offsetWidth,height:e.offsetHeight}:de.headerSize,d=r?{width:r.offsetWidth,height:r.offsetHeight}:de.footerSize;i(h=>Ki(h,{headerSize:u,footerSize:d})?{headerSize:u,footerSize:d}:h)};c();const l=new ResizeObserver(c);return e&&l.observe(e),r&&l.observe(r),()=>l.disconnect()},[e,r]),{headerRef:t,footerRef:s,measurements:o}},Ki=(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,Zi=({appearance:e,isEditable:t,style:r,children:s})=>{const{theme:o,themeClass:i,inlineVarsStyle:c}=Ce(),l=Mn(e.border),u=Math.max(0,e.cornerRadius),d=u===0?0:u+l,h=g.useMemo(()=>{const p={...r,borderRadius:`${d}px`,...c},m=In(e.border,o);return m!==null&&(p.background=m),p},[r,d,c,e.border,o]),f=g.useMemo(()=>({inset:`${l}px`,borderRadius:`${u}px`}),[l,u]),x=t&&e.background.type==="solid"&&e.background.color==="transparent";return n.jsx("div",{"data-testid":"graph-wrapper",className:A(Gn,i),style:h,children:n.jsx("div",{"data-testid":"graph-inner",className:A($n,{[qn]:x}),style:f,children:s})})},Ji=e=>n.jsx(a.HoverProvider,{children:n.jsx(a.TextMeasurerProvider,{children:n.jsx(Qi,{...e})})}),Qi=({width:e,height:t,isAnimated:r,showTooltips:s=!0,mode:o="readonly"})=>{const{axes:i,legends:c,numberFormat:l,parsingLocale:u,appearance:d,annotations:h,coordSystem:f,headline:x,headlineConfig:p}=a.useCompiledSelector(E.useShallow(L=>({axes:L.guides.axes,legends:L.guides.legends,numberFormat:L.config.numberFormat,parsingLocale:L.config.parsingLocale,appearance:L.config.appearance,annotations:L.annotations,coordSystem:L.coordSystem,headline:L.guides.headline,headlineConfig:L.config.headline}))),m=ir.useReducedMotion(),{headerRef:b,footerRef:j,measurements:y}=Xi(),{formattingLocale:_,theme:G,themeOverrides:z}=a.useGraphContext(),ke=g.useMemo(()=>v.formatLegends({legends:c,numberFormat:l,parsingLocale:u,formattingLocale:_}),[c,l,u,_]),$=g.useMemo(()=>v.formatHeadline({headline:x,show:p.show,numberFormat:l,parsingLocale:u,formattingLocale:_}),[x,p.show,l,u,_]),or=a.useTextMeasurer(),oe=d.border.type==="none"?0:d.border.width,ae=g.useMemo(()=>({width:Math.max(0,e-2*oe),height:Math.max(0,t-2*oe)}),[e,t,oe]),Y=g.useMemo(()=>$?{formatted:$,size:p.size,position:p.position,innerRadius:f.type==="polar"?f.innerRadius:0}:void 0,[$,p.size,p.position,f]),U=pn(or,d.textScale),q=mn({measurer:U,axes:i,numberFormat:l,parsingLocale:u,formattedLegends:ke,containerSize:ae,externalMeasurements:y,headline:Y,formattingLocale:_,annotations:h,coordSystem:f,textScale:d.textScale}),X=g.useMemo(()=>!q||!Y||!U?null:v.resolveHeadlinePlacement({headline:Y,layout:q.layout,containerSize:ae,measurer:U,itemGap:st}),[q,Y,ae,U]);if(!q)return null;const{layout:P,formattedAxes:ar}=q;return n.jsx(_t,{theme:G,themeOverrides:z,appearance:d,children:n.jsxs(Zi,{appearance:d,isEditable:o==="editable",style:{width:e,height:t},children:[n.jsx(wo,{ref:b,headerRect:P.header,mode:o}),n.jsx(Ui,{formattedAxes:ar,plotRect:P.plot,panelRect:P.panel,axisRects:P.axes,axisLabelRects:P.axisLabels,shouldAnimate:r??!m,formattingLocale:_??u}),n.jsx(ho,{ref:j,footerRect:P.footer,mode:o}),n.jsx(Oa,{formattedLegends:ke,rects:P.legends,textScale:d.textScale}),$&&X&&n.jsx(Uo,{headline:$,rect:X.rect,resolvedSize:X.resolvedSize,visibleItemCount:X.visibleItemCount}),s&&n.jsx(Xr,{})]})})};exports.CanvasTextMeasurer=a.CanvasTextMeasurer;exports.GraphProvider=a.GraphProvider;exports.HoverProvider=a.HoverProvider;exports.TextMeasurerProvider=a.TextMeasurerProvider;exports.useCompiledSelector=a.useCompiledSelector;exports.useGraphCommandDispatcher=a.useGraphCommandDispatcher;exports.useTextMeasurer=a.useTextMeasurer;exports.vars=a.vars;exports.DevToolsPanel=Fr;exports.GraphRenderer=Ji;exports.ThemeProvider=_t;exports.darkTheme=Et;exports.lightTheme=At;exports.useHoverState=W;
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ import { HexColorPicker as On, HexColorInput as Bn } from "react-colorful";
32
32
  import { Menu as L } from "@base-ui/react/menu";
33
33
  import { Toggle as In } from "@base-ui/react/toggle";
34
34
  import { getContrast as Rn } from "color2k";
35
- typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.reactRenderer = "0.0.1-plugins.0");
35
+ typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.reactRenderer = "0.0.1-plugins.1");
36
36
  var Hn = "drqe3u0", Mn = "drqe3u1", Gn = "drqe3u2", zn = "drqe3u3", oe = "drqe3u4", $n = "drqe3u5", Vn = "drqe3u6", Wn = "drqe3u7", me = "drqe3u8", qn = "drqe3u9", jn = "drqe3ua", Un = "drqe3ub", Xn = "drqe3uc", Yn = "drqe3ud", Kn = "drqe3ue", Zn = "drqe3uf", Jn = "drqe3ug", Qn = "drqe3uh", eo = "drqe3ui", Ve = { enabled: "drqe3uk drqe3uj", disabled: "drqe3ul drqe3uj" }, We = { ran: "drqe3un drqe3um", dim: "drqe3uo drqe3um" }, Ot = { ran: "drqe3uq drqe3up", cached: "drqe3ur drqe3up", untouched: "drqe3us drqe3up" };
37
37
  const rd = ({ width: e = 380, style: t, className: r } = {}) => {
38
38
  const { compileBus: n } = Le(), [s] = F(() => vn()), [i, l] = F(!1), [a, d] = F(Gr);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@graphysdk/react-renderer",
3
3
  "author": "Graphy",
4
- "version": "0.0.1-plugins.0",
4
+ "version": "0.0.1-plugins.1",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": [
@@ -20,6 +20,11 @@
20
20
  "import": "./dist/index.mjs",
21
21
  "require": "./dist/index.cjs"
22
22
  },
23
+ "./extensions": {
24
+ "types": "./dist/extensions.d.ts",
25
+ "import": "./dist/extensions.mjs",
26
+ "require": "./dist/extensions.cjs"
27
+ },
23
28
  "./styles.css": "./dist/index.css"
24
29
  },
25
30
  "dependencies": {
@@ -49,7 +54,7 @@
49
54
  "motion": "^12.23.12",
50
55
  "react-colorful": "^5.6.1",
51
56
  "zustand": "^5.0.12",
52
- "@graphysdk/viz-engine": "0.0.1-plugins.0"
57
+ "@graphysdk/viz-engine": "0.0.1-plugins.1"
53
58
  },
54
59
  "peerDependencies": {
55
60
  "react": "^19.0.0"
@@ -72,9 +77,9 @@
72
77
  "vite-plugin-dts": "^4.5.4",
73
78
  "vitest": "^4.1.0",
74
79
  "@graphytools/eslint-config": "0.0.1",
75
- "@graphytools/typescript-config": "0.0.1",
76
80
  "@graphytools/vitest-config": "1.0.0",
77
- "@graphysdk/viz-engine": "0.0.1-plugins.0",
81
+ "@graphytools/typescript-config": "0.0.1",
82
+ "@graphysdk/viz-engine": "0.0.1-plugins.1",
78
83
  "@graphytools/eslint-plugin-graphy": "1.0.0"
79
84
  },
80
85
  "lint-staged": {