@graphysdk/react-renderer 1.8.1-beta.1786366143449 → 1.8.1-beta.1786389092271

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/editable.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const c=require("./history-chords-B9Z337V_.cjs"),Xn=require("./font-values-CStAZ2d1.cjs");let p=require("@graphysdk/viz-engine"),x=require("react"),n=require("react/jsx-runtime"),ce=require("zustand/react/shallow"),Yn=require("react-dom"),V=require("clsx");V=c.__toESM(V,1);let He=require("@vanilla-extract/dynamic"),N=require("@base-ui/react/menu"),G=require("@base-ui/react"),X=require("@base-ui/react/accordion"),Ce=require("@base-ui/react/number-field"),Fe=require("@base-ui/react/radio"),Ge=require("@base-ui/react/radio-group"),H=require("@base-ui/react/select"),$=require("@base-ui/react/slider"),be=require("@base-ui/react/switch"),Jn=require("@base-ui/react/input");var Qn="data-graphy-chart-chrome",et="data-graphy-chart-menu",Ve={[et]:""},Q=e=>({[Qn]:e}),Be=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,nt=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,tt=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,Y=(e,t,i)=>e instanceof Node&&(t.contains(e)||Be(e,i)),rt="cml7ha0",Ke=(0,x.createContext)(null),at=({children:e})=>{const{chartId:t}=c.useGraphContext(),[i]=(0,x.useState)(c.resolvePortalContainer),[r,a]=(0,x.useState)(null);return i===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Yn.createPortal)((0,n.jsx)("div",{ref:a,className:rt,...Q(t)}),i),(0,n.jsx)(Ke.Provider,{value:r,children:e})]})},de=()=>(0,x.useContext)(Ke),qe=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",opacity:".12"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M3.325 3.156a.836.836 0 0 0-.836.836v6.832c0 .462.375.836.836.836h2.131a.5.5 0 0 1 .352.145L8 13.975l2.193-2.17a.5.5 0 0 1 .352-.145h2.13a.84.84 0 0 0 .836-.836V3.992a.84.84 0 0 0-.836-.836zm-1.836.836c0-1.014.822-1.836 1.836-1.836h9.35c1.015 0 1.836.825 1.836 1.836v6.832a1.84 1.84 0 0 1-1.836 1.836H10.75l-2.398 2.374a.5.5 0 0 1-.704 0L5.25 12.66H3.325a1.836 1.836 0 0 1-1.836-1.836z",clipRule:"evenodd"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M8 4.505a.5.5 0 0 1 .5.5v2.172h2.171a.5.5 0 0 1 0 1H8.5v2.171a.5.5 0 0 1-1 0V8.177H5.329a.5.5 0 0 1 0-1H7.5V5.005a.5.5 0 0 1 .5-.5",clipRule:"evenodd"})]});var Ue="efjmb40",We="efjmb41",q="efjmb42",U="efjmb43",ot="efjmb44",it="efjmb45",st=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),ue=({label:e,icon:t,onOpened:i,children:r})=>{const a=de(),[o,s]=(0,x.useState)(!1),d=(l,m)=>{l?(s(!0),i?.()):st.has(m.reason)&&s(!1)};return(0,n.jsxs)(G.Menu.SubmenuRoot,{open:o,onOpenChange:d,children:[(0,n.jsx)(lt,{label:e,icon:t}),(0,n.jsx)(G.Menu.Portal,{container:a,children:(0,n.jsx)(c.PortalThemeProvider,{children:(0,n.jsx)(G.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:Ue,...Ve,children:(0,n.jsx)(G.Menu.Popup,{className:We,children:r})})})})]})},lt=({label:e,icon:t})=>(0,n.jsxs)(G.Menu.SubmenuTrigger,{className:q,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:U,children:e}),(0,n.jsx)("span",{className:it,children:(0,n.jsx)(c.ChevronDownIcon,{size:"sm"})})]}),ct="_1qe7q450",dt="_1qe7q451",ut="_1qe7q452",ht=({label:e,placeholder:t,addLabel:i,at:r,onRequestClose:a})=>{const o=(0,x.useRef)(null),[s,d]=(0,x.useState)(""),{dispatch:l}=c.useGraphCommands(),m=s.trim(),u=()=>{m.length!==0&&(l(new p.AddAnnotationCommand({kind:"comment",annotation:{at:r,content:mt(m)}})),a())},h=f=>{f.key==="Enter"&&(f.preventDefault(),u()),f.key!=="Escape"&&f.stopPropagation()},v=f=>{d(f.target.value)},g=()=>{requestAnimationFrame(()=>o.current?.focus())};return(0,n.jsx)(ue,{label:e,icon:(0,n.jsx)(qe,{}),onOpened:g,children:(0,n.jsxs)("div",{className:ct,children:[(0,n.jsx)("input",{ref:o,className:dt,value:s,placeholder:t,onChange:v,onKeyDown:h}),(0,n.jsx)("button",{type:"button",className:ut,disabled:m.length===0,onClick:u,children:i})]})})},mt=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),pt=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 15 14",...e,children:(0,n.jsx)("path",{d:"M14.0146 5.20703C14.2118 5.40459 14.2121 5.72447 14.0146 5.92187L12.3291 7.6084C12.2343 7.70313 12.1047 7.75579 11.9707 7.75586C11.8369 7.75573 11.708 7.70291 11.6133 7.6084L9.92773 5.92187C9.73024 5.72438 9.73031 5.40457 9.92773 5.20703C10.1253 5.0095 10.445 5.0095 10.6426 5.20703L11.4658 6.03027L11.4658 1.68652L7.75586 1.68652L7.75586 12.6455C7.75563 12.9246 7.5291 13.1512 7.25 13.1514L2.5293 13.1514C2.2501 13.1514 2.02367 12.9247 2.02344 12.6455L2.02344 5.00781C0.868958 4.77348 0.000106647 3.7528 -1.10559e-07 2.5293C-4.95071e-08 1.13259 1.13261 9.74645e-05 2.5293 -5.23256e-07C3.92588 0.000220668 5.05859 1.13267 5.05859 2.5293C5.05849 3.75251 4.1892 4.77219 3.03516 5.00684L3.03516 12.1396L6.74414 12.1396L6.74414 1.18066C6.74414 0.901394 6.97076 0.674939 7.25 0.674804L11.9707 0.674805C12.2499 0.674939 12.4766 0.901394 12.4766 1.18066L12.4766 6.03027L13.2998 5.20703C13.4973 5.0095 13.8171 5.0095 14.0146 5.20703ZM4.04687 2.5293C4.04687 1.69137 3.36717 1.01194 2.5293 1.01172C1.69132 1.01182 1.01172 1.6913 1.01172 2.5293C1.01184 3.36719 1.6914 4.04678 2.5293 4.04687C3.36709 4.04665 4.04675 3.36712 4.04687 2.5293ZM14.5 11.2969C14.4998 12.6935 13.3673 13.8262 11.9707 13.8262C10.5742 13.826 9.4416 12.6934 9.44141 11.2969C9.44141 9.90018 10.574 8.7677 11.9707 8.76758C13.3675 8.76758 14.5 9.90011 14.5 11.2969ZM13.4883 11.2969C13.4883 10.4588 12.8088 9.7793 11.9707 9.7793C11.1327 9.77942 10.4531 10.4589 10.4531 11.2969C10.4533 12.1347 11.1329 12.8143 11.9707 12.8145C12.8086 12.8145 13.4881 12.1348 13.4883 11.2969Z",fill:"currentColor",fillOpacity:"0.8"})}),gt="relative-difference",xt=({label:e,layer:t,at:i,onRequestClose:r})=>{const{dispatch:a}=c.useGraphCommands(),o=c.useCompiledSelector(l=>l.coordSystem),s=(0,x.useMemo)(()=>(0,p.inferDifferenceArrowEndpoints)({layer:t,at:i,coordSystem:o}),[t,i,o]);if(s===null)return null;const d=()=>{a(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...s,label:gt}})),r()};return(0,n.jsxs)(N.Menu.Item,{className:q,onClick:d,children:[(0,n.jsx)(pt,{}),(0,n.jsx)("span",{className:U,children:e})]})};function vt(e,t){if(e.type==="polar"&&!ft(t))return[{scope:"series",labelKey:"pieSlice"}];const i=(0,p.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const r=[{scope:"data-point",labelKey:"bar"}];if(i){const a=t.position==="stack"||t.position==="fill";r.push({scope:"x-value",labelKey:a?"barStack":"barGroup"}),r.push({scope:"series",labelKey:"barSeries"})}return r}case"line":case"area":{const r=[{scope:"data-point",labelKey:"linePoint"}];return i&&r.push({scope:"series",labelKey:"lineSeries"}),r}case"point":{const r=[{scope:"data-point",labelKey:"scatterPoint"}];return i&&r.push({scope:"series",labelKey:"scatterSeries"}),r}default:return[]}}var ft=e=>{const t=(0,p.extractVariableName)(e.mapping.x);return t!==null&&t!==p.CONSTANT_VARIABLES.x},Ct=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),bt=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),St=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),jt=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),yt=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:".8",strokeWidth:"1.163",d:"m-1.618 15.96 9.118-5.3 11 2.34"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",stroke:"currentColor",strokeOpacity:"0.3",d:"M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,n.jsx)("rect",{width:"9.795",height:"6",x:"3",y:"2",fill:"currentColor",fillOpacity:"0.3",rx:"1.513"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.29 6.62a1.3 1.3 0 0 1-.424-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.262-.45 2.1 2.1 0 0 1-.096-.699q0-.389.082-.693.083-.304.238-.514a1.05 1.05 0 0 1 .374-.322q.22-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.321-.105.54.54 0 0 0-.485.273q-.168.273-.17.75h.021a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .813.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.571.134m-.003-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.07-.294.54.54 0 0 0-.484-.285.55.55 0 0 0-.403.173.596.596 0 0 0 .108.914.53.53 0 0 0 .288.08M6.88 6.579v-.396l1.05-1.03q.15-.15.25-.27a1 1 0 0 0 .151-.229.6.6 0 0 0 .05-.236.432.432 0 0 0-.244-.405.6.6 0 0 0-.258-.056q-.15 0-.261.062a.43.43 0 0 0-.175.173.56.56 0 0 0-.06.267H6.86q0-.288.132-.5a.9.9 0 0 1 .362-.33q.231-.117.532-.117.303 0 .534.114.23.114.358.312a.8.8 0 0 1 .128.452.9.9 0 0 1-.065.334q-.065.164-.229.363-.162.2-.456.483l-.522.53v.021h1.318v.458zM10.57 6.62a1.3 1.3 0 0 1-.423-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.263-.45 2.1 2.1 0 0 1-.096-.699q0-.389.083-.693t.238-.514a1.05 1.05 0 0 1 .374-.322q.219-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.322-.105.54.54 0 0 0-.484.273q-.168.273-.17.75h.02a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .814.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.572.134m-.002-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.071-.294.54.54 0 0 0-.483-.285.54.54 0 0 0-.403.173.597.597 0 0 0 .107.914.53.53 0 0 0 .289.08"})]}),It=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:".993",d:"M1.5 12 6 6.5l4 3.5 4-5.5"}),(0,n.jsx)("circle",{cx:"1.493",cy:"11.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"5.993",cy:"6.493",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"9.993",cy:"9.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"13.993",cy:"4.493",r:".993",fill:"currentColor",fillOpacity:"0.8"})]}),wt=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Pt=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Tt=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,n.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),At={bar:Ct,barGroup:bt,barStack:jt,barSeries:St,linePoint:yt,lineSeries:It,scatterPoint:Pt,scatterSeries:Tt,pieSlice:wt},$e=({labelKey:e})=>{const t=At[e];return(0,n.jsx)(t,{})},Ze=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.01683 15.3331C4.84407 15.3343 4.67292 15.2997 4.51421 15.2314C4.3555 15.1632 4.21268 15.0627 4.09476 14.9365L3.88656 14.7283L3.62877 14.8968L3.19253 15.3331H0L2.24072 13.0923L2.03251 12.8445C1.89423 12.7191 1.78392 12.566 1.70875 12.3952C1.63359 12.2244 1.59526 12.0396 1.59626 11.853C1.59579 11.6818 1.63078 11.5124 1.69904 11.3554C1.76729 11.1984 1.86733 11.0573 1.99285 10.9409L11.2036 1.73012C11.3215 1.60384 11.4643 1.5034 11.623 1.43514C11.7817 1.36688 11.9529 1.33228 12.1257 1.33353C12.2969 1.33245 12.4665 1.36716 12.6236 1.43546C12.7807 1.50375 12.9218 1.60412 13.0378 1.73012L15.1496 3.92126C15.2748 4.03899 15.3745 4.1811 15.4427 4.33882C15.5108 4.49654 15.546 4.66655 15.546 4.83837C15.546 5.01019 15.5108 5.1802 15.4427 5.33792C15.3745 5.49564 15.2748 5.63774 15.1496 5.75548L5.93889 14.9662C5.81806 15.0866 5.67403 15.1812 5.51552 15.2443C5.35702 15.3074 5.18736 15.3376 5.01683 15.3331ZM2.48858 11.9125L5.01683 14.4407L9.47843 9.97913L6.95019 7.4608L2.48858 11.9125ZM7.68388 6.72712L10.2022 9.24544L14.644 4.80367L12.1257 2.28534L7.68388 6.72712Z",fill:"currentColor",fillOpacity:"0.8"})]}),_t=({label:e,options:t,onSelect:i})=>{const r=c.useI18n();return(0,n.jsx)(ue,{label:e,icon:(0,n.jsx)(Ze,{}),children:t.map(a=>(0,n.jsxs)(G.Menu.Item,{className:q,onClick:()=>i(a.scope),children:[(0,n.jsx)($e,{labelKey:a.labelKey}),(0,n.jsx)("span",{className:U,children:r(`graph.annotations.highlights.labels.${a.labelKey}`)})]},a.scope))})},Mt=({label:e,layer:t,observation:i,highlights:r,onRequestClose:a})=>{const o=c.useI18n(),{dispatch:s}=c.useGraphCommands(),d=c.useCompiledSelector(g=>g.coordSystem),l=(0,x.useMemo)(()=>(0,p.buildObservationPredicate)(t,i),[t,i]),m=(0,x.useMemo)(()=>vt(d,t),[d,t]),u=(0,x.useMemo)(()=>{const g=new Set(r.map(f=>f.scope));return m.filter(f=>!g.has(f.scope))},[m,r]),[h]=u;if(l===null||h===void 0)return null;const v=g=>{s(new p.AddHighlightCommand({predicate:l,scope:g,layerId:t.id})),a()};if(u.length===1){const g=m.length===1?e:o("graph.annotations.baseMenu.highlightWithLabel",{label:o(`graph.annotations.highlights.labels.${h.labelKey}`)});return(0,n.jsxs)(G.Menu.Item,{className:q,onClick:()=>v(h.scope),children:[(0,n.jsx)($e,{labelKey:h.labelKey}),(0,n.jsx)("span",{className:U,children:g})]})}return(0,n.jsx)(_t,{label:e,options:u,onSelect:v})},Lt="_1aafi1g0",Et="_1aafi1g1",Xe=({children:e})=>(0,n.jsxs)("span",{className:Lt,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:Et})]}),Ot=({label:e,highlights:t,onRequestClose:i})=>{const{dispatch:r}=c.useGraphCommands(),a=t.at(-1);if(a===void 0)return null;const o=()=>{r(new p.RemoveHighlightCommand({id:a.id})),i()};return(0,n.jsxs)(N.Menu.Item,{className:q,onClick:o,children:[(0,n.jsx)(Xe,{children:(0,n.jsx)(Ze,{})}),(0,n.jsx)("span",{className:U,children:e})]})},Nt=(e,t)=>{const i=c.useCompiledSelector(a=>a.spec.highlights),r=c.useCompiledSelector(a=>a.config.parsingLocale);return(0,x.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:i,observation:t,parsingLocale:r}),[e,i,t,r])},Ye=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M13.5948 4.29016C13.8724 6.22367 12.5301 8.01618 10.5966 8.29384C8.66309 8.57151 6.87058 7.22918 6.59292 5.29567C6.31525 3.36216 7.65758 1.56965 9.59109 1.29198C11.5246 1.01432 13.3171 2.35665 13.5948 4.29016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.71886 3.51052C6.25611 1.3626 8.43287 0.0568985 10.5808 0.594151C12.7287 1.1314 14.0344 3.30817 13.4972 5.45609C13.0316 7.31748 11.3347 8.54637 9.49237 8.49145L7.50898 12.492C7.46485 12.581 7.40179 12.6548 7.32702 12.7108C7.20005 12.8073 7.03703 12.8532 6.87248 12.8303C6.80957 12.822 6.74697 12.8038 6.68687 12.7749C6.39369 12.6342 6.26689 12.2915 6.3923 11.9963L7.63393 7.97371C6.10249 7.10872 5.27136 5.29962 5.71886 3.51052ZM10.2785 1.80253C8.79799 1.4322 7.29756 2.33222 6.92723 3.81277C6.55691 5.29332 7.45692 6.79375 8.93747 7.16408C10.418 7.5344 11.9185 6.63439 12.2888 5.15384C12.6591 3.67329 11.7591 2.17285 10.2785 1.80253Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.42977 11.1572C5.70072 11.104 5.8772 10.8411 5.82393 10.5702C5.77067 10.2992 5.50784 10.1227 5.23688 10.176C4.31848 10.3565 3.57421 10.6423 3.04695 11.0266C2.51409 11.4149 2.16666 11.936 2.16666 12.557C2.16666 13.0322 2.41215 13.4327 2.74425 13.7433C3.07553 14.0531 3.52776 14.3091 4.04484 14.5137C5.08193 14.9239 6.48048 15.1666 7.99999 15.1666C9.5195 15.1666 10.9181 14.9239 11.9551 14.5137C12.4722 14.3091 12.9244 14.0531 13.2557 13.7433C13.5878 13.4327 13.8333 13.0322 13.8333 12.557C13.8333 11.936 13.4859 11.4149 12.953 11.0266C12.4258 10.6423 11.6815 10.3565 10.7631 10.176C10.4921 10.1227 10.2293 10.2992 10.176 10.5702C10.1228 10.8411 10.2993 11.104 10.5702 11.1572C11.4079 11.3219 11.997 11.5672 12.364 11.8347C12.7255 12.0981 12.8333 12.3496 12.8333 12.557C12.8333 12.6643 12.7803 12.8187 12.5727 13.013C12.3642 13.2079 12.0354 13.4065 11.5873 13.5838C10.6941 13.9371 9.426 14.1666 7.99999 14.1666C6.57398 14.1666 5.30586 13.9371 4.41267 13.5838C3.9646 13.4065 3.63578 13.2079 3.4273 13.013C3.21964 12.8187 3.16666 12.6643 3.16666 12.557C3.16666 12.3496 3.2745 12.0981 3.63595 11.8347C4.00299 11.5672 4.59206 11.3219 5.42977 11.1572Z",fill:"currentColor",fillOpacity:"0.8"})]}),kt=({label:e,at:t,onRequestClose:i})=>{const{dispatch:r}=c.useGraphCommands(),a=()=>{r(new p.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),i()};return(0,n.jsxs)(N.Menu.Item,{className:q,onClick:a,children:[(0,n.jsx)(Ye,{}),(0,n.jsx)("span",{className:U,children:e})]})},Je=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{opacity:"0.12",d:"M1.33334 8.00016C1.33334 4.31826 4.31811 1.3335 8.00001 1.3335C11.6819 1.3335 14.6667 4.31826 14.6667 8.00016C14.6667 11.6821 11.6819 14.6668 8.00001 14.6668C4.31811 14.6668 1.33334 11.6821 1.33334 8.00016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M5.7328 9.69963C5.56696 9.47884 5.25352 9.43429 5.03273 9.60013C4.81193 9.76598 4.76739 10.0794 4.93323 10.3002C5.63175 11.2302 6.74548 11.8333 7.99993 11.8333C9.25438 11.8333 10.3681 11.2302 11.0666 10.3002C11.2325 10.0794 11.1879 9.76598 10.9671 9.60013C10.7463 9.43429 10.4329 9.47884 10.2671 9.69963C9.74929 10.3889 8.92657 10.8333 7.99993 10.8333C7.07329 10.8333 6.25057 10.3889 5.7328 9.69963Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M6.66668 6.66658C6.66668 7.03478 6.3682 7.33325 6.00001 7.33325C5.63182 7.33325 5.33334 7.03478 5.33334 6.66658C5.33334 6.29839 5.63182 5.99992 6.00001 5.99992C6.3682 5.99992 6.66668 6.29839 6.66668 6.66658Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{d:"M10 7.33325C10.3682 7.33325 10.6667 7.03478 10.6667 6.66658C10.6667 6.29839 10.3682 5.99992 10 5.99992C9.63182 5.99992 9.33334 6.29839 9.33334 6.66658C9.33334 7.03478 9.63182 7.33325 10 7.33325Z",fill:"currentColor",fillOpacity:"0.8"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00001 0.833252C4.04197 0.833252 0.833344 4.04188 0.833344 7.99992C0.833344 11.958 4.04197 15.1666 8.00001 15.1666C11.9581 15.1666 15.1667 11.958 15.1667 7.99992C15.1667 4.04188 11.9581 0.833252 8.00001 0.833252ZM14.1667 7.99992C14.1667 11.4057 11.4058 14.1666 8.00001 14.1666C4.59425 14.1666 1.83334 11.4057 1.83334 7.99992C1.83334 4.59416 4.59425 1.83325 8.00001 1.83325C11.4058 1.83325 14.1667 4.59416 14.1667 7.99992Z",fill:"currentColor",fillOpacity:"0.8"})]}),Qe={pinnedNumber:{icon:Ye,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:qe,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:Je,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Rt=e=>(0,p.isObservationAttachmentKind)(e.kind)&&Qe[e.kind]!==null,Dt=({attachment:e,onRequestClose:t})=>{const i=c.useI18n(),{dispatch:r}=c.useGraphCommands(),{icon:a,labelKey:o}=Qe[e.kind],s=()=>{r(new p.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(N.Menu.Item,{className:q,onClick:s,children:[(0,n.jsx)(Xe,{children:(0,n.jsx)(a,{})}),(0,n.jsx)("span",{className:U,children:i(o)})]})},zt="ceeojg0",Ht="ceeojg1",Ft="ceeojg2",Gt=({label:e,at:t,onRequestClose:i})=>{const{dispatch:r}=c.useGraphCommands(),a=o=>{r(new p.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:o}})),i()};return(0,n.jsx)(ue,{label:e,icon:(0,n.jsx)(Je,{}),children:(0,n.jsx)("div",{className:zt,children:Object.entries(c.STICKER_ASSETS).map(([o,s])=>(0,n.jsx)(G.Menu.Item,{className:Ht,"aria-label":o,onClick:()=>a(o),children:(0,n.jsx)("img",{className:Ft,src:s.src,alt:o})},o))})})},Vt=({interaction:e,panelOrigin:t})=>{const i=c.useEditorStore(),r=c.useEditorState(o=>o.menuTrigger);if(e.kind!=="menu"||r===null)return null;const a=()=>{i.getState().releaseInteraction("menu")};return(0,n.jsx)(Bt,{trigger:{x:t.x+r.center.x,y:t.y+r.center.y,radius:r.radius},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:a})},Bt=({trigger:e,layer:t,at:i,observation:r,onClose:a})=>{const o=c.useI18n(),s=de(),d=c.useCompiledSelector(C=>C.spec.annotations),l=c.useCompiledSelector(C=>C.config.parsingLocale),m=qt(),{x:u,y:h,radius:v}=e,g=(0,x.useMemo)(()=>Kt(u,h,v),[u,h,v]),f=(0,p.findObservationAttachment)(d,i,(0,x.useMemo)(()=>(0,p.createObservationAnchorParser)(t,l),[t,l])),y=f!==null&&Rt(f)?f:null,P=Nt(t,r),j=(C,w)=>{!C&&Ut(w.reason)&&a()};return(0,n.jsx)(N.Menu.Root,{open:m,modal:!1,onOpenChange:j,children:(0,n.jsx)(N.Menu.Portal,{container:s,children:(0,n.jsx)(c.PortalThemeProvider,{children:(0,n.jsx)(N.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:Ue,...Ve,children:(0,n.jsxs)(N.Menu.Popup,{className:We,"data-testid":"observation-menu",children:[y!==null&&(0,n.jsx)(Dt,{attachment:y,onRequestClose:a}),(0,n.jsx)(Ot,{label:o("graph.annotations.baseMenu.removeHighlight"),highlights:P,onRequestClose:a}),(0,n.jsx)(N.Menu.Separator,{className:ot}),y===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kt,{label:o("graph.annotations.baseMenu.pinNumber"),at:i,onRequestClose:a}),(0,n.jsx)(ht,{label:o("graph.annotations.baseMenu.annotate"),placeholder:o("graph.annotations.textMenu.placeholder"),addLabel:o("graph.annotations.textMenu.addButton"),at:i,onRequestClose:a}),(0,n.jsx)(Gt,{label:o("graph.annotations.baseMenu.addSticker"),at:i,onRequestClose:a})]}),t.highlight!==null&&(0,n.jsx)(Mt,{label:o("graph.annotations.baseMenu.highlight"),layer:t,observation:r,highlights:P,onRequestClose:a}),(0,n.jsx)(xt,{label:o("graph.annotations.baseMenu.differenceArrow"),layer:t,at:i,onRequestClose:a})]})})})})})},Kt=(e,t,i)=>({getBoundingClientRect:()=>new DOMRect(e-i,t-i,i*2,i*2)}),qt=()=>{const[e,t]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{t(!0)},[]),e},Ut=e=>e==="outside-press"||e==="escape-key"||e==="item-press",Wt=()=>{const e=c.useGraphSelection();return en(e)},en=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},$t=e=>(0,n.jsx)(c.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,n.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Zt=e=>(0,n.jsx)(c.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M4 7h16"}),(0,n.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,n.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,n.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),Xt={kind:"chrome-popup"},Yt="var(--q7gcrz0)",Jt="var(--q7gcrz1)",Qt="q7gcrz2",er="q7gcrz3";var nr="q7gcrz5",tr="q7gcrz6",rr="q7gcrz7",ar="q7gcrz8",nn="q7gcrz9",or="q7gcrza";var Se="q7gcrzd q7gcrzc",tn="q7gcrze q7gcrzc",ir=["absolute-difference","relative-difference","proportion"],je=["absolute-difference","relative-difference"],sr=["relative-difference","proportion"],lr={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},cr=e=>{const{formattingLocale:t}=c.useGraphContext(),i=c.useCompiledSelector(a=>a.config.parsingLocale),r=t??i;return(0,x.useMemo)(()=>{const a=(0,p.areEndpointsComparable)(e.start,e.end);return ir.filter(o=>a||!je.includes(o)||o===e.label).map(o=>({kind:o,nameKey:lr[o],preview:(0,p.formatDifferenceLabel)({locale:r,kind:o,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:a||!je.includes(o),isSuspect:sr.includes(o)&&e.start.measurementValue===0}))},[e,r])},Z=8,dr=({labelBox:e,panelRect:t,frameWidth:i,frameHeight:r})=>{const a=t.y+e.y,o=a+e.height,s=a-8-36,d=o+8,l=ur(Z,s>=Z?s:d,r-Z-36),m=Z;return{top:l,left:m,available:Math.max(0,i-Z*2),centre:t.x+e.x+e.width/2-m}},ur=(e,t,i)=>Math.max(e,Math.min(t,i)),re=[{id:"small",nameKey:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",nameKey:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",nameKey:"graph.annotations.differenceArrowToolbar.size.large"}],hr=({arrow:e,labelBox:t,panelRect:i,frameWidth:r,frameHeight:a,frameElement:o})=>{const s=c.useI18n(),{chartId:d,commands:l}=c.useGraphContext(),m=c.useEditorStore(),[u,h]=(0,x.useState)(null),v=cr(e),g=dr({labelBox:t,panelRect:i,frameWidth:r,frameHeight:a}),f=(j,C)=>{l.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:j}),C)};(0,x.useEffect)(()=>()=>l.seal(),[l]),(0,x.useEffect)(()=>{const{claimInteraction:j,releaseInteraction:C}=m.getState();return u===null?C("chrome-popup"):j(Xt),()=>C("chrome-popup")},[m,u]);const y=j=>{h(j?"color":null),j||l.seal()},P=()=>{l.dispatch(new p.RemoveAnnotationCommand({id:e.id})),o.focus({preventScroll:!0})};return(0,n.jsx)("div",{className:Qt,style:{top:g.top,left:g.left,width:g.available},children:(0,n.jsxs)(c.FloatingToolbar.Root,{"aria-label":s("graph.annotations.differenceArrowToolbar.label"),className:er,"data-testid":"difference-arrow-toolbar",...Q(d),style:(0,He.assignInlineVars)({[Yt]:`${g.centre}px`,[Jt]:`${g.available}px`}),children:[(0,n.jsx)(mr,{options:v,current:e.label,isOpen:u==="labelKind",onOpenChange:j=>h(j?"labelKind":null),onPick:j=>{f({label:j}),h(null)}}),(0,n.jsx)(c.FloatingToolbar.Separator,{}),(0,n.jsx)(c.FloatingToolbar.ColorPicker,{color:e.color,label:s("graph.annotations.differenceArrowToolbar.color"),onChange:j=>f({color:j},{transient:!0}),isOpen:u==="color",onOpenChange:y,popupAttributes:Q(d),children:(0,n.jsx)("span",{className:tr,style:{background:e.color??"transparent"}})}),(0,n.jsx)(pr,{current:e.size,isOpen:u==="size",onOpenChange:j=>h(j?"size":null),onPick:j=>{f({size:j}),h(null)}}),(0,n.jsx)(c.FloatingToolbar.Separator,{}),(0,n.jsx)(c.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.swap"),className:Se,onClick:()=>f({start:e.end.anchor,end:e.start.anchor}),children:(0,n.jsx)($t,{size:"sm",title:""})}),(0,n.jsx)(c.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.remove"),className:Se,onClick:P,children:(0,n.jsx)(Zt,{size:"sm",title:""})})]})})},mr=({options:e,current:t,isOpen:i,onOpenChange:r,onPick:a})=>{const o=c.useI18n(),s=e.find(l=>l.kind===t),d=e.some(l=>l.isPickable&&l.kind!==t);return(0,n.jsxs)(N.Menu.Root,{open:i,modal:!1,onOpenChange:r,children:[(0,n.jsxs)(N.Menu.Trigger,{render:(0,n.jsx)(c.FloatingToolbar.Button,{}),"aria-label":o("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),className:tn,disabled:!d,onMouseDown:l=>l.preventDefault(),children:[(0,n.jsx)("span",{className:nr,children:s===void 0?"":o(s.nameKey)}),s!==void 0&&(0,n.jsxs)("span",{className:"q7gcrz4",children:["(",s.preview,")"]}),(0,n.jsx)(c.ChevronDownIcon,{size:"sm"})]}),(0,n.jsx)(rn,{children:e.map(l=>(0,n.jsxs)(N.Menu.Item,{className:nn,"data-selected":l.kind===t,disabled:!l.isPickable,onClick:()=>a(l.kind),children:[(0,n.jsx)("span",{children:o(l.nameKey)}),(l.isSuspect||!l.isPickable)&&(0,n.jsx)("span",{"aria-label":o(l.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrzb",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:or,children:l.preview})]},l.kind))})]})},pr=({current:e,isOpen:t,onOpenChange:i,onPick:r})=>{const a=c.useI18n(),o=re.find(s=>s.id===e)??re[0];return(0,n.jsxs)(N.Menu.Root,{open:t,modal:!1,onOpenChange:i,children:[(0,n.jsxs)(N.Menu.Trigger,{render:(0,n.jsx)(c.FloatingToolbar.Button,{}),"aria-label":a("graph.annotations.differenceArrowToolbar.size.ariaLabel"),className:tn,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{children:o===void 0?"":a(o.nameKey)}),(0,n.jsx)(c.ChevronDownIcon,{size:"sm"})]}),(0,n.jsx)(rn,{children:re.map(s=>(0,n.jsx)(N.Menu.Item,{className:nn,"data-selected":s.id===e,onClick:()=>r(s.id),children:a(s.nameKey)},s.id))})]})},rn=({children:e})=>{const{chartId:t}=c.useGraphContext();return(0,n.jsx)(N.Menu.Portal,{container:c.resolvePortalContainer(),children:(0,n.jsx)(c.PortalThemeProvider,{children:(0,n.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:rr,children:(0,n.jsx)(N.Menu.Popup,{className:ar,onMouseDown:i=>i.preventDefault(),...Q(t),children:e})})})})};var gr="ydgo3h0",xr="ydgo3h1",vr="ydgo3h2",an=e=>e==="start"?"end":"start",on=({dispatch:e,arrow:t,endpoint:i,anchor:r})=>{(0,p.areAnchorsEqual)(r,t[i].anchor)||e(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[i]:r}}))},fr=({clientPoint:e,panelOrigin:t,panelRect:i,engine:r,layers:a,coordSystem:o,resolver:s,fixedAnchor:d,align:l})=>{const m=Cr({x:e.x-t.x,y:e.y-t.y},i),{primary:u}=r.query((0,p.toPanelCursor)(m,i));if(u===null)return null;const h=a.find(g=>g.id===u.layerId);if(h===void 0)return null;const v=(0,p.resolveObservationPoint)({resolver:s,layer:h,observation:u.observation,coordSystem:o,align:l});return v===null||(0,p.areAnchorsEqual)(v.anchor,d)?null:v},Cr=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),br=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.finish(!0))},this.handleLost=t=>{t.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const t=this.pendingEvent;if(this.pendingEvent=null,t===null)return;const{editorStore:i,engine:r,anchorResolver:a,endpoint:o,readInputs:s}=this.params,{arrow:d,panelOrigin:l,panelRect:m,layers:u,coordSystem:h}=s(),v=i.getState();if(this.hasPublished&&c.readDraggedEndpointFor(c.readStanding(v,"endpoint-drag"),d.id,o)===null)return;const g=fr({clientPoint:{x:t.clientX,y:t.clientY},panelOrigin:l,panelRect:m,engine:r,layers:u,coordSystem:h,resolver:a,fixedAnchor:d[an(o)].anchor,align:d[o].anchor.align});g!==null&&this.publish(g)}}start(){const{handle:e}=this.params,{signal:t}=this.listeners;e.addEventListener("pointermove",this.handleMove,{signal:t}),e.addEventListener("pointerup",this.handleUp,{signal:t}),e.addEventListener("lostpointercapture",this.handleLost,{signal:t})}finish(e){this.params.onSettled(),this.listeners.abort(),this.cancelFrame(),e&&this.hasMoved&&this.runFrame(),this.pendingEvent=null;const{editorStore:t,endpoint:i,readInputs:r,dispatch:a}=this.params,{arrow:o}=r(),s=t.getState(),d=c.readDraggedEndpointFor(c.readStanding(s,"endpoint-drag"),o.id,i);d!==null&&(s.releaseInteraction("endpoint-drag"),e&&on({dispatch:a,arrow:o,endpoint:i,anchor:d.point.anchor}))}publish(e){const{editorStore:t,readInputs:i,endpoint:r}=this.params;t.getState().claimInteraction({kind:"endpoint-drag",annotationId:i().arrow.id,endpoint:r,point:e}),this.hasPublished=!0}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Sr=({arrow:e,panelOrigin:t,panelRect:i})=>{const{commands:r,anchorResolver:a}=c.useGraphContext(),{engine:o}=c.useHoverContext(),s=c.useEditorStore(),d=c.useLatestRef({arrow:e,panelOrigin:t,panelRect:i,...c.useCompiledSelector((0,ce.useShallow)(m=>({layers:m.layers,coordSystem:m.coordSystem})))}),l=(0,x.useRef)(null);return(0,x.useEffect)(()=>()=>l.current?.finish(!1),[]),(0,x.useCallback)(m=>({onClick:u=>u.stopPropagation(),onPointerDown:u=>{if(u.button!==0||l.current!==null)return;try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault();const h=new br({handle:u.currentTarget,pointerId:u.pointerId,endpoint:m,readInputs:()=>d.current,editorStore:s,engine:o,anchorResolver:a,dispatch:r.dispatch,onSettled:()=>{l.current=null}});l.current=h,h.start()}}),[d,s,o,a,r])},jr=[" ","Enter"],yr=({arrow:e})=>{const{commands:t,anchorResolver:i}=c.useGraphContext(),r=c.useEditorStore(),{layers:a,coordSystem:o,mainAxis:s}=c.useCompiledSelector((0,ce.useShallow)(l=>({layers:l.layers,coordSystem:l.coordSystem,mainAxis:l.coordSystem.type==="cartesian"?l.coordSystem.mainAxis:"x"}))),d=e.id;return(0,x.useEffect)(()=>()=>{const l=r.getState();c.readStanding(l,"endpoint-drag")?.annotationId===d&&l.releaseInteraction("endpoint-drag")},[r,d]),(0,x.useCallback)(l=>({onKeyDown:m=>{if(m.altKey||m.ctrlKey||m.metaKey||m.shiftKey)return;const u=r.getState(),h=c.readDraggedEndpointFor(c.readStanding(u,"endpoint-drag"),e.id,l);if(jr.includes(m.key)){if(m.preventDefault(),m.repeat)return;if(h===null)return u.claimInteraction({kind:"endpoint-drag",annotationId:e.id,endpoint:l,point:e[l]});u.releaseInteraction("endpoint-drag"),on({dispatch:t.dispatch,arrow:e,endpoint:l,anchor:h.point.anchor});return}if(h===null)return;const v=Ir(m.key,s);if(v===null)return;m.preventDefault();const g=wr({arrow:e,endpoint:l,from:h.point.anchor,move:v,layers:a,coordSystem:o,resolver:i});g!==null&&u.claimInteraction({kind:"endpoint-drag",annotationId:e.id,endpoint:l,point:g})}}),[e,r,t,i,a,o,s])},Ir=(e,t)=>{const i=e==="ArrowUp"||e==="ArrowDown";return!i&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:t==="x"===i?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},wr=({arrow:e,endpoint:t,from:i,move:r,layers:a,coordSystem:o,resolver:s})=>{const d=a.find(m=>m.id===i.layerId);if(d===void 0)return null;const l=(0,p.stepDifferenceArrowEndpoint)({layer:d,from:i,partner:e[an(t)].anchor,axis:r.axis,step:r.step,canLandOn:m=>(0,p.resolveObservationPoint)({resolver:s,layer:d,observation:m,coordSystem:o,align:e[t].anchor.align})!==null});return l===null?null:(0,p.resolveObservationPoint)({resolver:s,layer:d,observation:l.observation,coordSystem:o,align:e[t].anchor.align})},Pr=e=>{const t=Wt();return t===null?null:(0,n.jsx)(Tr,{annotationId:t,...e})},Tr=({annotationId:e,...t})=>{const i=c.useDifferenceArrowGeometries(),r=(0,x.useMemo)(()=>i.find(a=>a.id===e),[i,e]);return r===void 0?null:(0,n.jsx)(Ar,{committedArrow:r.committedArrow,committedLabelBox:r.committedLabelBox,labelBox:r.labelBox,start:r.start,end:r.end,isDragged:r.isDragged,...t})},Ar=({committedArrow:e,committedLabelBox:t,labelBox:i,start:r,end:a,panelRect:o,panelOrigin:s,frameRect:d,frameElement:l,isDragged:m})=>{const u=Sr({arrow:e,panelOrigin:s,panelRect:o}),h=yr({arrow:e});return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!m&&(0,n.jsx)(hr,{arrow:e,labelBox:t,panelRect:o,frameWidth:d.width,frameHeight:d.height,frameElement:l}),(0,n.jsx)("div",{"aria-hidden":"true",className:vr,"data-testid":"difference-arrow-selection-label",style:{left:o.x+i.x-2,top:o.y+i.y-2,width:i.width+4,height:i.height+4}}),(0,n.jsx)(ye,{endpoint:"start",point:r,panelRect:o,dragHandlers:u("start"),keyboardHandlers:h("start")}),(0,n.jsx)(ye,{endpoint:"end",point:a,panelRect:o,dragHandlers:u("end"),keyboardHandlers:h("end")})]})},ye=({endpoint:e,point:t,panelRect:i,dragHandlers:r,keyboardHandlers:a})=>(0,n.jsx)("div",{className:gr,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:i.x+t.x,top:i.y+t.y},tabIndex:0,...r,...a,children:(0,n.jsx)("span",{"aria-hidden":"true",className:xr})}),_r=e=>(0,n.jsx)(c.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M12 5v14"}),(0,n.jsx)("path",{d:"M5 12h14"})]})}),Mr="var(--_1tyillx0)",Lr={rest:.5,hovered:.75,open:1};var Er="_1tyillx1",Or={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},Nr="_1tyillx5",kr={closed:"_1tyillx6",open:"_1tyillx7"},Rr=({interaction:e,panelRect:t})=>{const i=c.useEditorStore(),r=c.useCompiledSelector(d=>d.coordSystem),a=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,o=Dr(e),s=(0,x.useMemo)(()=>{if(a===null)return null;const d=(0,p.projectAnchorToPanel)(a.position,t,r);return{center:d,radius:19*Lr[o],target:{kind:"observation",cursor:(0,p.toPanelCursor)(d,t)}}},[a,t,r,o]);return(0,x.useEffect)(()=>{i.getState().setMenuTrigger(s)},[i,s]),(0,x.useEffect)(()=>()=>i.getState().setMenuTrigger(null),[i]),a===null||s===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":o,className:(0,V.default)(Er,Or[o]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,He.assignInlineVars)({[Mr]:a.color??Xn.vars.border50})},children:(0,n.jsx)("span",{className:(0,V.default)(Nr,kr[o==="open"?"open":"closed"]),children:(0,n.jsx)(_r,{size:"lg"})})})},Dr=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",zr='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Hr=(e,t)=>{const{chartId:i}=c.useGraphContext(),r=c.useEditorStore();(0,x.useEffect)(()=>{if(t===null)return;const a=o=>{if(o.key!=="Tab"||o.defaultPrevented||!Y(o.target,e,i)||r.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(zr)];if(s.length===0)return;o.preventDefault();const d=s.findIndex(l=>l===document.activeElement);s[d===-1?o.shiftKey?s.length-1:0:(d+(o.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t,i,r])},Fr=e=>{const{selectionStore:t,chartId:i}=c.useGraphContext();(0,x.useEffect)(()=>{let r=null;const a=()=>{e.focus({preventScroll:!0})},o=d=>{const{selection:l,clearSelection:m}=t.getState();l.length!==0&&(Y(d.target,e,i)||m())},s=d=>{t.getState().selection.length!==0&&Y(d.target,e,i)&&d.relatedTarget===null&&(r!==null&&cancelAnimationFrame(r),r=requestAnimationFrame(()=>{r=null,document.hasFocus()&&(Y(document.activeElement,e,i)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",a),document.addEventListener("focusin",o),document.addEventListener("focusout",s),()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("pointerdown",a),document.removeEventListener("focusin",o),document.removeEventListener("focusout",s)}},[e,t,i])},Gr=e=>{const{selectionStore:t,commands:i,chartId:r}=c.useGraphContext(),a=c.useEditorStore(),o=(0,x.useCallback)(d=>{const{selection:l}=t.getState(),m=en(l);m!==null&&(d.preventDefault(),i.dispatch(new p.RemoveAnnotationCommand({id:m})),e.focus({preventScroll:!0}))},[e,i,t]),s=(0,x.useCallback)(d=>{const l=a.getState();switch(l.standingInteraction?.kind){case"endpoint-drag":l.releaseInteraction("endpoint-drag");return;case"chrome-popup":return;case"menu":l.releaseInteraction("menu");return;default:if(Be(d.target,r)){e.focus({preventScroll:!0});return}t.getState().clearSelection();return}},[a,t,e,r]);(0,x.useEffect)(()=>{const d=l=>{if(Y(l.target,e,r)&&!Vr(l.target)&&!nt(l.target))switch(l.key){case"Escape":return s(l);case"Delete":case"Backspace":return o(l);default:return}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,o,s,r])},Vr=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Br=`[${c.EDIT_TARGET_KIND_ATTRIBUTE}]`,sn=(e,t,i)=>{if(typeof document.elementsFromPoint!="function")return null;const r=document.elementsFromPoint(e,t);return Kr(r,i)},Kr=(e,t)=>{for(const i of e){const r=i.closest(Br);if(r===null||!t.contains(r))continue;const a=qr(r);if(a!==null)return a}return null},qr=e=>{const t=e.getAttribute(c.EDIT_TARGET_KIND_ATTRIBUTE);if(t!=="annotation")return null;const i=e.getAttribute(c.EDIT_TARGET_ID_ATTRIBUTE);return i===null||i===""?null:{kind:t,id:i}},Ur=()=>{const e=c.useHoverState(a=>a.hover.primary),{layers:t,coordSystem:i}=c.useCompiledSelector((0,ce.useShallow)(a=>({layers:a.layers,coordSystem:a.coordSystem}))),{anchorResolver:r}=c.useGraphContext();return(0,x.useMemo)(()=>{if(e===null)return null;const a=t.find(d=>d.id===e.layerId);if(a===void 0)return null;const o=r.resolve(a.geom,e.observation,{coordSystem:i,position:a.position,purpose:"pin"});if(o===null)return null;const s=(0,p.buildObservationAnchor)(a,e.observation);return s===null?null:{position:o,color:(0,p.getColor)(e.observation),layer:a,at:s,observation:e.observation}},[e,t,i,r])},Wr={kind:"idle"},ln=()=>{const e=c.useEditorState(r=>r.standingInteraction),t=c.useEditorState(r=>r.chromeUnderPointer),i=Ur();return(0,x.useMemo)(()=>e!==null?e:i===null?Wr:{kind:"trigger",anchor:i,isEngaged:t==="menu-trigger"},[e,i,t])},$r=(e,t)=>{const i=c.useEditorStore(),r=c.useLatestRef(t);(0,x.useEffect)(()=>{let a=null,o=null;const s=h=>{const{menuTrigger:v}=i.getState();return v===null?null:(0,p.isPointWithinEditMenuTrigger)(h,v)?"menu-trigger":null},d=()=>{a=null;const h=o;if(o=null,h===null)return;const v=r.current,g=i.getState();g.setChromeUnderPointer(s({x:h.x-v.x,y:h.y-v.y})),g.standingInteraction?.kind!=="menu"&&g.setEditTargetUnderPointer(sn(h.x,h.y,e))},l=()=>{const h=i.getState();h.setChromeUnderPointer(null),h.setEditTargetUnderPointer(null)},m=h=>{o={x:h.clientX,y:h.clientY},a===null&&(a=requestAnimationFrame(d))},u=()=>{o=null,a!==null&&(cancelAnimationFrame(a),a=null),l()};return e.addEventListener("pointermove",m),e.addEventListener("pointerleave",u),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointermove",m),e.removeEventListener("pointerleave",u),l()}},[e,i,r])},Ie="editor",we=[],Zr=(e,t,i,r)=>{const a=ln(),{store:o}=c.useHoverContext(),s=c.useGraphSelection().length>0,d=c.useEditorState(u=>u.menuTrigger),l=a.kind==="menu",m=(0,x.useMemo)(()=>d===null?we:[(0,p.buildEditMenuTriggerRegion)(d)],[d]);$r(e,t),Xr(a,e,t,i),Fr(e),Gr(e),Hr(e,r),(0,x.useEffect)(()=>(o.getState().publishPointerRegions(Ie,m),()=>o.getState().publishPointerRegions(Ie,we)),[o,m]),(0,x.useEffect)(()=>(o.getState().setPointerSuspended(l||s),()=>o.getState().setPointerSuspended(!1)),[o,l,s]),(0,x.useEffect)(()=>{if(!s)return;const u=o.getState();u.setHoverState(p.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[o,s])},Xr=(e,t,i,r)=>{const a=c.useEditorStore(),{selectionStore:o}=c.useGraphContext(),{store:s,engine:d}=c.useHoverContext(),l=c.useLatestRef(e),m=c.useLatestRef(i),u=c.useLatestRef(r);(0,x.useEffect)(()=>{const h=j=>{const{menuTrigger:C}=a.getState();return C===null?!1:(0,p.isPointWithinEditMenuTrigger)(Pe(j,m.current),C)},v=j=>{if(h(j)||o.getState().selection.length>0)return;const C=u.current,w=Pe(j,m.current),T=Yr(w,C)?d.query((0,p.toPanelCursor)(w,C)):p.RESTING_HOVER_STATE;s.getState().setHoverState(T)};let g=!1;const f=()=>{g=l.current.kind==="menu"},y=j=>{const C=sn(j.clientX,j.clientY,t),w=o.getState();if(C===null){w.clearSelection();return}w.setSelection([C])},P=j=>{if(tt(j.target))return;const{claimInteraction:C,releaseInteraction:w}=a.getState(),T=h(j);if(!T||g){w("menu"),T||y(j),g&&v(j);return}const k=l.current;k.kind==="trigger"&&C({kind:"menu",anchor:k.anchor})};return document.addEventListener("pointerdown",f,!0),document.addEventListener("click",P),()=>{document.removeEventListener("pointerdown",f,!0),document.removeEventListener("click",P)}},[a,o,t,l,s,d,m,u])},Pe=(e,t)=>({x:e.clientX-t.x,y:e.clientY-t.y}),Yr=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,Jr=({frameElement:e,panelRect:t})=>{const{measureRef:i,screenRect:r}=c.useElementScreenRect(),a=c.useEditorStore();return(0,x.useEffect)(()=>(i(e),()=>i(null)),[i,e]),(0,x.useEffect)(()=>()=>a.getState().releaseInteraction("menu"),[a]),r===null?null:(0,n.jsx)(at,{children:(0,n.jsx)(Qr,{frameElement:e,frameRect:r,panelRect:t})})},Qr=({frameElement:e,frameRect:t,panelRect:i})=>{const r=(0,x.useMemo)(()=>({x:t.left+i.x,y:t.top+i.y}),[t.left,t.top,i.x,i.y]),[a,o]=(0,x.useState)(null);return Zr(e,r,i,a),(0,n.jsx)(ea,{frameElement:e,frameRect:t,panelOrigin:r,panelRect:i,boxRef:o})},ea=({frameElement:e,frameRect:t,panelOrigin:i,panelRect:r,boxRef:a})=>{const o=de(),s=ln();return(0,n.jsx)(c.OverlayPortal,{rect:t,zIndex:c.Z_INDEX.editorOverlay,container:o,"data-testid":"editor-overlay",boxRef:a,children:(0,n.jsxs)(c.PortalThemeProvider,{children:[(0,n.jsx)(Pr,{panelRect:r,panelOrigin:i,frameRect:t,frameElement:e}),(0,n.jsx)(Rr,{interaction:s,panelRect:r}),(0,n.jsx)(Vt,{interaction:s,panelOrigin:i})]})})},na=({slots:e,...t})=>(0,n.jsx)(c.EditorProvider,{children:(0,n.jsx)(c.GraphRenderer,{slots:(0,x.useMemo)(()=>({EditorSurface:Jr,...e}),[e]),...t})}),cn=(0,x.createContext)(null),dn=({labelId:e,controlId:t,children:i})=>{const r=(0,x.useMemo)(()=>{let a=null;return{labelId:e,controlId:t,claimControlId:o=>(a??=o,a===o)}},[e,t]);return(0,n.jsx)(cn.Provider,{value:r,children:i})},B=({id:e,ariaLabel:t,ariaLabelledBy:i},r=!0)=>{const a=(0,x.useContext)(cn),o=(0,x.useId)(),[s]=(0,x.useState)(()=>r?a?.claimControlId(o)??!1:!1),d=e??(s?a?.controlId:void 0),l=i??(t===void 0?a?.labelId:void 0);return{...d!==void 0&&{id:d},...t!==void 0&&{"aria-label":t},...l!==void 0&&{"aria-labelledby":l}}};var ta={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},un=({label:e,icon:t,onClick:i,variant:r="default",isDisabled:a,ariaLabel:o,ariaLabelledBy:s,id:d})=>{const l=B({id:d,ariaLabel:o,ariaLabelledBy:s}),m=r==="tile";return(0,n.jsxs)("button",{type:"button",className:ta[r],disabled:a,onClick:i,...l,children:[t!==void 0&&(0,n.jsx)("span",{className:"woi4bh0",children:t}),e!==void 0&&(0,n.jsx)("span",{className:m?"woi4bh2":"woi4bh1",children:e})]})},he=(0,x.createContext)(null),M=()=>{const e=(0,x.useContext)(he);if(!e)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return e},hn=({children:e,onKeyDown:t,...i})=>{const r=(0,x.useContext)(he),a=o=>{if(t?.(o),!r||o.defaultPrevented)return;const s=c.resolveHistoryStep(o.nativeEvent);s&&(o.preventDefault(),s==="undo"?r.undo():r.redo())};return(0,n.jsx)("div",{onKeyDown:a,...i,children:e})},mn="keyboard",ne=e=>{const t=(0,x.useRef)(!1),i=(0,x.useRef)(!1),r=()=>{t.current=!1,i.current&&(i.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){i.current=!0;return}e?.()},commitUnlessHeldKey:a=>{if(a){i.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:r,onBlur:a=>{a.relatedTarget instanceof Node&&a.currentTarget.contains(a.relatedTarget)||r()}}}},ra="eh8dvc0",aa="eh8dvc1 uz3g760",oa="eh8dvc2 uz3g761";var pn=({value:e,onChange:t,onCommit:i,min:r,max:a,step:o,prefix:s,suffix:d,isDisabled:l,hasError:m,ariaLabel:u,ariaLabelledBy:h,id:v})=>{const g=B({id:v,ariaLabel:u,ariaLabelledBy:h}),{commitUnlessHeldKey:f,gestureHandlers:y}=ne(i);return(0,n.jsx)(Ce.NumberField.Root,{className:ra,value:e,onValueChange:P=>t(P),onValueCommitted:(P,j)=>{f(j.reason===mn)},min:r,max:a,step:o,disabled:l,children:(0,n.jsxs)(hn,{className:aa,"data-error":m===!0,"data-disabled":l===!0?"":void 0,children:[s!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:s}),(0,n.jsx)(Ce.NumberField.Input,{className:oa,...y,"aria-invalid":m===!0?!0:void 0,...g}),d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d})]})})},ia="_1b7s5f0",W={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},sa="_1b7s5f7";var la=6,gn=({options:e,value:t,onChange:i,onCommit:r,columns:a,itemLayout:o="tile",isDisabled:s,ariaLabel:d,ariaLabelledBy:l,id:m})=>{const u=B({id:m,ariaLabel:d,ariaLabelledBy:l}),h=o==="swatch",{commitAfterChange:v,gestureHandlers:g}=ne(r);return(0,n.jsx)(Ge.RadioGroup,{className:(0,V.default)(ia,ca(a??e.length)),value:t,onValueChange:f=>{i(f),v()},...g,disabled:s,...u,children:e.map(f=>(0,n.jsxs)(Fe.Radio.Root,{value:f.value,disabled:f.isDisabled,className:(0,V.default)(sa,h&&"_1b7s5f8"),"aria-label":h?f.label:void 0,children:[f.icon,!h&&(0,n.jsx)("span",{className:"_1b7s5f9",children:f.label})]},f.value))})},ca=e=>{switch(Math.min(Math.max(Math.round(e),1),la)){case 1:return W[1];case 2:return W[2];case 3:return W[3];case 4:return W[4];case 5:return W[5];default:return W[6]}},da="_1g5x15w0 uz3g760",ua="_1g5x15w1",ha="_1g5x15w2",Te="_1g5x15w3",ma="_1g5x15w4",pa="_1g5x15w5",ga="_1g5x15w6",xa="_1g5x15w7";var xn=({options:e,value:t,onChange:i,placeholder:r,isDisabled:a,hasError:o,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const m=B({id:l,ariaLabel:s,ariaLabelledBy:d});return(0,n.jsxs)(H.Select.Root,{value:t,onValueChange:u=>u!==null&&i(u),disabled:a,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,n.jsxs)(H.Select.Trigger,{className:da,"data-error":o===!0,...m,children:[(0,n.jsx)(H.Select.Value,{className:ua,children:u=>va(e,u,r)}),(0,n.jsx)(H.Select.Icon,{className:Te,children:(0,n.jsx)(c.ChevronDownIcon,{size:"sm"})})]}),(0,n.jsx)(H.Select.Portal,{container:c.resolvePortalContainer(),children:(0,n.jsx)(c.PortalThemeProvider,{children:(0,n.jsx)(H.Select.Positioner,{className:ma,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(H.Select.Popup,{className:pa,children:e.map(u=>(0,n.jsxs)(H.Select.Item,{value:u.value,disabled:u.isDisabled,className:ga,children:[u.icon,(0,n.jsxs)("span",{className:xa,children:[(0,n.jsx)(H.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,n.jsx)(H.Select.ItemIndicator,{className:Te,children:(0,n.jsx)(c.CheckIcon,{size:"sm"})})]},u.value))})})})})]})},va=(e,t,i)=>t===null?(0,n.jsx)("span",{className:ha,children:i}):fa(e,t),fa=(e,t)=>e.find(i=>i.value===t)?.label??t,Ca="vod76w0",ba="vod76w1",Sa="vod76w2",ja="vod76w3",ya="vod76w4",Ia="vod76w5";var vn=({value:e,onChange:t,onCommit:i,min:r,max:a,step:o,suffix:s,formatValue:d,isDisabled:l,ariaLabel:m,ariaLabelledBy:u})=>{const h=B({ariaLabel:m,ariaLabelledBy:u},!1),v=wa(e,s,d),{commitUnlessHeldKey:g,gestureHandlers:f}=ne(i);return(0,n.jsxs)("div",{className:Ca,children:[(0,n.jsx)($.Slider.Root,{className:ba,value:e,onValueChange:y=>t(y),onValueCommitted:(y,P)=>{g(P.reason===mn)},min:r,max:a,step:o,disabled:l,children:(0,n.jsx)($.Slider.Control,{className:Sa,children:(0,n.jsxs)($.Slider.Track,{className:ja,children:[(0,n.jsx)($.Slider.Indicator,{className:ya}),(0,n.jsx)($.Slider.Thumb,{className:Ia,...f,...h})]})})}),v!==null&&(0,n.jsx)("span",{className:"vod76w6",children:v})]})},wa=(e,t,i)=>i!==void 0?i(e):t!==void 0?`${e}${t}`:null,Pa="_1hyrlw60",Ta="_1hyrlw61",fn=({isChecked:e,onChange:t,isDisabled:i,ariaLabel:r,ariaLabelledBy:a,id:o})=>{const s=B({id:o,ariaLabel:r,ariaLabelledBy:a});return(0,n.jsx)(be.Switch.Root,{checked:e,onCheckedChange:d=>t(d),disabled:i,className:Pa,...s,children:(0,n.jsx)(be.Switch.Thumb,{className:Ta})})},Aa="uz3g761",_a="tpcnun0 uz3g760",Cn=({value:e,onChange:t,onCommit:i,placeholder:r,isDisabled:a,hasError:o,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const m=B({id:l,ariaLabel:s,ariaLabelledBy:d});return(0,n.jsx)(hn,{className:_a,"data-error":o===!0,children:(0,n.jsx)(Jn.Input,{className:Aa,value:e,onValueChange:u=>t(u),onBlur:i,placeholder:r,disabled:a,"aria-invalid":o===!0?!0:void 0,...m})})},Ma="cnu9yl0",La="cnu9yl1";var bn=({options:e,value:t,onChange:i,onCommit:r,itemLayout:a="inline",isDisabled:o,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const m=B({id:l,ariaLabel:s,ariaLabelledBy:d}),u=a==="stacked",{commitAfterChange:h,gestureHandlers:v}=ne(r);return(0,n.jsx)(Ge.RadioGroup,{className:Ma,value:t,onValueChange:g=>{i(g),h()},...v,disabled:o,...m,children:e.map(g=>(0,n.jsxs)(Fe.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,V.default)(La,u&&"cnu9yl2"),"aria-label":Ea(g,u),children:[g.icon,Sn(g,u)&&(0,n.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Sn=(e,t)=>e.icon===void 0||t,Ea=(e,t)=>{if(!Sn(e,t))return e.label},jn={ToggleGroup:bn,Switch:fn,Slider:vn,RadioGrid:gn,Button:un,TextField:Cn,NumberField:pn,Select:xn},yn=(0,x.createContext)(jn),Oa=({controls:e,children:t})=>{const i=(0,x.useMemo)(()=>({...jn,...e}),[e]);return(0,n.jsx)(yn.Provider,{value:i,children:t})},L=()=>(0,x.useContext)(yn),Na="_12lhx9e0",ka=({children:e})=>(0,n.jsx)("div",{className:Na,children:e}),Ra="_139ohwv0",D=({children:e})=>(0,n.jsx)("div",{className:Ra,children:e}),In=(0,x.createContext)(null),Da=In.Provider,wn=()=>{const e=(0,x.useContext)(In);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},za="_1jlczkt0",Pn="data-graphy-editor-panel",Ha={List:D,Grid:ka};function Fa(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var Ga=({handle:e,children:t,controls:i,defaultExpandedSection:r=void 0,className:a})=>{const o=c.useGraphHandle(e),{themeClass:s,inlineVarsStyle:d}=c.useThemeContext(),[l,m]=(0,x.useState)(()=>r?[r]:[]),u=(0,x.useMemo)(()=>({expandSection:h=>m([h]),collapseAllSections:()=>m([])}),[]);return(0,n.jsx)(he.Provider,{value:o,children:(0,n.jsx)(Oa,{controls:i,children:(0,n.jsx)(Da,{value:u,children:(0,n.jsx)(X.Accordion.Root,{[Pn]:"",className:(0,V.default)(za,a,{[s]:!Fa(a)}),style:d,value:l,onValueChange:h=>m(h),children:t})})})})},me={Root:Ga,Controls:Ha},Ae={stack:"pr583x0",grid:"pr583x1"},_e="pr583x2",Va="pr583x3",b=({label:e,layout:t="grid",children:i})=>{const r=(0,x.useId)(),a=(0,x.useId)();return e===void 0?(0,n.jsx)("div",{className:Ae[t],children:(0,n.jsx)("div",{className:_e,children:i})}):(0,n.jsxs)("div",{className:Ae[t],children:[(0,n.jsx)("label",{id:r,htmlFor:a,className:Va,children:e}),(0,n.jsx)("div",{className:_e,children:(0,n.jsx)(dn,{labelId:r,controlId:a,children:i})})]})},Ba=e=>(0,n.jsx)(c.Icon,{...e,children:(0,n.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})})}),pe="_40zvwv0",ge="_40zvwv1",Ka="_40zvwv2",Tn="_40zvwv3",qa="_40zvwv4 _40zvwv3";var Ua="_40zvwv6";var Wa="_40zvwv8",O=({title:e,layout:t="fixed",preview:i,accessory:r,onOpenChange:a,children:o})=>t==="collapsible"?(0,n.jsx)(Za,{title:e,preview:i,accessory:r,onOpenChange:a,children:o}):t==="inline"&&i===void 0?(0,n.jsx)($a,{title:e,accessory:r,children:o}):(0,n.jsxs)("div",{className:pe,children:[(0,n.jsxs)("div",{className:ge,children:[(0,n.jsx)("span",{className:Tn,children:e}),i!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:i}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:r})]}),(0,n.jsx)("div",{children:o})]}),$a=({title:e,accessory:t,children:i})=>{const r=(0,x.useId)(),a=(0,x.useId)();return(0,n.jsx)("div",{className:pe,children:(0,n.jsxs)("div",{className:ge,children:[(0,n.jsx)("label",{id:r,htmlFor:a,className:qa,children:e}),(0,n.jsx)("span",{className:Ua,children:(0,n.jsx)(dn,{labelId:r,controlId:a,children:i})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},Za=({title:e,preview:t,accessory:i,onOpenChange:r,children:a})=>{const o=c.useI18n();return(0,n.jsxs)(X.Accordion.Item,{value:e,className:pe,onOpenChange:r,children:[(0,n.jsxs)(X.Accordion.Header,{className:ge,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(X.Accordion.Trigger,{className:Ka,"aria-label":o("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:Tn,children:e}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:t}),i!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:i}),(0,n.jsx)("span",{className:Wa,children:(0,n.jsx)(Ba,{size:"sm"})})]}),(0,n.jsx)(X.Accordion.Panel,{children:(0,n.jsx)("div",{children:a})})]})},Xa=({title:e,isChecked:t,onToggle:i,isDisabled:r,preview:a,children:o})=>{const{expandSection:s,collapseAllSections:d}=wn(),{Switch:l}=L(),m=h=>{i(h),h?s(e):d()},u=h=>{h&&!t&&r!==!0&&i(!0)};return(0,n.jsx)(O,{title:e,layout:"collapsible",preview:a,onOpenChange:u,accessory:(0,n.jsx)(l,{isChecked:t,onChange:m,isDisabled:r,ariaLabel:e}),children:o})},Ya={horizontal:["bottom","top"],vertical:["left","right"]},Ja={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Qa={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},oe=({axis:e,title:t,layout:i="collapsible",preview:r})=>{const a=M(),o=c.useHandleCompiled(a),s=c.useI18n(),{NumberField:d,Switch:l,TextField:m,ToggleGroup:u}=L();if(!o)return null;const h=o.coordSystem.type==="polar"?o.coordSystem.axisMapping[e].geometry:"linear",v=o.config.axes[e],g=o.scales[e],f=g?.spec,y=f?.scaleType==="continuous"?f:void 0;if(h==="circular"||h==="radial"&&y===void 0)return null;const P=f!==void 0&&"reverse"in f?f:void 0,j=f?.scaleType==="continuous"||f?.scaleType==="datetime",C=e==="y"&&y!==void 0&&o.layers.some(S=>S.yScaleType==="primary"&&S.geom==="bar"),w=y?.transform==="log",T=y?.domainMax??null,k=eo(y),z=(S,F)=>S.map(J=>({value:J,label:F(J)})),E=o.guides.axes.find(S=>S.scaleAestheticKey===e)?.position,R=Ya[E==="bottom"||E==="top"||E===void 0&&e==="x"?"horizontal":"vertical"],A=o.guides.legends.drawn.some(S=>R.some(F=>F===S.position)),I=R.map(S=>({value:S,label:s(Ja[S])})),_=z(["auto","edges"],S=>s(S==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),K=z(["linear","log"],S=>s(S==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Rn=z(["auto","zero","custom"],S=>s(S==="zero"?"editor.axesPanel.startFrom.zero":S==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Dn=z(["auto","custom"],S=>s(S==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),zn=z(["no","yes"],S=>s(S==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Hn=S=>{a.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:S}))},Fn=S=>{a.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:S===""?null:S}),{transient:!0})},Gn=S=>{a.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:S}))},Vn=S=>{a.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:S==="edges"?"edges":"auto"}))},Bn=S=>{a.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:S==="yes"}))},Kn=S=>{a.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:S==="log"?"log":"linear"}))},fe=S=>{a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...S}),{transient:!0})},qn=S=>{S!==null&&fe({domainMin:S})},Un=S=>{S!==null&&fe({domainMax:S})},Wn=S=>{if(y){if(S==="custom"){y.zero&&a.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:Me(g?.domain,"start")}));return}y.domainMin!==null&&a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),a.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:S==="zero"}))}},$n=S=>{const F=S==="custom"?Me(g?.domain,"end"):null;a.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:F}))},Zn=S=>{const F=R.find(J=>J===S);F&&a.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:F}))};return(0,n.jsx)(O,{title:t??s(Qa[e]),layout:i,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(l,{isChecked:v.isVisible,onChange:Hn})}),h==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(m,{value:v.label??"",onChange:Fn,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(l,{isChecked:v.ticks.isVisible,onChange:Gn})})]}),j&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(u,{value:v.ticks.mode,options:_,onChange:Vn})}),y&&h==="linear"&&!A&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(u,{value:E??v.position,options:I,onChange:Zn})}),P!==void 0&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(u,{value:P.reverse===!0?"yes":"no",options:zn,onChange:Bn})}),y&&!C&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(u,{value:w?"log":"linear",options:K,onChange:Kn})}),y&&!w&&(0,n.jsxs)(n.Fragment,{children:[!C&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(u,{value:k,options:Rn,onChange:Wn})}),k==="custom"&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:y.domainMin??null,onChange:qn,onCommit:a.commands.seal})})]}),(0,n.jsx)(b,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(u,{value:T===null?"auto":"custom",options:Dn,onChange:$n})}),T!==null&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:T,onChange:Un,onCommit:a.commands.seal})})]})]})})},eo=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",Me=(e,t)=>{const i=t==="start"?e?.[0]:e?.[e.length-1];return typeof i=="number"?i:0},xe=({value:e,onChange:t})=>{const i=M(),r=c.useI18n(),{TextField:a}=L(),o=e!==null&&typeof e!="string",s=d=>t(d===""?null:d);return(0,n.jsx)(b,{label:r("editor.elementsPanel.contentValue"),children:(0,n.jsx)(a,{value:typeof e=="string"?e:"",onChange:s,onCommit:i.commands.seal,isDisabled:o})})},An=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Switch:s}=L();if(!a)return null;const d=a.config.content,l=u=>{r.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},m=u=>{r.commands.dispatch(new p.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,n.jsx)(O,{title:e??o("editor.elementsPanel.footerSection.caption"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:d.isCaptionVisible,onChange:l})}),(0,n.jsx)(xe,{value:d.caption,onChange:m})]})})},Le=/^[a-z][a-z\d+.-]*:/i,no={},_n=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Switch:s}=L();if(!a)return null;const d=a.config.content,l=m=>{r.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"source",isVisible:m}))};return(0,n.jsx)(O,{title:e??o("editor.elementsPanel.sourceSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:d.isSourceVisible,onChange:l})}),(0,n.jsx)(to,{source:d.source??no})]})})},to=({source:e})=>{const t=M(),i=c.useI18n(),{TextField:r}=L(),a=l=>{const m=(l.label??"")!==""||(l.url??"")!=="";t.commands.dispatch(new p.SetContentSourceCommand({source:m?l:null}),{transient:!0})},o=()=>{const l=e.url??"";l!==""&&!Le.test(l)&&a({...e,url:`https://${l}`}),t.commands.seal()},s=l=>a({...e,url:l}),d=l=>a({...e,label:l});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:i("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(r,{value:e.url??"",onChange:s,onCommit:o,hasError:Le.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,n.jsx)(b,{label:i("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(r,{value:e.label??"",onChange:d,onCommit:t.commands.seal})})]})},Mn=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Switch:s}=L();if(!a)return null;const d=a.config.content,l=u=>{r.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},m=u=>{r.commands.dispatch(new p.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,n.jsx)(O,{title:e??o("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:d.isSubtitleVisible,onChange:l})}),(0,n.jsx)(xe,{value:d.subtitle,onChange:m})]})})},ie=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],ro=ie.length/2,Ln=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{RadioGrid:s}=L();if(!a)return null;const{textScale:d}=a.config.appearance,l=h=>o("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${h}`}),m=ie.map(h=>({value:`${h}`,label:l(h)})),u=h=>{const v=ie.find(g=>`${g}`===h);v!==void 0&&r.commands.dispatch(new p.SetAppearanceTextScaleCommand({textScale:v}))};return(0,n.jsx)(O,{title:e??o("editor.elementsPanel.textSizeSection.title"),layout:t,preview:i??l(d),children:(0,n.jsx)(s,{value:`${d}`,options:m,columns:ro,onChange:u,ariaLabel:o("editor.elementsPanel.textSizeSection.title")})})},En=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Switch:s}=L();if(!a)return null;const d=a.config.content,l=u=>{r.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},m=u=>{r.commands.dispatch(new p.SetContentTitleCommand({title:u}),{transient:!0})};return(0,n.jsx)(O,{title:e??o("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{isChecked:d.isTitleVisible,onChange:l})}),(0,n.jsx)(xe,{value:d.title,onChange:m})]})})},ao=({children:e,...t})=>(0,n.jsx)(me.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(En,{}),(0,n.jsx)(Mn,{}),(0,n.jsx)(An,{}),(0,n.jsx)(_n,{}),(0,n.jsx)(Ln,{})]})}),oo=({children:e,...t})=>(0,n.jsx)(me.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(oe,{axis:"x"}),(0,n.jsx)(oe,{axis:"y"})]})}),te=e=>`${e}px`,On=e=>`${Math.round(e*100)}%`,io=e=>`${e}°`,so=24,Ee=["dim","desaturate"],lo=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Slider:s,ToggleGroup:d}=L();if(!a)return null;const{cornerRadius:l}=a.config.appearance,m=(0,p.readHighlightDimStyle)(a.spec),u=Ee.map(g=>({value:g,label:o(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),h=g=>{r.commands.dispatch(new p.SetAppearanceCornerRadiusCommand({cornerRadius:g}),{transient:!0})},v=g=>{const f=Ee.find(y=>y===g);f&&r.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:f}))};return(0,n.jsx)(O,{title:e??o("editor.colorPanel.appearanceSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(s,{value:l,min:0,max:so,step:1,formatValue:te,onChange:h,onCommit:r.commands.seal})}),(0,n.jsx)(b,{label:o("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(d,{value:m,options:u,onChange:v})})]})})},ve=(e,t)=>{const{colorScheme:i}=c.useThemeContext();return(0,x.useMemo)(()=>{const r=e?.layers.find(a=>a.id===t);return r===void 0?null:(0,p.createStyleResolver)({colorScheme:i}).geomReaders(r)},[e,t,i])},co=.05,uo=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Slider:s,ToggleGroup:d}=L(),l=a?(0,p.findLayerByGeom)(a.spec.layers,"bar"):void 0,m=ve(a,l?.id??null);if(!a||!l||a.coordSystem.type==="polar"&&a.coordSystem.bandAxis===null)return null;const u=g=>{r.commands.dispatch(new p.SetBarWidthCommand({layerId:l.id,width:g}),{transient:!0})},h=g=>{const f=p.BORDER_RADIUS_TOKENS.find(y=>y===g);f&&r.commands.dispatch(new p.SetBarBorderRadiusCommand({layerId:l.id,borderRadius:f}))},v=p.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:o(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,n.jsx)(O,{title:e??o("editor.graphPanel.barSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(s,{value:l.params.width,min:p.MIN_BAR_WIDTH,max:p.MAX_BAR_WIDTH,step:co,formatValue:On,onChange:u,onCommit:r.commands.seal})}),(0,n.jsx)(b,{label:o("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(d,{value:m?.get("borderRadius")??p.DEFAULT_BAR_BORDER_RADIUS,options:v,onChange:h})})]})})},ho=({layerId:e,title:t,layout:i="collapsible",preview:r})=>{const a=M(),o=c.useHandleCompiled(a),s=c.useI18n(),{Switch:d}=L();if(!o)return null;const l=e===void 0?o.spec.layers[0]:o.spec.layers.find(E=>E.id===e);if(!l)return null;const{showDataLabels:m,format:u,showStackTotals:h,showCategoryLabels:v}=l.dataLabels,g=o.coordSystem.type==="polar",f=l.geom==="bar",y=l.position==="stack"||l.position==="fill",P=f&&!g&&l.position==="stack",j=f&&(!g||m),C=f||l.geom==="area"&&y;if(!(0,p.canPlaceDataLabels)(l.geom,o.coordSystem.type))return null;const w=E=>{const R=new p.ToggleDataLabelsCommand({layerId:l.id,showDataLabels:E});a.commands.dispatch(R)},T=E=>{const R=new p.SetDataLabelsFormatCommand({layerId:l.id,format:E?"percentage":"absolute"});a.commands.dispatch(R)},k=E=>{const R=new p.ToggleStackTotalsCommand({layerId:l.id,showStackTotals:E});a.commands.dispatch(R)},z=E=>{const R=new p.ToggleCategoryLabelsCommand({layerId:l.id,showCategoryLabels:E});a.commands.dispatch(R)};return(0,n.jsx)(O,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:i,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(d,{isChecked:m,onChange:w})}),m&&C&&(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(d,{isChecked:u==="percentage",onChange:T})}),P&&(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(d,{isChecked:h,onChange:k})}),j&&(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(d,{isChecked:v,onChange:z})})]})})},mo=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M5.744 5.565 0 11.826V8l5.744-6.957 4.718 2.087L16 0v6.957l-5.538 4z"})]}),po=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),go=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),xo=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),vo=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),fo=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Co=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),bo=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),So=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,n.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,n.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,n.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,n.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,n.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,n.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),jo=e=>(0,n.jsxs)(c.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),yo=e=>(0,n.jsx)(c.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,n.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,n.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,n.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,n.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,n.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,n.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,n.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),Io=.55,se=[{name:"column",icon:vo,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Co,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:fo,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:po,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:xo,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:go,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:So,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:mo,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"scatter",icon:yo,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:jo,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:bo,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Io}}],wo=.05,Po=e=>e===null?null:se.find(t=>Ao(t.summary,e))??null,To=(e,t)=>{const{summary:i}=e;return i.coordType!=="polar"||!ee(i.innerRadius)||t===null||t.coordType!=="polar"||!ee(t.innerRadius)?i:{...i,innerRadius:t.innerRadius}},Ao=(e,t)=>e.coordType!==t.coordType||e.geom!==t.geom||e.position!==t.position?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&ee(e.innerRadius)===ee(t.innerRadius),ee=e=>e>=wo,_o=3,Mo=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{RadioGrid:s}=L(),d=(0,x.useMemo)(()=>se.map(({name:h,icon:v})=>({value:h,label:o(`editor.graphTypes.${h}`),icon:(0,n.jsx)(v,{size:"md"})})),[o]);if(!a)return null;const l=(0,p.readChartType)(a.spec),m=Po(l),u=h=>{const v=se.find(g=>g.name===h);v&&r.commands.dispatch(new p.SetChartTypeCommand(To(v,l)))};return(0,n.jsx)(O,{title:e??o("editor.graphPanel.graphTypeSection.title"),layout:t,preview:i??o(m===null?"editor.graphTypes.combo":`editor.graphTypes.${m.name}`),children:(0,n.jsx)(s,{value:m?.name??"",options:d,columns:_o,onChange:u,ariaLabel:o("editor.graphPanel.graphTypeSection.title")})})},Oe=["solid","dashed","dotted"],Lo=Number.parseFloat(c.chromeTokens.gridLineWidth),Eo=8,Oo=0,No=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Slider:s,Switch:d,ToggleGroup:l}=L(),{themeValues:m}=c.useThemeContext();if(!a)return null;const u=a.guides.axes.filter(ko);if(u.length===0)return null;const h=a.coordSystem.type!=="polar",v=u.some(C=>C.gridVisible),g=a.config.axes.y.grid,f=Oe.map(C=>({value:C,label:o(`editor.graphPanel.gridSection.lineStyles.${C}`)})),y=C=>w=>{r.commands.dispatch(new p.SetGridVisibilityCommand({axis:C,isVisible:w}))},P=C=>{const w=Oe.find(T=>T===C);w&&r.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:w}))},j=C=>{r.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:C}),{transient:!0})};return(0,n.jsx)(O,{title:e??o("editor.graphPanel.gridSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[u.map(C=>(0,n.jsx)(b,{label:o(Ro(C)),children:(0,n.jsx)(d,{isChecked:C.gridVisible,onChange:y(C.scaleAestheticKey)})},C.scaleAestheticKey)),h&&v&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:o("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(l,{value:g.lineStyle,options:f,onChange:P})}),(0,n.jsx)(b,{label:o("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:g.lineWidth??c.parsePx(m.gridLineWidth,Lo),min:Oo,max:Eo,step:.5,formatValue:te,onChange:j,onCommit:r.commands.seal})})]})]})})},ko=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",Ro=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaleAestheticKey==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",Do="total",Nn=["total","average","current"],zo=["total"],Ne=["previous","first"],ke=["auto","small","medium","large"],Ho=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Switch:s,ToggleGroup:d}=L();if(!a)return null;const l=a.config.headline,m=l.show!=="none",u=a.coordSystem,h=u.type==="polar",v=u.type==="polar"&&u.innerRadius>0,g=a.layers.some(I=>I.summary.grandTotal!==void 0);if(h&&!g)return null;const f=h?zo:Nn,y=a.guides.headline,P=y?.kind==="perGroup"&&y.items.some(I=>I.comparison!==null),j=f.map(I=>({value:I,label:o(`editor.graphPanel.headlineNumberSection.metrics.${I}`)})),C=Ne.map(I=>({value:I,label:o(`editor.graphPanel.headlineNumberSection.comparison.${I}`)})),w=ke.map(I=>({value:I,label:o(I==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${I}`)})),T=[{value:"above",label:o("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:o("editor.graphPanel.headlineNumberSection.position.center")}],k=I=>{r.commands.dispatch(new p.SetHeadlineShowCommand({show:I?Do:"none"}))},z=I=>{const _=f.find(K=>K===I);_&&r.commands.dispatch(new p.SetHeadlineShowCommand({show:_}))},E=I=>{const _=Ne.find(K=>K===I);_&&r.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:_}))},R=I=>{const _=ke.find(K=>K===I);_&&r.commands.dispatch(new p.SetHeadlineSizeCommand({size:_}))},A=I=>{r.commands.dispatch(new p.SetHeadlinePositionCommand({position:I==="center"?"center":"above"}))};return(0,n.jsx)(O,{title:e??o("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:i??Fo(o,l.show),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{isChecked:m,onChange:k})}),m&&(0,n.jsxs)(n.Fragment,{children:[j.length>1&&(0,n.jsx)(b,{label:o("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(d,{value:l.show,options:j,onChange:z})}),P&&(0,n.jsx)(b,{label:o("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(d,{value:(0,p.resolveComparisonBasis)(l.compareWith),options:C,onChange:E})}),(0,n.jsx)(b,{label:o("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(d,{value:l.size,options:w,onChange:R})}),v&&(0,n.jsx)(b,{label:o("editor.axesPanel.controls.position"),children:(0,n.jsx)(d,{value:l.position,options:T,onChange:A})})]})]})})},Fo=(e,t)=>{const i=Nn.find(r=>r===t);return i&&e(`editor.graphPanel.headlineNumberSection.metrics.${i}`)},ae=["top","bottom","left","right","none"],Re=["auto","start","center","end"],De=["auto","pill","direct"],Go=({positions:e,title:t,layout:i="collapsible",preview:r})=>{const a=M(),o=c.useHandleCompiled(a),s=c.useI18n(),{ToggleGroup:d}=L();if(!o)return null;const l=o.config.legend.position,m=e??ae,u=o.guides.legends.drawn[0],h=(0,p.canAnchorDirectLabels)({legendPosition:o.guides.legends.position,coordSystem:o.coordSystem,layers:o.layers}),v=o.guides.headline?.kind==="perGroup",g=o.guides.colorGroups.length>0;if(l==="auto"&&u===void 0&&!h&&(v||!g))return null;const f=u?.position??"none",y=l==="auto"?f:l,P=ae.filter(A=>A===y||m.includes(A)).map(A=>({value:A,label:s(`editor.graphPanel.legendSection.${A}`)})),j=A=>{const I=ae.find(_=>_===A);I&&a.commands.dispatch(new p.SetLegendPositionCommand({position:I}))},C=A=>{const I=Re.find(_=>_===A);I&&a.commands.dispatch(new p.SetLegendAlignCommand({align:I}))},w=A=>{const I=De.find(_=>_===A);I&&a.commands.dispatch(new p.SetLegendDisplayCommand({display:I}))},T=Re.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.align.${A}`)})),k=De.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.display.${A}`)})),z=t??s("editor.graphPanel.legendSection.title"),E=P.find(A=>A.value===y)?.label,R=u!==void 0;return(0,n.jsx)(O,{title:z,layout:i,preview:r??E,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(d,{value:y,options:P,onChange:j})}),R&&(0,n.jsx)(b,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(d,{value:o.config.legend.align,options:T,onChange:C})}),h&&(0,n.jsx)(b,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(d,{value:o.config.legend.display,options:k,onChange:w})})]})})},Vo=1,Bo=20,Ko=.5,kn=({layerId:e})=>{const t=M(),i=c.useHandleCompiled(t),{Slider:r}=L(),a=ve(i,e);if(!i)return null;const o=s=>{const d=new p.SetPointSizeCommand({layerId:e,size:s});t.commands.dispatch(d,{transient:!0})};return(0,n.jsx)(r,{value:a?.get("size")??p.DEFAULT_POINT_SIZE,min:Vo,max:Bo,step:Ko,formatValue:te,onChange:o,onCommit:t.commands.seal})},qo=1,Uo=10,Wo=.1,$o=["gap","zero","connect"],Zo=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Select:s,Slider:d,Switch:l,ToggleGroup:m}=L(),u=a?.spec.layers??[],h=(0,p.findLayerByGeom)(u,"line","area"),v=ve(a,h?.id??null);if(!a||!h)return null;const g=a.coordSystem.type==="polar",f=Jo(o,h),y=Yo(h,u),P=ze(a.spec,h.geom,"strokeWidth",h.id),j=typeof P=="number",C=h.geom==="line"?h:void 0,w=[{value:"auto",label:o("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:o("editor.graphPanel.numberFormat.options.custom")}],T=I=>{r.commands.dispatch(new p.ToggleLinePointsVisibilityCommand({layerId:h.id,showPoints:I}))},k=I=>{C&&r.commands.dispatch(new p.ToggleLineFillCommand({layerId:C.id,showFill:I}))},z=I=>{r.commands.dispatch(new p.SetLineInterpolationCommand({layerId:h.id,interpolate:I?"catmull-rom":"linear"}))},E=I=>{const _=v?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH;r.commands.dispatch(new p.SetLineWidthCommand({layerId:h.id,lineWidth:I==="custom"?_:null}))},R=I=>{r.commands.dispatch(new p.SetLineWidthCommand({layerId:h.id,lineWidth:I}),{transient:!0})},A=I=>{const _=Xo(I);_&&r.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:h.id,missingValues:_}))};return(0,n.jsx)(O,{title:e??o("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(l,{isChecked:y!==void 0,onChange:T})}),y&&(0,n.jsx)(b,{label:o("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(kn,{layerId:y.id})}),C&&!g&&(0,n.jsx)(b,{label:o("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(l,{isChecked:ze(a.spec,"line","fillAlpha",C.id)!==void 0,onChange:k})}),!g&&(0,n.jsx)(b,{label:o("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(l,{isChecked:h.params.interpolate==="catmull-rom",onChange:z})}),(0,n.jsx)(b,{label:o("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(m,{value:j?"custom":"auto",options:w,onChange:E})}),j&&(0,n.jsx)(b,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:P,min:qo,max:Uo,step:Wo,formatValue:te,onChange:R,onCommit:r.commands.seal})}),!g&&f.length>1&&(0,n.jsx)(b,{label:o("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:h.params.missingValues,options:f,onChange:A})})]})})},Xo=e=>$o.find(t=>t===e),ze=(e,t,i,r)=>(0,p.findStyleRule)(e.styles.overrides,(0,p.buildLayerStyleAddress)(t,r))?.declarations?.[i],Yo=(e,t)=>(0,p.filterLayersByGeoms)(t,"point").find(i=>(0,p.isCompanionLayer)(i,[e])),Jo=(e,t)=>{const i=[{value:"gap",label:e("editor.graphPanel.treatEmptyValues.leaveGap.label")},{value:"zero",label:e("editor.graphPanel.treatEmptyValues.fillZero.label")}];return t.position!=="stack"&&t.position!=="fill"&&i.push({value:"connect",label:e("editor.graphPanel.treatEmptyValues.connectGaps.label")}),t.geom==="area"?i.filter(r=>r.value!=="gap"):i},Qo="k",ei=2,ni=0,ti=5,le=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],ri=["auto","none"],ai=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{NumberField:s,ToggleGroup:d}=L();if(!a)return null;const{abbreviation:l,decimals:m}=a.config.numberFormat,u=oi(l)!==void 0,h=m!=="auto",v=w=>w.map(T=>({value:T,label:o(`editor.graphPanel.numberFormat.options.${T}`)})),g=le.map(({value:w,labelKey:T})=>({value:w,label:o(`common.abbreviations.${T}`)})),f=w=>{r.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:w}))},y=w=>{const T=ri.find(k=>k===w);f(T??Qo)},P=w=>{const T=le.find(k=>k.value===w);T&&f(T.value)},j=w=>{r.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:w==="custom"?ei:"auto"}))},C=w=>{w!==null&&r.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:w}),{transient:!0})};return(0,n.jsx)(O,{title:e??o("editor.graphPanel.numberFormatSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(d,{value:u?"custom":l,options:v(["auto","none","custom"]),onChange:y})}),u&&(0,n.jsx)(b,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:l,options:g,onChange:P})}),(0,n.jsx)(b,{label:o("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(d,{value:h?"custom":"auto",options:v(["auto","custom"]),onChange:j})}),h&&(0,n.jsx)(b,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:m,min:ni,max:ti,onChange:C,onCommit:r.commands.seal})})]})})},oi=e=>le.find(t=>t.value===e),ii=({title:e,layout:t="collapsible",preview:i})=>{const r=c.useHandleCompiled(M()),a=c.useI18n();if(!r)return null;const o=si(r.spec.layers);return o?(0,n.jsx)(O,{title:e??a("editor.graphPanel.pointSize.label"),layout:t,preview:i,children:(0,n.jsx)(D,{children:(0,n.jsx)(b,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(kn,{layerId:o.id})})})}):null},si=e=>{const t=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(i=>!(0,p.isCompanionLayer)(i,t))},li=.9,ci=360,di=.05,ui=15,hi=({title:e,layout:t="collapsible",preview:i})=>{const r=M(),a=c.useHandleCompiled(r),o=c.useI18n(),{Slider:s}=L();if(!a||a.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:l}=a.spec.coords.params,m=h=>{r.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:h}),{transient:!0})},u=h=>{r.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:h}),{transient:!0})};return(0,n.jsx)(O,{title:e??o("editor.graphPanel.polarSection.title"),layout:t,preview:i,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(s,{value:d,min:0,max:li,step:di,formatValue:On,onChange:m,onCommit:r.commands.seal})}),(0,n.jsx)(b,{label:o("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:l,min:0,max:ci-1,step:ui,formatValue:io,onChange:u,onCommit:r.commands.seal})})]})})};exports.AppearanceSection=lo;exports.AxesPanel=oo;exports.AxisSection=oe;exports.BarSection=uo;exports.Button=un;exports.CaptionSection=An;exports.EditableGraphRenderer=na;exports.EditorPanel=me;exports.ElementsPanel=ao;exports.GraphOptionsSection=ho;exports.GraphTypeSection=Mo;exports.GridSection=No;exports.HeadlineSection=Ho;exports.IntlProvider=c.IntlProvider;exports.LegendSection=Go;exports.LineSection=Zo;exports.NumberField=pn;exports.NumberFormatSection=ai;exports.PANEL_ROOT_ATTRIBUTE=Pn;exports.PointSection=ii;exports.PolarSection=hi;exports.RadioGrid=gn;exports.Row=b;exports.Section=O;exports.Select=xn;exports.Slider=vn;exports.SourceSection=_n;exports.SubtitleSection=Mn;exports.Switch=fn;exports.TextField=Cn;exports.TextSizeSection=Ln;exports.TitleSection=En;exports.ToggleGroup=bn;exports.ToggledSection=Xa;exports.useControls=L;exports.usePanelExpansion=wn;exports.usePanelGraph=M;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const c=require("./history-chords-BIU47Fn4.cjs"),Qn=require("./font-values-CStAZ2d1.cjs");let h=require("@graphysdk/viz-engine"),x=require("react"),e=require("react/jsx-runtime"),ue=require("zustand/react/shallow"),et=require("react-dom"),G=require("clsx");G=c.__toESM(G,1);let Ve=require("@vanilla-extract/dynamic"),N=require("@base-ui/react/menu"),V=require("@base-ui/react"),X=require("@base-ui/react/accordion"),Se=require("@base-ui/react/number-field"),Ge=require("@base-ui/react/radio"),Be=require("@base-ui/react/radio-group"),z=require("@base-ui/react/select"),Z=require("@base-ui/react/slider"),je=require("@base-ui/react/switch"),nt=require("@base-ui/react/input");var tt="data-graphy-chart-chrome",rt="data-graphy-chart-menu",Ke={[rt]:""},Q=n=>({[tt]:n}),qe=(n,t)=>n instanceof Element&&n.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,at=n=>n instanceof Element&&n.closest("[data-graphy-chart-menu]")!==null,ot=n=>n instanceof Element&&n.closest("[data-graphy-chart-chrome]")!==null,Y=(n,t,i)=>n instanceof Node&&(t.contains(n)||qe(n,i)),it="cml7ha0",Ue=(0,x.createContext)(null),st=({children:n})=>{const{chartId:t}=c.useGraphContext(),[i]=(0,x.useState)(c.resolvePortalContainer),[a,o]=(0,x.useState)(null);return i===null?null:(0,e.jsxs)(e.Fragment,{children:[(0,et.createPortal)((0,e.jsx)("div",{ref:o,className:it,...Q(t)}),i),(0,e.jsx)(Ue.Provider,{value:a,children:n})]})},he=()=>(0,x.useContext)(Ue),We=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",opacity:".12"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M3.325 3.156a.836.836 0 0 0-.836.836v6.832c0 .462.375.836.836.836h2.131a.5.5 0 0 1 .352.145L8 13.975l2.193-2.17a.5.5 0 0 1 .352-.145h2.13a.84.84 0 0 0 .836-.836V3.992a.84.84 0 0 0-.836-.836zm-1.836.836c0-1.014.822-1.836 1.836-1.836h9.35c1.015 0 1.836.825 1.836 1.836v6.832a1.84 1.84 0 0 1-1.836 1.836H10.75l-2.398 2.374a.5.5 0 0 1-.704 0L5.25 12.66H3.325a1.836 1.836 0 0 1-1.836-1.836z",clipRule:"evenodd"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:".8",fillRule:"evenodd",d:"M8 4.505a.5.5 0 0 1 .5.5v2.172h2.171a.5.5 0 0 1 0 1H8.5v2.171a.5.5 0 0 1-1 0V8.177H5.329a.5.5 0 0 1 0-1H7.5V5.005a.5.5 0 0 1 .5-.5",clipRule:"evenodd"})]});var Ze="efjmb40",$e="efjmb41",q="efjmb42",U="efjmb43",lt="efjmb44",ct="efjmb45",dt=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),me=({label:n,icon:t,onOpened:i,children:a})=>{const o=he(),[r,s]=(0,x.useState)(!1),d=(l,p)=>{l?(s(!0),i?.()):dt.has(p.reason)&&s(!1)};return(0,e.jsxs)(V.Menu.SubmenuRoot,{open:r,onOpenChange:d,children:[(0,e.jsx)(ut,{label:n,icon:t}),(0,e.jsx)(V.Menu.Portal,{container:o,children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(V.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:Ze,...Ke,children:(0,e.jsx)(V.Menu.Popup,{className:$e,children:a})})})})]})},ut=({label:n,icon:t})=>(0,e.jsxs)(V.Menu.SubmenuTrigger,{className:q,openOnHover:!1,children:[t,(0,e.jsx)("span",{className:U,children:n}),(0,e.jsx)("span",{className:ct,children:(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})})]}),ht="_1qe7q450",mt="_1qe7q451",pt="_1qe7q452",gt=({label:n,placeholder:t,addLabel:i,at:a,onRequestClose:o})=>{const r=(0,x.useRef)(null),[s,d]=(0,x.useState)(""),{dispatch:l}=c.useGraphCommands(),p=s.trim(),u=()=>{p.length!==0&&(l(new h.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:xt(p)}})),o())},m=C=>{C.key==="Enter"&&(C.preventDefault(),u()),C.key!=="Escape"&&C.stopPropagation()},v=C=>{d(C.target.value)},g=()=>{requestAnimationFrame(()=>r.current?.focus())};return(0,e.jsx)(me,{label:n,icon:(0,e.jsx)(We,{}),onOpened:g,children:(0,e.jsxs)("div",{className:ht,children:[(0,e.jsx)("input",{ref:r,className:mt,value:s,placeholder:t,onChange:v,onKeyDown:m}),(0,e.jsx)("button",{type:"button",className:pt,disabled:p.length===0,onClick:u,children:i})]})})},xt=n=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:n}]}]}),vt=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 15 14",...n,children:(0,e.jsx)("path",{d:"M14.0146 5.20703C14.2118 5.40459 14.2121 5.72447 14.0146 5.92187L12.3291 7.6084C12.2343 7.70313 12.1047 7.75579 11.9707 7.75586C11.8369 7.75573 11.708 7.70291 11.6133 7.6084L9.92773 5.92187C9.73024 5.72438 9.73031 5.40457 9.92773 5.20703C10.1253 5.0095 10.445 5.0095 10.6426 5.20703L11.4658 6.03027L11.4658 1.68652L7.75586 1.68652L7.75586 12.6455C7.75563 12.9246 7.5291 13.1512 7.25 13.1514L2.5293 13.1514C2.2501 13.1514 2.02367 12.9247 2.02344 12.6455L2.02344 5.00781C0.868958 4.77348 0.000106647 3.7528 -1.10559e-07 2.5293C-4.95071e-08 1.13259 1.13261 9.74645e-05 2.5293 -5.23256e-07C3.92588 0.000220668 5.05859 1.13267 5.05859 2.5293C5.05849 3.75251 4.1892 4.77219 3.03516 5.00684L3.03516 12.1396L6.74414 12.1396L6.74414 1.18066C6.74414 0.901394 6.97076 0.674939 7.25 0.674804L11.9707 0.674805C12.2499 0.674939 12.4766 0.901394 12.4766 1.18066L12.4766 6.03027L13.2998 5.20703C13.4973 5.0095 13.8171 5.0095 14.0146 5.20703ZM4.04687 2.5293C4.04687 1.69137 3.36717 1.01194 2.5293 1.01172C1.69132 1.01182 1.01172 1.6913 1.01172 2.5293C1.01184 3.36719 1.6914 4.04678 2.5293 4.04687C3.36709 4.04665 4.04675 3.36712 4.04687 2.5293ZM14.5 11.2969C14.4998 12.6935 13.3673 13.8262 11.9707 13.8262C10.5742 13.826 9.4416 12.6934 9.44141 11.2969C9.44141 9.90018 10.574 8.7677 11.9707 8.76758C13.3675 8.76758 14.5 9.90011 14.5 11.2969ZM13.4883 11.2969C13.4883 10.4588 12.8088 9.7793 11.9707 9.7793C11.1327 9.77942 10.4531 10.4589 10.4531 11.2969C10.4533 12.1347 11.1329 12.8143 11.9707 12.8145C12.8086 12.8145 13.4881 12.1348 13.4883 11.2969Z",fill:"currentColor",fillOpacity:"0.8"})}),Ct="relative-difference",ft=({label:n,layer:t,at:i,onRequestClose:a})=>{const{dispatch:o}=c.useGraphCommands(),r=c.useCompiledSelector(l=>l.coordSystem),s=(0,x.useMemo)(()=>(0,h.inferDifferenceArrowEndpoints)({layer:t,at:i,coordSystem:r}),[t,i,r]);if(s===null)return null;const d=()=>{o(new h.AddAnnotationCommand({kind:"differenceArrow",annotation:{...h.DIFFERENCE_ARROW_DEFAULTS,...s,label:Ct}})),a()};return(0,e.jsxs)(N.Menu.Item,{className:q,onClick:d,children:[(0,e.jsx)(vt,{}),(0,e.jsx)("span",{className:U,children:n})]})};function bt(n,t){if(n.type==="polar"&&!St(t))return[{scope:"series",labelKey:"pieSlice"}];const i=(0,h.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const a=[{scope:"data-point",labelKey:"bar"}];if(i){const o=t.position==="stack"||t.position==="fill";a.push({scope:"x-value",labelKey:o?"barStack":"barGroup"}),a.push({scope:"series",labelKey:"barSeries"})}return a}case"line":case"area":{const a=[{scope:"data-point",labelKey:"linePoint"}];return i&&a.push({scope:"series",labelKey:"lineSeries"}),a}case"point":{const a=[{scope:"data-point",labelKey:"scatterPoint"}];return i&&a.push({scope:"series",labelKey:"scatterSeries"}),a}default:return[]}}var St=n=>{const t=(0,h.extractVariableName)(n.mapping.x);return t!==null&&t!==h.CONSTANT_VARIABLES.x},jt=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),yt=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),It=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),wt=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Tt=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:".8",strokeWidth:"1.163",d:"m-1.618 15.96 9.118-5.3 11 2.34"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",stroke:"currentColor",strokeOpacity:"0.3",d:"M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,e.jsx)("rect",{width:"9.795",height:"6",x:"3",y:"2",fill:"currentColor",fillOpacity:"0.3",rx:"1.513"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:".8",d:"M5.29 6.62a1.3 1.3 0 0 1-.424-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.262-.45 2.1 2.1 0 0 1-.096-.699q0-.389.082-.693.083-.304.238-.514a1.05 1.05 0 0 1 .374-.322q.22-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.321-.105.54.54 0 0 0-.485.273q-.168.273-.17.75h.021a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .813.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.571.134m-.003-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.07-.294.54.54 0 0 0-.484-.285.55.55 0 0 0-.403.173.596.596 0 0 0 .108.914.53.53 0 0 0 .288.08M6.88 6.579v-.396l1.05-1.03q.15-.15.25-.27a1 1 0 0 0 .151-.229.6.6 0 0 0 .05-.236.432.432 0 0 0-.244-.405.6.6 0 0 0-.258-.056q-.15 0-.261.062a.43.43 0 0 0-.175.173.56.56 0 0 0-.06.267H6.86q0-.288.132-.5a.9.9 0 0 1 .362-.33q.231-.117.532-.117.303 0 .534.114.23.114.358.312a.8.8 0 0 1 .128.452.9.9 0 0 1-.065.334q-.065.164-.229.363-.162.2-.456.483l-.522.53v.021h1.318v.458zM10.57 6.62a1.3 1.3 0 0 1-.423-.075 1 1 0 0 1-.373-.244 1.2 1.2 0 0 1-.263-.45 2.1 2.1 0 0 1-.096-.699q0-.389.083-.693t.238-.514a1.05 1.05 0 0 1 .374-.322q.219-.11.492-.11.285 0 .505.112a.973.973 0 0 1 .526.744h-.54a.5.5 0 0 0-.17-.277.5.5 0 0 0-.322-.105.54.54 0 0 0-.484.273q-.168.273-.17.75h.02a.8.8 0 0 1 .188-.223.92.92 0 0 1 .569-.195.91.91 0 0 1 .814.477q.125.222.123.509 0 .297-.136.536a1 1 0 0 1-.383.372 1.15 1.15 0 0 1-.572.134m-.002-.443a.54.54 0 0 0 .288-.078.57.57 0 0 0 .2-.211.6.6 0 0 0 .073-.299.6.6 0 0 0-.071-.294.54.54 0 0 0-.483-.285.54.54 0 0 0-.403.173.597.597 0 0 0 .107.914.53.53 0 0 0 .289.08"})]}),Pt=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{stroke:"currentColor",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"bevel",strokeWidth:".993",d:"M1.5 12 6 6.5l4 3.5 4-5.5"}),(0,e.jsx)("circle",{cx:"1.493",cy:"11.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("circle",{cx:"5.993",cy:"6.493",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("circle",{cx:"9.993",cy:"9.993",r:".993",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("circle",{cx:"13.993",cy:"4.493",r:".993",fill:"currentColor",fillOpacity:"0.8"})]}),At=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Lt=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),_t=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 3.598 7.215)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 6.681 11.327)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 9.251 7.215)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:".8",rx:"1.028",transform:"matrix(-1 0 0 1 10.28 2.59)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 13.877 6.187)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 2.056 12.869)"}),(0,e.jsx)("rect",{width:"2.056",height:"2.056",fill:"currentColor",fillOpacity:"0.3",rx:"1.028",transform:"matrix(-1 0 0 1 15.933 .533)"})]}),Mt={bar:jt,barGroup:yt,barStack:wt,barSeries:It,linePoint:Tt,lineSeries:Pt,scatterPoint:Lt,scatterSeries:_t,pieSlice:At},Xe=({labelKey:n})=>{const t=Mt[n];return(0,e.jsx)(t,{})},Ye=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{d:"M5.01683 15.3331C4.84407 15.3343 4.67292 15.2997 4.51421 15.2314C4.3555 15.1632 4.21268 15.0627 4.09476 14.9365L3.88656 14.7283L3.62877 14.8968L3.19253 15.3331H0L2.24072 13.0923L2.03251 12.8445C1.89423 12.7191 1.78392 12.566 1.70875 12.3952C1.63359 12.2244 1.59526 12.0396 1.59626 11.853C1.59579 11.6818 1.63078 11.5124 1.69904 11.3554C1.76729 11.1984 1.86733 11.0573 1.99285 10.9409L11.2036 1.73012C11.3215 1.60384 11.4643 1.5034 11.623 1.43514C11.7817 1.36688 11.9529 1.33228 12.1257 1.33353C12.2969 1.33245 12.4665 1.36716 12.6236 1.43546C12.7807 1.50375 12.9218 1.60412 13.0378 1.73012L15.1496 3.92126C15.2748 4.03899 15.3745 4.1811 15.4427 4.33882C15.5108 4.49654 15.546 4.66655 15.546 4.83837C15.546 5.01019 15.5108 5.1802 15.4427 5.33792C15.3745 5.49564 15.2748 5.63774 15.1496 5.75548L5.93889 14.9662C5.81806 15.0866 5.67403 15.1812 5.51552 15.2443C5.35702 15.3074 5.18736 15.3376 5.01683 15.3331ZM2.48858 11.9125L5.01683 14.4407L9.47843 9.97913L6.95019 7.4608L2.48858 11.9125ZM7.68388 6.72712L10.2022 9.24544L14.644 4.80367L12.1257 2.28534L7.68388 6.72712Z",fill:"currentColor",fillOpacity:"0.8"})]}),Et=({label:n,options:t,onSelect:i})=>{const a=c.useI18n();return(0,e.jsx)(me,{label:n,icon:(0,e.jsx)(Ye,{}),children:t.map(o=>(0,e.jsxs)(V.Menu.Item,{className:q,onClick:()=>i(o.scope),children:[(0,e.jsx)(Xe,{labelKey:o.labelKey}),(0,e.jsx)("span",{className:U,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},Ot=({label:n,layer:t,observation:i,highlights:a,onRequestClose:o})=>{const r=c.useI18n(),{dispatch:s}=c.useGraphCommands(),d=c.useCompiledSelector(g=>g.coordSystem),l=(0,x.useMemo)(()=>(0,h.buildObservationPredicate)(t,i),[t,i]),p=(0,x.useMemo)(()=>bt(d,t),[d,t]),u=(0,x.useMemo)(()=>{const g=new Set(a.map(C=>C.scope));return p.filter(C=>!g.has(C.scope))},[p,a]),[m]=u;if(l===null||m===void 0)return null;const v=g=>{s(new h.AddHighlightCommand({predicate:l,scope:g,layerId:t.id})),o()};if(u.length===1){const g=p.length===1?n:r("graph.annotations.baseMenu.highlightWithLabel",{label:r(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,e.jsxs)(V.Menu.Item,{className:q,onClick:()=>v(m.scope),children:[(0,e.jsx)(Xe,{labelKey:m.labelKey}),(0,e.jsx)("span",{className:U,children:g})]})}return(0,e.jsx)(Et,{label:n,options:u,onSelect:v})},Nt="_1aafi1g0",Rt="_1aafi1g1",Je=({children:n})=>(0,e.jsxs)("span",{className:Nt,"aria-hidden":"true",children:[n,(0,e.jsx)("span",{className:Rt})]}),kt=({label:n,highlights:t,onRequestClose:i})=>{const{dispatch:a}=c.useGraphCommands(),o=t.at(-1);if(o===void 0)return null;const r=()=>{a(new h.RemoveHighlightCommand({id:o.id})),i()};return(0,e.jsxs)(N.Menu.Item,{className:q,onClick:r,children:[(0,e.jsx)(Je,{children:(0,e.jsx)(Ye,{})}),(0,e.jsx)("span",{className:U,children:n})]})},Dt=(n,t)=>{const i=c.useCompiledSelector(o=>o.spec.highlights),a=c.useCompiledSelector(o=>o.config.parsingLocale);return(0,x.useMemo)(()=>(0,h.findHighlightsAtObservation)({layer:n,highlights:i,observation:t,parsingLocale:a}),[n,i,t,a])},Qe=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{opacity:"0.12",d:"M13.5948 4.29016C13.8724 6.22367 12.5301 8.01618 10.5966 8.29384C8.66309 8.57151 6.87058 7.22918 6.59292 5.29567C6.31525 3.36216 7.65758 1.56965 9.59109 1.29198C11.5246 1.01432 13.3171 2.35665 13.5948 4.29016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.71886 3.51052C6.25611 1.3626 8.43287 0.0568985 10.5808 0.594151C12.7287 1.1314 14.0344 3.30817 13.4972 5.45609C13.0316 7.31748 11.3347 8.54637 9.49237 8.49145L7.50898 12.492C7.46485 12.581 7.40179 12.6548 7.32702 12.7108C7.20005 12.8073 7.03703 12.8532 6.87248 12.8303C6.80957 12.822 6.74697 12.8038 6.68687 12.7749C6.39369 12.6342 6.26689 12.2915 6.3923 11.9963L7.63393 7.97371C6.10249 7.10872 5.27136 5.29962 5.71886 3.51052ZM10.2785 1.80253C8.79799 1.4322 7.29756 2.33222 6.92723 3.81277C6.55691 5.29332 7.45692 6.79375 8.93747 7.16408C10.418 7.5344 11.9185 6.63439 12.2888 5.15384C12.6591 3.67329 11.7591 2.17285 10.2785 1.80253Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{d:"M5.42977 11.1572C5.70072 11.104 5.8772 10.8411 5.82393 10.5702C5.77067 10.2992 5.50784 10.1227 5.23688 10.176C4.31848 10.3565 3.57421 10.6423 3.04695 11.0266C2.51409 11.4149 2.16666 11.936 2.16666 12.557C2.16666 13.0322 2.41215 13.4327 2.74425 13.7433C3.07553 14.0531 3.52776 14.3091 4.04484 14.5137C5.08193 14.9239 6.48048 15.1666 7.99999 15.1666C9.5195 15.1666 10.9181 14.9239 11.9551 14.5137C12.4722 14.3091 12.9244 14.0531 13.2557 13.7433C13.5878 13.4327 13.8333 13.0322 13.8333 12.557C13.8333 11.936 13.4859 11.4149 12.953 11.0266C12.4258 10.6423 11.6815 10.3565 10.7631 10.176C10.4921 10.1227 10.2293 10.2992 10.176 10.5702C10.1228 10.8411 10.2993 11.104 10.5702 11.1572C11.4079 11.3219 11.997 11.5672 12.364 11.8347C12.7255 12.0981 12.8333 12.3496 12.8333 12.557C12.8333 12.6643 12.7803 12.8187 12.5727 13.013C12.3642 13.2079 12.0354 13.4065 11.5873 13.5838C10.6941 13.9371 9.426 14.1666 7.99999 14.1666C6.57398 14.1666 5.30586 13.9371 4.41267 13.5838C3.9646 13.4065 3.63578 13.2079 3.4273 13.013C3.21964 12.8187 3.16666 12.6643 3.16666 12.557C3.16666 12.3496 3.2745 12.0981 3.63595 11.8347C4.00299 11.5672 4.59206 11.3219 5.42977 11.1572Z",fill:"currentColor",fillOpacity:"0.8"})]}),Ht=({label:n,at:t,onRequestClose:i})=>{const{dispatch:a}=c.useGraphCommands(),o=()=>{a(new h.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),i()};return(0,e.jsxs)(N.Menu.Item,{className:q,onClick:o,children:[(0,e.jsx)(Qe,{}),(0,e.jsx)("span",{className:U,children:n})]})},en=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{opacity:"0.12",d:"M1.33334 8.00016C1.33334 4.31826 4.31811 1.3335 8.00001 1.3335C11.6819 1.3335 14.6667 4.31826 14.6667 8.00016C14.6667 11.6821 11.6819 14.6668 8.00001 14.6668C4.31811 14.6668 1.33334 11.6821 1.33334 8.00016Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{d:"M5.7328 9.69963C5.56696 9.47884 5.25352 9.43429 5.03273 9.60013C4.81193 9.76598 4.76739 10.0794 4.93323 10.3002C5.63175 11.2302 6.74548 11.8333 7.99993 11.8333C9.25438 11.8333 10.3681 11.2302 11.0666 10.3002C11.2325 10.0794 11.1879 9.76598 10.9671 9.60013C10.7463 9.43429 10.4329 9.47884 10.2671 9.69963C9.74929 10.3889 8.92657 10.8333 7.99993 10.8333C7.07329 10.8333 6.25057 10.3889 5.7328 9.69963Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{d:"M6.66668 6.66658C6.66668 7.03478 6.3682 7.33325 6.00001 7.33325C5.63182 7.33325 5.33334 7.03478 5.33334 6.66658C5.33334 6.29839 5.63182 5.99992 6.00001 5.99992C6.3682 5.99992 6.66668 6.29839 6.66668 6.66658Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{d:"M10 7.33325C10.3682 7.33325 10.6667 7.03478 10.6667 6.66658C10.6667 6.29839 10.3682 5.99992 10 5.99992C9.63182 5.99992 9.33334 6.29839 9.33334 6.66658C9.33334 7.03478 9.63182 7.33325 10 7.33325Z",fill:"currentColor",fillOpacity:"0.8"}),(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00001 0.833252C4.04197 0.833252 0.833344 4.04188 0.833344 7.99992C0.833344 11.958 4.04197 15.1666 8.00001 15.1666C11.9581 15.1666 15.1667 11.958 15.1667 7.99992C15.1667 4.04188 11.9581 0.833252 8.00001 0.833252ZM14.1667 7.99992C14.1667 11.4057 11.4058 14.1666 8.00001 14.1666C4.59425 14.1666 1.83334 11.4057 1.83334 7.99992C1.83334 4.59416 4.59425 1.83325 8.00001 1.83325C11.4058 1.83325 14.1667 4.59416 14.1667 7.99992Z",fill:"currentColor",fillOpacity:"0.8"})]}),nn={pinnedNumber:{icon:Qe,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:We,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:en,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},zt=n=>(0,h.isObservationAttachmentKind)(n.kind)&&nn[n.kind]!==null,Ft=({attachment:n,onRequestClose:t})=>{const i=c.useI18n(),{dispatch:a}=c.useGraphCommands(),{icon:o,labelKey:r}=nn[n.kind],s=()=>{a(new h.RemoveAnnotationCommand({id:n.annotation.id})),t()};return(0,e.jsxs)(N.Menu.Item,{className:q,onClick:s,children:[(0,e.jsx)(Je,{children:(0,e.jsx)(o,{})}),(0,e.jsx)("span",{className:U,children:i(r)})]})},Vt="ceeojg0",Gt="ceeojg1",Bt="ceeojg2",Kt=({label:n,at:t,onRequestClose:i})=>{const{dispatch:a}=c.useGraphCommands(),o=r=>{a(new h.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:r}})),i()};return(0,e.jsx)(me,{label:n,icon:(0,e.jsx)(en,{}),children:(0,e.jsx)("div",{className:Vt,children:Object.entries(c.STICKER_ASSETS).map(([r,s])=>(0,e.jsx)(V.Menu.Item,{className:Gt,"aria-label":r,onClick:()=>o(r),children:(0,e.jsx)("img",{className:Bt,src:s.src,alt:r})},r))})})},qt=({interaction:n,panelOrigin:t})=>{const i=c.useEditorStore(),a=c.useEditorState(r=>r.menuTrigger);if(n.kind!=="menu"||a===null)return null;const o=()=>{i.getState().releaseInteraction("menu")};return(0,e.jsx)(Ut,{trigger:{x:t.x+a.center.x,y:t.y+a.center.y,radius:a.radius},layer:n.anchor.layer,at:n.anchor.at,observation:n.anchor.observation,onClose:o})},Ut=({trigger:n,layer:t,at:i,observation:a,onClose:o})=>{const r=c.useI18n(),s=he(),d=c.useCompiledSelector(f=>f.spec.annotations),l=c.useCompiledSelector(f=>f.config.parsingLocale),p=Zt(),{x:u,y:m,radius:v}=n,g=(0,x.useMemo)(()=>Wt(u,m,v),[u,m,v]),C=(0,h.findObservationAttachment)(d,i,(0,x.useMemo)(()=>(0,h.createObservationAnchorParser)(t,l),[t,l])),y=C!==null&&zt(C)?C:null,T=Dt(t,a),j=(f,w)=>{!f&&$t(w.reason)&&o()};return(0,e.jsx)(N.Menu.Root,{open:p,modal:!1,onOpenChange:j,children:(0,e.jsx)(N.Menu.Portal,{container:s,children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(N.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:Ze,...Ke,children:(0,e.jsxs)(N.Menu.Popup,{className:$e,"data-testid":"observation-menu",children:[y!==null&&(0,e.jsx)(Ft,{attachment:y,onRequestClose:o}),(0,e.jsx)(kt,{label:r("graph.annotations.baseMenu.removeHighlight"),highlights:T,onRequestClose:o}),(0,e.jsx)(N.Menu.Separator,{className:lt}),y===null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ht,{label:r("graph.annotations.baseMenu.pinNumber"),at:i,onRequestClose:o}),(0,e.jsx)(gt,{label:r("graph.annotations.baseMenu.annotate"),placeholder:r("graph.annotations.textMenu.placeholder"),addLabel:r("graph.annotations.textMenu.addButton"),at:i,onRequestClose:o}),(0,e.jsx)(Kt,{label:r("graph.annotations.baseMenu.addSticker"),at:i,onRequestClose:o})]}),t.highlight!==null&&(0,e.jsx)(Ot,{label:r("graph.annotations.baseMenu.highlight"),layer:t,observation:a,highlights:T,onRequestClose:o}),(0,e.jsx)(ft,{label:r("graph.annotations.baseMenu.differenceArrow"),layer:t,at:i,onRequestClose:o})]})})})})})},Wt=(n,t,i)=>({getBoundingClientRect:()=>new DOMRect(n-i,t-i,i*2,i*2)}),Zt=()=>{const[n,t]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{t(!0)},[]),n},$t=n=>n==="outside-press"||n==="escape-key"||n==="item-press",Xt=()=>{const n=c.useGraphSelection();return tn(n)},tn=n=>{if(n.length!==1)return null;const[t]=n;return t?.kind==="annotation"?t.id:null},Yt=n=>(0,e.jsx)(c.Icon,{...n,children:(0,e.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,e.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Jt=n=>(0,e.jsx)(c.Icon,{...n,children:(0,e.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M4 7h16"}),(0,e.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,e.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,e.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),Qt={kind:"chrome-popup"},er="var(--q7gcrz0)",nr="var(--q7gcrz1)",tr="q7gcrz2",rr="q7gcrz3";var ar="q7gcrz5",or="q7gcrz6",ir="q7gcrz7",sr="q7gcrz8",rn="q7gcrz9",lr="q7gcrza";var ye="q7gcrzd q7gcrzc",an="q7gcrze q7gcrzc",cr=["absolute-difference","relative-difference","proportion"],Ie=["absolute-difference","relative-difference"],dr=["relative-difference","proportion"],ur={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},hr=n=>{const{formattingLocale:t}=c.useGraphContext(),i=c.useCompiledSelector(o=>o.config.parsingLocale),a=t??i;return(0,x.useMemo)(()=>{const o=(0,h.areEndpointsComparable)(n.start,n.end);return cr.filter(r=>o||!Ie.includes(r)||r===n.label).map(r=>({kind:r,nameKey:ur[r],preview:(0,h.formatDifferenceLabel)({locale:a,kind:r,startValue:n.start.measurementValue,endValue:n.end.measurementValue,valueFormat:n.start.valueFormat}),isPickable:o||!Ie.includes(r),isSuspect:dr.includes(r)&&n.start.measurementValue===0}))},[n,a])},$=8,mr=({labelBox:n,panelRect:t,frameWidth:i,frameHeight:a})=>{const o=t.y+n.y,r=o+n.height,s=o-8-36,d=r+8,l=pr($,s>=$?s:d,a-$-36),p=$;return{top:l,left:p,available:Math.max(0,i-$*2),centre:t.x+n.x+n.width/2-p}},pr=(n,t,i)=>Math.max(n,Math.min(t,i)),oe=[{id:"small",nameKey:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",nameKey:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",nameKey:"graph.annotations.differenceArrowToolbar.size.large"}],gr=({arrow:n,labelBox:t,panelRect:i,frameWidth:a,frameHeight:o,frameElement:r})=>{const s=c.useI18n(),{chartId:d,commands:l}=c.useGraphContext(),p=c.useEditorStore(),[u,m]=(0,x.useState)(null),v=hr(n),g=mr({labelBox:t,panelRect:i,frameWidth:a,frameHeight:o}),C=(j,f)=>{l.dispatch(new h.UpdateAnnotationCommand({kind:"differenceArrow",id:n.id,patch:j}),f)};(0,x.useEffect)(()=>()=>l.seal(),[l]),(0,x.useEffect)(()=>{const{claimInteraction:j,releaseInteraction:f}=p.getState();return u===null?f("chrome-popup"):j(Qt),()=>f("chrome-popup")},[p,u]);const y=j=>{m(j?"color":null),j||l.seal()},T=()=>{l.dispatch(new h.RemoveAnnotationCommand({id:n.id})),r.focus({preventScroll:!0})};return(0,e.jsx)("div",{className:tr,style:{top:g.top,left:g.left,width:g.available},children:(0,e.jsxs)(c.FloatingToolbar.Root,{"aria-label":s("graph.annotations.differenceArrowToolbar.label"),className:rr,"data-testid":"difference-arrow-toolbar",...Q(d),style:(0,Ve.assignInlineVars)({[er]:`${g.centre}px`,[nr]:`${g.available}px`}),children:[(0,e.jsx)(xr,{options:v,current:n.label,isOpen:u==="labelKind",onOpenChange:j=>m(j?"labelKind":null),onPick:j=>{C({label:j}),m(null)}}),(0,e.jsx)(c.FloatingToolbar.Separator,{}),(0,e.jsx)(c.FloatingToolbar.ColorPicker,{color:n.color,label:s("graph.annotations.differenceArrowToolbar.color"),onChange:j=>C({color:j},{transient:!0}),isOpen:u==="color",onOpenChange:y,popupAttributes:Q(d),children:(0,e.jsx)("span",{className:or,style:{background:n.color??"transparent"}})}),(0,e.jsx)(vr,{current:n.size,isOpen:u==="size",onOpenChange:j=>m(j?"size":null),onPick:j=>{C({size:j}),m(null)}}),(0,e.jsx)(c.FloatingToolbar.Separator,{}),(0,e.jsx)(c.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.swap"),className:ye,onClick:()=>C({start:n.end.anchor,end:n.start.anchor}),children:(0,e.jsx)(Yt,{size:"sm",title:""})}),(0,e.jsx)(c.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.remove"),className:ye,onClick:T,children:(0,e.jsx)(Jt,{size:"sm",title:""})})]})})},xr=({options:n,current:t,isOpen:i,onOpenChange:a,onPick:o})=>{const r=c.useI18n(),s=n.find(l=>l.kind===t),d=n.some(l=>l.isPickable&&l.kind!==t);return(0,e.jsxs)(N.Menu.Root,{open:i,modal:!1,onOpenChange:a,children:[(0,e.jsxs)(N.Menu.Trigger,{render:(0,e.jsx)(c.FloatingToolbar.Button,{}),"aria-label":r("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),className:an,disabled:!d,onMouseDown:l=>l.preventDefault(),children:[(0,e.jsx)("span",{className:ar,children:s===void 0?"":r(s.nameKey)}),s!==void 0&&(0,e.jsxs)("span",{className:"q7gcrz4",children:["(",s.preview,")"]}),(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})]}),(0,e.jsx)(on,{children:n.map(l=>(0,e.jsxs)(N.Menu.Item,{className:rn,"data-selected":l.kind===t,disabled:!l.isPickable,onClick:()=>o(l.kind),children:[(0,e.jsx)("span",{children:r(l.nameKey)}),(l.isSuspect||!l.isPickable)&&(0,e.jsx)("span",{"aria-label":r(l.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrzb",role:"img",children:"⚠"}),(0,e.jsx)("span",{className:lr,children:l.preview})]},l.kind))})]})},vr=({current:n,isOpen:t,onOpenChange:i,onPick:a})=>{const o=c.useI18n(),r=oe.find(s=>s.id===n)??oe[0];return(0,e.jsxs)(N.Menu.Root,{open:t,modal:!1,onOpenChange:i,children:[(0,e.jsxs)(N.Menu.Trigger,{render:(0,e.jsx)(c.FloatingToolbar.Button,{}),"aria-label":o("graph.annotations.differenceArrowToolbar.size.ariaLabel"),className:an,onMouseDown:s=>s.preventDefault(),children:[(0,e.jsx)("span",{children:r===void 0?"":o(r.nameKey)}),(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})]}),(0,e.jsx)(on,{children:oe.map(s=>(0,e.jsx)(N.Menu.Item,{className:rn,"data-selected":s.id===n,onClick:()=>a(s.id),children:o(s.nameKey)},s.id))})]})},on=({children:n})=>{const{chartId:t}=c.useGraphContext();return(0,e.jsx)(N.Menu.Portal,{container:c.resolvePortalContainer(),children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(N.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:ir,children:(0,e.jsx)(N.Menu.Popup,{className:sr,onMouseDown:i=>i.preventDefault(),...Q(t),children:n})})})})};var Cr="ydgo3h0",fr="ydgo3h1",br="ydgo3h2",sn=n=>n==="start"?"end":"start",ln=({dispatch:n,arrow:t,endpoint:i,anchor:a})=>{(0,h.areAnchorsEqual)(a,t[i].anchor)||n(new h.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[i]:a}}))},Sr=({clientPoint:n,panelOrigin:t,panelRect:i,engine:a,layers:o,coordSystem:r,resolver:s,fixedAnchor:d,align:l})=>{const p=jr({x:n.x-t.x,y:n.y-t.y},i),{primary:u}=a.query((0,h.toPanelCursor)(p,i));if(u===null)return null;const m=o.find(g=>g.id===u.layerId);if(m===void 0)return null;const v=(0,h.resolveObservationPoint)({resolver:s,layer:m,observation:u.observation,coordSystem:r,align:l});return v===null||(0,h.areAnchorsEqual)(v.anchor,d)?null:v},jr=(n,t)=>({x:Math.max(0,Math.min(n.x,t.width)),y:Math.max(0,Math.min(n.y,t.height))}),yr=class{constructor(n){this.params=n,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.finish(!0))},this.handleLost=t=>{t.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const t=this.pendingEvent;if(this.pendingEvent=null,t===null)return;const{editorStore:i,engine:a,anchorResolver:o,endpoint:r,readInputs:s}=this.params,{arrow:d,panelOrigin:l,panelRect:p,layers:u,coordSystem:m}=s(),v=i.getState();if(this.hasPublished&&c.readDraggedEndpointFor(c.readStanding(v,"endpoint-drag"),d.id,r)===null)return;const g=Sr({clientPoint:{x:t.clientX,y:t.clientY},panelOrigin:l,panelRect:p,engine:a,layers:u,coordSystem:m,resolver:o,fixedAnchor:d[sn(r)].anchor,align:d[r].anchor.align});g!==null&&this.publish(g)}}start(){const{handle:n}=this.params,{signal:t}=this.listeners;n.addEventListener("pointermove",this.handleMove,{signal:t}),n.addEventListener("pointerup",this.handleUp,{signal:t}),n.addEventListener("lostpointercapture",this.handleLost,{signal:t})}finish(n){this.params.onSettled(),this.listeners.abort(),this.cancelFrame(),n&&this.hasMoved&&this.runFrame(),this.pendingEvent=null;const{editorStore:t,endpoint:i,readInputs:a,dispatch:o}=this.params,{arrow:r}=a(),s=t.getState(),d=c.readDraggedEndpointFor(c.readStanding(s,"endpoint-drag"),r.id,i);d!==null&&(s.releaseInteraction("endpoint-drag"),n&&ln({dispatch:o,arrow:r,endpoint:i,anchor:d.point.anchor}))}publish(n){const{editorStore:t,readInputs:i,endpoint:a}=this.params;t.getState().claimInteraction({kind:"endpoint-drag",annotationId:i().arrow.id,endpoint:a,point:n}),this.hasPublished=!0}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Ir=({arrow:n,panelOrigin:t,panelRect:i})=>{const{commands:a,anchorResolver:o}=c.useGraphContext(),{engine:r}=c.useHoverContext(),s=c.useEditorStore(),d=c.useLatestRef({arrow:n,panelOrigin:t,panelRect:i,...c.useCompiledSelector((0,ue.useShallow)(p=>({layers:p.layers,coordSystem:p.coordSystem})))}),l=(0,x.useRef)(null);return(0,x.useEffect)(()=>()=>l.current?.finish(!1),[]),(0,x.useCallback)(p=>({onClick:u=>u.stopPropagation(),onPointerDown:u=>{if(u.button!==0||l.current!==null)return;try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault();const m=new yr({handle:u.currentTarget,pointerId:u.pointerId,endpoint:p,readInputs:()=>d.current,editorStore:s,engine:r,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{l.current=null}});l.current=m,m.start()}}),[d,s,r,o,a])},wr=[" ","Enter"],Tr=({arrow:n})=>{const{commands:t,anchorResolver:i}=c.useGraphContext(),a=c.useEditorStore(),{layers:o,coordSystem:r,mainAxis:s}=c.useCompiledSelector((0,ue.useShallow)(l=>({layers:l.layers,coordSystem:l.coordSystem,mainAxis:l.coordSystem.type==="cartesian"?l.coordSystem.mainAxis:"x"}))),d=n.id;return(0,x.useEffect)(()=>()=>{const l=a.getState();c.readStanding(l,"endpoint-drag")?.annotationId===d&&l.releaseInteraction("endpoint-drag")},[a,d]),(0,x.useCallback)(l=>({onKeyDown:p=>{if(p.altKey||p.ctrlKey||p.metaKey||p.shiftKey)return;const u=a.getState(),m=c.readDraggedEndpointFor(c.readStanding(u,"endpoint-drag"),n.id,l);if(wr.includes(p.key)){if(p.preventDefault(),p.repeat)return;if(m===null)return u.claimInteraction({kind:"endpoint-drag",annotationId:n.id,endpoint:l,point:n[l]});u.releaseInteraction("endpoint-drag"),ln({dispatch:t.dispatch,arrow:n,endpoint:l,anchor:m.point.anchor});return}if(m===null)return;const v=Pr(p.key,s);if(v===null)return;p.preventDefault();const g=Ar({arrow:n,endpoint:l,from:m.point.anchor,move:v,layers:o,coordSystem:r,resolver:i});g!==null&&u.claimInteraction({kind:"endpoint-drag",annotationId:n.id,endpoint:l,point:g})}}),[n,a,t,i,o,r,s])},Pr=(n,t)=>{const i=n==="ArrowUp"||n==="ArrowDown";return!i&&!(n==="ArrowLeft"||n==="ArrowRight")?null:{axis:t==="x"===i?"cross":"main",step:n==="ArrowDown"||n==="ArrowRight"?1:-1}},Ar=({arrow:n,endpoint:t,from:i,move:a,layers:o,coordSystem:r,resolver:s})=>{const d=o.find(p=>p.id===i.layerId);if(d===void 0)return null;const l=(0,h.stepDifferenceArrowEndpoint)({layer:d,from:i,partner:n[sn(t)].anchor,axis:a.axis,step:a.step,canLandOn:p=>(0,h.resolveObservationPoint)({resolver:s,layer:d,observation:p,coordSystem:r,align:n[t].anchor.align})!==null});return l===null?null:(0,h.resolveObservationPoint)({resolver:s,layer:d,observation:l.observation,coordSystem:r,align:n[t].anchor.align})},Lr=n=>{const t=Xt();return t===null?null:(0,e.jsx)(_r,{annotationId:t,...n})},_r=({annotationId:n,...t})=>{const i=c.useDifferenceArrowGeometries(),a=(0,x.useMemo)(()=>i.find(o=>o.id===n),[i,n]);return a===void 0?null:(0,e.jsx)(Mr,{committedArrow:a.committedArrow,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...t})},Mr=({committedArrow:n,committedLabelBox:t,labelBox:i,start:a,end:o,panelRect:r,panelOrigin:s,frameRect:d,frameElement:l,isDragged:p})=>{const u=Ir({arrow:n,panelOrigin:s,panelRect:r}),m=Tr({arrow:n});return(0,e.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!p&&(0,e.jsx)(gr,{arrow:n,labelBox:t,panelRect:r,frameWidth:d.width,frameHeight:d.height,frameElement:l}),(0,e.jsx)("div",{"aria-hidden":"true",className:br,"data-testid":"difference-arrow-selection-label",style:{left:r.x+i.x-2,top:r.y+i.y-2,width:i.width+4,height:i.height+4}}),(0,e.jsx)(we,{endpoint:"start",point:a,panelRect:r,dragHandlers:u("start"),keyboardHandlers:m("start")}),(0,e.jsx)(we,{endpoint:"end",point:o,panelRect:r,dragHandlers:u("end"),keyboardHandlers:m("end")})]})},we=({endpoint:n,point:t,panelRect:i,dragHandlers:a,keyboardHandlers:o})=>(0,e.jsx)("div",{className:Cr,"data-testid":"difference-arrow-selection-handle","data-endpoint":n,role:"button",style:{left:i.x+t.x,top:i.y+t.y},tabIndex:0,...a,...o,children:(0,e.jsx)("span",{"aria-hidden":"true",className:fr})}),Er=n=>(0,e.jsx)(c.Icon,{...n,children:(0,e.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M12 5v14"}),(0,e.jsx)("path",{d:"M5 12h14"})]})}),Or="var(--_1tyillx0)",Nr={rest:.5,hovered:.75,open:1};var Rr="_1tyillx1",kr={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},Dr="_1tyillx5",Hr={closed:"_1tyillx6",open:"_1tyillx7"},zr=({interaction:n,panelRect:t})=>{const i=c.useEditorStore(),a=c.useCompiledSelector(d=>d.coordSystem),o=n.kind==="trigger"||n.kind==="menu"?n.anchor:null,r=Fr(n),s=(0,x.useMemo)(()=>{if(o===null)return null;const d=(0,h.projectAnchorToPanel)(o.position,t,a);return{center:d,radius:19*Nr[r],target:{kind:"observation",cursor:(0,h.toPanelCursor)(d,t)}}},[o,t,a,r]);return(0,x.useEffect)(()=>{i.getState().setMenuTrigger(s)},[i,s]),(0,x.useEffect)(()=>()=>i.getState().setMenuTrigger(null),[i]),o===null||s===null?null:(0,e.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":r,className:(0,G.default)(Rr,kr[r]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,Ve.assignInlineVars)({[Or]:o.color??Qn.vars.border50})},children:(0,e.jsx)("span",{className:(0,G.default)(Dr,Hr[r==="open"?"open":"closed"]),children:(0,e.jsx)(Er,{size:"lg"})})})},Fr=n=>n.kind==="menu"?"open":n.kind==="trigger"&&n.isEngaged?"hovered":"rest",Vr='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Gr=(n,t)=>{const{chartId:i}=c.useGraphContext(),a=c.useEditorStore();(0,x.useEffect)(()=>{if(t===null)return;const o=r=>{if(r.key!=="Tab"||r.defaultPrevented||!Y(r.target,n,i)||a.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(Vr)];if(s.length===0)return;r.preventDefault();const d=s.findIndex(l=>l===document.activeElement);s[d===-1?r.shiftKey?s.length-1:0:(d+(r.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n,t,i,a])},Br=n=>{const{selectionStore:t,chartId:i}=c.useGraphContext();(0,x.useEffect)(()=>{let a=null;const o=()=>{n.focus({preventScroll:!0})},r=d=>{const{selection:l,clearSelection:p}=t.getState();l.length!==0&&(Y(d.target,n,i)||p())},s=d=>{t.getState().selection.length!==0&&Y(d.target,n,i)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(Y(document.activeElement,n,i)||t.getState().clearSelection())}))};return n.addEventListener("pointerdown",o),document.addEventListener("focusin",r),document.addEventListener("focusout",s),()=>{a!==null&&cancelAnimationFrame(a),n.removeEventListener("pointerdown",o),document.removeEventListener("focusin",r),document.removeEventListener("focusout",s)}},[n,t,i])},Kr=n=>{const{selectionStore:t,commands:i,chartId:a}=c.useGraphContext(),o=c.useEditorStore(),r=(0,x.useCallback)(d=>{const{selection:l}=t.getState(),p=tn(l);p!==null&&(d.preventDefault(),i.dispatch(new h.RemoveAnnotationCommand({id:p})),n.focus({preventScroll:!0}))},[n,i,t]),s=(0,x.useCallback)(d=>{const l=o.getState();switch(l.standingInteraction?.kind){case"endpoint-drag":l.releaseInteraction("endpoint-drag");return;case"chrome-popup":return;case"menu":l.releaseInteraction("menu");return;default:if(qe(d.target,a)){n.focus({preventScroll:!0});return}t.getState().clearSelection();return}},[o,t,n,a]);(0,x.useEffect)(()=>{const d=l=>{if(Y(l.target,n,a)&&!qr(l.target)&&!at(l.target))switch(l.key){case"Escape":return s(l);case"Delete":case"Backspace":return r(l);default:return}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,r,s,a])},qr=n=>n instanceof HTMLElement&&(n.isContentEditable||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement),Ur=`[${c.EDIT_TARGET_KIND_ATTRIBUTE}]`,cn=(n,t,i)=>{if(typeof document.elementsFromPoint!="function")return null;const a=document.elementsFromPoint(n,t);return Wr(a,i)},Wr=(n,t)=>{for(const i of n){const a=i.closest(Ur);if(a===null||!t.contains(a))continue;const o=Zr(a);if(o!==null)return o}return null},Zr=n=>{const t=n.getAttribute(c.EDIT_TARGET_KIND_ATTRIBUTE);if(t!=="annotation")return null;const i=n.getAttribute(c.EDIT_TARGET_ID_ATTRIBUTE);return i===null||i===""?null:{kind:t,id:i}},$r=()=>{const n=c.useHoverState(o=>o.hover.primary),{layers:t,coordSystem:i}=c.useCompiledSelector((0,ue.useShallow)(o=>({layers:o.layers,coordSystem:o.coordSystem}))),{anchorResolver:a}=c.useGraphContext();return(0,x.useMemo)(()=>{if(n===null)return null;const o=t.find(d=>d.id===n.layerId);if(o===void 0)return null;const r=a.resolve(o.geom,n.observation,{coordSystem:i,position:o.position,purpose:"pin"});if(r===null)return null;const s=(0,h.buildObservationAnchor)(o,n.observation);return s===null?null:{position:r,color:(0,h.getColor)(n.observation),layer:o,at:s,observation:n.observation}},[n,t,i,a])},Xr={kind:"idle"},dn=()=>{const n=c.useEditorState(a=>a.standingInteraction),t=c.useEditorState(a=>a.chromeUnderPointer),i=$r();return(0,x.useMemo)(()=>n!==null?n:i===null?Xr:{kind:"trigger",anchor:i,isEngaged:t==="menu-trigger"},[n,i,t])},Yr=(n,t)=>{const i=c.useEditorStore(),a=c.useLatestRef(t);(0,x.useEffect)(()=>{let o=null,r=null;const s=m=>{const{menuTrigger:v}=i.getState();return v===null?null:(0,h.isPointWithinEditMenuTrigger)(m,v)?"menu-trigger":null},d=()=>{o=null;const m=r;if(r=null,m===null)return;const v=a.current,g=i.getState();g.setChromeUnderPointer(s({x:m.x-v.x,y:m.y-v.y})),g.standingInteraction?.kind!=="menu"&&g.setEditTargetUnderPointer(cn(m.x,m.y,n))},l=()=>{const m=i.getState();m.setChromeUnderPointer(null),m.setEditTargetUnderPointer(null)},p=m=>{r={x:m.clientX,y:m.clientY},o===null&&(o=requestAnimationFrame(d))},u=()=>{r=null,o!==null&&(cancelAnimationFrame(o),o=null),l()};return n.addEventListener("pointermove",p),n.addEventListener("pointerleave",u),()=>{o!==null&&cancelAnimationFrame(o),n.removeEventListener("pointermove",p),n.removeEventListener("pointerleave",u),l()}},[n,i,a])},Te="editor",Pe=[],Jr=(n,t,i,a)=>{const o=dn(),{store:r}=c.useHoverContext(),s=c.useGraphSelection().length>0,d=c.useEditorState(u=>u.menuTrigger),l=o.kind==="menu",p=(0,x.useMemo)(()=>d===null?Pe:[(0,h.buildEditMenuTriggerRegion)(d)],[d]);Yr(n,t),Qr(o,n,t,i),Br(n),Kr(n),Gr(n,a),(0,x.useEffect)(()=>(r.getState().publishPointerRegions(Te,p),()=>r.getState().publishPointerRegions(Te,Pe)),[r,p]),(0,x.useEffect)(()=>(r.getState().setPointerSuspended(l||s),()=>r.getState().setPointerSuspended(!1)),[r,l,s]),(0,x.useEffect)(()=>{if(!s)return;const u=r.getState();u.setHoverState(h.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[r,s])},Qr=(n,t,i,a)=>{const o=c.useEditorStore(),{selectionStore:r}=c.useGraphContext(),{store:s,engine:d}=c.useHoverContext(),l=c.useLatestRef(n),p=c.useLatestRef(i),u=c.useLatestRef(a);(0,x.useEffect)(()=>{const m=j=>{const{menuTrigger:f}=o.getState();return f===null?!1:(0,h.isPointWithinEditMenuTrigger)(Ae(j,p.current),f)},v=j=>{if(m(j)||r.getState().selection.length>0)return;const f=u.current,w=Ae(j,p.current),P=ea(w,f)?d.query((0,h.toPanelCursor)(w,f)):h.RESTING_HOVER_STATE;s.getState().setHoverState(P)};let g=!1;const C=()=>{g=l.current.kind==="menu"},y=j=>{const f=cn(j.clientX,j.clientY,t),w=r.getState();if(f===null){w.clearSelection();return}w.setSelection([f])},T=j=>{if(ot(j.target))return;const{claimInteraction:f,releaseInteraction:w}=o.getState(),P=m(j);if(!P||g){w("menu"),P||y(j),g&&v(j);return}const R=l.current;R.kind==="trigger"&&f({kind:"menu",anchor:R.anchor})};return document.addEventListener("pointerdown",C,!0),document.addEventListener("click",T),()=>{document.removeEventListener("pointerdown",C,!0),document.removeEventListener("click",T)}},[o,r,t,l,s,d,p,u])},Ae=(n,t)=>({x:n.clientX-t.x,y:n.clientY-t.y}),ea=(n,t)=>n.x>=0&&n.x<=t.width&&n.y>=0&&n.y<=t.height,na=({frameElement:n,panelRect:t})=>{const{measureRef:i,screenRect:a}=c.useElementScreenRect(),o=c.useEditorStore();return(0,x.useEffect)(()=>(i(n),()=>i(null)),[i,n]),(0,x.useEffect)(()=>()=>o.getState().releaseInteraction("menu"),[o]),a===null?null:(0,e.jsx)(st,{children:(0,e.jsx)(ta,{frameElement:n,frameRect:a,panelRect:t})})},ta=({frameElement:n,frameRect:t,panelRect:i})=>{const a=(0,x.useMemo)(()=>({x:t.left+i.x,y:t.top+i.y}),[t.left,t.top,i.x,i.y]),[o,r]=(0,x.useState)(null);return Jr(n,a,i,o),(0,e.jsx)(ra,{frameElement:n,frameRect:t,panelOrigin:a,panelRect:i,boxRef:r})},ra=({frameElement:n,frameRect:t,panelOrigin:i,panelRect:a,boxRef:o})=>{const r=he(),s=dn();return(0,e.jsx)(c.OverlayPortal,{rect:t,zIndex:c.Z_INDEX.editorOverlay,container:r,"data-testid":"editor-overlay",boxRef:o,children:(0,e.jsxs)(c.PortalThemeProvider,{children:[(0,e.jsx)(Lr,{panelRect:a,panelOrigin:i,frameRect:t,frameElement:n}),(0,e.jsx)(zr,{interaction:s,panelRect:a}),(0,e.jsx)(qt,{interaction:s,panelOrigin:i})]})})},aa=({slots:n,...t})=>(0,e.jsx)(c.EditorProvider,{children:(0,e.jsx)(c.GraphRenderer,{slots:(0,x.useMemo)(()=>({EditorSurface:na,...n}),[n]),...t})}),un=(0,x.createContext)(null),hn=({labelId:n,controlId:t,children:i})=>{const a=(0,x.useMemo)(()=>{let o=null;return{labelId:n,controlId:t,claimControlId:r=>(o??=r,o===r)}},[n,t]);return(0,e.jsx)(un.Provider,{value:a,children:i})},B=({id:n,ariaLabel:t,ariaLabelledBy:i},a=!0)=>{const o=(0,x.useContext)(un),r=(0,x.useId)(),[s]=(0,x.useState)(()=>a?o?.claimControlId(r)??!1:!1),d=n??(s?o?.controlId:void 0),l=i??(t===void 0?o?.labelId:void 0);return{...d!==void 0&&{id:d},...t!==void 0&&{"aria-label":t},...l!==void 0&&{"aria-labelledby":l}}};var oa={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},mn=({label:n,icon:t,onClick:i,variant:a="default",isDisabled:o,ariaLabel:r,ariaLabelledBy:s,id:d})=>{const l=B({id:d,ariaLabel:r,ariaLabelledBy:s}),p=a==="tile";return(0,e.jsxs)("button",{type:"button",className:oa[a],disabled:o,onClick:i,...l,children:[t!==void 0&&(0,e.jsx)("span",{className:"woi4bh0",children:t}),n!==void 0&&(0,e.jsx)("span",{className:p?"woi4bh2":"woi4bh1",children:n})]})},pe=(0,x.createContext)(null),L=()=>{const n=(0,x.useContext)(pe);if(!n)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return n},pn=({children:n,onKeyDown:t,...i})=>{const a=(0,x.useContext)(pe),o=r=>{if(t?.(r),!a||r.defaultPrevented)return;const s=c.resolveHistoryStep(r.nativeEvent);s&&(r.preventDefault(),s==="undo"?a.undo():a.redo())};return(0,e.jsx)("div",{onKeyDown:o,...i,children:n})},gn="keyboard",ne=n=>{const t=(0,x.useRef)(!1),i=(0,x.useRef)(!1),a=()=>{t.current=!1,i.current&&(i.current=!1,n?.())};return{commitAfterChange:()=>{if(t.current){i.current=!0;return}n?.()},commitUnlessHeldKey:o=>{if(o){i.current=!0;return}n?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},ia="eh8dvc0",sa="eh8dvc1 uz3g760",la="eh8dvc2 uz3g761";var xn=({value:n,onChange:t,onCommit:i,min:a,max:o,step:r,prefix:s,suffix:d,isDisabled:l,hasError:p,ariaLabel:u,ariaLabelledBy:m,id:v})=>{const g=B({id:v,ariaLabel:u,ariaLabelledBy:m}),{commitUnlessHeldKey:C,gestureHandlers:y}=ne(i);return(0,e.jsx)(Se.NumberField.Root,{className:ia,value:n,onValueChange:T=>t(T),onValueCommitted:(T,j)=>{C(j.reason===gn)},min:a,max:o,step:r,disabled:l,children:(0,e.jsxs)(pn,{className:sa,"data-error":p===!0,"data-disabled":l===!0?"":void 0,children:[s!==void 0&&(0,e.jsx)("span",{className:"eh8dvc3",children:s}),(0,e.jsx)(Se.NumberField.Input,{className:la,...y,"aria-invalid":p===!0?!0:void 0,...g}),d!==void 0&&(0,e.jsx)("span",{className:"eh8dvc3",children:d})]})})},ca="_1b7s5f0",W={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},da="_1b7s5f7";var ua=6,vn=({options:n,value:t,onChange:i,onCommit:a,columns:o,itemLayout:r="tile",isDisabled:s,ariaLabel:d,ariaLabelledBy:l,id:p})=>{const u=B({id:p,ariaLabel:d,ariaLabelledBy:l}),m=r==="swatch",{commitAfterChange:v,gestureHandlers:g}=ne(a);return(0,e.jsx)(Be.RadioGroup,{className:(0,G.default)(ca,ha(o??n.length)),value:t,onValueChange:C=>{i(C),v()},...g,disabled:s,...u,children:n.map(C=>(0,e.jsxs)(Ge.Radio.Root,{value:C.value,disabled:C.isDisabled,className:(0,G.default)(da,m&&"_1b7s5f8"),"aria-label":m?C.label:void 0,children:[C.icon,!m&&(0,e.jsx)("span",{className:"_1b7s5f9",children:C.label})]},C.value))})},ha=n=>{switch(Math.min(Math.max(Math.round(n),1),ua)){case 1:return W[1];case 2:return W[2];case 3:return W[3];case 4:return W[4];case 5:return W[5];default:return W[6]}},ma="_1g5x15w0 uz3g760",pa="_1g5x15w1",ga="_1g5x15w2",Le="_1g5x15w3",xa="_1g5x15w4",va="_1g5x15w5",Ca="_1g5x15w6",fa="_1g5x15w7";var Cn=({options:n,value:t,onChange:i,placeholder:a,isDisabled:o,hasError:r,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const p=B({id:l,ariaLabel:s,ariaLabelledBy:d});return(0,e.jsxs)(z.Select.Root,{value:t,onValueChange:u=>u!==null&&i(u),disabled:o,items:n.map(u=>({value:u.value,label:u.label})),children:[(0,e.jsxs)(z.Select.Trigger,{className:ma,"data-error":r===!0,...p,children:[(0,e.jsx)(z.Select.Value,{className:pa,children:u=>ba(n,u,a)}),(0,e.jsx)(z.Select.Icon,{className:Le,children:(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})})]}),(0,e.jsx)(z.Select.Portal,{container:c.resolvePortalContainer(),children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(z.Select.Positioner,{className:xa,sideOffset:4,alignItemWithTrigger:!1,children:(0,e.jsx)(z.Select.Popup,{className:va,children:n.map(u=>(0,e.jsxs)(z.Select.Item,{value:u.value,disabled:u.isDisabled,className:Ca,children:[u.icon,(0,e.jsxs)("span",{className:fa,children:[(0,e.jsx)(z.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,e.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,e.jsx)(z.Select.ItemIndicator,{className:Le,children:(0,e.jsx)(c.CheckIcon,{size:"sm"})})]},u.value))})})})})]})},ba=(n,t,i)=>t===null?(0,e.jsx)("span",{className:ga,children:i}):Sa(n,t),Sa=(n,t)=>n.find(i=>i.value===t)?.label??t,ja="vod76w0",ya="vod76w1",Ia="vod76w2",wa="vod76w3",Ta="vod76w4",Pa="vod76w5";var fn=({value:n,onChange:t,onCommit:i,min:a,max:o,step:r,suffix:s,formatValue:d,isDisabled:l,ariaLabel:p,ariaLabelledBy:u})=>{const m=B({ariaLabel:p,ariaLabelledBy:u},!1),v=Aa(n,s,d),{commitUnlessHeldKey:g,gestureHandlers:C}=ne(i);return(0,e.jsxs)("div",{className:ja,children:[(0,e.jsx)(Z.Slider.Root,{className:ya,value:n,onValueChange:y=>t(y),onValueCommitted:(y,T)=>{g(T.reason===gn)},min:a,max:o,step:r,disabled:l,children:(0,e.jsx)(Z.Slider.Control,{className:Ia,children:(0,e.jsxs)(Z.Slider.Track,{className:wa,children:[(0,e.jsx)(Z.Slider.Indicator,{className:Ta}),(0,e.jsx)(Z.Slider.Thumb,{className:Pa,...C,...m})]})})}),v!==null&&(0,e.jsx)("span",{className:"vod76w6",children:v})]})},Aa=(n,t,i)=>i!==void 0?i(n):t!==void 0?`${n}${t}`:null,La="_1hyrlw60",_a="_1hyrlw61",bn=({isChecked:n,onChange:t,isDisabled:i,ariaLabel:a,ariaLabelledBy:o,id:r})=>{const s=B({id:r,ariaLabel:a,ariaLabelledBy:o});return(0,e.jsx)(je.Switch.Root,{checked:n,onCheckedChange:d=>t(d),disabled:i,className:La,...s,children:(0,e.jsx)(je.Switch.Thumb,{className:_a})})},Ma="uz3g761",Ea="tpcnun0 uz3g760",Sn=({value:n,onChange:t,onCommit:i,placeholder:a,isDisabled:o,hasError:r,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const p=B({id:l,ariaLabel:s,ariaLabelledBy:d});return(0,e.jsx)(pn,{className:Ea,"data-error":r===!0,children:(0,e.jsx)(nt.Input,{className:Ma,value:n,onValueChange:u=>t(u),onBlur:i,placeholder:a,disabled:o,"aria-invalid":r===!0?!0:void 0,...p})})},Oa="cnu9yl0",Na="cnu9yl1";var jn=({options:n,value:t,onChange:i,onCommit:a,itemLayout:o="inline",isDisabled:r,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const p=B({id:l,ariaLabel:s,ariaLabelledBy:d}),u=o==="stacked",{commitAfterChange:m,gestureHandlers:v}=ne(a);return(0,e.jsx)(Be.RadioGroup,{className:Oa,value:t,onValueChange:g=>{i(g),m()},...v,disabled:r,...p,children:n.map(g=>(0,e.jsxs)(Ge.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,G.default)(Na,u&&"cnu9yl2"),"aria-label":Ra(g,u),children:[g.icon,yn(g,u)&&(0,e.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},yn=(n,t)=>n.icon===void 0||t,Ra=(n,t)=>{if(!yn(n,t))return n.label},In={ToggleGroup:jn,Switch:bn,Slider:fn,RadioGrid:vn,Button:mn,TextField:Sn,NumberField:xn,Select:Cn},wn=(0,x.createContext)(In),ka=({controls:n,children:t})=>{const i=(0,x.useMemo)(()=>({...In,...n}),[n]);return(0,e.jsx)(wn.Provider,{value:i,children:t})},_=()=>(0,x.useContext)(wn),Da="_12lhx9e0",Tn=({children:n})=>(0,e.jsx)("div",{className:Da,children:n}),Ha="_139ohwv0",D=({children:n})=>(0,e.jsx)("div",{className:Ha,children:n}),Pn=(0,x.createContext)(null),za=Pn.Provider,An=()=>{const n=(0,x.useContext)(Pn);if(!n)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return n},Fa="_1jlczkt0",Ln="data-graphy-editor-panel",Va={List:D,Grid:Tn};function Ga(n){if(n===void 0)return!1;const t=n.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var Ba=({handle:n,children:t,controls:i,defaultExpandedSection:a=void 0,className:o})=>{const r=c.useGraphHandle(n),{themeClass:s,inlineVarsStyle:d}=c.useThemeContext(),[l,p]=(0,x.useState)(()=>a?[a]:[]),u=(0,x.useMemo)(()=>({expandSection:m=>p([m]),collapseAllSections:()=>p([])}),[]);return(0,e.jsx)(pe.Provider,{value:r,children:(0,e.jsx)(ka,{controls:i,children:(0,e.jsx)(za,{value:u,children:(0,e.jsx)(X.Accordion.Root,{[Ln]:"",className:(0,G.default)(Fa,o,{[s]:!Ga(o)}),style:d,value:l,onValueChange:m=>p(m),children:t})})})})},ge={Root:Ba,Controls:Va},_e={stack:"pr583x0",grid:"pr583x1"},Me="pr583x2",Ka="pr583x3",b=({label:n,layout:t="grid",children:i})=>{const a=(0,x.useId)(),o=(0,x.useId)();return n===void 0?(0,e.jsx)("div",{className:_e[t],children:(0,e.jsx)("div",{className:Me,children:i})}):(0,e.jsxs)("div",{className:_e[t],children:[(0,e.jsx)("label",{id:a,htmlFor:o,className:Ka,children:n}),(0,e.jsx)("div",{className:Me,children:(0,e.jsx)(hn,{labelId:a,controlId:o,children:i})})]})},qa=n=>(0,e.jsx)(c.Icon,{...n,children:(0,e.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"m9 6 6 6-6 6"})})}),xe="_40zvwv0",ve="_40zvwv1",Ua="_40zvwv2",_n="_40zvwv3",Wa="_40zvwv4 _40zvwv3";var Za="_40zvwv6";var $a="_40zvwv8",O=({title:n,layout:t="fixed",preview:i,accessory:a,onOpenChange:o,children:r})=>t==="collapsible"?(0,e.jsx)(Ya,{title:n,preview:i,accessory:a,onOpenChange:o,children:r}):t==="inline"&&i===void 0?(0,e.jsx)(Xa,{title:n,accessory:a,children:r}):(0,e.jsxs)("div",{className:xe,children:[(0,e.jsxs)("div",{className:ve,children:[(0,e.jsx)("span",{className:_n,children:n}),i!==void 0&&(0,e.jsx)("span",{className:"_40zvwv5",children:i}),a!==void 0&&(0,e.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,e.jsx)("div",{children:r})]}),Xa=({title:n,accessory:t,children:i})=>{const a=(0,x.useId)(),o=(0,x.useId)();return(0,e.jsx)("div",{className:xe,children:(0,e.jsxs)("div",{className:ve,children:[(0,e.jsx)("label",{id:a,htmlFor:o,className:Wa,children:n}),(0,e.jsx)("span",{className:Za,children:(0,e.jsx)(hn,{labelId:a,controlId:o,children:i})}),t!==void 0&&(0,e.jsx)("span",{className:"_40zvwv7",children:t})]})})},Ya=({title:n,preview:t,accessory:i,onOpenChange:a,children:o})=>{const r=c.useI18n();return(0,e.jsxs)(X.Accordion.Item,{value:n,className:xe,onOpenChange:a,children:[(0,e.jsxs)(X.Accordion.Header,{className:ve,render:(0,e.jsx)("div",{}),children:[(0,e.jsx)(X.Accordion.Trigger,{className:Ua,"aria-label":r("editor.accessibility.toggleSection",{title:n})}),(0,e.jsx)("span",{className:_n,children:n}),t!==void 0&&(0,e.jsx)("span",{className:"_40zvwv5",children:t}),i!==void 0&&(0,e.jsx)("span",{className:"_40zvwv7",children:i}),(0,e.jsx)("span",{className:$a,children:(0,e.jsx)(qa,{size:"sm"})})]}),(0,e.jsx)(X.Accordion.Panel,{children:(0,e.jsx)("div",{children:o})})]})},Ja=({title:n,isChecked:t,onToggle:i,isDisabled:a,preview:o,children:r})=>{const{expandSection:s,collapseAllSections:d}=An(),{Switch:l}=_(),p=m=>{i(m),m?s(n):d()},u=m=>{m&&!t&&a!==!0&&i(!0)};return(0,e.jsx)(O,{title:n,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,e.jsx)(l,{isChecked:t,onChange:p,isDisabled:a,ariaLabel:n}),children:r})},Qa={horizontal:["bottom","top"],vertical:["left","right"]},eo={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},no={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},se=({axis:n,title:t,layout:i="collapsible",preview:a})=>{const o=L(),r=c.useHandleCompiled(o),s=c.useI18n(),{NumberField:d,Switch:l,TextField:p,ToggleGroup:u}=_();if(!r)return null;const m=r.coordSystem.type==="polar"?r.coordSystem.axisMapping[n].geometry:"linear",v=r.config.axes[n],g=r.scales[n],C=g?.spec,y=C?.scaleType==="continuous"?C:void 0;if(m==="circular"||m==="radial"&&y===void 0)return null;const T=C!==void 0&&"reverse"in C?C:void 0,j=C?.scaleType==="continuous"||C?.scaleType==="datetime",f=n==="y"&&y!==void 0&&r.layers.some(S=>S.yScaleType==="primary"&&S.geom==="bar"),w=y?.transform==="log",P=y?.domainMax??null,R=to(y),H=(S,F)=>S.map(J=>({value:J,label:F(J)})),E=r.guides.axes.find(S=>S.scaleAestheticKey===n)?.position,k=Qa[E==="bottom"||E==="top"||E===void 0&&n==="x"?"horizontal":"vertical"],A=r.guides.legends.drawn.some(S=>k.some(F=>F===S.position)),I=k.map(S=>({value:S,label:s(eo[S])})),M=H(["auto","edges"],S=>s(S==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),K=H(["linear","log"],S=>s(S==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),zn=H(["auto","zero","custom"],S=>s(S==="zero"?"editor.axesPanel.startFrom.zero":S==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Fn=H(["auto","custom"],S=>s(S==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Vn=H(["no","yes"],S=>s(S==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Gn=S=>{o.commands.dispatch(new h.SetAxisVisibilityCommand({axis:n,isVisible:S}))},Bn=S=>{o.commands.dispatch(new h.SetAxisLabelCommand({axis:n,label:S===""?null:S}),{transient:!0})},Kn=S=>{o.commands.dispatch(new h.SetAxisTicksVisibilityCommand({axis:n,isVisible:S}))},qn=S=>{o.commands.dispatch(new h.SetAxisTickModeCommand({axis:n,tickMode:S==="edges"?"edges":"auto"}))},Un=S=>{o.commands.dispatch(new h.SetScaleReverseCommand({scaledAesthetic:n,reverse:S==="yes"}))},Wn=S=>{o.commands.dispatch(new h.SetScaleTransformCommand({scaledAesthetic:n,transform:S==="log"?"log":"linear"}))},be=S=>{o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,...S}),{transient:!0})},Zn=S=>{S!==null&&be({domainMin:S})},$n=S=>{S!==null&&be({domainMax:S})},Xn=S=>{if(y){if(S==="custom"){y.zero&&o.commands.dispatch(new h.SetScaleZeroCommand({scaledAesthetic:n,zero:!1})),o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,domainMin:Ee(g?.domain,"start")}));return}y.domainMin!==null&&o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,domainMin:null})),o.commands.dispatch(new h.SetScaleZeroCommand({scaledAesthetic:n,zero:S==="zero"}))}},Yn=S=>{const F=S==="custom"?Ee(g?.domain,"end"):null;o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,domainMax:F}))},Jn=S=>{const F=k.find(J=>J===S);F&&o.commands.dispatch(new h.SetAxisPositionCommand({axis:n,position:F}))};return(0,e.jsx)(O,{title:t??s(no[n]),layout:i,preview:a,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:s("editor.axesPanel.controls.visible"),children:(0,e.jsx)(l,{isChecked:v.isVisible,onChange:Gn})}),m==="linear"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{label:s("editor.axesPanel.controls.title"),children:(0,e.jsx)(p,{value:v.label??"",onChange:Bn,onCommit:o.commands.seal})}),(0,e.jsx)(b,{label:s("editor.axesPanel.controls.ticks"),children:(0,e.jsx)(l,{isChecked:v.ticks.isVisible,onChange:Kn})})]}),j&&(0,e.jsx)(b,{label:s("editor.axesPanel.controls.labels"),children:(0,e.jsx)(u,{value:v.ticks.mode,options:M,onChange:qn})}),y&&m==="linear"&&!A&&(0,e.jsx)(b,{label:s("editor.axesPanel.controls.position"),children:(0,e.jsx)(u,{value:E??v.position,options:I,onChange:Jn})}),T!==void 0&&(0,e.jsx)(b,{label:s("editor.axesPanel.controls.reverse"),children:(0,e.jsx)(u,{value:T.reverse===!0?"yes":"no",options:Vn,onChange:Un})}),y&&!f&&(0,e.jsx)(b,{label:s("editor.axesPanel.controls.scale"),children:(0,e.jsx)(u,{value:w?"log":"linear",options:K,onChange:Wn})}),y&&!w&&(0,e.jsxs)(e.Fragment,{children:[!f&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{label:s("editor.axesPanel.controls.startFrom"),children:(0,e.jsx)(u,{value:R,options:zn,onChange:Xn})}),R==="custom"&&(0,e.jsx)(b,{label:s("editor.axesPanel.controls.value"),children:(0,e.jsx)(d,{value:y.domainMin??null,onChange:Zn,onCommit:o.commands.seal})})]}),(0,e.jsx)(b,{label:s("editor.axesPanel.controls.endAt"),children:(0,e.jsx)(u,{value:P===null?"auto":"custom",options:Fn,onChange:Yn})}),P!==null&&(0,e.jsx)(b,{label:s("editor.axesPanel.controls.value"),children:(0,e.jsx)(d,{value:P,onChange:$n,onCommit:o.commands.seal})})]})]})})},to=n=>n===void 0?"auto":n.domainMin!==null&&n.domainMin!==void 0?"custom":n.zero===!0?"zero":"auto",Ee=(n,t)=>{const i=t==="start"?n?.[0]:n?.[n.length-1];return typeof i=="number"?i:0},Ce=({value:n,onChange:t})=>{const i=L(),a=c.useI18n(),{TextField:o}=_(),r=n!==null&&typeof n!="string",s=d=>t(d===""?null:d);return(0,e.jsx)(b,{label:a("editor.elementsPanel.contentValue"),children:(0,e.jsx)(o,{value:typeof n=="string"?n:"",onChange:s,onCommit:i.commands.seal,isDisabled:r})})},Mn=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Switch:s}=_();if(!o)return null;const d=o.config.content,l=u=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},p=u=>{a.commands.dispatch(new h.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,e.jsx)(O,{title:n??r("editor.elementsPanel.footerSection.caption"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isCaptionVisible,onChange:l})}),(0,e.jsx)(Ce,{value:d.caption,onChange:p})]})})},Oe=/^[a-z][a-z\d+.-]*:/i,ro={},En=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Switch:s}=_();if(!o)return null;const d=o.config.content,l=p=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"source",isVisible:p}))};return(0,e.jsx)(O,{title:n??r("editor.elementsPanel.sourceSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isSourceVisible,onChange:l})}),(0,e.jsx)(ao,{source:d.source??ro})]})})},ao=({source:n})=>{const t=L(),i=c.useI18n(),{TextField:a}=_(),o=l=>{const p=(l.label??"")!==""||(l.url??"")!=="";t.commands.dispatch(new h.SetContentSourceCommand({source:p?l:null}),{transient:!0})},r=()=>{const l=n.url??"";l!==""&&!Oe.test(l)&&o({...n,url:`https://${l}`}),t.commands.seal()},s=l=>o({...n,url:l}),d=l=>o({...n,label:l});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{label:i("editor.elementsPanel.sourceSection.url"),children:(0,e.jsx)(a,{value:n.url??"",onChange:s,onCommit:r,hasError:Oe.test(n.url??"")&&!(0,h.isSafeUrl)(n.url)})}),(0,e.jsx)(b,{label:i("editor.elementsPanel.sourceSection.name"),children:(0,e.jsx)(a,{value:n.label??"",onChange:d,onCommit:t.commands.seal})})]})},On=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Switch:s}=_();if(!o)return null;const d=o.config.content,l=u=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},p=u=>{a.commands.dispatch(new h.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,e.jsx)(O,{title:n??r("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isSubtitleVisible,onChange:l})}),(0,e.jsx)(Ce,{value:d.subtitle,onChange:p})]})})},le=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],oo=le.length/2,Nn=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{RadioGrid:s}=_();if(!o)return null;const{textScale:d}=o.config.appearance,l=m=>r("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${m}`}),p=le.map(m=>({value:`${m}`,label:l(m)})),u=m=>{const v=le.find(g=>`${g}`===m);v!==void 0&&a.commands.dispatch(new h.SetAppearanceTextScaleCommand({textScale:v}))};return(0,e.jsx)(O,{title:n??r("editor.elementsPanel.textSizeSection.title"),layout:t,preview:i??l(d),children:(0,e.jsx)(s,{value:`${d}`,options:p,columns:oo,onChange:u,ariaLabel:r("editor.elementsPanel.textSizeSection.title")})})},Rn=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Switch:s}=_();if(!o)return null;const d=o.config.content,l=u=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},p=u=>{a.commands.dispatch(new h.SetContentTitleCommand({title:u}),{transient:!0})};return(0,e.jsx)(O,{title:n??r("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isTitleVisible,onChange:l})}),(0,e.jsx)(Ce,{value:d.title,onChange:p})]})})},io=({children:n,...t})=>(0,e.jsx)(ge.Root,{...t,children:n??(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Rn,{}),(0,e.jsx)(On,{}),(0,e.jsx)(Mn,{}),(0,e.jsx)(En,{}),(0,e.jsx)(Nn,{})]})}),so=({children:n,...t})=>(0,e.jsx)(ge.Root,{...t,children:n??(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(se,{axis:"x"}),(0,e.jsx)(se,{axis:"y"})]})}),te=n=>`${n}px`,kn=n=>`${Math.round(n*100)}%`,lo=n=>`${n}°`,co=24,Ne=["dim","desaturate"],uo=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Slider:s,ToggleGroup:d}=_();if(!o)return null;const{cornerRadius:l}=o.config.appearance,p=(0,h.readHighlightDimStyle)(o.spec),u=Ne.map(g=>({value:g,label:r(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),m=g=>{a.commands.dispatch(new h.SetAppearanceCornerRadiusCommand({cornerRadius:g}),{transient:!0})},v=g=>{const C=Ne.find(y=>y===g);C&&a.commands.dispatch(new h.SetHighlightDimStyleCommand({dimStyle:C}))};return(0,e.jsx)(O,{title:n??r("editor.colorPanel.appearanceSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.colorPanel.borderSection.cornerRadius"),children:(0,e.jsx)(s,{value:l,min:0,max:co,step:1,formatValue:te,onChange:m,onCommit:a.commands.seal})}),(0,e.jsx)(b,{label:r("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,e.jsx)(d,{value:p,options:u,onChange:v})})]})})},fe=(n,t)=>{const{colorScheme:i}=c.useThemeContext();return(0,x.useMemo)(()=>{const a=n?.layers.find(o=>o.id===t);return a===void 0?null:(0,h.createStyleResolver)({colorScheme:i}).geomReaders(a)},[n,t,i])},ho=.05,mo=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Slider:s,ToggleGroup:d}=_(),l=o?(0,h.findLayerByGeom)(o.spec.layers,"bar"):void 0,p=fe(o,l?.id??null);if(!o||!l||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=g=>{a.commands.dispatch(new h.SetBarWidthCommand({layerId:l.id,width:g}),{transient:!0})},m=g=>{const C=h.BORDER_RADIUS_TOKENS.find(y=>y===g);C&&a.commands.dispatch(new h.SetBarBorderRadiusCommand({layerId:l.id,borderRadius:C}))},v=h.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:r(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,e.jsx)(O,{title:n??r("editor.graphPanel.barSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.graphPanel.barSection.thickness"),children:(0,e.jsx)(s,{value:l.params.width,min:h.MIN_BAR_WIDTH,max:h.MAX_BAR_WIDTH,step:ho,formatValue:kn,onChange:u,onCommit:a.commands.seal})}),(0,e.jsx)(b,{label:r("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,e.jsx)(d,{value:p?.get("borderRadius")??h.DEFAULT_BAR_BORDER_RADIUS,options:v,onChange:m})})]})})},re=({children:n})=>{const t=(0,x.useId)();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("g",{filter:`url(#${t})`,children:n}),(0,e.jsx)("defs",{children:(0,e.jsxs)("filter",{id:t,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,e.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,e.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},ae="qdaoth0",po=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 31 33",...n,children:[(0,e.jsx)(re,{children:(0,e.jsx)("path",{className:ae,fillRule:"evenodd",clipRule:"evenodd",d:"M25.7417 6.23664C25.7417 6.09417 25.7076 5.95967 25.6471 5.84086C25.5633 5.67624 25.4288 5.54173 25.2641 5.4579C25.1453 5.39739 25.0108 5.36328 24.8684 5.36328H12.0591C11.5767 5.36328 11.1857 5.7543 11.1857 6.23664C11.1857 6.71899 11.5767 7.11 12.0591 7.11H22.7599L5.61908 24.2508C5.27801 24.5919 5.27801 25.1448 5.61908 25.4859C5.96015 25.827 6.51313 25.827 6.8542 25.4859L23.995 8.34513V19.0459C23.995 19.5283 24.386 19.9193 24.8684 19.9193C25.3507 19.9193 25.7417 19.5283 25.7417 19.0459V6.23664ZM20.995 15.5878V19.0459C20.995 21.1851 22.7292 22.9193 24.8684 22.9193C27.0076 22.9193 28.7417 21.1851 28.7417 19.0459V6.23664C28.7417 4.09744 27.0076 2.36328 24.8684 2.36328H12.0591C9.91985 2.36328 8.18569 4.09744 8.18569 6.23664C8.18569 8.37584 9.91985 10.11 12.0591 10.11H15.5172L3.49777 22.1295C1.98512 23.6421 1.98513 26.0946 3.49776 27.6072C5.0104 29.1199 7.46288 29.1199 8.97552 27.6072L20.995 15.5878Z"})}),(0,e.jsx)("path",{fill:"currentColor",d:"M12.0591 7.11C11.5767 7.11 11.1857 6.71899 11.1857 6.23664C11.1857 5.7543 11.5767 5.36328 12.0591 5.36328H24.8684C25.3507 5.36328 25.7417 5.7543 25.7417 6.23664V19.0459C25.7417 19.5283 25.3507 19.9193 24.8684 19.9193C24.386 19.9193 23.995 19.5283 23.995 19.0459V8.34512L6.8542 25.4859C6.51313 25.827 5.96015 25.827 5.61908 25.4859C5.27801 25.1448 5.27801 24.5919 5.61908 24.2508L22.7599 7.11H12.0591Z"})]}),go=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 32 32",...n,children:(0,e.jsxs)(re,{children:[(0,e.jsx)("path",{className:ae,d:"M11 21H21V11H11V21ZM29 23C29 26.3137 26.3137 29 23 29H9C5.68629 29 3 26.3137 3 23V9C3 5.68629 5.68629 3 9 3H23C26.3137 3 29 5.68629 29 9V23Z"}),(0,e.jsx)("path",{fill:"currentColor",d:"M24.25 9C24.25 8.30964 23.6904 7.75 23 7.75H9C8.30964 7.75 7.75 8.30964 7.75 9V23C7.75 23.6904 8.30964 24.25 9 24.25H23C23.6904 24.25 24.25 23.6904 24.25 23V9ZM25.75 23C25.75 24.5188 24.5188 25.75 23 25.75H9C7.48122 25.75 6.25 24.5188 6.25 23V9C6.25 7.48122 7.48122 6.25 9 6.25H23C24.5188 6.25 25.75 7.48122 25.75 9V23Z"})]})}),xo=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 32 33",...n,children:[(0,e.jsx)(re,{children:(0,e.jsx)("path",{className:ae,fillRule:"evenodd",clipRule:"evenodd",d:"M4.89961 14.7968C3.08522 13.5116 1.89961 11.3966 1.89961 9.00039C1.89961 5.07917 5.07839 1.90039 8.99961 1.90039C10.7798 1.90039 12.4069 2.55553 13.6531 3.63785C14.3179 3.17306 15.1269 2.90039 15.9996 2.90039L22.9996 2.90039C25.264 2.90039 27.0996 4.73602 27.0996 7.00039L27.0996 9.7243C27.5717 9.92414 28.014 10.2165 28.3987 10.6013C29.9999 12.2024 29.9999 14.7984 28.3987 16.3995L27.9182 16.8801C29.2628 18.172 30.0996 19.9885 30.0996 22.0004C30.0996 25.9216 26.9208 29.1004 22.9996 29.1004C21.2195 29.1004 19.5923 28.4453 18.3461 27.3629C17.6813 27.8277 16.8723 28.1004 15.9996 28.1004L8.99961 28.1004C6.73524 28.1004 4.89961 26.2648 4.89961 24.0004L4.89961 14.7968Z"})}),(0,e.jsx)("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M25.25 22C25.25 20.7574 24.2426 19.75 23 19.75C21.7574 19.75 20.75 20.7574 20.75 22C20.75 23.2426 21.7574 24.25 23 24.25C24.2426 24.25 25.25 23.2426 25.25 22ZM23 18.25C25.0711 18.25 26.75 19.9289 26.75 22C26.75 24.0711 25.0711 25.75 23 25.75C20.9289 25.75 19.25 24.0711 19.25 22C19.25 19.9289 20.9289 18.25 23 18.25ZM11.25 9C11.25 7.75736 10.2426 6.75 9 6.75C7.75736 6.75 6.75 7.75736 6.75 9C6.75 10.2426 7.75736 11.25 9 11.25C10.2426 11.25 11.25 10.2426 11.25 9ZM9.75 12.675C11.4617 12.3275 12.75 10.8142 12.75 9C12.75 6.92893 11.0711 5.25 9 5.25C6.92893 5.25 5.25 6.92893 5.25 9C5.25 10.8142 6.53832 12.3275 8.25 12.675L8.25 24C8.25 24.4142 8.58579 24.75 9 24.75L16 24.75C16.4142 24.75 16.75 24.4142 16.75 24L16.75 7.75L22.25 7.75L22.25 14.1893L21.0303 12.9697C20.7374 12.6768 20.2626 12.6768 19.9697 12.9697C19.6768 13.2626 19.6768 13.7374 19.9697 14.0303L22.4697 16.5303C22.7626 16.8232 23.2374 16.8232 23.5303 16.5303L26.0303 14.0303C26.3232 13.7374 26.3232 13.2626 26.0303 12.9697C25.7374 12.6768 25.2626 12.6768 24.9697 12.9697L23.75 14.1893L23.75 7C23.75 6.58579 23.4142 6.25 23 6.25L16 6.25C15.5858 6.25 15.25 6.58579 15.25 7L15.25 23.25L9.75 23.25L9.75 12.675Z"})]}),vo=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 32 33",...n,children:[(0,e.jsx)(re,{children:(0,e.jsx)("path",{className:ae,d:"M20.7271 2C21.4372 2 21.7114 2.00463 22.0841 2.03504C22.8228 2.0954 23.4839 2.25122 24.1592 2.59527C25.1865 3.1188 26.0219 3.9541 26.5458 4.98208C26.8896 5.65706 27.0454 6.31812 27.1057 7.05672C27.1301 7.35469 27.1379 7.58979 27.14 8.03558L27.1408 9.10155C27.1408 11.2114 25.4304 12.922 23.3205 12.922C21.4083 12.922 19.8243 11.5172 19.5441 9.68336L19.538 9.64H18.39V21.687L20.0392 21.6877C22.149 21.6877 23.8595 23.398 23.8595 25.508C23.8595 27.6178 22.149 29.3283 20.0392 29.3283H9.10159C6.99169 29.3283 5.28127 27.6178 5.28127 25.508C5.28127 23.398 6.99172 21.6877 9.10159 21.6877L10.75 21.687V9.64H9.601L9.59661 9.68334C9.32609 11.4539 7.84018 12.8246 6.01692 12.917L5.82032 12.922C3.71035 12.922 2 11.2114 2 9.10155V8.41371C2 7.70349 2.00463 7.42929 2.03504 7.05674C2.09538 6.31803 2.25122 5.65681 2.59521 4.98173C3.11877 3.95419 3.95418 3.11876 4.98174 2.5952C5.65683 2.25122 6.31798 2.09539 7.057 2.03501C7.42935 2.00463 7.70354 2 8.41371 2H20.7271Z"})}),(0,e.jsx)("path",{fill:"currentColor",d:"M8.41371 5H20.7271C21.1595 5 21.5325 5 21.8398 5.02507C22.1641 5.05157 22.4867 5.11007 22.7971 5.26822C23.2601 5.50416 23.6366 5.88064 23.8726 6.3437C24.0307 6.65409 24.0892 6.97666 24.1157 7.30097C24.1408 7.60823 24.1408 7.98127 24.1408 8.41369V9.10155C24.1408 9.55465 23.7735 9.92195 23.3205 9.92195C22.8674 9.92195 22.5001 9.55465 22.5001 9.10155V8.44533C22.5001 7.97237 22.4995 7.66699 22.4805 7.43457C22.4623 7.21172 22.4314 7.12909 22.4107 7.08853C22.3321 6.93418 22.2066 6.80869 22.0522 6.73004C22.0117 6.70938 21.9291 6.67847 21.7062 6.66026C21.4738 6.64127 21.1684 6.64063 20.6954 6.64063H15.3907V24.6877H20.0392C20.4922 24.6877 20.8595 25.0549 20.8595 25.508C20.8595 25.961 20.4922 26.3283 20.0392 26.3283H9.10159C8.64854 26.3283 8.28127 25.961 8.28127 25.508C8.28127 25.0549 8.64854 24.6877 9.10159 24.6877H13.7501V6.64063H8.44533C7.97238 6.64063 7.66699 6.64127 7.43457 6.66026C7.21172 6.67847 7.1291 6.70938 7.08854 6.73004C6.93418 6.80869 6.80869 6.93418 6.73004 7.08853C6.70938 7.12909 6.67847 7.21172 6.66026 7.43457C6.64127 7.66699 6.64063 7.97237 6.64063 8.44533V9.10155C6.64063 9.55465 6.27337 9.92195 5.82032 9.92195C5.36727 9.92195 5 9.55465 5 9.10155V8.41371C5 7.98128 5 7.60823 5.02508 7.30097C5.05157 6.97666 5.11007 6.65409 5.26823 6.3437C5.50417 5.88064 5.88064 5.50416 6.3437 5.26822C6.65409 5.11007 6.97666 5.05157 7.30097 5.02507C7.60824 5 7.98129 5 8.41371 5Z"})]}),Co={x:.5,y:.5},fo=.2,bo={x:.375,y:.25,width:.25,height:.5},So={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},jo={x:.4,y:.6},yo={x:.6,y:.4},Io="relative-difference",wo=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Button:s}=_();if(!o)return null;const d=()=>{a.commands.dispatch(new h.AddAnnotationCommand({kind:"text",annotation:{...h.TEXT_ANNOTATION_DEFAULTS,content:To(r("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...Co},width:fo}}))},l=()=>{a.commands.dispatch(new h.AddAnnotationCommand({kind:"arrow",annotation:{...h.ARROW_DEFAULTS,start:{anchorType:"panel",...jo},end:{anchorType:"panel",...yo}}}))},p=()=>{a.commands.dispatch(new h.AddAnnotationCommand({kind:"shape",annotation:{...h.SHAPE_DEFAULTS,...So,region:{anchorType:"panel",...bo}}}))},u=()=>{const v=(0,h.inferDefaultDifferenceArrowEndpoints)(o);v!==null&&a.commands.dispatch(new h.AddAnnotationCommand({kind:"differenceArrow",annotation:{...h.DIFFERENCE_ARROW_DEFAULTS,...v,label:Io}}))},m=o.coordSystem.type==="cartesian";return(0,e.jsx)(O,{title:n??r("editor.annotatePanel.callOutSection.title"),layout:t,preview:i,children:(0,e.jsxs)(Tn,{children:[(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(vo,{size:"xl"}),label:r("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(po,{size:"xl"}),label:r("editor.annotatePanel.callOutSection.arrow"),onClick:l}),(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(go,{size:"xl"}),label:r("editor.annotatePanel.callOutSection.box"),onClick:p}),m&&(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(xo,{size:"xl"}),label:r("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},To=n=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:n}]}]}),Po=({layerId:n,title:t,layout:i="collapsible",preview:a})=>{const o=L(),r=c.useHandleCompiled(o),s=c.useI18n(),{Switch:d}=_();if(!r)return null;const l=n===void 0?r.spec.layers[0]:r.spec.layers.find(E=>E.id===n);if(!l)return null;const{showDataLabels:p,format:u,showStackTotals:m,showCategoryLabels:v}=l.dataLabels,g=r.coordSystem.type==="polar",C=l.geom==="bar",y=l.position==="stack"||l.position==="fill",T=C&&!g&&l.position==="stack",j=C&&(!g||p),f=C||l.geom==="area"&&y;if(!(0,h.canPlaceDataLabels)(l.geom,r.coordSystem.type))return null;const w=E=>{const k=new h.ToggleDataLabelsCommand({layerId:l.id,showDataLabels:E});o.commands.dispatch(k)},P=E=>{const k=new h.SetDataLabelsFormatCommand({layerId:l.id,format:E?"percentage":"absolute"});o.commands.dispatch(k)},R=E=>{const k=new h.ToggleStackTotalsCommand({layerId:l.id,showStackTotals:E});o.commands.dispatch(k)},H=E=>{const k=new h.ToggleCategoryLabelsCommand({layerId:l.id,showCategoryLabels:E});o.commands.dispatch(k)};return(0,e.jsx)(O,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:i,preview:a,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,e.jsx)(d,{isChecked:p,onChange:w})}),p&&f&&(0,e.jsx)(b,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,e.jsx)(d,{isChecked:u==="percentage",onChange:P})}),T&&(0,e.jsx)(b,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,e.jsx)(d,{isChecked:m,onChange:R})}),j&&(0,e.jsx)(b,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,e.jsx)(d,{isChecked:v,onChange:H})})]})})},Ao=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M5.744 5.565 0 11.826V8l5.744-6.957 4.718 2.087L16 0v6.957l-5.538 4z"})]}),Lo=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 16 16",...n,children:(0,e.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,e.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),_o=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 16 16",...n,children:(0,e.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Mo=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 16 16",...n,children:(0,e.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]})}),Eo=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,e.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Oo=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 12.445h4.267V.52A.52.52 0 0 0 3.748 0H.518A.52.52 0 0 0 0 .519zM5.867 7.111h4.266V.52A.52.52 0 0 0 9.615 0h-3.23a.52.52 0 0 0-.518.519zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),No=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 13.037h4.267v2.445a.52.52 0 0 1-.519.518H.518A.52.52 0 0 1 0 15.482zM5.867 7.704h4.266v7.778a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.518-.518zM11.733 10.074H16v5.408a.52.52 0 0 1-.518.518h-3.23a.52.52 0 0 1-.519-.518z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 7.037c0-.286.232-.518.519-.518h3.23c.286 0 .518.232.518.518v5.408H0zM5.867 7.111h4.266V4.074a.52.52 0 0 0-.518-.518h-3.23a.52.52 0 0 0-.518.518zM11.733 9.481H16V.52A.52.52 0 0 0 15.482 0h-3.23a.52.52 0 0 0-.519.519z"})]}),Ro=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 16 16",...n,children:(0,e.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),ko=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 16 16",...n,children:(0,e.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,e.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,e.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,e.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,e.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,e.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,e.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,e.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,e.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,e.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,e.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,e.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,e.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),Do=n=>(0,e.jsxs)(c.Icon,{viewBox:"0 0 16 16",...n,children:[(0,e.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,e.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),Ho=n=>(0,e.jsx)(c.Icon,{viewBox:"0 0 16 16",...n,children:(0,e.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,e.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,e.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,e.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,e.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,e.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,e.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,e.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),zo=.55,ce=[{name:"column",icon:Eo,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:No,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Oo,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Lo,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Mo,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:_o,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:ko,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Ao,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"scatter",icon:Ho,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Do,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Ro,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:zo}}],Fo=.05,Vo=n=>n===null?null:ce.find(t=>Bo(t.summary,n))??null,Go=(n,t)=>{const{summary:i}=n;return i.coordType!=="polar"||!ee(i.innerRadius)||t===null||t.coordType!=="polar"||!ee(t.innerRadius)?i:{...i,innerRadius:t.innerRadius}},Bo=(n,t)=>n.coordType!==t.coordType||n.geom!==t.geom||n.position!==t.position?!1:n.coordType!=="polar"||t.coordType!=="polar"?!0:n.theta===t.theta&&ee(n.innerRadius)===ee(t.innerRadius),ee=n=>n>=Fo,Ko=3,qo=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{RadioGrid:s}=_(),d=(0,x.useMemo)(()=>ce.map(({name:m,icon:v})=>({value:m,label:r(`editor.graphTypes.${m}`),icon:(0,e.jsx)(v,{size:"md"})})),[r]);if(!o)return null;const l=(0,h.readChartType)(o.spec),p=Vo(l),u=m=>{const v=ce.find(g=>g.name===m);v&&a.commands.dispatch(new h.SetChartTypeCommand(Go(v,l)))};return(0,e.jsx)(O,{title:n??r("editor.graphPanel.graphTypeSection.title"),layout:t,preview:i??r(p===null?"editor.graphTypes.combo":`editor.graphTypes.${p.name}`),children:(0,e.jsx)(s,{value:p?.name??"",options:d,columns:Ko,onChange:u,ariaLabel:r("editor.graphPanel.graphTypeSection.title")})})},Re=["solid","dashed","dotted"],Uo=Number.parseFloat(c.chromeTokens.gridLineWidth),Wo=8,Zo=0,$o=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Slider:s,Switch:d,ToggleGroup:l}=_(),{themeValues:p}=c.useThemeContext();if(!o)return null;const u=o.guides.axes.filter(Xo);if(u.length===0)return null;const m=o.coordSystem.type!=="polar",v=u.some(f=>f.gridVisible),g=o.config.axes.y.grid,C=Re.map(f=>({value:f,label:r(`editor.graphPanel.gridSection.lineStyles.${f}`)})),y=f=>w=>{a.commands.dispatch(new h.SetGridVisibilityCommand({axis:f,isVisible:w}))},T=f=>{const w=Re.find(P=>P===f);w&&a.commands.dispatch(new h.SetGridLineStyleCommand({axis:"both",lineStyle:w}))},j=f=>{a.commands.dispatch(new h.SetGridLineWidthCommand({axis:"both",lineWidth:f}),{transient:!0})};return(0,e.jsx)(O,{title:n??r("editor.graphPanel.gridSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[u.map(f=>(0,e.jsx)(b,{label:r(Yo(f)),children:(0,e.jsx)(d,{isChecked:f.gridVisible,onChange:y(f.scaleAestheticKey)})},f.scaleAestheticKey)),m&&v&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{label:r("editor.graphPanel.gridSection.gridStyle"),children:(0,e.jsx)(l,{value:g.lineStyle,options:C,onChange:T})}),(0,e.jsx)(b,{label:r("editor.graphPanel.gridSection.gridThickness"),children:(0,e.jsx)(s,{value:g.lineWidth??c.parsePx(p.gridLineWidth,Uo),min:Zo,max:Wo,step:.5,formatValue:te,onChange:j,onCommit:a.commands.seal})})]})]})})},Xo=n=>n.scaleAestheticKey==="x"||n.scaleAestheticKey==="y",Yo=n=>n.geometry==="radial"?"editor.graphPanel.gridSection.rings":n.geometry==="circular"?"editor.graphPanel.gridSection.spokes":n.scaleAestheticKey==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",Jo="total",Dn=["total","average","current"],Qo=["total"],ke=["previous","first"],De=["auto","small","medium","large"],ei=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Switch:s,ToggleGroup:d}=_();if(!o)return null;const l=o.config.headline,p=l.show!=="none",u=o.coordSystem,m=u.type==="polar",v=u.type==="polar"&&u.innerRadius>0,g=o.layers.some(I=>I.summary.grandTotal!==void 0);if(m&&!g)return null;const C=m?Qo:Dn,y=o.guides.headline,T=y?.kind==="perGroup"&&y.items.some(I=>I.comparison!==null),j=C.map(I=>({value:I,label:r(`editor.graphPanel.headlineNumberSection.metrics.${I}`)})),f=ke.map(I=>({value:I,label:r(`editor.graphPanel.headlineNumberSection.comparison.${I}`)})),w=De.map(I=>({value:I,label:r(I==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${I}`)})),P=[{value:"above",label:r("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:r("editor.graphPanel.headlineNumberSection.position.center")}],R=I=>{a.commands.dispatch(new h.SetHeadlineShowCommand({show:I?Jo:"none"}))},H=I=>{const M=C.find(K=>K===I);M&&a.commands.dispatch(new h.SetHeadlineShowCommand({show:M}))},E=I=>{const M=ke.find(K=>K===I);M&&a.commands.dispatch(new h.SetHeadlineCompareWithCommand({compareWith:M}))},k=I=>{const M=De.find(K=>K===I);M&&a.commands.dispatch(new h.SetHeadlineSizeCommand({size:M}))},A=I=>{a.commands.dispatch(new h.SetHeadlinePositionCommand({position:I==="center"?"center":"above"}))};return(0,e.jsx)(O,{title:n??r("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:i??ni(r,l.show),children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.graphPanel.headlineNumberSection.toggle"),children:(0,e.jsx)(s,{isChecked:p,onChange:R})}),p&&(0,e.jsxs)(e.Fragment,{children:[j.length>1&&(0,e.jsx)(b,{label:r("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,e.jsx)(d,{value:l.show,options:j,onChange:H})}),T&&(0,e.jsx)(b,{label:r("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,e.jsx)(d,{value:(0,h.resolveComparisonBasis)(l.compareWith),options:f,onChange:E})}),(0,e.jsx)(b,{label:r("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,e.jsx)(d,{value:l.size,options:w,onChange:k})}),v&&(0,e.jsx)(b,{label:r("editor.axesPanel.controls.position"),children:(0,e.jsx)(d,{value:l.position,options:P,onChange:A})})]})]})})},ni=(n,t)=>{const i=Dn.find(a=>a===t);return i&&n(`editor.graphPanel.headlineNumberSection.metrics.${i}`)},ie=["top","bottom","left","right","none"],He=["auto","start","center","end"],ze=["auto","pill","direct"],ti=({positions:n,title:t,layout:i="collapsible",preview:a})=>{const o=L(),r=c.useHandleCompiled(o),s=c.useI18n(),{ToggleGroup:d}=_();if(!r)return null;const l=r.config.legend.position,p=n??ie,u=r.guides.legends.drawn[0],m=(0,h.canAnchorDirectLabels)({legendPosition:r.guides.legends.position,coordSystem:r.coordSystem,layers:r.layers}),v=r.guides.headline?.kind==="perGroup",g=r.guides.colorGroups.length>0;if(l==="auto"&&u===void 0&&!m&&(v||!g))return null;const C=u?.position??"none",y=l==="auto"?C:l,T=ie.filter(A=>A===y||p.includes(A)).map(A=>({value:A,label:s(`editor.graphPanel.legendSection.${A}`)})),j=A=>{const I=ie.find(M=>M===A);I&&o.commands.dispatch(new h.SetLegendPositionCommand({position:I}))},f=A=>{const I=He.find(M=>M===A);I&&o.commands.dispatch(new h.SetLegendAlignCommand({align:I}))},w=A=>{const I=ze.find(M=>M===A);I&&o.commands.dispatch(new h.SetLegendDisplayCommand({display:I}))},P=He.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.align.${A}`)})),R=ze.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.display.${A}`)})),H=t??s("editor.graphPanel.legendSection.title"),E=T.find(A=>A.value===y)?.label,k=u!==void 0;return(0,e.jsx)(O,{title:H,layout:i,preview:a??E,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,e.jsx)(d,{value:y,options:T,onChange:j})}),k&&(0,e.jsx)(b,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,e.jsx)(d,{value:r.config.legend.align,options:P,onChange:f})}),m&&(0,e.jsx)(b,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,e.jsx)(d,{value:r.config.legend.display,options:R,onChange:w})})]})})},ri=1,ai=20,oi=.5,Hn=({layerId:n})=>{const t=L(),i=c.useHandleCompiled(t),{Slider:a}=_(),o=fe(i,n);if(!i)return null;const r=s=>{const d=new h.SetPointSizeCommand({layerId:n,size:s});t.commands.dispatch(d,{transient:!0})};return(0,e.jsx)(a,{value:o?.get("size")??h.DEFAULT_POINT_SIZE,min:ri,max:ai,step:oi,formatValue:te,onChange:r,onCommit:t.commands.seal})},ii=1,si=10,li=.1,ci=["gap","zero","connect"],di=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Select:s,Slider:d,Switch:l,ToggleGroup:p}=_(),u=o?.spec.layers??[],m=(0,h.findLayerByGeom)(u,"line","area"),v=fe(o,m?.id??null);if(!o||!m)return null;const g=o.coordSystem.type==="polar",C=mi(r,m),y=hi(m,u),T=Fe(o.spec,m.geom,"strokeWidth",m.id),j=typeof T=="number",f=m.geom==="line"?m:void 0,w=[{value:"auto",label:r("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:r("editor.graphPanel.numberFormat.options.custom")}],P=I=>{a.commands.dispatch(new h.ToggleLinePointsVisibilityCommand({layerId:m.id,showPoints:I}))},R=I=>{f&&a.commands.dispatch(new h.ToggleLineFillCommand({layerId:f.id,showFill:I}))},H=I=>{a.commands.dispatch(new h.SetLineInterpolationCommand({layerId:m.id,interpolate:I?"catmull-rom":"linear"}))},E=I=>{const M=v?.get("strokeWidth")??h.DEFAULT_STROKE_WIDTH;a.commands.dispatch(new h.SetLineWidthCommand({layerId:m.id,lineWidth:I==="custom"?M:null}))},k=I=>{a.commands.dispatch(new h.SetLineWidthCommand({layerId:m.id,lineWidth:I}),{transient:!0})},A=I=>{const M=ui(I);M&&a.commands.dispatch(new h.SetLineMissingValuesCommand({layerId:m.id,missingValues:M}))};return(0,e.jsx)(O,{title:n??r("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.graphPanel.graphOptions.showPoints"),children:(0,e.jsx)(l,{isChecked:y!==void 0,onChange:P})}),y&&(0,e.jsx)(b,{label:r("editor.graphPanel.pointSize.label"),children:(0,e.jsx)(Hn,{layerId:y.id})}),f&&!g&&(0,e.jsx)(b,{label:r("editor.graphPanel.graphOptions.lineFill"),children:(0,e.jsx)(l,{isChecked:Fe(o.spec,"line","fillAlpha",f.id)!==void 0,onChange:R})}),!g&&(0,e.jsx)(b,{label:r("editor.graphPanel.graphOptions.smoothLines"),children:(0,e.jsx)(l,{isChecked:m.params.interpolate==="catmull-rom",onChange:H})}),(0,e.jsx)(b,{label:r("editor.graphPanel.lineThickness.label"),children:(0,e.jsx)(p,{value:j?"custom":"auto",options:w,onChange:E})}),j&&(0,e.jsx)(b,{label:r("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(d,{value:T,min:ii,max:si,step:li,formatValue:te,onChange:k,onCommit:a.commands.seal})}),!g&&C.length>1&&(0,e.jsx)(b,{label:r("editor.fineTunePanel.detailSection.missingValues"),children:(0,e.jsx)(s,{value:m.params.missingValues,options:C,onChange:A})})]})})},ui=n=>ci.find(t=>t===n),Fe=(n,t,i,a)=>(0,h.findStyleRule)(n.styles.overrides,(0,h.buildLayerStyleAddress)(t,a))?.declarations?.[i],hi=(n,t)=>(0,h.filterLayersByGeoms)(t,"point").find(i=>(0,h.isCompanionLayer)(i,[n])),mi=(n,t)=>{const i=[{value:"gap",label:n("editor.graphPanel.treatEmptyValues.leaveGap.label")},{value:"zero",label:n("editor.graphPanel.treatEmptyValues.fillZero.label")}];return t.position!=="stack"&&t.position!=="fill"&&i.push({value:"connect",label:n("editor.graphPanel.treatEmptyValues.connectGaps.label")}),t.geom==="area"?i.filter(a=>a.value!=="gap"):i},pi="k",gi=2,xi=0,vi=5,de=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],Ci=["auto","none"],fi=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{NumberField:s,ToggleGroup:d}=_();if(!o)return null;const{abbreviation:l,decimals:p}=o.config.numberFormat,u=bi(l)!==void 0,m=p!=="auto",v=w=>w.map(P=>({value:P,label:r(`editor.graphPanel.numberFormat.options.${P}`)})),g=de.map(({value:w,labelKey:P})=>({value:w,label:r(`common.abbreviations.${P}`)})),C=w=>{a.commands.dispatch(new h.SetNumberFormatAbbreviationCommand({abbreviation:w}))},y=w=>{const P=Ci.find(R=>R===w);C(P??pi)},T=w=>{const P=de.find(R=>R.value===w);P&&C(P.value)},j=w=>{a.commands.dispatch(new h.SetNumberFormatDecimalsCommand({decimals:w==="custom"?gi:"auto"}))},f=w=>{w!==null&&a.commands.dispatch(new h.SetNumberFormatDecimalsCommand({decimals:w}),{transient:!0})};return(0,e.jsx)(O,{title:n??r("editor.graphPanel.numberFormatSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,e.jsx)(d,{value:u?"custom":l,options:v(["auto","none","custom"]),onChange:y})}),u&&(0,e.jsx)(b,{label:r("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(d,{value:l,options:g,onChange:T})}),(0,e.jsx)(b,{label:r("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,e.jsx)(d,{value:m?"custom":"auto",options:v(["auto","custom"]),onChange:j})}),m&&(0,e.jsx)(b,{label:r("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(s,{value:p,min:xi,max:vi,onChange:f,onCommit:a.commands.seal})})]})})},bi=n=>de.find(t=>t.value===n),Si=({title:n,layout:t="collapsible",preview:i})=>{const a=c.useHandleCompiled(L()),o=c.useI18n();if(!a)return null;const r=ji(a.spec.layers);return r?(0,e.jsx)(O,{title:n??o("editor.graphPanel.pointSize.label"),layout:t,preview:i,children:(0,e.jsx)(D,{children:(0,e.jsx)(b,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(Hn,{layerId:r.id})})})}):null},ji=n=>{const t=(0,h.filterLayersByGeoms)(n,"line","area");return(0,h.filterLayersByGeoms)(n,"point").find(i=>!(0,h.isCompanionLayer)(i,t))},yi=.9,Ii=360,wi=.05,Ti=15,Pi=({title:n,layout:t="collapsible",preview:i})=>{const a=L(),o=c.useHandleCompiled(a),r=c.useI18n(),{Slider:s}=_();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:l}=o.spec.coords.params,p=m=>{a.commands.dispatch(new h.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{a.commands.dispatch(new h.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,e.jsx)(O,{title:n??r("editor.graphPanel.polarSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(b,{label:r("editor.graphPanel.polarSection.innerRadius"),children:(0,e.jsx)(s,{value:d,min:0,max:yi,step:wi,formatValue:kn,onChange:p,onCommit:a.commands.seal})}),(0,e.jsx)(b,{label:r("editor.graphPanel.polarSection.startAngle"),children:(0,e.jsx)(s,{value:l,min:0,max:Ii-1,step:Ti,formatValue:lo,onChange:u,onCommit:a.commands.seal})})]})})};exports.AppearanceSection=uo;exports.AxesPanel=so;exports.AxisSection=se;exports.BarSection=mo;exports.Button=mn;exports.CalloutsSection=wo;exports.CaptionSection=Mn;exports.EditableGraphRenderer=aa;exports.EditorPanel=ge;exports.ElementsPanel=io;exports.GraphOptionsSection=Po;exports.GraphTypeSection=qo;exports.GridSection=$o;exports.HeadlineSection=ei;exports.IntlProvider=c.IntlProvider;exports.LegendSection=ti;exports.LineSection=di;exports.NumberField=xn;exports.NumberFormatSection=fi;exports.PANEL_ROOT_ATTRIBUTE=Ln;exports.PointSection=Si;exports.PolarSection=Pi;exports.RadioGrid=vn;exports.Row=b;exports.Section=O;exports.Select=Cn;exports.Slider=fn;exports.SourceSection=En;exports.SubtitleSection=On;exports.Switch=bn;exports.TextField=Sn;exports.TextSizeSection=Nn;exports.TitleSection=Rn;exports.ToggleGroup=jn;exports.ToggledSection=Ja;exports.useControls=_;exports.usePanelExpansion=An;exports.usePanelGraph=L;