@graphysdk/react-renderer 2.0.0-beta.1786389736654 → 2.0.0-beta.1787130761469

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-BbsdKV5t.cjs"),tt=require("./font-values-CStAZ2d1.cjs");let h=require("@graphysdk/viz-engine"),x=require("react"),e=require("react/jsx-runtime"),ue=require("zustand/react/shallow"),rt=require("react-dom"),G=require("clsx");G=c.__toESM(G,1);let Be=require("@vanilla-extract/dynamic"),k=require("@base-ui/react/menu"),F=require("@base-ui/react"),X=require("@base-ui/react/accordion"),Se=require("@base-ui/react/number-field"),Ke=require("@base-ui/react/radio"),qe=require("@base-ui/react/radio-group"),V=require("@base-ui/react/select"),Z=require("@base-ui/react/slider"),je=require("@base-ui/react/switch"),at=require("@base-ui/react/input");var ot="data-graphy-chart-chrome",it="data-graphy-chart-menu",Ue={[it]:""},Q=n=>({[ot]:n}),We=(n,t)=>n instanceof Element&&n.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,st=n=>n instanceof Element&&n.closest("[data-graphy-chart-menu]")!==null,lt=n=>n instanceof Element&&n.closest("[data-graphy-chart-chrome]")!==null,Y=(n,t,i)=>n instanceof Node&&(t.contains(n)||We(n,i)),ct="cml7ha0",Ze=(0,x.createContext)(null),dt=({children:n})=>{const{chartId:t}=c.useGraphContext(),[i]=(0,x.useState)(c.resolvePortalContainer),[o,r]=(0,x.useState)(null);return i===null?null:(0,e.jsxs)(e.Fragment,{children:[(0,rt.createPortal)((0,e.jsx)("div",{ref:r,className:ct,...Q(t)}),i),(0,e.jsx)(Ze.Provider,{value:o,children:n})]})},he=()=>(0,x.useContext)(Ze),$e=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 Xe="efjmb40",Ye="efjmb41",q="efjmb42",U="efjmb43",ut="efjmb44",ht="efjmb45",mt=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),me=({label:n,icon:t,onOpened:i,children:o})=>{const r=he(),[a,s]=(0,x.useState)(!1),d=(l,p)=>{l?(s(!0),i?.()):mt.has(p.reason)&&s(!1)};return(0,e.jsxs)(F.Menu.SubmenuRoot,{open:a,onOpenChange:d,children:[(0,e.jsx)(pt,{label:n,icon:t}),(0,e.jsx)(F.Menu.Portal,{container:r,children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(F.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:Xe,...Ue,children:(0,e.jsx)(F.Menu.Popup,{className:Ye,children:o})})})})]})},pt=({label:n,icon:t})=>(0,e.jsxs)(F.Menu.SubmenuTrigger,{className:q,openOnHover:!1,children:[t,(0,e.jsx)("span",{className:U,children:n}),(0,e.jsx)("span",{className:ht,children:(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})})]}),gt="_1qe7q450",Ct="_1qe7q451",vt="_1qe7q452",xt=({label:n,placeholder:t,addLabel:i,at:o,onRequestClose:r})=>{const a=(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:o,content:ft(p)}})),r())},m=C=>{C.key==="Enter"&&(C.preventDefault(),u()),C.key!=="Escape"&&C.stopPropagation()},v=C=>{d(C.target.value)},g=()=>{requestAnimationFrame(()=>a.current?.focus())};return(0,e.jsx)(me,{label:n,icon:(0,e.jsx)($e,{}),onOpened:g,children:(0,e.jsxs)("div",{className:gt,children:[(0,e.jsx)("input",{ref:a,className:Ct,value:s,placeholder:t,onChange:v,onKeyDown:m}),(0,e.jsx)("button",{type:"button",className:vt,disabled:p.length===0,onClick:u,children:i})]})})},ft=n=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:n}]}]}),bt=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"})}),St="relative-difference",jt=({label:n,layer:t,at:i,onRequestClose:o})=>{const{dispatch:r}=c.useGraphCommands(),a=c.useCompiledSelector(l=>l.coordSystem),s=(0,x.useMemo)(()=>(0,h.inferDifferenceArrowEndpoints)({layer:t,at:i,coordSystem:a}),[t,i,a]);if(s===null)return null;const d=()=>{r(new h.AddAnnotationCommand({kind:"differenceArrow",annotation:{...h.DIFFERENCE_ARROW_DEFAULTS,...s,label:St}})),o()};return(0,e.jsxs)(k.Menu.Item,{className:q,onClick:d,children:[(0,e.jsx)(bt,{}),(0,e.jsx)("span",{className:U,children:n})]})};function yt(n,t){if(n.type==="polar"&&!It(t))return[{scope:"series",labelKey:"pieSlice"}];const i=(0,h.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const o=[{scope:"data-point",labelKey:"bar"}];if(i){const r=t.position==="stack"||t.position==="fill";o.push({scope:"x-value",labelKey:r?"barStack":"barGroup"}),o.push({scope:"series",labelKey:"barSeries"})}return o}case"line":case"area":{const o=[{scope:"data-point",labelKey:"linePoint"}];return i&&o.push({scope:"series",labelKey:"lineSeries"}),o}case"point":{const o=[{scope:"data-point",labelKey:"scatterPoint"}];return i&&o.push({scope:"series",labelKey:"scatterSeries"}),o}default:return[]}}var It=n=>{const t=(0,h.extractVariableName)(n.mapping.x);return t!==null&&t!==h.CONSTANT_VARIABLES.x},Tt=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"})]}),wt=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"})]}),Pt=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"})]}),Lt=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"})]}),At=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"})]}),Mt=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"})]}),_t=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"})]}),Et=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)"})]}),Ot=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)"})]}),Rt={bar:Tt,barGroup:wt,barStack:Lt,barSeries:Pt,linePoint:At,lineSeries:Mt,scatterPoint:Et,scatterSeries:Ot,pieSlice:_t},Je=({labelKey:n})=>{const t=Rt[n];return(0,e.jsx)(t,{})},Qe=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"})]}),Nt=({label:n,options:t,onSelect:i})=>{const o=c.useI18n();return(0,e.jsx)(me,{label:n,icon:(0,e.jsx)(Qe,{}),children:t.map(r=>(0,e.jsxs)(F.Menu.Item,{className:q,onClick:()=>i(r.scope),children:[(0,e.jsx)(Je,{labelKey:r.labelKey}),(0,e.jsx)("span",{className:U,children:o(`graph.annotations.highlights.labels.${r.labelKey}`)})]},r.scope))})},kt=({label:n,layer:t,observation:i,highlights:o,onRequestClose:r})=>{const a=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)(()=>yt(d,t),[d,t]),u=(0,x.useMemo)(()=>{const g=new Set(o.map(C=>C.scope));return p.filter(C=>!g.has(C.scope))},[p,o]),[m]=u;if(l===null||m===void 0)return null;const v=g=>{s(new h.AddHighlightCommand({predicate:l,scope:g,layerId:t.id})),r()};if(u.length===1){const g=p.length===1?n:a("graph.annotations.baseMenu.highlightWithLabel",{label:a(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,e.jsxs)(F.Menu.Item,{className:q,onClick:()=>v(m.scope),children:[(0,e.jsx)(Je,{labelKey:m.labelKey}),(0,e.jsx)("span",{className:U,children:g})]})}return(0,e.jsx)(Nt,{label:n,options:u,onSelect:v})},Dt="_1aafi1g0",Ht="_1aafi1g1",en=({children:n})=>(0,e.jsxs)("span",{className:Dt,"aria-hidden":"true",children:[n,(0,e.jsx)("span",{className:Ht})]}),Vt=({label:n,highlights:t,onRequestClose:i})=>{const{dispatch:o}=c.useGraphCommands(),r=t.at(-1);if(r===void 0)return null;const a=()=>{o(new h.RemoveHighlightCommand({id:r.id})),i()};return(0,e.jsxs)(k.Menu.Item,{className:q,onClick:a,children:[(0,e.jsx)(en,{children:(0,e.jsx)(Qe,{})}),(0,e.jsx)("span",{className:U,children:n})]})},zt=(n,t)=>{const i=c.useCompiledSelector(r=>r.spec.highlights),o=c.useCompiledSelector(r=>r.config.parsingLocale);return(0,x.useMemo)(()=>(0,h.findHighlightsAtObservation)({layer:n,highlights:i,observation:t,parsingLocale:o}),[n,i,t,o])},nn=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"})]}),Ft=({label:n,at:t,onRequestClose:i})=>{const{dispatch:o}=c.useGraphCommands(),r=()=>{o(new h.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),i()};return(0,e.jsxs)(k.Menu.Item,{className:q,onClick:r,children:[(0,e.jsx)(nn,{}),(0,e.jsx)("span",{className:U,children:n})]})},tn=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"})]}),rn={pinnedNumber:{icon:nn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:$e,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:tn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Gt=n=>(0,h.isObservationAttachmentKind)(n.kind)&&rn[n.kind]!==null,Bt=({attachment:n,onRequestClose:t})=>{const i=c.useI18n(),{dispatch:o}=c.useGraphCommands(),{icon:r,labelKey:a}=rn[n.kind],s=()=>{o(new h.RemoveAnnotationCommand({id:n.annotation.id})),t()};return(0,e.jsxs)(k.Menu.Item,{className:q,onClick:s,children:[(0,e.jsx)(en,{children:(0,e.jsx)(r,{})}),(0,e.jsx)("span",{className:U,children:i(a)})]})},Kt="ceeojg0",qt="ceeojg1",Ut="ceeojg2",Wt=({label:n,at:t,onRequestClose:i})=>{const{dispatch:o}=c.useGraphCommands(),r=a=>{o(new h.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:a}})),i()};return(0,e.jsx)(me,{label:n,icon:(0,e.jsx)(tn,{}),children:(0,e.jsx)("div",{className:Kt,children:Object.entries(c.STICKER_ASSETS).map(([a,s])=>(0,e.jsx)(F.Menu.Item,{className:qt,"aria-label":a,onClick:()=>r(a),children:(0,e.jsx)("img",{className:Ut,src:s.src,alt:a})},a))})})},Zt=({interaction:n,panelOrigin:t})=>{const i=c.useEditorStore(),o=c.useEditorState(a=>a.menuTrigger);if(n.kind!=="menu"||o===null)return null;const r=()=>{i.getState().releaseInteraction("menu")};return(0,e.jsx)($t,{trigger:{x:t.x+o.center.x,y:t.y+o.center.y,radius:o.radius},layer:n.anchor.layer,at:n.anchor.at,observation:n.anchor.observation,onClose:r})},$t=({trigger:n,layer:t,at:i,observation:o,onClose:r})=>{const a=c.useI18n(),s=he(),d=c.useCompiledSelector(S=>S.spec.annotations),l=c.useCompiledSelector(S=>S.config.parsingLocale),p=Yt(),{x:u,y:m,radius:v}=n,g=(0,x.useMemo)(()=>Xt(u,m,v),[u,m,v]),C=(0,h.findObservationAttachment)(d,i,(0,x.useMemo)(()=>(0,h.createObservationAnchorParser)(t,l),[t,l])),b=C!==null&&Gt(C)?C:null,P=zt(t,o),j=(S,T)=>{!S&&Jt(T.reason)&&r()};return(0,e.jsx)(k.Menu.Root,{open:p,modal:!1,onOpenChange:j,children:(0,e.jsx)(k.Menu.Portal,{container:s,children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(k.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:Xe,...Ue,children:(0,e.jsxs)(k.Menu.Popup,{className:Ye,"data-testid":"observation-menu",children:[b!==null&&(0,e.jsx)(Bt,{attachment:b,onRequestClose:r}),(0,e.jsx)(Vt,{label:a("graph.annotations.baseMenu.removeHighlight"),highlights:P,onRequestClose:r}),(0,e.jsx)(k.Menu.Separator,{className:ut}),b===null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ft,{label:a("graph.annotations.baseMenu.pinNumber"),at:i,onRequestClose:r}),(0,e.jsx)(xt,{label:a("graph.annotations.baseMenu.annotate"),placeholder:a("graph.annotations.textMenu.placeholder"),addLabel:a("graph.annotations.textMenu.addButton"),at:i,onRequestClose:r}),(0,e.jsx)(Wt,{label:a("graph.annotations.baseMenu.addSticker"),at:i,onRequestClose:r})]}),t.highlight!==null&&(0,e.jsx)(kt,{label:a("graph.annotations.baseMenu.highlight"),layer:t,observation:o,highlights:P,onRequestClose:r}),(0,e.jsx)(jt,{label:a("graph.annotations.baseMenu.differenceArrow"),layer:t,at:i,onRequestClose:r})]})})})})})},Xt=(n,t,i)=>({getBoundingClientRect:()=>new DOMRect(n-i,t-i,i*2,i*2)}),Yt=()=>{const[n,t]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{t(!0)},[]),n},Jt=n=>n==="outside-press"||n==="escape-key"||n==="item-press",Qt=()=>{const n=c.useGraphSelection();return an(n)},an=n=>{if(n.length!==1)return null;const[t]=n;return t?.kind==="annotation"?t.id:null},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:"M4 9h16m-4-4 4 4"}),(0,e.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),nr=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"})]})}),tr={kind:"chrome-popup"},rr="var(--q7gcrz0)",ar="var(--q7gcrz1)",or="q7gcrz2",ir="q7gcrz3";var sr="q7gcrz5",lr="q7gcrz6",cr="q7gcrz7",dr="q7gcrz8",on="q7gcrz9",ur="q7gcrza";var ye="q7gcrzd q7gcrzc",sn="q7gcrze q7gcrzc",hr=["absolute-difference","relative-difference","proportion"],Ie=["absolute-difference","relative-difference"],mr=["relative-difference","proportion"],pr={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},gr=n=>{const{formattingLocale:t}=c.useGraphContext(),i=c.useCompiledSelector(r=>r.config.parsingLocale),o=t??i;return(0,x.useMemo)(()=>{const r=(0,h.areEndpointsComparable)(n.start,n.end);return hr.filter(a=>r||!Ie.includes(a)||a===n.label).map(a=>({kind:a,nameKey:pr[a],preview:(0,h.formatDifferenceLabel)({locale:o,kind:a,startValue:n.start.measurementValue,endValue:n.end.measurementValue,valueFormat:n.start.valueFormat}),isPickable:r||!Ie.includes(a),isSuspect:mr.includes(a)&&n.start.measurementValue===0}))},[n,o])},$=8,Cr=({labelBox:n,panelRect:t,frameWidth:i,frameHeight:o})=>{const r=t.y+n.y,a=r+n.height,s=r-8-36,d=a+8,l=vr($,s>=$?s:d,o-$-36),p=$;return{top:l,left:p,available:Math.max(0,i-$*2),centre:t.x+n.x+n.width/2-p}},vr=(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"}],xr=({arrow:n,labelBox:t,panelRect:i,frameWidth:o,frameHeight:r,frameElement:a})=>{const s=c.useI18n(),{chartId:d,commands:l}=c.useGraphContext(),p=c.useEditorStore(),[u,m]=(0,x.useState)(null),v=gr(n),g=Cr({labelBox:t,panelRect:i,frameWidth:o,frameHeight:r}),C=(j,S)=>{l.dispatch(new h.UpdateAnnotationCommand({kind:"differenceArrow",id:n.id,patch:j}),S)};(0,x.useEffect)(()=>()=>l.seal(),[l]),(0,x.useEffect)(()=>{const{claimInteraction:j,releaseInteraction:S}=p.getState();return u===null?S("chrome-popup"):j(tr),()=>S("chrome-popup")},[p,u]);const b=j=>{m(j?"color":null),j||l.seal()},P=()=>{l.dispatch(new h.RemoveAnnotationCommand({id:n.id})),a.focus({preventScroll:!0})};return(0,e.jsx)("div",{className:or,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:ir,"data-testid":"difference-arrow-toolbar",...Q(d),style:(0,Be.assignInlineVars)({[rr]:`${g.centre}px`,[ar]:`${g.available}px`}),children:[(0,e.jsx)(fr,{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:b,popupAttributes:Q(d),children:(0,e.jsx)("span",{className:lr,style:{background:n.color??"transparent"}})}),(0,e.jsx)(br,{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)(er,{size:"sm",title:""})}),(0,e.jsx)(c.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.remove"),className:ye,onClick:P,children:(0,e.jsx)(nr,{size:"sm",title:""})})]})})},fr=({options:n,current:t,isOpen:i,onOpenChange:o,onPick:r})=>{const a=c.useI18n(),s=n.find(l=>l.kind===t),d=n.some(l=>l.isPickable&&l.kind!==t);return(0,e.jsxs)(k.Menu.Root,{open:i,modal:!1,onOpenChange:o,children:[(0,e.jsxs)(k.Menu.Trigger,{render:(0,e.jsx)(c.FloatingToolbar.Button,{}),"aria-label":a("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),className:sn,disabled:!d,onMouseDown:l=>l.preventDefault(),children:[(0,e.jsx)("span",{className:sr,children:s===void 0?"":a(s.nameKey)}),s!==void 0&&(0,e.jsxs)("span",{className:"q7gcrz4",children:["(",s.preview,")"]}),(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})]}),(0,e.jsx)(ln,{children:n.map(l=>(0,e.jsxs)(k.Menu.Item,{className:on,"data-selected":l.kind===t,disabled:!l.isPickable,onClick:()=>r(l.kind),children:[(0,e.jsx)("span",{children:a(l.nameKey)}),(l.isSuspect||!l.isPickable)&&(0,e.jsx)("span",{"aria-label":a(l.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrzb",role:"img",children:"⚠"}),(0,e.jsx)("span",{className:ur,children:l.preview})]},l.kind))})]})},br=({current:n,isOpen:t,onOpenChange:i,onPick:o})=>{const r=c.useI18n(),a=oe.find(s=>s.id===n)??oe[0];return(0,e.jsxs)(k.Menu.Root,{open:t,modal:!1,onOpenChange:i,children:[(0,e.jsxs)(k.Menu.Trigger,{render:(0,e.jsx)(c.FloatingToolbar.Button,{}),"aria-label":r("graph.annotations.differenceArrowToolbar.size.ariaLabel"),className:sn,onMouseDown:s=>s.preventDefault(),children:[(0,e.jsx)("span",{children:a===void 0?"":r(a.nameKey)}),(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})]}),(0,e.jsx)(ln,{children:oe.map(s=>(0,e.jsx)(k.Menu.Item,{className:on,"data-selected":s.id===n,onClick:()=>o(s.id),children:r(s.nameKey)},s.id))})]})},ln=({children:n})=>{const{chartId:t}=c.useGraphContext();return(0,e.jsx)(k.Menu.Portal,{container:c.resolvePortalContainer(),children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(k.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:cr,children:(0,e.jsx)(k.Menu.Popup,{className:dr,onMouseDown:i=>i.preventDefault(),...Q(t),children:n})})})})};var Sr="ydgo3h0",jr="ydgo3h1",yr="ydgo3h2",cn=n=>n==="start"?"end":"start",dn=({dispatch:n,arrow:t,endpoint:i,anchor:o})=>{(0,h.areAnchorsEqual)(o,t[i].anchor)||n(new h.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[i]:o}}))},Ir=({clientPoint:n,panelOrigin:t,panelRect:i,engine:o,layers:r,coordSystem:a,resolver:s,fixedAnchor:d,align:l})=>{const p=Tr({x:n.x-t.x,y:n.y-t.y},i),{primary:u}=o.query((0,h.toPanelCursor)(p,i));if(u===null)return null;const m=r.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:a,align:l});return v===null||(0,h.areAnchorsEqual)(v.anchor,d)?null:v},Tr=(n,t)=>({x:Math.max(0,Math.min(n.x,t.width)),y:Math.max(0,Math.min(n.y,t.height))}),wr=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:o,anchorResolver:r,endpoint:a,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,a)===null)return;const g=Ir({clientPoint:{x:t.clientX,y:t.clientY},panelOrigin:l,panelRect:p,engine:o,layers:u,coordSystem:m,resolver:r,fixedAnchor:d[cn(a)].anchor,align:d[a].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:o,dispatch:r}=this.params,{arrow:a}=o(),s=t.getState(),d=c.readDraggedEndpointFor(c.readStanding(s,"endpoint-drag"),a.id,i);d!==null&&(s.releaseInteraction("endpoint-drag"),n&&dn({dispatch:r,arrow:a,endpoint:i,anchor:d.point.anchor}))}publish(n){const{editorStore:t,readInputs:i,endpoint:o}=this.params;t.getState().claimInteraction({kind:"endpoint-drag",annotationId:i().arrow.id,endpoint:o,point:n}),this.hasPublished=!0}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Pr=({arrow:n,panelOrigin:t,panelRect:i})=>{const{commands:o,anchorResolver:r}=c.useGraphContext(),{engine:a}=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 wr({handle:u.currentTarget,pointerId:u.pointerId,endpoint:p,readInputs:()=>d.current,editorStore:s,engine:a,anchorResolver:r,dispatch:o.dispatch,onSettled:()=>{l.current=null}});l.current=m,m.start()}}),[d,s,a,r,o])},Lr=[" ","Enter"],Ar=({arrow:n})=>{const{commands:t,anchorResolver:i}=c.useGraphContext(),o=c.useEditorStore(),{layers:r,coordSystem:a,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=o.getState();c.readStanding(l,"endpoint-drag")?.annotationId===d&&l.releaseInteraction("endpoint-drag")},[o,d]),(0,x.useCallback)(l=>({onKeyDown:p=>{if(p.altKey||p.ctrlKey||p.metaKey||p.shiftKey)return;const u=o.getState(),m=c.readDraggedEndpointFor(c.readStanding(u,"endpoint-drag"),n.id,l);if(Lr.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"),dn({dispatch:t.dispatch,arrow:n,endpoint:l,anchor:m.point.anchor});return}if(m===null)return;const v=Mr(p.key,s);if(v===null)return;p.preventDefault();const g=_r({arrow:n,endpoint:l,from:m.point.anchor,move:v,layers:r,coordSystem:a,resolver:i});g!==null&&u.claimInteraction({kind:"endpoint-drag",annotationId:n.id,endpoint:l,point:g})}}),[n,o,t,i,r,a,s])},Mr=(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}},_r=({arrow:n,endpoint:t,from:i,move:o,layers:r,coordSystem:a,resolver:s})=>{const d=r.find(p=>p.id===i.layerId);if(d===void 0)return null;const l=(0,h.stepDifferenceArrowEndpoint)({layer:d,from:i,partner:n[cn(t)].anchor,axis:o.axis,step:o.step,canLandOn:p=>(0,h.resolveObservationPoint)({resolver:s,layer:d,observation:p,coordSystem:a,align:n[t].anchor.align})!==null});return l===null?null:(0,h.resolveObservationPoint)({resolver:s,layer:d,observation:l.observation,coordSystem:a,align:n[t].anchor.align})},Er=n=>{const t=Qt();return t===null?null:(0,e.jsx)(Or,{annotationId:t,...n})},Or=({annotationId:n,...t})=>{const i=c.useDifferenceArrowGeometries(),o=(0,x.useMemo)(()=>i.find(r=>r.id===n),[i,n]);return o===void 0?null:(0,e.jsx)(Rr,{committedArrow:o.committedArrow,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,start:o.start,end:o.end,isDragged:o.isDragged,...t})},Rr=({committedArrow:n,committedLabelBox:t,labelBox:i,start:o,end:r,panelRect:a,panelOrigin:s,frameRect:d,frameElement:l,isDragged:p})=>{const u=Pr({arrow:n,panelOrigin:s,panelRect:a}),m=Ar({arrow:n});return(0,e.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!p&&(0,e.jsx)(xr,{arrow:n,labelBox:t,panelRect:a,frameWidth:d.width,frameHeight:d.height,frameElement:l}),(0,e.jsx)("div",{"aria-hidden":"true",className:yr,"data-testid":"difference-arrow-selection-label",style:{left:a.x+i.x-2,top:a.y+i.y-2,width:i.width+4,height:i.height+4}}),(0,e.jsx)(Te,{endpoint:"start",point:o,panelRect:a,dragHandlers:u("start"),keyboardHandlers:m("start")}),(0,e.jsx)(Te,{endpoint:"end",point:r,panelRect:a,dragHandlers:u("end"),keyboardHandlers:m("end")})]})},Te=({endpoint:n,point:t,panelRect:i,dragHandlers:o,keyboardHandlers:r})=>(0,e.jsx)("div",{className:Sr,"data-testid":"difference-arrow-selection-handle","data-endpoint":n,role:"button",style:{left:i.x+t.x,top:i.y+t.y},tabIndex:0,...o,...r,children:(0,e.jsx)("span",{"aria-hidden":"true",className:jr})}),Nr=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"})]})}),kr="var(--_1tyillx0)",Dr={rest:.5,hovered:.75,open:1};var Hr="_1tyillx1",Vr={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},zr="_1tyillx5",Fr={closed:"_1tyillx6",open:"_1tyillx7"},Gr=({interaction:n,panelRect:t})=>{const i=c.useEditorStore(),o=c.useCompiledSelector(d=>d.coordSystem),r=n.kind==="trigger"||n.kind==="menu"?n.anchor:null,a=Br(n),s=(0,x.useMemo)(()=>{if(r===null)return null;const d=(0,h.projectAnchorToPanel)(r.position,t,o);return{center:d,radius:19*Dr[a],target:{kind:"observation",cursor:(0,h.toPanelCursor)(d,t)}}},[r,t,o,a]);return(0,x.useEffect)(()=>{i.getState().setMenuTrigger(s)},[i,s]),(0,x.useEffect)(()=>()=>i.getState().setMenuTrigger(null),[i]),r===null||s===null?null:(0,e.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":a,className:(0,G.default)(Hr,Vr[a]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,Be.assignInlineVars)({[kr]:r.color??tt.vars.border50})},children:(0,e.jsx)("span",{className:(0,G.default)(zr,Fr[a==="open"?"open":"closed"]),children:(0,e.jsx)(Nr,{size:"lg"})})})},Br=n=>n.kind==="menu"?"open":n.kind==="trigger"&&n.isEngaged?"hovered":"rest",Kr='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',qr=(n,t)=>{const{chartId:i}=c.useGraphContext(),o=c.useEditorStore();(0,x.useEffect)(()=>{if(t===null)return;const r=a=>{if(a.key!=="Tab"||a.defaultPrevented||!Y(a.target,n,i)||o.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(Kr)];if(s.length===0)return;a.preventDefault();const d=s.findIndex(l=>l===document.activeElement);s[d===-1?a.shiftKey?s.length-1:0:(d+(a.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[n,t,i,o])},Ur=n=>{const{selectionStore:t,chartId:i}=c.useGraphContext();(0,x.useEffect)(()=>{let o=null;const r=()=>{n.focus({preventScroll:!0})},a=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&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{o=null,document.hasFocus()&&(Y(document.activeElement,n,i)||t.getState().clearSelection())}))};return n.addEventListener("pointerdown",r),document.addEventListener("focusin",a),document.addEventListener("focusout",s),()=>{o!==null&&cancelAnimationFrame(o),n.removeEventListener("pointerdown",r),document.removeEventListener("focusin",a),document.removeEventListener("focusout",s)}},[n,t,i])},Wr=n=>{const{selectionStore:t,commands:i,chartId:o}=c.useGraphContext(),r=c.useEditorStore(),a=(0,x.useCallback)(d=>{const{selection:l}=t.getState(),p=an(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=r.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(We(d.target,o)){n.focus({preventScroll:!0});return}t.getState().clearSelection();return}},[r,t,n,o]);(0,x.useEffect)(()=>{const d=l=>{if(Y(l.target,n,o)&&!Zr(l.target)&&!st(l.target))switch(l.key){case"Escape":return s(l);case"Delete":case"Backspace":return a(l);default:return}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,a,s,o])},Zr=n=>n instanceof HTMLElement&&(n.isContentEditable||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement),$r=`[${c.EDIT_TARGET_KIND_ATTRIBUTE}]`,un=(n,t,i)=>{if(typeof document.elementsFromPoint!="function")return null;const o=document.elementsFromPoint(n,t);return Xr(o,i)},Xr=(n,t)=>{for(const i of n){const o=i.closest($r);if(o===null||!t.contains(o))continue;const r=Yr(o);if(r!==null)return r}return null},Yr=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}},Jr=()=>{const n=c.useHoverState(r=>r.hover.primary),{layers:t,coordSystem:i}=c.useCompiledSelector((0,ue.useShallow)(r=>({layers:r.layers,coordSystem:r.coordSystem}))),{anchorResolver:o}=c.useGraphContext();return(0,x.useMemo)(()=>{if(n===null)return null;const r=t.find(d=>d.id===n.layerId);if(r===void 0)return null;const a=o.resolve(r.geom,n.observation,{coordSystem:i,position:r.position,purpose:"pin"});if(a===null)return null;const s=(0,h.buildObservationAnchor)(r,n.observation);return s===null?null:{position:a,color:(0,h.getColor)(n.observation),layer:r,at:s,observation:n.observation}},[n,t,i,o])},Qr={kind:"idle"},hn=()=>{const n=c.useEditorState(o=>o.standingInteraction),t=c.useEditorState(o=>o.chromeUnderPointer),i=Jr();return(0,x.useMemo)(()=>n!==null?n:i===null?Qr:{kind:"trigger",anchor:i,isEngaged:t==="menu-trigger"},[n,i,t])},ea=(n,t)=>{const i=c.useEditorStore(),o=c.useLatestRef(t);(0,x.useEffect)(()=>{let r=null,a=null;const s=m=>{const{menuTrigger:v}=i.getState();return v===null?null:(0,h.isPointWithinEditMenuTrigger)(m,v)?"menu-trigger":null},d=()=>{r=null;const m=a;if(a=null,m===null)return;const v=o.current,g=i.getState();g.setChromeUnderPointer(s({x:m.x-v.x,y:m.y-v.y})),g.standingInteraction?.kind!=="menu"&&g.setEditTargetUnderPointer(un(m.x,m.y,n))},l=()=>{const m=i.getState();m.setChromeUnderPointer(null),m.setEditTargetUnderPointer(null)},p=m=>{a={x:m.clientX,y:m.clientY},r===null&&(r=requestAnimationFrame(d))},u=()=>{a=null,r!==null&&(cancelAnimationFrame(r),r=null),l()};return n.addEventListener("pointermove",p),n.addEventListener("pointerleave",u),()=>{r!==null&&cancelAnimationFrame(r),n.removeEventListener("pointermove",p),n.removeEventListener("pointerleave",u),l()}},[n,i,o])},we="editor",Pe=[],na=(n,t,i,o)=>{const r=hn(),{store:a}=c.useHoverContext(),s=c.useGraphSelection().length>0,d=c.useEditorState(u=>u.menuTrigger),l=r.kind==="menu",p=(0,x.useMemo)(()=>d===null?Pe:[(0,h.buildEditMenuTriggerRegion)(d)],[d]);ea(n,t),ta(r,n,t,i),Ur(n),Wr(n),qr(n,o),(0,x.useEffect)(()=>(a.getState().publishPointerRegions(we,p),()=>a.getState().publishPointerRegions(we,Pe)),[a,p]),(0,x.useEffect)(()=>(a.getState().setPointerSuspended(l||s),()=>a.getState().setPointerSuspended(!1)),[a,l,s]),(0,x.useEffect)(()=>{if(!s)return;const u=a.getState();u.setHoverState(h.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[a,s])},ta=(n,t,i,o)=>{const r=c.useEditorStore(),{selectionStore:a}=c.useGraphContext(),{store:s,engine:d}=c.useHoverContext(),l=c.useLatestRef(n),p=c.useLatestRef(i),u=c.useLatestRef(o);(0,x.useEffect)(()=>{const m=j=>{const{menuTrigger:S}=r.getState();return S===null?!1:(0,h.isPointWithinEditMenuTrigger)(Le(j,p.current),S)},v=j=>{if(m(j)||a.getState().selection.length>0)return;const S=u.current,T=Le(j,p.current),w=ra(T,S)?d.query((0,h.toPanelCursor)(T,S)):h.RESTING_HOVER_STATE;s.getState().setHoverState(w)};let g=!1;const C=()=>{g=l.current.kind==="menu"},b=j=>{const S=un(j.clientX,j.clientY,t),T=a.getState();if(S===null){T.clearSelection();return}T.setSelection([S])},P=j=>{if(lt(j.target))return;const{claimInteraction:S,releaseInteraction:T}=r.getState(),w=m(j);if(!w||g){T("menu"),w||b(j),g&&v(j);return}const L=l.current;L.kind==="trigger"&&S({kind:"menu",anchor:L.anchor})};return document.addEventListener("pointerdown",C,!0),document.addEventListener("click",P),()=>{document.removeEventListener("pointerdown",C,!0),document.removeEventListener("click",P)}},[r,a,t,l,s,d,p,u])},Le=(n,t)=>({x:n.clientX-t.x,y:n.clientY-t.y}),ra=(n,t)=>n.x>=0&&n.x<=t.width&&n.y>=0&&n.y<=t.height,aa=({frameElement:n,panelRect:t})=>{const{measureRef:i,screenRect:o}=c.useElementScreenRect(),r=c.useEditorStore();return(0,x.useEffect)(()=>(i(n),()=>i(null)),[i,n]),(0,x.useEffect)(()=>()=>r.getState().releaseInteraction("menu"),[r]),o===null?null:(0,e.jsx)(dt,{children:(0,e.jsx)(oa,{frameElement:n,frameRect:o,panelRect:t})})},oa=({frameElement:n,frameRect:t,panelRect:i})=>{const o=(0,x.useMemo)(()=>({x:t.left+i.x,y:t.top+i.y}),[t.left,t.top,i.x,i.y]),[r,a]=(0,x.useState)(null);return na(n,o,i,r),(0,e.jsx)(ia,{frameElement:n,frameRect:t,panelOrigin:o,panelRect:i,boxRef:a})},ia=({frameElement:n,frameRect:t,panelOrigin:i,panelRect:o,boxRef:r})=>{const a=he(),s=hn();return(0,e.jsx)(c.OverlayPortal,{rect:t,zIndex:c.Z_INDEX.editorOverlay,container:a,"data-testid":"editor-overlay",boxRef:r,children:(0,e.jsxs)(c.PortalThemeProvider,{children:[(0,e.jsx)(Er,{panelRect:o,panelOrigin:i,frameRect:t,frameElement:n}),(0,e.jsx)(Gr,{interaction:s,panelRect:o}),(0,e.jsx)(Zt,{interaction:s,panelOrigin:i})]})})},sa=({slots:n,...t})=>(0,e.jsx)(c.EditorProvider,{children:(0,e.jsx)(c.GraphRenderer,{slots:(0,x.useMemo)(()=>({EditorSurface:aa,...n}),[n]),...t})}),mn=(0,x.createContext)(null),pn=({labelId:n,controlId:t,children:i})=>{const o=(0,x.useMemo)(()=>{let r=null;return{labelId:n,controlId:t,claimControlId:a=>(r??=a,r===a)}},[n,t]);return(0,e.jsx)(mn.Provider,{value:o,children:i})},B=({id:n,ariaLabel:t,ariaLabelledBy:i},o=!0)=>{const r=(0,x.useContext)(mn),a=(0,x.useId)(),[s]=(0,x.useState)(()=>o?r?.claimControlId(a)??!1:!1),d=n??(s?r?.controlId:void 0),l=i??(t===void 0?r?.labelId:void 0);return{...d!==void 0&&{id:d},...t!==void 0&&{"aria-label":t},...l!==void 0&&{"aria-labelledby":l}}};var la={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},gn=({label:n,icon:t,onClick:i,variant:o="default",isDisabled:r,ariaLabel:a,ariaLabelledBy:s,id:d})=>{const l=B({id:d,ariaLabel:a,ariaLabelledBy:s}),p=o==="tile";return(0,e.jsxs)("button",{type:"button",className:la[o],disabled:r,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),M=()=>{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},Cn=({children:n,onKeyDown:t,...i})=>{const o=(0,x.useContext)(pe),r=a=>{if(t?.(a),!o||a.defaultPrevented)return;const s=c.resolveHistoryStep(a.nativeEvent);s&&(a.preventDefault(),s==="undo"?o.undo():o.redo())};return(0,e.jsx)("div",{onKeyDown:r,...i,children:n})},vn="keyboard",ne=n=>{const t=(0,x.useRef)(!1),i=(0,x.useRef)(!1),o=()=>{t.current=!1,i.current&&(i.current=!1,n?.())};return{commitAfterChange:()=>{if(t.current){i.current=!0;return}n?.()},commitUnlessHeldKey:r=>{if(r){i.current=!0;return}n?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:o,onBlur:r=>{r.relatedTarget instanceof Node&&r.currentTarget.contains(r.relatedTarget)||o()}}}},ca="eh8dvc0",da="eh8dvc1 uz3g760",ua="eh8dvc2 uz3g761";var xn=({value:n,onChange:t,onCommit:i,min:o,max:r,step:a,placeholder:s,prefix:d,suffix:l,isDisabled:p,hasError:u,ariaLabel:m,ariaLabelledBy:v,id:g})=>{const C=B({id:g,ariaLabel:m,ariaLabelledBy:v}),{commitUnlessHeldKey:b,gestureHandlers:P}=ne(i);return(0,e.jsx)(Se.NumberField.Root,{className:ca,value:n,onValueChange:j=>t(j),onValueCommitted:(j,S)=>{b(S.reason===vn)},min:o,max:r,step:a,disabled:p,children:(0,e.jsxs)(Cn,{className:da,"data-error":u===!0,"data-disabled":p===!0?"":void 0,children:[d!==void 0&&(0,e.jsx)("span",{className:"eh8dvc3",children:d}),(0,e.jsx)(Se.NumberField.Input,{className:ua,placeholder:s,...P,"aria-invalid":u===!0?!0:void 0,...C}),l!==void 0&&(0,e.jsx)("span",{className:"eh8dvc3",children:l})]})})},ha="_1b7s5f0",W={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},ma="_1b7s5f7";var pa=6,fn=({options:n,value:t,onChange:i,onCommit:o,columns:r,itemLayout:a="tile",isDisabled:s,ariaLabel:d,ariaLabelledBy:l,id:p})=>{const u=B({id:p,ariaLabel:d,ariaLabelledBy:l}),m=a==="swatch",{commitAfterChange:v,gestureHandlers:g}=ne(o);return(0,e.jsx)(qe.RadioGroup,{className:(0,G.default)(ha,ga(r??n.length)),value:t,onValueChange:C=>{i(C),v()},...g,disabled:s,...u,children:n.map(C=>(0,e.jsxs)(Ke.Radio.Root,{value:C.value,disabled:C.isDisabled,className:(0,G.default)(ma,m&&"_1b7s5f8"),"aria-label":m?C.label:void 0,children:[C.icon,!m&&(0,e.jsx)("span",{className:"_1b7s5f9",children:C.label})]},C.value))})},ga=n=>{switch(Math.min(Math.max(Math.round(n),1),pa)){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]}},Ca="_1g5x15w0 uz3g760",va="_1g5x15w1",xa="_1g5x15w2",Ae="_1g5x15w3",fa="_1g5x15w4",ba="_1g5x15w5",Sa="_1g5x15w6",ja="_1g5x15w7";var bn=({options:n,value:t,onChange:i,placeholder:o,isDisabled:r,hasError:a,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const p=B({id:l,ariaLabel:s,ariaLabelledBy:d});return(0,e.jsxs)(V.Select.Root,{value:t,onValueChange:u=>u!==null&&i(u),disabled:r,items:n.map(u=>({value:u.value,label:u.label})),children:[(0,e.jsxs)(V.Select.Trigger,{className:Ca,"data-error":a===!0,...p,children:[(0,e.jsx)(V.Select.Value,{className:va,children:u=>ya(n,u,o)}),(0,e.jsx)(V.Select.Icon,{className:Ae,children:(0,e.jsx)(c.ChevronDownIcon,{size:"sm"})})]}),(0,e.jsx)(V.Select.Portal,{container:c.resolvePortalContainer(),children:(0,e.jsx)(c.PortalThemeProvider,{children:(0,e.jsx)(V.Select.Positioner,{className:fa,sideOffset:4,alignItemWithTrigger:!1,children:(0,e.jsx)(V.Select.Popup,{className:ba,children:n.map(u=>(0,e.jsxs)(V.Select.Item,{value:u.value,disabled:u.isDisabled,className:Sa,children:[u.icon,(0,e.jsxs)("span",{className:ja,children:[(0,e.jsx)(V.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,e.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,e.jsx)(V.Select.ItemIndicator,{className:Ae,children:(0,e.jsx)(c.CheckIcon,{size:"sm"})})]},u.value))})})})})]})},ya=(n,t,i)=>t===null?(0,e.jsx)("span",{className:xa,children:i}):Ia(n,t),Ia=(n,t)=>n.find(i=>i.value===t)?.label??t,Ta="vod76w0",wa="vod76w1",Pa="vod76w2",La="vod76w3",Aa="vod76w4",Ma="vod76w5";var Sn=({value:n,onChange:t,onCommit:i,min:o,max:r,step:a,suffix:s,formatValue:d,isDisabled:l,ariaLabel:p,ariaLabelledBy:u})=>{const m=B({ariaLabel:p,ariaLabelledBy:u},!1),v=_a(n,s,d),{commitUnlessHeldKey:g,gestureHandlers:C}=ne(i);return(0,e.jsxs)("div",{className:Ta,children:[(0,e.jsx)(Z.Slider.Root,{className:wa,value:n,onValueChange:b=>t(b),onValueCommitted:(b,P)=>{g(P.reason===vn)},min:o,max:r,step:a,disabled:l,children:(0,e.jsx)(Z.Slider.Control,{className:Pa,children:(0,e.jsxs)(Z.Slider.Track,{className:La,children:[(0,e.jsx)(Z.Slider.Indicator,{className:Aa}),(0,e.jsx)(Z.Slider.Thumb,{className:Ma,...C,...m})]})})}),v!==null&&(0,e.jsx)("span",{className:"vod76w6",children:v})]})},_a=(n,t,i)=>i!==void 0?i(n):t!==void 0?`${n}${t}`:null,Ea="_1hyrlw60",Oa="_1hyrlw61",jn=({isChecked:n,onChange:t,isDisabled:i,ariaLabel:o,ariaLabelledBy:r,id:a})=>{const s=B({id:a,ariaLabel:o,ariaLabelledBy:r});return(0,e.jsx)(je.Switch.Root,{checked:n,onCheckedChange:d=>t(d),disabled:i,className:Ea,...s,children:(0,e.jsx)(je.Switch.Thumb,{className:Oa})})},Ra="uz3g761",Na="tpcnun0 uz3g760",yn=({value:n,onChange:t,onCommit:i,placeholder:o,isDisabled:r,hasError:a,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const p=B({id:l,ariaLabel:s,ariaLabelledBy:d});return(0,e.jsx)(Cn,{className:Na,"data-error":a===!0,children:(0,e.jsx)(at.Input,{className:Ra,value:n,onValueChange:u=>t(u),onBlur:i,placeholder:o,disabled:r,"aria-invalid":a===!0?!0:void 0,...p})})},ka="cnu9yl0",Da="cnu9yl1";var In=({options:n,value:t,onChange:i,onCommit:o,itemLayout:r="inline",isDisabled:a,ariaLabel:s,ariaLabelledBy:d,id:l})=>{const p=B({id:l,ariaLabel:s,ariaLabelledBy:d}),u=r==="stacked",{commitAfterChange:m,gestureHandlers:v}=ne(o);return(0,e.jsx)(qe.RadioGroup,{className:ka,value:t,onValueChange:g=>{i(g),m()},...v,disabled:a,...p,children:n.map(g=>(0,e.jsxs)(Ke.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,G.default)(Da,u&&"cnu9yl2"),"aria-label":Ha(g,u),children:[g.icon,Tn(g,u)&&(0,e.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Tn=(n,t)=>n.icon===void 0||t,Ha=(n,t)=>{if(!Tn(n,t))return n.label},wn={ToggleGroup:In,Switch:jn,Slider:Sn,RadioGrid:fn,Button:gn,TextField:yn,NumberField:xn,Select:bn},Pn=(0,x.createContext)(wn),Va=({controls:n,children:t})=>{const i=(0,x.useMemo)(()=>({...wn,...n}),[n]);return(0,e.jsx)(Pn.Provider,{value:i,children:t})},_=()=>(0,x.useContext)(Pn),za="_12lhx9e0",Ln=({children:n})=>(0,e.jsx)("div",{className:za,children:n}),Fa="_139ohwv0",D=({children:n})=>(0,e.jsx)("div",{className:Fa,children:n}),An=(0,x.createContext)(null),Ga=An.Provider,Mn=()=>{const n=(0,x.useContext)(An);if(!n)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return n},Ba="_1jlczkt0",_n="data-graphy-editor-panel",Ka={List:D,Grid:Ln};function qa(n){if(n===void 0)return!1;const t=n.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var Ua=({handle:n,children:t,controls:i,defaultExpandedSection:o=void 0,className:r})=>{const a=c.useGraphHandle(n),{themeClass:s,inlineVarsStyle:d}=c.useThemeContext(),[l,p]=(0,x.useState)(()=>o?[o]:[]),u=(0,x.useMemo)(()=>({expandSection:m=>p([m]),collapseAllSections:()=>p([])}),[]);return(0,e.jsx)(pe.Provider,{value:a,children:(0,e.jsx)(Va,{controls:i,children:(0,e.jsx)(Ga,{value:u,children:(0,e.jsx)(X.Accordion.Root,{[_n]:"",className:(0,G.default)(Ba,r,{[s]:!qa(r)}),style:d,value:l,onValueChange:m=>p(m),children:t})})})})},ge={Root:Ua,Controls:Ka},Me={stack:"pr583x0",grid:"pr583x1"},_e="pr583x2",Wa={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},f=({label:n,layout:t="grid",icon:i,children:o})=>{const r=(0,x.useId)(),a=(0,x.useId)();return n===void 0?(0,e.jsx)("div",{className:Me[t],children:(0,e.jsx)("div",{className:_e,children:o})}):(0,e.jsxs)("div",{className:Me[t],children:[(0,e.jsxs)("label",{id:r,htmlFor:a,className:Wa[i===void 0?"plain":"withIcon"],children:[i!==void 0&&(0,e.jsx)("span",{"aria-hidden":"true",children:i}),n]}),(0,e.jsx)("div",{className:_e,children:(0,e.jsx)(pn,{labelId:r,controlId:a,children:o})})]})},Za=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"})})}),Ce="_40zvwv0",ve="_40zvwv1",$a="_40zvwv2",En="_40zvwv3",Xa="_40zvwv4 _40zvwv3";var Ya="_40zvwv6";var Ja="_40zvwv8",R=({title:n,layout:t="fixed",preview:i,accessory:o,onOpenChange:r,children:a})=>t==="collapsible"?(0,e.jsx)(eo,{title:n,preview:i,accessory:o,onOpenChange:r,children:a}):t==="inline"&&i===void 0?(0,e.jsx)(Qa,{title:n,accessory:o,children:a}):(0,e.jsxs)("div",{className:Ce,children:[(0,e.jsxs)("div",{className:ve,children:[(0,e.jsx)("span",{className:En,children:n}),i!==void 0&&(0,e.jsx)("span",{className:"_40zvwv5",children:i}),o!==void 0&&(0,e.jsx)("span",{className:"_40zvwv7",children:o})]}),(0,e.jsx)("div",{children:a})]}),Qa=({title:n,accessory:t,children:i})=>{const o=(0,x.useId)(),r=(0,x.useId)();return(0,e.jsx)("div",{className:Ce,children:(0,e.jsxs)("div",{className:ve,children:[(0,e.jsx)("label",{id:o,htmlFor:r,className:Xa,children:n}),(0,e.jsx)("span",{className:Ya,children:(0,e.jsx)(pn,{labelId:o,controlId:r,children:i})}),t!==void 0&&(0,e.jsx)("span",{className:"_40zvwv7",children:t})]})})},eo=({title:n,preview:t,accessory:i,onOpenChange:o,children:r})=>{const a=c.useI18n();return(0,e.jsxs)(X.Accordion.Item,{value:n,className:Ce,onOpenChange:o,children:[(0,e.jsxs)(X.Accordion.Header,{className:ve,render:(0,e.jsx)("div",{}),children:[(0,e.jsx)(X.Accordion.Trigger,{className:$a,"aria-label":a("editor.accessibility.toggleSection",{title:n})}),(0,e.jsx)("span",{className:En,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:Ja,children:(0,e.jsx)(Za,{size:"sm"})})]}),(0,e.jsx)(X.Accordion.Panel,{children:(0,e.jsx)("div",{children:r})})]})},On=({title:n,isChecked:t,onToggle:i,isDisabled:o,preview:r,children:a})=>{const{expandSection:s,collapseAllSections:d}=Mn(),{Switch:l}=_(),p=m=>{i(m),m?s(n):d()},u=m=>{m&&!t&&o!==!0&&i(!0)};return(0,e.jsx)(R,{title:n,layout:"collapsible",preview:r,onOpenChange:u,accessory:(0,e.jsx)(l,{isChecked:t,onChange:p,isDisabled:o,ariaLabel:n}),children:a})},no={horizontal:["bottom","top"],vertical:["left","right"]},to={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},ro={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},se=({axis:n,title:t,layout:i="collapsible",preview:o})=>{const r=M(),a=c.useHandleCompiled(r),s=c.useI18n(),{NumberField:d,Switch:l,TextField:p,ToggleGroup:u}=_();if(!a)return null;const m=a.coordSystem.type==="polar"?a.coordSystem.axisMapping[n].geometry:"linear",v=a.config.axes[n],g=a.scales[n],C=g?.spec,b=C?.scaleType==="continuous"?C:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const P=C!==void 0&&"reverse"in C?C:void 0,j=C?.scaleType==="continuous"||C?.scaleType==="datetime",S=n==="y"&&b!==void 0&&a.layers.some(y=>y.yScaleType==="primary"&&y.geom==="bar"),T=b?.transform==="log",w=b?.domainMax??null,L=ao(b),N=(y,z)=>y.map(J=>({value:J,label:z(J)})),E=a.guides.axes.find(y=>y.scaleAestheticKey===n)?.position,H=no[E==="bottom"||E==="top"||E===void 0&&n==="x"?"horizontal":"vertical"],A=a.guides.legends.drawn.some(y=>H.some(z=>z===y.position)),I=H.map(y=>({value:y,label:s(to[y])})),O=N(["auto","edges"],y=>s(y==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),K=N(["linear","log"],y=>s(y==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Gn=N(["auto","zero","custom"],y=>s(y==="zero"?"editor.axesPanel.startFrom.zero":y==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Bn=N(["auto","custom"],y=>s(y==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Kn=N(["no","yes"],y=>s(y==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),qn=y=>{r.commands.dispatch(new h.SetAxisVisibilityCommand({axis:n,isVisible:y}))},Un=y=>{r.commands.dispatch(new h.SetAxisLabelCommand({axis:n,label:y===""?null:y}),{transient:!0})},Wn=y=>{r.commands.dispatch(new h.SetAxisTicksVisibilityCommand({axis:n,isVisible:y}))},Zn=y=>{r.commands.dispatch(new h.SetAxisTickModeCommand({axis:n,tickMode:y==="edges"?"edges":"auto"}))},$n=y=>{r.commands.dispatch(new h.SetScaleReverseCommand({scaledAesthetic:n,reverse:y==="yes"}))},Xn=y=>{r.commands.dispatch(new h.SetScaleTransformCommand({scaledAesthetic:n,transform:y==="log"?"log":"linear"}))},be=y=>{r.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,...y}),{transient:!0})},Yn=y=>{y!==null&&be({domainMin:y})},Jn=y=>{y!==null&&be({domainMax:y})},Qn=y=>{if(b){if(y==="custom"){b.zero&&r.commands.dispatch(new h.SetScaleZeroCommand({scaledAesthetic:n,zero:!1})),r.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,domainMin:Ee(g?.domain,"start")}));return}b.domainMin!==null&&r.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,domainMin:null})),r.commands.dispatch(new h.SetScaleZeroCommand({scaledAesthetic:n,zero:y==="zero"}))}},et=y=>{const z=y==="custom"?Ee(g?.domain,"end"):null;r.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:n,domainMax:z}))},nt=y=>{const z=H.find(J=>J===y);z&&r.commands.dispatch(new h.SetAxisPositionCommand({axis:n,position:z}))};return(0,e.jsx)(R,{title:t??s(ro[n]),layout:i,preview:o,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:s("editor.axesPanel.controls.visible"),children:(0,e.jsx)(l,{isChecked:v.isVisible,onChange:qn})}),m==="linear"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(f,{label:s("editor.axesPanel.controls.title"),children:(0,e.jsx)(p,{value:v.label??"",onChange:Un,onCommit:r.commands.seal})}),(0,e.jsx)(f,{label:s("editor.axesPanel.controls.ticks"),children:(0,e.jsx)(l,{isChecked:v.ticks.isVisible,onChange:Wn})})]}),j&&(0,e.jsx)(f,{label:s("editor.axesPanel.controls.labels"),children:(0,e.jsx)(u,{value:v.ticks.mode,options:O,onChange:Zn})}),b&&m==="linear"&&!A&&(0,e.jsx)(f,{label:s("editor.axesPanel.controls.position"),children:(0,e.jsx)(u,{value:E??v.position,options:I,onChange:nt})}),P!==void 0&&(0,e.jsx)(f,{label:s("editor.axesPanel.controls.reverse"),children:(0,e.jsx)(u,{value:P.reverse===!0?"yes":"no",options:Kn,onChange:$n})}),b&&!S&&(0,e.jsx)(f,{label:s("editor.axesPanel.controls.scale"),children:(0,e.jsx)(u,{value:T?"log":"linear",options:K,onChange:Xn})}),b&&!T&&(0,e.jsxs)(e.Fragment,{children:[!S&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(f,{label:s("editor.axesPanel.controls.startFrom"),children:(0,e.jsx)(u,{value:L,options:Gn,onChange:Qn})}),L==="custom"&&(0,e.jsx)(f,{label:s("editor.axesPanel.controls.value"),children:(0,e.jsx)(d,{value:b.domainMin??null,onChange:Yn,onCommit:r.commands.seal})})]}),(0,e.jsx)(f,{label:s("editor.axesPanel.controls.endAt"),children:(0,e.jsx)(u,{value:w===null?"auto":"custom",options:Bn,onChange:et})}),w!==null&&(0,e.jsx)(f,{label:s("editor.axesPanel.controls.value"),children:(0,e.jsx)(d,{value:w,onChange:Jn,onCommit:r.commands.seal})})]})]})})},ao=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},xe=({value:n,onChange:t})=>{const i=M(),o=c.useI18n(),{TextField:r}=_(),a=n!==null&&typeof n!="string",s=d=>t(d===""?null:d);return(0,e.jsx)(f,{label:o("editor.elementsPanel.contentValue"),children:(0,e.jsx)(r,{value:typeof n=="string"?n:"",onChange:s,onCommit:i.commands.seal,isDisabled:a})})},Rn=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Switch:s}=_();if(!r)return null;const d=r.config.content,l=u=>{o.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},p=u=>{o.commands.dispatch(new h.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,e.jsx)(R,{title:n??a("editor.elementsPanel.footerSection.caption"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isCaptionVisible,onChange:l})}),(0,e.jsx)(xe,{value:d.caption,onChange:p})]})})},Oe=/^[a-z][a-z\d+.-]*:/i,oo={},Nn=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Switch:s}=_();if(!r)return null;const d=r.config.content,l=p=>{o.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"source",isVisible:p}))};return(0,e.jsx)(R,{title:n??a("editor.elementsPanel.sourceSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isSourceVisible,onChange:l})}),(0,e.jsx)(io,{source:d.source??oo})]})})},io=({source:n})=>{const t=M(),i=c.useI18n(),{TextField:o}=_(),r=l=>{const p=(l.label??"")!==""||(l.url??"")!=="";t.commands.dispatch(new h.SetContentSourceCommand({source:p?l:null}),{transient:!0})},a=()=>{const l=n.url??"";l!==""&&!Oe.test(l)&&r({...n,url:`https://${l}`}),t.commands.seal()},s=l=>r({...n,url:l}),d=l=>r({...n,label:l});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(f,{label:i("editor.elementsPanel.sourceSection.url"),children:(0,e.jsx)(o,{value:n.url??"",onChange:s,onCommit:a,hasError:Oe.test(n.url??"")&&!(0,h.isSafeUrl)(n.url)})}),(0,e.jsx)(f,{label:i("editor.elementsPanel.sourceSection.name"),children:(0,e.jsx)(o,{value:n.label??"",onChange:d,onCommit:t.commands.seal})})]})},kn=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Switch:s}=_();if(!r)return null;const d=r.config.content,l=u=>{o.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},p=u=>{o.commands.dispatch(new h.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,e.jsx)(R,{title:n??a("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isSubtitleVisible,onChange:l})}),(0,e.jsx)(xe,{value:d.subtitle,onChange:p})]})})},le=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],so=le.length/2,Dn=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{RadioGrid:s}=_();if(!r)return null;const{textScale:d}=r.config.appearance,l=m=>a("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&&o.commands.dispatch(new h.SetAppearanceTextScaleCommand({textScale:v}))};return(0,e.jsx)(R,{title:n??a("editor.elementsPanel.textSizeSection.title"),layout:t,preview:i??l(d),children:(0,e.jsx)(s,{value:`${d}`,options:p,columns:so,onChange:u,ariaLabel:a("editor.elementsPanel.textSizeSection.title")})})},Hn=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Switch:s}=_();if(!r)return null;const d=r.config.content,l=u=>{o.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},p=u=>{o.commands.dispatch(new h.SetContentTitleCommand({title:u}),{transient:!0})};return(0,e.jsx)(R,{title:n??a("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.elementsPanel.contentVisible"),children:(0,e.jsx)(s,{isChecked:d.isTitleVisible,onChange:l})}),(0,e.jsx)(xe,{value:d.title,onChange:p})]})})},lo=({children:n,...t})=>(0,e.jsx)(ge.Root,{...t,children:n??(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Hn,{}),(0,e.jsx)(kn,{}),(0,e.jsx)(Rn,{}),(0,e.jsx)(Nn,{}),(0,e.jsx)(Dn,{})]})}),co=({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`,Vn=n=>`${Math.round(n*100)}%`,uo=n=>`${n}°`,ho=24,Re=["dim","desaturate"],mo=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Slider:s,ToggleGroup:d}=_();if(!r)return null;const{cornerRadius:l}=r.config.appearance,p=(0,h.readHighlightDimStyle)(r.spec),u=Re.map(g=>({value:g,label:a(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),m=g=>{o.commands.dispatch(new h.SetAppearanceCornerRadiusCommand({cornerRadius:g}),{transient:!0})},v=g=>{const C=Re.find(b=>b===g);C&&o.commands.dispatch(new h.SetHighlightDimStyleCommand({dimStyle:C}))};return(0,e.jsx)(R,{title:n??a("editor.colorPanel.appearanceSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.colorPanel.borderSection.cornerRadius"),children:(0,e.jsx)(s,{value:l,min:0,max:ho,step:1,formatValue:te,onChange:m,onCommit:o.commands.seal})}),(0,e.jsx)(f,{label:a("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 o=n?.layers.find(r=>r.id===t);return o===void 0?null:(0,h.createStyleResolver)({colorScheme:i}).geomReaders(o)},[n,t,i])},po=.05,go=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Slider:s,ToggleGroup:d}=_(),l=r?(0,h.findLayerByGeom)(r.spec.layers,"bar"):void 0,p=fe(r,l?.id??null);if(!r||!l||r.coordSystem.type==="polar"&&r.coordSystem.bandAxis===null)return null;const u=g=>{o.commands.dispatch(new h.SetBarWidthCommand({layerId:l.id,width:g}),{transient:!0})},m=g=>{const C=h.BORDER_RADIUS_TOKENS.find(b=>b===g);C&&o.commands.dispatch(new h.SetBarBorderRadiusCommand({layerId:l.id,borderRadius:C}))},v=h.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:a(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,e.jsx)(R,{title:n??a("editor.graphPanel.barSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.graphPanel.barSection.thickness"),children:(0,e.jsx)(s,{value:l.params.width,min:h.MIN_BAR_WIDTH,max:h.MAX_BAR_WIDTH,step:po,formatValue:Vn,onChange:u,onCommit:o.commands.seal})}),(0,e.jsx)(f,{label:a("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",Co=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"})]}),vo=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"})]}),fo=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"})]}),bo={x:.5,y:.5},So=.2,jo={x:.375,y:.25,width:.25,height:.5},yo={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},Io={x:.4,y:.6},To={x:.6,y:.4},wo="relative-difference",Po=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Button:s}=_();if(!r)return null;const d=()=>{o.commands.dispatch(new h.AddAnnotationCommand({kind:"text",annotation:{...h.TEXT_ANNOTATION_DEFAULTS,content:Lo(a("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...bo},width:So}}))},l=()=>{o.commands.dispatch(new h.AddAnnotationCommand({kind:"arrow",annotation:{...h.ARROW_DEFAULTS,start:{anchorType:"panel",...Io},end:{anchorType:"panel",...To}}}))},p=()=>{o.commands.dispatch(new h.AddAnnotationCommand({kind:"shape",annotation:{...h.SHAPE_DEFAULTS,...yo,region:{anchorType:"panel",...jo}}}))},u=()=>{const v=(0,h.inferDefaultDifferenceArrowEndpoints)(r);v!==null&&o.commands.dispatch(new h.AddAnnotationCommand({kind:"differenceArrow",annotation:{...h.DIFFERENCE_ARROW_DEFAULTS,...v,label:wo}}))},m=r.coordSystem.type==="cartesian";return(0,e.jsx)(R,{title:n??a("editor.annotatePanel.callOutSection.title"),layout:t,preview:i,children:(0,e.jsxs)(Ln,{children:[(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(fo,{size:"xl"}),label:a("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(Co,{size:"xl"}),label:a("editor.annotatePanel.callOutSection.arrow"),onClick:l}),(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(vo,{size:"xl"}),label:a("editor.annotatePanel.callOutSection.box"),onClick:p}),m&&(0,e.jsx)(s,{variant:"tile",icon:(0,e.jsx)(xo,{size:"xl"}),label:a("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},Lo=n=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:n}]}]}),Ao=.1,Mo=20,_o=({title:n,preview:t})=>{const i=M(),o=c.useHandleCompiled(i),r=c.useI18n(),{NumberField:a,TextField:s}=_();if(!o||o.coordSystem.type==="polar")return null;const d=(0,h.findGoalLineLayer)(o.spec.layers),l=n??r("editor.annotationsPanel.goalSection.title"),p=(0,h.extractConstantValue)(d?.mapping.y),u=typeof p=="number"?p:null,m=C=>{const b=new h.ToggleGoalLineCommand({showGoalLine:C,value:Eo(o),...d!==void 0&&{layerId:d.id}});i.commands.dispatch(b)},v=C=>{if(d===void 0)return;const b=new h.SetRuleLabelCommand({layerId:d.id,label:C===""?null:C});i.commands.dispatch(b,{transient:!0})},g=C=>{if(d===void 0||C===null)return;const b=new h.SetRuleValueCommand({layerId:d.id,value:C});i.commands.dispatch(b,{transient:!0})};return(0,e.jsx)(On,{title:l,preview:t,isChecked:d!==void 0,onToggle:m,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:r("editor.annotationsPanel.goalSection.labelControl"),children:(0,e.jsx)(s,{value:d?.params.label??"",placeholder:r("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:v,onCommit:i.commands.seal,ariaLabel:r("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,e.jsx)(f,{label:r("editor.annotationsPanel.goalSection.valueControl"),children:(0,e.jsx)(a,{value:u,placeholder:r("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:i.commands.seal,ariaLabel:r("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},Eo=n=>{const t=(n.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const i=Math.max(...t),o=i-Math.min(...t),r=o>0?o:Math.abs(i);if(r===0)return 0;const a=Math.min(Mo,Math.max(0,1-Math.floor(Math.log10(r))));return Number((i+r*Ao).toFixed(a))},Oo=({layerId:n,title:t,layout:i="collapsible",preview:o})=>{const r=M(),a=c.useHandleCompiled(r),s=c.useI18n(),{Switch:d}=_();if(!a)return null;const l=n===void 0?a.spec.layers[0]:a.spec.layers.find(E=>E.id===n);if(!l)return null;const{showDataLabels:p,format:u,showStackTotals:m,showCategoryLabels:v}=l.dataLabels,g=a.coordSystem.type==="polar",C=l.geom==="bar",b=l.position==="stack"||l.position==="fill",P=C&&!g&&l.position==="stack",j=C&&(!g||p),S=C||l.geom==="area"&&b;if(!(0,h.canPlaceDataLabels)(l.geom,a.coordSystem.type))return null;const T=E=>{const H=new h.ToggleDataLabelsCommand({layerId:l.id,showDataLabels:E});r.commands.dispatch(H)},w=E=>{const H=new h.SetDataLabelsFormatCommand({layerId:l.id,format:E?"percentage":"absolute"});r.commands.dispatch(H)},L=E=>{const H=new h.ToggleStackTotalsCommand({layerId:l.id,showStackTotals:E});r.commands.dispatch(H)},N=E=>{const H=new h.ToggleCategoryLabelsCommand({layerId:l.id,showCategoryLabels:E});r.commands.dispatch(H)};return(0,e.jsx)(R,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:i,preview:o,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,e.jsx)(d,{isChecked:p,onChange:T})}),p&&S&&(0,e.jsx)(f,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,e.jsx)(d,{isChecked:u==="percentage",onChange:w})}),P&&(0,e.jsx)(f,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,e.jsx)(d,{isChecked:m,onChange:L})}),j&&(0,e.jsx)(f,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,e.jsx)(d,{isChecked:v,onChange:N})})]})})},Ro=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"})]}),No=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"})]})}),ko=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"})]})}),Do=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"})]})}),Ho=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"})]}),Vo=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"})]}),zo=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"})]}),Fo=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"})]})}),Go=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"})]})]})}),Bo=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"})]}),Ko=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"})]})}),qo=.55,ce=[{name:"column",icon:Ho,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:zo,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Vo,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:No,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Do,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:ko,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Go,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Ro,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"scatter",icon:Ko,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Bo,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Fo,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:qo}}],Uo=.05,Wo=n=>n===null?null:ce.find(t=>$o(t.summary,n))??null,Zo=(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}},$o=(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>=Uo,Xo=3,Yo=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{RadioGrid:s}=_(),d=(0,x.useMemo)(()=>ce.map(({name:m,icon:v})=>({value:m,label:a(`editor.graphTypes.${m}`),icon:(0,e.jsx)(v,{size:"md"})})),[a]);if(!r)return null;const l=(0,h.readChartType)(r.spec),p=Wo(l),u=m=>{const v=ce.find(g=>g.name===m);v&&o.commands.dispatch(new h.SetChartTypeCommand(Zo(v,l)))};return(0,e.jsx)(R,{title:n??a("editor.graphPanel.graphTypeSection.title"),layout:t,preview:i??a(p===null?"editor.graphTypes.combo":`editor.graphTypes.${p.name}`),children:(0,e.jsx)(s,{value:p?.name??"",options:d,columns:Xo,onChange:u,ariaLabel:a("editor.graphPanel.graphTypeSection.title")})})},Ne=["solid","dashed","dotted"],Jo=Number.parseFloat(c.chromeTokens.gridLineWidth),Qo=8,ei=0,ni=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Slider:s,Switch:d,ToggleGroup:l}=_(),{themeValues:p}=c.useThemeContext();if(!r)return null;const u=r.guides.axes.filter(ti);if(u.length===0)return null;const m=r.coordSystem.type!=="polar",v=u.some(S=>S.gridVisible),g=r.config.axes.y.grid,C=Ne.map(S=>({value:S,label:a(`editor.graphPanel.gridSection.lineStyles.${S}`)})),b=S=>T=>{o.commands.dispatch(new h.SetGridVisibilityCommand({axis:S,isVisible:T}))},P=S=>{const T=Ne.find(w=>w===S);T&&o.commands.dispatch(new h.SetGridLineStyleCommand({axis:"both",lineStyle:T}))},j=S=>{o.commands.dispatch(new h.SetGridLineWidthCommand({axis:"both",lineWidth:S}),{transient:!0})};return(0,e.jsx)(R,{title:n??a("editor.graphPanel.gridSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[u.map(S=>(0,e.jsx)(f,{label:a(ri(S)),children:(0,e.jsx)(d,{isChecked:S.gridVisible,onChange:b(S.scaleAestheticKey)})},S.scaleAestheticKey)),m&&v&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(f,{label:a("editor.graphPanel.gridSection.gridStyle"),children:(0,e.jsx)(l,{value:g.lineStyle,options:C,onChange:P})}),(0,e.jsx)(f,{label:a("editor.graphPanel.gridSection.gridThickness"),children:(0,e.jsx)(s,{value:g.lineWidth??c.parsePx(p.gridLineWidth,Jo),min:ei,max:Qo,step:.5,formatValue:te,onChange:j,onCommit:o.commands.seal})})]})]})})},ti=n=>n.scaleAestheticKey==="x"||n.scaleAestheticKey==="y",ri=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",ai="total",zn=["total","average","current"],oi=["total"],ke=["previous","first"],De=["auto","small","medium","large"],ii=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Switch:s,ToggleGroup:d}=_();if(!r)return null;const l=r.config.headline,p=l.show!=="none",u=r.coordSystem,m=u.type==="polar",v=u.type==="polar"&&u.innerRadius>0,g=r.layers.some(I=>I.summary.grandTotal!==void 0);if(m&&!g)return null;const C=m?oi:zn,b=r.guides.headline,P=b?.kind==="perGroup"&&b.items.some(I=>I.comparison!==null),j=C.map(I=>({value:I,label:a(`editor.graphPanel.headlineNumberSection.metrics.${I}`)})),S=ke.map(I=>({value:I,label:a(`editor.graphPanel.headlineNumberSection.comparison.${I}`)})),T=De.map(I=>({value:I,label:a(I==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${I}`)})),w=[{value:"above",label:a("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:a("editor.graphPanel.headlineNumberSection.position.center")}],L=I=>{o.commands.dispatch(new h.SetHeadlineShowCommand({show:I?ai:"none"}))},N=I=>{const O=C.find(K=>K===I);O&&o.commands.dispatch(new h.SetHeadlineShowCommand({show:O}))},E=I=>{const O=ke.find(K=>K===I);O&&o.commands.dispatch(new h.SetHeadlineCompareWithCommand({compareWith:O}))},H=I=>{const O=De.find(K=>K===I);O&&o.commands.dispatch(new h.SetHeadlineSizeCommand({size:O}))},A=I=>{o.commands.dispatch(new h.SetHeadlinePositionCommand({position:I==="center"?"center":"above"}))};return(0,e.jsx)(R,{title:n??a("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:i??si(a,l.show),children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.graphPanel.headlineNumberSection.toggle"),children:(0,e.jsx)(s,{isChecked:p,onChange:L})}),p&&(0,e.jsxs)(e.Fragment,{children:[j.length>1&&(0,e.jsx)(f,{label:a("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,e.jsx)(d,{value:l.show,options:j,onChange:N})}),P&&(0,e.jsx)(f,{label:a("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,e.jsx)(d,{value:(0,h.resolveComparisonBasis)(l.compareWith),options:S,onChange:E})}),(0,e.jsx)(f,{label:a("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,e.jsx)(d,{value:l.size,options:T,onChange:H})}),v&&(0,e.jsx)(f,{label:a("editor.axesPanel.controls.position"),children:(0,e.jsx)(d,{value:l.position,options:w,onChange:A})})]})]})})},si=(n,t)=>{const i=zn.find(o=>o===t);return i&&n(`editor.graphPanel.headlineNumberSection.metrics.${i}`)},ie=["top","bottom","left","right","none"],He=["auto","start","center","end"],Ve=["auto","pill","direct"],li=({positions:n,title:t,layout:i="collapsible",preview:o})=>{const r=M(),a=c.useHandleCompiled(r),s=c.useI18n(),{ToggleGroup:d}=_();if(!a)return null;const l=a.config.legend.position,p=n??ie,u=a.guides.legends.drawn[0],m=(0,h.canAnchorDirectLabels)({legendPosition:a.guides.legends.position,coordSystem:a.coordSystem,layers:a.layers}),v=a.guides.headline?.kind==="perGroup",g=a.guides.colorGroups.length>0;if(l==="auto"&&u===void 0&&!m&&(v||!g))return null;const C=u?.position??"none",b=l==="auto"?C:l,P=ie.filter(A=>A===b||p.includes(A)).map(A=>({value:A,label:s(`editor.graphPanel.legendSection.${A}`)})),j=A=>{const I=ie.find(O=>O===A);I&&r.commands.dispatch(new h.SetLegendPositionCommand({position:I}))},S=A=>{const I=He.find(O=>O===A);I&&r.commands.dispatch(new h.SetLegendAlignCommand({align:I}))},T=A=>{const I=Ve.find(O=>O===A);I&&r.commands.dispatch(new h.SetLegendDisplayCommand({display:I}))},w=He.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.align.${A}`)})),L=Ve.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.display.${A}`)})),N=t??s("editor.graphPanel.legendSection.title"),E=P.find(A=>A.value===b)?.label,H=u!==void 0;return(0,e.jsx)(R,{title:N,layout:i,preview:o??E,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,e.jsx)(d,{value:b,options:P,onChange:j})}),H&&(0,e.jsx)(f,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,e.jsx)(d,{value:a.config.legend.align,options:w,onChange:S})}),m&&(0,e.jsx)(f,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,e.jsx)(d,{value:a.config.legend.display,options:L,onChange:T})})]})})},ci=1,di=20,ui=.5,Fn=({layerId:n})=>{const t=M(),i=c.useHandleCompiled(t),{Slider:o}=_(),r=fe(i,n);if(!i)return null;const a=s=>{const d=new h.SetPointSizeCommand({layerId:n,size:s});t.commands.dispatch(d,{transient:!0})};return(0,e.jsx)(o,{value:r?.get("size")??h.DEFAULT_POINT_SIZE,min:ci,max:di,step:ui,formatValue:te,onChange:a,onCommit:t.commands.seal})},hi=1,mi=10,pi=.1,gi=["gap","zero","connect"],Ci=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Select:s,Slider:d,Switch:l,ToggleGroup:p}=_(),u=r?.spec.layers??[],m=(0,h.findLayerByGeom)(u,"line","area"),v=fe(r,m?.id??null);if(!r||!m)return null;const g=r.coordSystem.type==="polar",C=fi(a,m),b=xi(m,u),P=ze(r.spec,m.geom,"strokeWidth",m.id),j=typeof P=="number",S=m.geom==="line"?m:void 0,T=[{value:"auto",label:a("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:a("editor.graphPanel.numberFormat.options.custom")}],w=I=>{o.commands.dispatch(new h.ToggleLinePointsVisibilityCommand({layerId:m.id,showPoints:I}))},L=I=>{S&&o.commands.dispatch(new h.ToggleLineFillCommand({layerId:S.id,showFill:I}))},N=I=>{o.commands.dispatch(new h.SetLineInterpolationCommand({layerId:m.id,interpolate:I?"catmull-rom":"linear"}))},E=I=>{const O=v?.get("strokeWidth")??h.DEFAULT_STROKE_WIDTH;o.commands.dispatch(new h.SetLineWidthCommand({layerId:m.id,lineWidth:I==="custom"?O:null}))},H=I=>{o.commands.dispatch(new h.SetLineWidthCommand({layerId:m.id,lineWidth:I}),{transient:!0})},A=I=>{const O=vi(I);O&&o.commands.dispatch(new h.SetLineMissingValuesCommand({layerId:m.id,missingValues:O}))};return(0,e.jsx)(R,{title:n??a("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,e.jsx)(l,{isChecked:b!==void 0,onChange:w})}),b&&(0,e.jsx)(f,{label:a("editor.graphPanel.pointSize.label"),children:(0,e.jsx)(Fn,{layerId:b.id})}),S&&!g&&(0,e.jsx)(f,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,e.jsx)(l,{isChecked:ze(r.spec,"line","fillAlpha",S.id)!==void 0,onChange:L})}),!g&&(0,e.jsx)(f,{label:a("editor.graphPanel.graphOptions.smoothLines"),children:(0,e.jsx)(l,{isChecked:m.params.interpolate==="catmull-rom",onChange:N})}),(0,e.jsx)(f,{label:a("editor.graphPanel.lineThickness.label"),children:(0,e.jsx)(p,{value:j?"custom":"auto",options:T,onChange:E})}),j&&(0,e.jsx)(f,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(d,{value:P,min:hi,max:mi,step:pi,formatValue:te,onChange:H,onCommit:o.commands.seal})}),!g&&C.length>1&&(0,e.jsx)(f,{label:a("editor.fineTunePanel.detailSection.missingValues"),children:(0,e.jsx)(s,{value:m.params.missingValues,options:C,onChange:A})})]})})},vi=n=>gi.find(t=>t===n),ze=(n,t,i,o)=>(0,h.findStyleRule)(n.styles.overrides,(0,h.buildLayerStyleAddress)(t,o))?.declarations?.[i],xi=(n,t)=>(0,h.filterLayersByGeoms)(t,"point").find(i=>(0,h.isCompanionLayer)(i,[n])),fi=(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(o=>o.value!=="gap"):i},bi="k",Si=2,ji=0,yi=5,de=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],Ii=["auto","none"],Ti=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{NumberField:s,ToggleGroup:d}=_();if(!r)return null;const{abbreviation:l,decimals:p}=r.config.numberFormat,u=wi(l)!==void 0,m=p!=="auto",v=T=>T.map(w=>({value:w,label:a(`editor.graphPanel.numberFormat.options.${w}`)})),g=de.map(({value:T,labelKey:w})=>({value:T,label:a(`common.abbreviations.${w}`)})),C=T=>{o.commands.dispatch(new h.SetNumberFormatAbbreviationCommand({abbreviation:T}))},b=T=>{const w=Ii.find(L=>L===T);C(w??bi)},P=T=>{const w=de.find(L=>L.value===T);w&&C(w.value)},j=T=>{o.commands.dispatch(new h.SetNumberFormatDecimalsCommand({decimals:T==="custom"?Si:"auto"}))},S=T=>{T!==null&&o.commands.dispatch(new h.SetNumberFormatDecimalsCommand({decimals:T}),{transient:!0})};return(0,e.jsx)(R,{title:n??a("editor.graphPanel.numberFormatSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,e.jsx)(d,{value:u?"custom":l,options:v(["auto","none","custom"]),onChange:b})}),u&&(0,e.jsx)(f,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(d,{value:l,options:g,onChange:P})}),(0,e.jsx)(f,{label:a("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,e.jsx)(d,{value:m?"custom":"auto",options:v(["auto","custom"]),onChange:j})}),m&&(0,e.jsx)(f,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(s,{value:p,min:ji,max:yi,onChange:S,onCommit:o.commands.seal})})]})})},wi=n=>de.find(t=>t.value===n),Pi=({title:n,layout:t="collapsible",preview:i})=>{const o=c.useHandleCompiled(M()),r=c.useI18n();if(!o)return null;const a=Li(o.spec.layers);return a?(0,e.jsx)(R,{title:n??r("editor.graphPanel.pointSize.label"),layout:t,preview:i,children:(0,e.jsx)(D,{children:(0,e.jsx)(f,{label:r("editor.graphPanel.numberFormat.valueLabel"),children:(0,e.jsx)(Fn,{layerId:a.id})})})}):null},Li=n=>{const t=(0,h.filterLayersByGeoms)(n,"line","area");return(0,h.filterLayersByGeoms)(n,"point").find(i=>!(0,h.isCompanionLayer)(i,t))},Ai=.9,Mi=360,_i=.05,Ei=15,Oi=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Slider:s}=_();if(!r||r.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:l}=r.spec.coords.params,p=m=>{o.commands.dispatch(new h.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{o.commands.dispatch(new h.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,e.jsx)(R,{title:n??a("editor.graphPanel.polarSection.title"),layout:t,preview:i,children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.graphPanel.polarSection.innerRadius"),children:(0,e.jsx)(s,{value:d,min:0,max:Ai,step:_i,formatValue:Vn,onChange:p,onCommit:o.commands.seal})}),(0,e.jsx)(f,{label:a("editor.graphPanel.polarSection.startAngle"),children:(0,e.jsx)(s,{value:l,min:0,max:Mi-1,step:Ei,formatValue:uo,onChange:u,onCommit:o.commands.seal})})]})})},Ri=n=>(0,e.jsxs)(c.Icon,{...n,children:[(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4796 12.2222L17.6085 12.2291L17.6029 10.7291L19.474 10.7222L19.4796 12.2222ZM15.3662 12.2375L13.124 12.2459L13.1184 10.7459L15.3606 10.7375L15.3662 12.2375ZM10.8817 12.2542L8.63945 12.2626L8.63386 10.7626L10.8761 10.7542L10.8817 12.2542ZM6.39719 12.2709L4.52607 12.2779L4.52048 10.7779L6.3916 10.7709L6.39719 12.2709Z",fill:"currentColor"})]}),Fe=n=>(0,e.jsxs)(c.Icon,{...n,children:[(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,e.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.6749 8.04877L17.1069 9.06975L16.2884 7.81273L17.8564 6.79175L18.6749 8.04877ZM15.2278 10.2932L13.3488 11.5167L12.5303 10.2597L14.4093 9.03622L15.2278 10.2932ZM11.4697 12.7402L9.59064 13.9637L8.77217 12.7067L10.6512 11.4832L11.4697 12.7402ZM7.71158 15.1872L6.14354 16.2082L5.32507 14.9511L6.89311 13.9302L7.71158 15.1872Z",fill:"currentColor"})]}),Ni=n=>(0,x.useMemo)(()=>{if(n===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:i}=n.config,o=n.guides.colorGroups.map(r=>{const a=(0,h.createValueFormatter)({valueFormat:r.valueFormat,locale:t,numberFormat:i}),s=r.value instanceof Date?r.value.getTime():r.value;return{value:s,option:{value:String(s),label:r.label??a(r.value)}}});return{options:o.map(({option:r})=>r),findValue:r=>o.find(a=>a.option.value===r)?.value}},[n]),Ge=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],ki="linear",Di=({title:n,layout:t="collapsible",preview:i})=>{const o=M(),r=c.useHandleCompiled(o),a=c.useI18n(),{Select:s,Switch:d}=_(),{options:l,findValue:p}=Ni(r);if(!r||r.coordSystem.type==="polar")return null;const u=(0,h.findTrendLineLayer)(r.spec.layers),m=(0,h.findAverageLineLayer)(r.spec.layers),v=u?.stat.type==="smooth"?u.stat.method:ki,g=Hi(m),C=Ge.map(w=>({value:w,label:a(`editor.annotationsPanel.trendType.options.${w}`)})),b=(w,L={})=>{const N=u??m,E=new h.SetStatLineCommand({line:w,...L,...N!==void 0&&{layerId:N.id},label:a("editor.annotationsPanel.trendsAndAveragesSection.average")});o.commands.dispatch(E)},P=w=>b(w?"trend":"none",{method:v}),j=w=>b(w?"average":"none",{group:g??p(l[0]?.value??"")}),S=w=>{const L=Ge.find(N=>N===w);L!==void 0&&b("trend",{method:L})},T=w=>{const L=w===null?void 0:p(w);L!==void 0&&b("average",{group:L})};return(0,e.jsx)(R,{title:n??a("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:i??(0,e.jsx)(Fe,{size:"lg"}),children:(0,e.jsxs)(D,{children:[(0,e.jsx)(f,{label:a("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,e.jsx)(Fe,{size:"lg"}),children:(0,e.jsx)(d,{isChecked:u!==void 0,onChange:P})}),u!==void 0&&(0,e.jsx)(f,{label:a("editor.annotationsPanel.trendType.label"),children:(0,e.jsx)(s,{value:v,options:C,onChange:S,placeholder:a("editor.annotationsPanel.trendType.placeholder")})}),(0,e.jsx)(f,{label:a("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,e.jsx)(Ri,{size:"lg"}),children:(0,e.jsx)(d,{isChecked:m!==void 0,onChange:j})}),m!==void 0&&l.length>0&&(0,e.jsx)(f,{label:a("editor.annotationsPanel.averageLineSeries.label"),children:(0,e.jsx)(s,{value:g===void 0?null:String(g),options:l,onChange:T,placeholder:a("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:a("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},Hi=n=>{const t=n?.transforms.find(i=>i.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=mo;exports.AxesPanel=co;exports.AxisSection=se;exports.BarSection=go;exports.Button=gn;exports.CalloutsSection=Po;exports.CaptionSection=Rn;exports.EditableGraphRenderer=sa;exports.EditorPanel=ge;exports.ElementsPanel=lo;exports.GoalSection=_o;exports.GraphOptionsSection=Oo;exports.GraphTypeSection=Yo;exports.GridSection=ni;exports.HeadlineSection=ii;exports.IntlProvider=c.IntlProvider;exports.LegendSection=li;exports.LineSection=Ci;exports.NumberField=xn;exports.NumberFormatSection=Ti;exports.PANEL_ROOT_ATTRIBUTE=_n;exports.PointSection=Pi;exports.PolarSection=Oi;exports.RadioGrid=fn;exports.Row=f;exports.Section=R;exports.Select=bn;exports.Slider=Sn;exports.SourceSection=Nn;exports.SubtitleSection=kn;exports.Switch=jn;exports.TextField=yn;exports.TextSizeSection=Dn;exports.TitleSection=Hn;exports.ToggleGroup=In;exports.ToggledSection=On;exports.TrendsAndAveragesSection=Di;exports.useControls=_;exports.usePanelExpansion=Mn;exports.usePanelGraph=M;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const s=require("./history-chords-BIarPFDp.cjs"),Ft=require("./typography-CsG_IWDd.cjs");let p=require("@graphysdk/viz-engine"),f=require("react"),n=require("react/jsx-runtime"),ne=require("zustand/react/shallow"),Gt=require("react-dom"),B=require("clsx");B=s.__toESM(B,1);let vn=require("@vanilla-extract/dynamic"),Y=require("@base-ui/react/slider"),z=require("@base-ui/react/menu"),V=require("@base-ui/react"),X=require("lodash-es/clamp");X=s.__toESM(X,1);let Q=require("@base-ui/react/accordion"),ze=require("@base-ui/react/number-field"),fn=require("@base-ui/react/radio"),Cn=require("@base-ui/react/radio-group"),F=require("@base-ui/react/select"),Fe=require("@base-ui/react/switch"),Vt=require("@base-ui/react/input");var Bt="data-graphy-chart-chrome",Kt="data-graphy-chart-menu",Sn={[Kt]:""},le=e=>({[Bt]:e}),bn=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,Wt=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,yn=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,jn=(e,t,r)=>r!==null&&(0,p.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),ee=(e,t,r)=>e instanceof Node&&(t.contains(e)||bn(e,r)),Ut="cml7ha0",wn=(0,f.createContext)(null),qt=({children:e})=>{const{chartId:t}=s.useGraphContext(),[r]=(0,f.useState)(s.resolvePortalContainer),[a,o]=(0,f.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Gt.createPortal)((0,n.jsx)("div",{ref:o,className:Ut,...le(t)}),r),(0,n.jsx)(wn.Provider,{value:a,children:e})]})},we=()=>(0,f.useContext)(wn),In=e=>(0,n.jsxs)(s.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 Tn="efjmb40",An="efjmb41",q="efjmb42",Z="efjmb43",Zt="efjmb44",$t="efjmb45",Xt=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),Ie=({label:e,icon:t,onOpened:r,children:a})=>{const o=we(),[i,l]=(0,f.useState)(!1),d=(c,u)=>{c?(l(!0),r?.()):Xt.has(u.reason)&&l(!1)};return(0,n.jsxs)(V.Menu.SubmenuRoot,{open:i,onOpenChange:d,children:[(0,n.jsx)(Yt,{label:e,icon:t}),(0,n.jsx)(V.Menu.Portal,{container:o,children:(0,n.jsx)(s.PortalThemeProvider,{children:(0,n.jsx)(V.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:Tn,...Sn,children:(0,n.jsx)(V.Menu.Popup,{className:An,children:a})})})})]})},Yt=({label:e,icon:t})=>(0,n.jsxs)(V.Menu.SubmenuTrigger,{className:q,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:Z,children:e}),(0,n.jsx)("span",{className:$t,children:(0,n.jsx)(s.ChevronDownIcon,{size:"sm"})})]}),Jt="_1qe7q450",Qt="_1qe7q451",er="_1qe7q452",nr=({label:e,placeholder:t,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,f.useRef)(null),[l,d]=(0,f.useState)(""),{dispatch:c}=s.useGraphCommands(),u=l.trim(),h=()=>{u.length!==0&&(c(new p.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:tr(u)}})),o())},m=v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key!=="Escape"&&v.stopPropagation()},x=v=>{d(v.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)(Ie,{label:e,icon:(0,n.jsx)(In,{}),onOpened:g,children:(0,n.jsxs)("div",{className:Jt,children:[(0,n.jsx)("input",{ref:i,className:Qt,value:l,placeholder:t,onChange:x,onKeyDown:m}),(0,n.jsx)("button",{type:"button",className:er,disabled:u.length===0,onClick:h,children:r})]})})},tr=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),rr=e=>(0,n.jsx)(s.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"})}),ar="relative-difference",or=({label:e,layer:t,at:r,onRequestClose:a})=>{const{dispatch:o}=s.useGraphCommands(),i=s.useCompiledSelector(c=>c.coordSystem),l=(0,f.useMemo)(()=>(0,p.inferDifferenceArrowEndpoints)({layer:t,at:r,coordSystem:i}),[t,r,i]);if(l===null)return null;const d=()=>{o(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...l,label:ar}})),a()};return(0,n.jsxs)(z.Menu.Item,{className:q,onClick:d,children:[(0,n.jsx)(rr,{}),(0,n.jsx)("span",{className:Z,children:e})]})};function ir(e,t){if(e.type==="polar"&&!sr(t))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,p.hasMultipleGroups)(t.data,t.mapping);switch(t.geom){case"bar":{const a=[{scope:"data-point",labelKey:"bar"}];if(r){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 r&&a.push({scope:"series",labelKey:"lineSeries"}),a}case"point":{const a=[{scope:"data-point",labelKey:"scatterPoint"}];return r&&a.push({scope:"series",labelKey:"scatterSeries"}),a}default:return[]}}var sr=e=>{const t=(0,p.extractVariableName)(e.mapping.x);return t!==null&&t!==p.CONSTANT_VARIABLES.x},lr=e=>(0,n.jsxs)(s.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"})]}),cr=e=>(0,n.jsxs)(s.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"})]}),dr=e=>(0,n.jsxs)(s.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"})]}),ur=e=>(0,n.jsxs)(s.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"})]}),hr=e=>(0,n.jsxs)(s.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"})]}),pr=e=>(0,n.jsxs)(s.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"})]}),mr=e=>(0,n.jsxs)(s.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"})]}),gr=e=>(0,n.jsxs)(s.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)"})]}),xr=e=>(0,n.jsxs)(s.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)"})]}),vr={bar:lr,barGroup:cr,barStack:ur,barSeries:dr,linePoint:hr,lineSeries:pr,scatterPoint:gr,scatterSeries:xr,pieSlice:mr},Pn=({labelKey:e})=>{const t=vr[e];return(0,n.jsx)(t,{})},Ln=e=>(0,n.jsxs)(s.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"})]}),fr=({label:e,options:t,onSelect:r})=>{const a=s.useI18n();return(0,n.jsx)(Ie,{label:e,icon:(0,n.jsx)(Ln,{}),children:t.map(o=>(0,n.jsxs)(V.Menu.Item,{className:q,onClick:()=>r(o.scope),children:[(0,n.jsx)(Pn,{labelKey:o.labelKey}),(0,n.jsx)("span",{className:Z,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},Cr=({label:e,layer:t,observation:r,highlights:a,onRequestClose:o})=>{const i=s.useI18n(),{dispatch:l}=s.useGraphCommands(),d=s.useCompiledSelector(g=>g.coordSystem),c=(0,f.useMemo)(()=>(0,p.buildObservationPredicate)(t,r),[t,r]),u=(0,f.useMemo)(()=>ir(d,t),[d,t]),h=(0,f.useMemo)(()=>{const g=new Set(a.map(v=>v.scope));return u.filter(v=>!g.has(v.scope))},[u,a]),[m]=h;if(c===null||m===void 0)return null;const x=g=>{l(new p.AddHighlightCommand({predicate:c,scope:g,layerId:t.id})),o()};if(h.length===1){const g=u.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,n.jsxs)(V.Menu.Item,{className:q,onClick:()=>x(m.scope),children:[(0,n.jsx)(Pn,{labelKey:m.labelKey}),(0,n.jsx)("span",{className:Z,children:g})]})}return(0,n.jsx)(fr,{label:e,options:h,onSelect:x})},Sr="_1aafi1g0",br="_1aafi1g1",Mn=({children:e})=>(0,n.jsxs)("span",{className:Sr,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:br})]}),yr=({label:e,highlights:t,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=t.at(-1);if(o===void 0)return null;const i=()=>{a(new p.RemoveHighlightCommand({id:o.id})),r()};return(0,n.jsxs)(z.Menu.Item,{className:q,onClick:i,children:[(0,n.jsx)(Mn,{children:(0,n.jsx)(Ln,{})}),(0,n.jsx)("span",{className:Z,children:e})]})},jr=(e,t)=>{const r=s.useCompiledSelector(o=>o.spec.highlights),a=s.useCompiledSelector(o=>o.config.parsingLocale);return(0,f.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:a}),[e,r,t,a])},En=e=>(0,n.jsxs)(s.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"})]}),wr=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=()=>{a(new p.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),r()};return(0,n.jsxs)(z.Menu.Item,{className:q,onClick:o,children:[(0,n.jsx)(En,{}),(0,n.jsx)("span",{className:Z,children:e})]})},kn=e=>(0,n.jsxs)(s.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"})]}),_n={pinnedNumber:{icon:En,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:In,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:kn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Ir=e=>(0,p.isObservationAttachmentKind)(e.kind)&&_n[e.kind]!==null,Tr=({attachment:e,onRequestClose:t})=>{const r=s.useI18n(),{dispatch:a}=s.useGraphCommands(),{icon:o,labelKey:i}=_n[e.kind],l=()=>{a(new p.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(z.Menu.Item,{className:q,onClick:l,children:[(0,n.jsx)(Mn,{children:(0,n.jsx)(o,{})}),(0,n.jsx)("span",{className:Z,children:r(i)})]})},Ar="ceeojg0",Pr="ceeojg1",Lr="ceeojg2",Mr=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=s.useGraphCommands(),o=i=>{a(new p.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:i}})),r()};return(0,n.jsx)(Ie,{label:e,icon:(0,n.jsx)(kn,{}),children:(0,n.jsx)("div",{className:Ar,children:Object.entries(s.STICKER_ASSETS).map(([i,l])=>(0,n.jsx)(V.Menu.Item,{className:Pr,"aria-label":i,onClick:()=>o(i),children:(0,n.jsx)("img",{className:Lr,src:l.src,alt:i})},i))})})},Er=({interaction:e,panelOrigin:t})=>{const r=s.useEditorStore(),a=s.useEditorState(i=>i.menuTrigger);if(e.kind!=="menu"||a===null)return null;const o=()=>{r.getState().releaseInteraction("menu")};return(0,n.jsx)(kr,{trigger:{x:t.x+a.center.x,y:t.y+a.center.y,radius:a.radius},layer:e.anchor.layer,at:e.anchor.at,observation:e.anchor.observation,onClose:o})},kr=({trigger:e,layer:t,at:r,observation:a,onClose:o})=>{const i=s.useI18n(),l=we(),d=s.useCompiledSelector(y=>y.spec.annotations),c=s.useCompiledSelector(y=>y.config.parsingLocale),u=Rr(),{x:h,y:m,radius:x}=e,g=(0,f.useMemo)(()=>_r(h,m,x),[h,m,x]),v=(0,p.findObservationAttachment)(d,r,(0,f.useMemo)(()=>(0,p.createObservationAnchorParser)(t,c),[t,c])),C=v!==null&&Ir(v)?v:null,A=jr(t,a),I=(y,T)=>{!y&&Or(T.reason)&&o()};return(0,n.jsx)(z.Menu.Root,{open:u,modal:!1,onOpenChange:I,children:(0,n.jsx)(z.Menu.Portal,{container:l,children:(0,n.jsx)(s.PortalThemeProvider,{children:(0,n.jsx)(z.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:Tn,...Sn,children:(0,n.jsxs)(z.Menu.Popup,{className:An,"data-testid":"observation-menu",children:[C!==null&&(0,n.jsx)(Tr,{attachment:C,onRequestClose:o}),(0,n.jsx)(yr,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:A,onRequestClose:o}),(0,n.jsx)(z.Menu.Separator,{className:Zt}),C===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(wr,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:o}),(0,n.jsx)(nr,{label:i("graph.annotations.baseMenu.annotate"),placeholder:i("graph.annotations.textMenu.placeholder"),addLabel:i("graph.annotations.textMenu.addButton"),at:r,onRequestClose:o}),(0,n.jsx)(Mr,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:o})]}),t.highlight!==null&&(0,n.jsx)(Cr,{label:i("graph.annotations.baseMenu.highlight"),layer:t,observation:a,highlights:A,onRequestClose:o}),(0,n.jsx)(or,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:t,at:r,onRequestClose:o})]})})})})})},_r=(e,t,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,t-r,r*2,r*2)}),Rr=()=>{const[e,t]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{t(!0)},[]),e},Or=e=>e==="outside-press"||e==="escape-key"||e==="item-press",Te="l8tsqe0",Rn=["start","end"],On=({anchor:e,point:t,delta:r})=>{const a={x:Ge(t.x,r.x),y:Ge(1-t.y,r.y)};return{anchor:{...e,x:e.x+a.x,y:e.y+a.y},point:{x:t.x+a.x,y:t.y-a.y}}},Ae=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),Nn=(e,t)=>e.x===t.x&&e.y===t.y,Nr=(e,t)=>({x:t.x+e.x*t.width,y:t.y+(1-e.y)*t.height}),Dr=(e,t,r)=>{const a=e.x*r.width,o=t.x*r.width,i=(1-e.y)*r.height,l=(1-t.y)*r.height;return{x:Math.min(a,o),y:Math.min(i,l),width:Math.abs(o-a),height:Math.abs(l-i)}},Ge=(e,t)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,X.default)(t,Math.min(-e,0),Math.max(1-e,0)),Hr=({panelRect:e})=>{const t=s.useEditorState(i=>s.readStanding(i,"arrow-endpoint-drag")),r=s.useResolvedAnnotations(e).arrows;if(t===null)return null;const a=r.find(i=>i.id===t.annotationId);if(a===void 0)return null;const o=(0,p.computeArrow)({arrow:Ae(a,t),panelWidth:e.width,panelHeight:e.height});return o===null?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:Te,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(s.ArrowAnnotation,{computed:o,isAddressable:!1})})},ce=()=>{const e=s.useGraphSelection();return Dn(e)},Dn=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},zr=e=>(0,n.jsx)(s.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,n.jsx)("path",{d:"M19 12H5"})]})}),Hn=e=>(0,n.jsx)(s.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M5 12h14"}),(0,n.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),Fr=e=>(0,n.jsx)(s.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M7 17 17 7"}),(0,n.jsx)("path",{d:"M7 7h10v10"})]})}),zn=e=>(0,n.jsx)(s.Icon,{...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("rect",{x:"3",y:"5",width:"18",height:"1.5",rx:"0.75"}),(0,n.jsx)("rect",{x:"3",y:"10",width:"18",height:"3",rx:"1.5"}),(0,n.jsx)("rect",{x:"3",y:"16.5",width:"18",height:"4.5",rx:"2.25"})]})}),Pe=e=>(0,n.jsx)(s.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"})]})}),Gr="var(--pvjfpx0)",Vr="var(--pvjfpx1)",Br="pvjfpx2",Kr="pvjfpx3",Wr="pvjfpx4",Ur="pvjfpx6 pvjfpx5",qr="pvjfpx7 pvjfpx6 pvjfpx5",Zr="pvjfpx8 pvjfpx5",J=8,$r=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a})=>{const o=t.y+e.y,i=o+e.height,l=o-8-36,d=i+8,c=(0,X.default)(l>=J?l:d,J,a-J-36),u=J;return{top:c,left:u,available:Math.max(0,r-J*2),centre:t.x+e.x+e.width/2-u}},Xr=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a,label:o,testId:i,children:l})=>{const{chartId:d}=s.useGraphContext(),c=$r({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a});return(0,n.jsx)("div",{className:Br,style:{top:c.top,left:c.left,width:c.available},children:(0,n.jsx)(s.FloatingToolbar.Root,{"aria-label":o,className:Kr,"data-testid":i,...le(d),style:(0,vn.assignInlineVars)({[Gr]:`${c.centre}px`,[Vr]:`${c.available}px`}),children:l})})},Yr=({label:e,trigger:t,isOpen:r,onOpenChange:a,isDisabled:o=!1,children:i})=>{const{chartId:l}=s.useGraphContext();return(0,n.jsxs)(z.Menu.Root,{open:r,modal:!1,onOpenChange:a,children:[(0,n.jsxs)(z.Menu.Trigger,{render:(0,n.jsx)(s.FloatingToolbar.Button,{}),"aria-label":e,className:Zr,disabled:o,onMouseDown:d=>d.preventDefault(),children:[t,(0,n.jsx)(s.ChevronDownIcon,{size:"sm"})]}),(0,n.jsx)(s.FloatingToolbar.MenuPopup,{popupAttributes:le(l),children:i})]})},Jr=e=>{const{chartId:t}=s.useGraphContext();return(0,n.jsx)(s.FloatingToolbar.ColorPicker,{...e,popupAttributes:le(t)})},Qr=({color:e,opacity:t})=>(0,n.jsx)("span",{className:Wr,style:{background:e,opacity:t}}),ea=({label:e,onClick:t,children:r})=>(0,n.jsx)(s.FloatingToolbar.Button,{"aria-label":e,className:Ur,onClick:t,children:r}),na=({label:e,isPressed:t,onClick:r,children:a})=>(0,n.jsx)(s.FloatingToolbar.Button,{"aria-label":e,"aria-pressed":t,className:qr,onClick:r,children:a}),L={Root:Xr,Dropdown:Yr,MenuItem:s.FloatingToolbar.MenuItem,ColorPicker:Jr,Swatch:Qr,IconButton:ea,ToggleButton:na,Button:s.FloatingToolbar.Button,Separator:s.FloatingToolbar.Separator},ta={kind:"chrome-popup"},Le=()=>{const{commands:e}=s.useGraphContext(),t=s.useEditorStore(),[r,a]=(0,f.useState)(null);(0,f.useEffect)(()=>()=>e.seal(),[e]),(0,f.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:l}=t.getState();return r===null?l("chrome-popup"):i(ta),()=>l("chrome-popup")},[t,r]);const o=()=>{a(null),e.seal()};return{bind:i=>({isOpen:r===i,onOpenChange:l=>l?a(i):o()}),close:o}},ra=e=>(0,n.jsx)(s.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19 8 16"}),(0,n.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,n.jsx)("path",{d:"M16 8 19 5"})]})}),aa=e=>(0,n.jsx)(s.Icon,{...e,children:(0,n.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),oa=[{value:"thin",key:"graph.annotations.arrowToolbar.thickness.thin"},{value:"medium",key:"graph.annotations.arrowToolbar.thickness.medium"},{value:"thick",key:"graph.annotations.arrowToolbar.thickness.thick"}],Ve=[{value:"line-arrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:Hn},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:s.MinusIcon}],Be=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:aa},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:ra}],ia=(e,t)=>e.find(r=>r.value===t)??e[0];var sa=({arrow:e,arrowBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),u=Le(),h=e.color??c.defaultAnnotationArrowStroke,m=ia(Be,e.lineStyle),x=(P,N)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:P}),N)},g=P=>{x(P),u.close()},v=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},C=P=>x({color:P},{transient:!0}),A=P=>g({thickness:P}),I=P=>g({startArrowheadStyle:P}),y=P=>g({lineStyle:P}),T=P=>g({endArrowheadStyle:P}),S=()=>x({hasStickerStyle:!e.hasStickerStyle});return(0,n.jsxs)(L.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,n.jsx)(L.ColorPicker,{color:h,label:l("graph.annotations.arrowToolbar.color"),onChange:C,...u.bind("color"),children:(0,n.jsx)(L.Swatch,{color:h})}),(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,n.jsx)(zn,{size:"sm",title:""}),...u.bind("thickness"),children:(0,n.jsx)(re,{options:oa,current:e.thickness,onPick:A})}),(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,n.jsx)(zr,{size:"sm",title:""}),...u.bind("startArrowhead"),children:(0,n.jsx)(re,{options:Ve,current:e.startArrowheadStyle,onPick:I})}),(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:m?.Icon!==void 0&&(0,n.jsx)(m.Icon,{size:"sm",title:""}),...u.bind("lineStyle"),children:(0,n.jsx)(re,{options:Be,current:e.lineStyle,onPick:y})}),(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,n.jsx)(Hn,{size:"sm",title:""}),...u.bind("endArrowhead"),children:(0,n.jsx)(re,{options:Ve,current:e.endArrowheadStyle,onPick:T})}),(0,n.jsx)(L.ToggleButton,{label:l("graph.annotations.arrowToolbar.sticker"),isPressed:e.hasStickerStyle,onClick:S,children:(0,n.jsx)(Fr,{size:"sm",title:""})}),(0,n.jsx)(L.Separator,{}),(0,n.jsx)(L.IconButton,{label:l("graph.annotations.arrowToolbar.remove"),onClick:v,children:(0,n.jsx)(Pe,{size:"sm",title:""})})]})},re=({options:e,current:t,onPick:r})=>{const a=s.useI18n(),o=i=>()=>r(i);return(0,n.jsx)(n.Fragment,{children:e.map(i=>(0,n.jsxs)(L.MenuItem,{isSelected:i.value===t,onClick:o(i.value),children:[(0,n.jsx)("span",{children:a(i.key)}),i.Icon!==void 0&&(0,n.jsx)("span",{className:"_112xh5c0",children:(0,n.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},la="_1me29t10",K=(e,t)=>t>0?e/t:0,Me=(e,t,r)=>({x:K(t.x-e.x,r.width),y:K(t.y-e.y,r.height)}),ca=e=>e.x!==0||e.y!==0,Fn=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var da=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,de=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 r=this.params.editorStore.getState();if(this.hasPublished&&this.readOwn(r)===null)return;const a={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,a))return;const o=this.resolvePreview(a);o!==null&&(r.claimInteraction(o),this.hasPublished=!0)}}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();try{e&&this.hasMoved&&this.runFrame()}finally{this.settle(e)}}isDragConfirmed(e,t){return da(e,t)}settle(e){this.pendingEvent=null;const t=this.params.editorStore.getState(),r=this.readOwn(t);r!==null&&t.releaseInteraction(this.kind),!(!e||r===null)&&this.commit(r)}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},oe=(e,t,r)=>{const a=e.arrows.find(i=>i.id===t);if(a===void 0)return null;const o=a[r];return o.anchorType==="panel"?o:null},Gn=(e,t)=>e==="start"?{start:t}:{end:t},ua=class extends de{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:t,endpoint:r}=this.params;return s.readDraggedArrowEndpointFor(s.readStanding(e,"arrow-endpoint-drag"),t,r)}resolvePreview(e){const{annotationId:t,endpoint:r,press:a,readInputs:o}=this.params,{annotations:i,arrow:l,panelRect:d}=o(),c=oe(i,t,r);return c===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:r,...On({anchor:c,point:l[r],delta:Me(a,e,d)})}}commit({anchor:e}){const{annotationId:t,endpoint:r,dispatch:a,readInputs:o}=this.params,i=oe(o().annotations,t,r);i===null||Nn(i,e)||a(new p.UpdateAnnotationCommand({kind:"arrow",id:t,patch:Gn(r,e)}))}},ha=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useLatestRef({annotations:s.useCompiledSelector(d=>d.spec.annotations),arrow:t,panelRect:r}),l=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>l.current?.finish(!1),[]),(0,f.useCallback)(d=>({onPointerDown:c=>{if(c.button===0&&l.current===null){try{c.currentTarget.setPointerCapture(c.pointerId)}catch{return}c.currentTarget.focus({preventScroll:!0}),c.preventDefault(),l.current=new ua({handle:c.currentTarget,pointerId:c.pointerId,annotationId:e,endpoint:d,press:{x:c.clientX,y:c.clientY},readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch,onSettled:()=>{l.current=null}}),l.current.start()}}}),[e,i,o,a])},pa=[" ","Enter"],Ke=4,ma=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:a}=s.useGraphContext(),o=s.useEditorStore(),i=s.useCompiledSelector(c=>c.spec.annotations),l=s.useLatestRef(i),d=s.useLatestRef(a.dispatch);return(0,f.useEffect)(()=>()=>{for(const c of Rn)We({editorStore:o,annotationId:e,endpoint:c,annotations:l.current,dispatch:d.current})},[o,e,l,d]),(0,f.useCallback)(c=>({onKeyDown:u=>{if(u.altKey||u.ctrlKey||u.metaKey||u.shiftKey)return;const h=o.getState(),m=s.readDraggedArrowEndpointFor(s.readStanding(h,"arrow-endpoint-drag"),e,c);if(pa.includes(u.key)){if(u.preventDefault(),u.repeat)return;if(m!==null){We({editorStore:o,annotationId:e,endpoint:c,annotations:i,dispatch:a.dispatch});return}const g=oe(i,e,c);if(g===null)return;h.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:c,anchor:g,point:t[c]});return}if(m===null)return;const x=ga(u.key,r);x!==null&&(u.preventDefault(),h.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:c,...On({anchor:m.anchor,point:m.point,delta:x})}))}}),[e,i,t,r,o,a])},We=({editorStore:e,annotationId:t,endpoint:r,annotations:a,dispatch:o})=>{const i=e.getState(),l=s.readDraggedArrowEndpointFor(s.readStanding(i,"arrow-endpoint-drag"),t,r);if(l===null)return;i.releaseInteraction("arrow-endpoint-drag");const d=oe(a,t,r);d===null||Nn(d,l.anchor)||o(new p.UpdateAnnotationCommand({kind:"arrow",id:t,patch:Gn(r,l.anchor)}))},ga=(e,t)=>{const r=K(Ke,t.width),a=K(Ke,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},xa=e=>{const t=ce(),r=Ca(t),a=Sa(e.panelRect,t),o=ba(t);if(r===null||a===null)return null;const i=o.dragged===null?a:Ae(a,o.dragged);return(0,n.jsx)(va,{arrow:r,committed:a,painted:i,isSettled:o.dragged===null&&!o.isMoved,isMoved:o.isMoved,...e})},va=({arrow:e,committed:t,painted:r,isSettled:a,isMoved:o,panelRect:i,frameRect:l,frameElement:d})=>{const c=s.useI18n(),u=ha({annotationId:e.id,arrow:t,panelRect:i}),h=ma({annotationId:e.id,arrow:t,panelRect:i});return(0,n.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[a&&(0,n.jsx)(sa,{arrow:e,arrowBox:Dr(t.start,t.end,i),panelRect:i,frameWidth:l.width,frameHeight:l.height,frameElement:d}),!o&&Rn.filter(m=>e[m].anchorType==="panel").map(m=>(0,n.jsx)(fa,{endpoint:m,point:Nr(r[m],i),label:c(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:u(m),keyboardHandlers:h(m)},m))]})},fa=({endpoint:e,point:t,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{"aria-label":r,className:la,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...a,...o}),Ca=e=>{const t=s.useCompiledSelector(r=>r.spec.annotations.arrows);return e===null?null:t.find(r=>r.id===e)??null},Sa=(e,t)=>{const r=s.useResolvedAnnotations(e).arrows;return t===null?null:r.find(a=>a.id===t)??null},ba=e=>s.useEditorState((0,ne.useShallow)(t=>{if(e===null)return{dragged:null,isMoved:!1};const r=s.readStanding(t,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,isMoved:s.readMovedAnnotationFor(s.readStanding(t,"move-drag"),e)!==null}})),ya=e=>(0,n.jsx)(s.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"})]})}),ja="q7gcrz0",wa="q7gcrz1",Ia="q7gcrz2";var Ta=["absolute-difference","relative-difference","proportion"],Ue=["absolute-difference","relative-difference"],Aa=["relative-difference","proportion"],Pa={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},La=e=>{const{formattingLocale:t}=s.useGraphContext(),r=s.useCompiledSelector(o=>o.config.parsingLocale),a=t??r;return(0,f.useMemo)(()=>{const o=(0,p.areEndpointsComparable)(e.start,e.end);return Ta.filter(i=>o||!Ue.includes(i)||i===e.label).map(i=>({kind:i,key:Pa[i],preview:(0,p.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!Ue.includes(i),isSuspect:Aa.includes(i)&&e.start.measurementValue===0}))},[e,a])},ge=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],Ma=({arrow:e,labelBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),c=Le(),u=La(e),h=u.find(S=>S.kind===e.label),m=u.some(S=>S.isPickable&&S.kind!==e.label),x=ge.find(S=>S.id===e.size)??ge[0],g=(S,P)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:S}),P)},v=S=>{g(S),c.close()},C=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},A=S=>g({color:S},{transient:!0}),I=()=>g({start:e.end.anchor,end:e.start.anchor}),y=S=>()=>v({label:S}),T=S=>()=>v({size:S});return(0,n.jsxs)(L.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(Ea,{option:h}),isDisabled:!m,...c.bind("labelKind"),children:u.map(S=>(0,n.jsxs)(L.MenuItem,{isSelected:S.kind===e.label,isDisabled:!S.isPickable,onClick:y(S.kind),children:[(0,n.jsx)("span",{children:l(S.key)}),(S.isSuspect||!S.isPickable)&&(0,n.jsx)("span",{"aria-label":l(S.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:Ia,children:S.preview})]},S.kind))}),(0,n.jsx)(L.Separator,{}),(0,n.jsx)(L.ColorPicker,{color:e.color,label:l("graph.annotations.differenceArrowToolbar.color"),onChange:A,...c.bind("color"),children:(0,n.jsx)(L.Swatch,{color:e.color??"transparent"})}),(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:x===void 0?"":l(x.key),...c.bind("size"),children:ge.map(S=>(0,n.jsx)(L.MenuItem,{isSelected:S.id===e.size,onClick:T(S.id),children:l(S.key)},S.id))}),(0,n.jsx)(L.Separator,{}),(0,n.jsx)(L.IconButton,{label:l("graph.annotations.differenceArrowToolbar.swap"),onClick:I,children:(0,n.jsx)(ya,{size:"sm",title:""})}),(0,n.jsx)(L.IconButton,{label:l("graph.annotations.differenceArrowToolbar.remove"),onClick:C,children:(0,n.jsx)(Pe,{size:"sm",title:""})})]})},Ea=({option:e})=>{const t=s.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:wa,children:t(e.key)}),(0,n.jsxs)("span",{className:ja,children:["(",e.preview,")"]})]})};var ka="ydgo3h0",_a="ydgo3h1",Ra="ydgo3h2",Oa=({clientPoint:e,panelOrigin:t,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:l,fixedAnchor:d,align:c})=>{const u=Na({x:e.x-t.x,y:e.y-t.y},r),{primary:h}=a.query((0,p.toPanelCursor)(u,r));if(h===null)return null;const m=o.find(g=>g.id===h.layerId);if(m===void 0)return null;const x=(0,p.resolveObservationPoint)({resolver:l,layer:m,observation:h.observation,coordSystem:i,align:c});return x===null||(0,p.areAnchorsEqual)(x.anchor,d)?null:x},Na=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),Vn=e=>e==="start"?"end":"start",Bn=({dispatch:e,arrow:t,endpoint:r,anchor:a})=>{(0,p.areAnchorsEqual)(a,t[r].anchor)||e(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:a}}))},Da=class extends de{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:t,readInputs:r}=this.params;return s.readDraggedDifferenceArrowEndpointFor(s.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,t)}resolvePreview(e){const{endpoint:t,readInputs:r,engine:a,anchorResolver:o}=this.params,{arrow:i,panelOrigin:l,panelRect:d,layers:c,coordSystem:u}=r(),h=Oa({clientPoint:e,panelOrigin:l,panelRect:d,engine:a,layers:c,coordSystem:u,resolver:o,fixedAnchor:i[Vn(t)].anchor,align:i[t].anchor.align});return h===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:h}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:a}=this.params;Bn({dispatch:r,arrow:a().arrow,endpoint:t,anchor:e.anchor})}},Ha=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:a,anchorResolver:o}=s.useGraphContext(),{engine:i}=s.useHoverContext(),l=s.useEditorStore(),d=s.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...s.useCompiledSelector((0,ne.useShallow)(u=>({layers:u.layers,coordSystem:u.coordSystem})))}),c=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,f.useCallback)(u=>({onPointerDown:h=>{if(h.button===0&&c.current===null){try{h.currentTarget.setPointerCapture(h.pointerId)}catch{return}h.currentTarget.focus({preventScroll:!0}),h.preventDefault(),c.current=new Da({handle:h.currentTarget,pointerId:h.pointerId,press:{x:h.clientX,y:h.clientY},endpoint:u,readInputs:()=>d.current,editorStore:l,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{c.current=null}}),c.current.start()}}}),[d,l,i,o,a])},za=[" ","Enter"],Fa=({arrow:e})=>{const{commands:t,anchorResolver:r}=s.useGraphContext(),a=s.useEditorStore(),{layers:o,coordSystem:i,mainAxis:l}=s.useCompiledSelector((0,ne.useShallow)(c=>({layers:c.layers,coordSystem:c.coordSystem,mainAxis:c.coordSystem.type==="cartesian"?c.coordSystem.mainAxis:"x"}))),d=e.id;return(0,f.useEffect)(()=>()=>{const c=a.getState();s.readStanding(c,"difference-arrow-endpoint-drag")?.annotationId===d&&c.releaseInteraction("difference-arrow-endpoint-drag")},[a,d]),(0,f.useCallback)(c=>({onKeyDown:u=>{if(u.altKey||u.ctrlKey||u.metaKey||u.shiftKey)return;const h=a.getState(),m=s.readDraggedDifferenceArrowEndpointFor(s.readStanding(h,"difference-arrow-endpoint-drag"),e.id,c);if(za.includes(u.key)){if(u.preventDefault(),u.repeat)return;if(m===null)return h.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:e[c]});h.releaseInteraction("difference-arrow-endpoint-drag"),Bn({dispatch:t.dispatch,arrow:e,endpoint:c,anchor:m.point.anchor});return}if(m===null)return;const x=Ga(u.key,l);if(x===null)return;u.preventDefault();const g=Va({arrow:e,endpoint:c,from:m.point.anchor,move:x,layers:o,coordSystem:i,resolver:r});g!==null&&h.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:g})}}),[e,a,t,r,o,i,l])},Ga=(e,t)=>{const r=e==="ArrowUp"||e==="ArrowDown";return!r&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:t==="x"===r?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},Va=({arrow:e,endpoint:t,from:r,move:a,layers:o,coordSystem:i,resolver:l})=>{const d=o.find(u=>u.id===r.layerId);if(d===void 0)return null;const c=(0,p.stepDifferenceArrowEndpoint)({layer:d,from:r,partner:e[Vn(t)].anchor,axis:a.axis,step:a.step,canLandOn:u=>(0,p.resolveObservationPoint)({resolver:l,layer:d,observation:u,coordSystem:i,align:e[t].anchor.align})!==null});return c===null?null:(0,p.resolveObservationPoint)({resolver:l,layer:d,observation:c.observation,coordSystem:i,align:e[t].anchor.align})},Ba=e=>{const t=ce();return t===null?null:(0,n.jsx)(Ka,{annotationId:t,...e})},Ka=({annotationId:e,...t})=>{const r=s.useDifferenceArrowGeometries(),a=(0,f.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,n.jsx)(Wa,{committedArrow:a.committedArrow,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...t})},Wa=({committedArrow:e,committedLabelBox:t,labelBox:r,start:a,end:o,panelRect:i,panelOrigin:l,frameRect:d,frameElement:c,isDragged:u})=>{const h=Ha({arrow:e,panelOrigin:l,panelRect:i}),m=Fa({arrow:e});return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!u&&(0,n.jsx)(Ma,{arrow:e,labelBox:t,panelRect:i,frameWidth:d.width,frameHeight:d.height,frameElement:c}),(0,n.jsx)("div",{"aria-hidden":"true",className:Ra,"data-testid":"difference-arrow-selection-label",style:{left:i.x+r.x-2,top:i.y+r.y-2,width:r.width+4,height:r.height+4}}),(0,n.jsx)(qe,{endpoint:"start",point:a,panelRect:i,dragHandlers:h("start"),keyboardHandlers:m("start")}),(0,n.jsx)(qe,{endpoint:"end",point:o,panelRect:i,dragHandlers:h("end"),keyboardHandlers:m("end")})]})},qe=({endpoint:e,point:t,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{className:ka,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+t.x,top:r.y+t.y},tabIndex:0,...a,...o,children:(0,n.jsx)("span",{"aria-hidden":"true",className:_a})}),Ze=({start:e,extent:t,isStartMoving:r,delta:a,minExtent:o})=>{if(!Number.isFinite(a))return{start:e,extent:t};const i=e+t,l=Math.min(o,t);if(r){const u=Math.min(0,e),h=Math.min(Math.max(1,e),i-l),m=(0,X.default)(e+a,u,h);return{start:m,extent:i-m}}const d=Math.max(Math.min(0,i),e+l),c=Math.max(1,i);return{start:e,extent:(0,X.default)(i+a,d,c)-e}},Ua=["top-left","top-right","bottom-right","bottom-left"];var Kn=({width:e,height:t})=>({x:K(16,e),y:K(16,t)}),qa=(e,t)=>({x:qn(t)?e.x:e.x+e.width,y:Zn(t)?e.y:e.y+e.height}),Ee=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),Wn=({region:e,corner:t,delta:r,minSize:a})=>{const o=Ze({start:e.x,extent:e.width,isStartMoving:qn(t),delta:r.x,minExtent:a.x}),i=Ze({start:e.y,extent:e.height,isStartMoving:Zn(t),delta:r.y,minExtent:a.y});return{anchorType:"panel",x:o.start,y:i.start,width:o.extent,height:i.extent}},Un=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,qn=e=>e==="top-left"||e==="bottom-left",Zn=e=>e==="top-left"||e==="top-right";var Za={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},$a={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},Xa=({panelRect:e})=>{const t=s.useResolvedAnnotations(e),r=s.useMeasuredBoxes(),a=ce(),o=s.useEditorState(g=>s.readStanding(g,"move-drag")),i=s.useEditorState(g=>s.readStanding(g,"shape-resize-drag")),l=s.useEditorState(g=>s.readStanding(g,"arrow-endpoint-drag")),d=s.useEditorState(g=>{const v=g.editTargetUnderPointer;return v?.kind==="annotation"?v.id:null}),c=(0,f.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r}),[e.width,e.height,r]),u=$e(t,a,c),h=$e(t,d===a?null:d,c),m=g=>{if(i?.annotationId===g.id){const v=t.shapes.find(C=>C.id===g.id);return v===void 0?g.geometry:s.measureShapeRegion(Ee(i.region),v.strokeWidth,c.panel)}if(l?.annotationId===g.id){const v=t.arrows.find(C=>C.id===g.id);return v===void 0?g.geometry:s.measureArrowEnds(Ae(v,l),c.panel)??g.geometry}return g.geometry},x=g=>{if(o?.annotationId!==g)return e;const v=Fn(o.translation,e);return{x:e.x+v.x,y:e.y+v.y}};return(0,n.jsxs)(n.Fragment,{children:[h!==null&&(0,n.jsx)(Xe,{annotationId:h.id,geometry:m(h),state:"hovered",origin:x(h.id)}),u!==null&&(0,n.jsx)(Xe,{annotationId:u.id,geometry:m(u),state:"selected",origin:x(u.id)})]})},$e=(e,t,r)=>{if(t===null)return null;const a=s.resolveAnnotationChromeGeometry(e,t,r);return a===null?null:{id:t,geometry:a}},Xe=({annotationId:e,geometry:t,state:r,origin:a})=>t.shape==="segment"?(0,n.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,children:[(0,n.jsx)(Ye,{point:t.start,state:r,origin:a}),(0,n.jsx)(Ye,{point:t.end,state:r,origin:a})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:Za[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{left:a.x+t.rect.x-2,top:a.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}}),Ye=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:$a[t],style:{left:r.x+e.x,top:r.y+e.y}}),Ya=({panelRect:e})=>{const t=s.useEditorState(o=>s.readStanding(o,"move-drag")),r=s.useResolvedAnnotations(e);if(t===null)return null;const a=Fn(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:Te,width:e.width,height:e.height,style:{left:e.x+a.x,top:e.y+a.y},"data-testid":"annotation-preview","data-annotation-id":t.annotationId,children:eo(r,t.annotationId,e)})},Ja=({annotation:e})=>(0,n.jsx)(s.TextAnnotation,{annotation:e,blockRef:s.useMeasuredBoxRef(e.id)}),ae=(e,t,r)=>{const a=e.find(o=>o.id===t);return a===void 0?null:r(a)},Qa={text:(e,t)=>ae(e.textAnnotations,t,r=>(0,n.jsx)(Ja,{annotation:r})),shape:(e,t)=>ae(e.shapes,t,r=>(0,n.jsx)(s.ShapeAnnotation,{shape:r})),image:(e,t)=>ae(e.images,t,r=>(0,n.jsx)(s.ImageAnnotation,{image:r})),arrow:(e,t,r)=>ae(e.arrows,t,a=>{const o=(0,p.computeArrow)({arrow:a,panelWidth:r.width,panelHeight:r.height});return o===null?null:(0,n.jsx)(s.ArrowAnnotation,{computed:o,isAddressable:!1})})},eo=(e,t,r)=>{for(const a of Object.values(Qa)){const o=a(e,t,r);if(o!==null)return o}return null},no=({panelRect:e})=>{const t=s.useEditorState(o=>s.readStanding(o,"shape-resize-drag")),r=s.useResolvedAnnotations(e).shapes;if(t===null)return null;const a=r.find(o=>o.id===t.annotationId);return a===void 0?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:Te,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"shape-resize-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(s.ShapeAnnotation,{shape:{...a,region:Ee(t.region)}})})},fe=[{width:0,key:"graph.annotations.shapeToolbar.border.none"},{width:2,key:"graph.annotations.shapeToolbar.border.thin"},{width:8,key:"graph.annotations.shapeToolbar.border.medium"},{width:16,key:"graph.annotations.shapeToolbar.border.thick"}],to=e=>[...fe].reverse().find(t=>t.width<=e)??fe[0],ro=({shape:e,shapeBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),u=Le(),h=e.fillColor??c.defaultAnnotationShapeFill,m=to(e.strokeWidth),x=(I,y)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"shape",id:e.id,patch:I}),y)},g=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},v=I=>x({fillColor:I,strokeColor:null},{transient:!0}),C=I=>x({fillOpacity:I},{transient:!0}),A=I=>()=>{x({strokeWidth:I}),u.close()};return(0,n.jsxs)(L.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(L.ColorPicker,{color:h,label:l("graph.annotations.shapeToolbar.color"),onChange:v,opacity:e.fillOpacity,onOpacityChange:C,...u.bind("color"),children:(0,n.jsx)(L.Swatch,{color:h,opacity:e.fillOpacity})}),(0,n.jsx)(L.Dropdown,{label:l("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(zn,{size:"sm",title:""}),...u.bind("border"),children:fe.map(I=>(0,n.jsx)(L.MenuItem,{isSelected:I.width===m?.width,onClick:A(I.width),children:l(I.key)},I.width))}),(0,n.jsx)(L.Separator,{}),(0,n.jsx)(L.IconButton,{label:l("graph.annotations.shapeToolbar.remove"),onClick:g,children:(0,n.jsx)(Pe,{size:"sm",title:""})})]})},ao="_1a8z7ku0",oo="_1a8z7ku1",ie=(e,t)=>{const r=e.shapes.find(a=>a.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},io=class extends de{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return s.readResizedShapeFor(s.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,corner:r,press:a,readInputs:o}=this.params,{annotations:i,panelRect:l}=o(),d=ie(i,t);return d===null?null:{kind:"shape-resize-drag",annotationId:t,region:Wn({region:d,corner:r,delta:Me(a,e,l),minSize:Kn(l)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:a}=this.params,o=ie(a().annotations,t);o===null||Un(o,e)||r(new p.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},so=({annotationId:e,panelRect:t})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useLatestRef({annotations:s.useCompiledSelector(l=>l.spec.annotations),panelRect:t}),i=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>i.current?.finish(!1),[]),(0,f.useCallback)(l=>({onPointerDown:d=>{if(d.button===0&&i.current===null){try{d.currentTarget.setPointerCapture(d.pointerId)}catch{return}d.currentTarget.focus({preventScroll:!0}),d.preventDefault(),i.current=new io({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,corner:l,press:{x:d.clientX,y:d.clientY},readInputs:()=>o.current,editorStore:a,dispatch:r.dispatch,onSettled:()=>{i.current=null}}),i.current.start()}}}),[e,o,a,r])},lo=[" ","Enter"],Je=4,co=({annotationId:e,panelRect:t})=>{const{commands:r}=s.useGraphContext(),a=s.useEditorStore(),o=s.useCompiledSelector(d=>d.spec.annotations),i=s.useLatestRef(o),l=s.useLatestRef(r.dispatch);return(0,f.useEffect)(()=>()=>{Qe({editorStore:a,annotationId:e,annotations:i.current,dispatch:l.current})},[a,e,i,l]),(0,f.useCallback)(d=>({onKeyDown:c=>{if(c.altKey||c.ctrlKey||c.metaKey||c.shiftKey)return;const u=a.getState(),h=s.readResizedShapeFor(s.readStanding(u,"shape-resize-drag"),e);if(lo.includes(c.key)){if(c.preventDefault(),c.repeat)return;if(h!==null){Qe({editorStore:a,annotationId:e,annotations:o,dispatch:r.dispatch});return}const x=ie(o,e);if(x===null)return;u.claimInteraction({kind:"shape-resize-drag",annotationId:e,region:x});return}if(h===null)return;const m=uo(c.key,t);m!==null&&(c.preventDefault(),u.claimInteraction({kind:"shape-resize-drag",annotationId:e,region:Wn({region:h.region,corner:d,delta:m,minSize:Kn(t)})}))}}),[e,o,t,a,r])},Qe=({editorStore:e,annotationId:t,annotations:r,dispatch:a})=>{const o=e.getState(),i=s.readResizedShapeFor(s.readStanding(o,"shape-resize-drag"),t);if(i===null)return;o.releaseInteraction("shape-resize-drag");const l=ie(r,t);l===null||Un(l,i.region)||a(new p.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:i.region}}))},uo=(e,t)=>{const r=K(Je,t.width),a=K(Je,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},ho=e=>{const t=ce(),r=go(t),a=xo(t);if(r===null)return null;const o=a.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return o===null?null:(0,n.jsx)(po,{shape:r,region:o,isSettled:a.resizedRegion===null&&!a.isMoved,isMoved:a.isMoved,...e})},po=({shape:e,region:t,isSettled:r,isMoved:a,panelRect:o,frameRect:i,frameElement:l})=>{const d=s.useI18n(),c=so({annotationId:e.id,panelRect:o}),u=co({annotationId:e.id,panelRect:o}),{rect:h}=s.measureShapeRegion(Ee(t),e.strokeWidth,o);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(ro,{shape:e,shapeBox:h,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:l}),!a&&Ua.map(m=>{const x=qa(h,m);return(0,n.jsx)(mo,{corner:m,point:{x:o.x+x.x,y:o.y+x.y},label:d(`graph.annotations.shapeToolbar.resize.${m}`),dragHandlers:c(m),keyboardHandlers:u(m)},m)})]})},mo=({corner:e,point:t,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{"aria-label":r,className:oo,"data-testid":"shape-resize-handle","data-corner":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...a,...o,children:(0,n.jsx)("span",{"aria-hidden":"true",className:ao})}),go=e=>{const t=s.useCompiledSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},xo=e=>s.useEditorState((0,ne.useShallow)(t=>e===null?{resizedRegion:null,isMoved:!1}:{resizedRegion:s.readResizedShapeFor(s.readStanding(t,"shape-resize-drag"),e)?.region??null,isMoved:s.readMovedAnnotationFor(s.readStanding(t,"move-drag"),e)!==null})),vo=e=>(0,n.jsx)(s.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"})]})}),fo="var(--_1tyillx0)",Co={rest:.5,hovered:.75,open:1};var So="_1tyillx1",bo={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},yo="_1tyillx5",jo={closed:"_1tyillx6",open:"_1tyillx7"},wo=({interaction:e,panelRect:t})=>{const r=s.useEditorStore(),a=s.useCompiledSelector(d=>d.coordSystem),o=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,i=Io(e),l=(0,f.useMemo)(()=>{if(o===null)return null;const d=(0,p.projectAnchorToPanel)(o.position,t,a);return{center:d,radius:19*Co[i],target:{kind:"observation",cursor:(0,p.toPanelCursor)(d,t)}}},[o,t,a,i]);return(0,f.useEffect)(()=>{r.getState().setMenuTrigger(l)},[r,l]),(0,f.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),o===null||l===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,B.default)(So,bo[i]),style:{left:t.x+l.center.x,top:t.y+l.center.y,...(0,vn.assignInlineVars)({[fo]:o.color??Ft.vars.border50})},children:(0,n.jsx)("span",{className:(0,B.default)(yo,jo[i==="open"?"open":"closed"]),children:(0,n.jsx)(vo,{size:"lg"})})})},Io=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",To='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Ao=(e,t)=>{const{chartId:r}=s.useGraphContext(),a=s.useEditorStore();(0,f.useEffect)(()=>{if(t===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!ee(i.target,e,r)||a.getState().standingInteraction?.kind==="chrome-popup")return;const l=[...t.querySelectorAll(To)];if(l.length===0)return;i.preventDefault();const d=l.findIndex(c=>c===document.activeElement);l[d===-1?i.shiftKey?l.length-1:0:(d+(i.shiftKey?-1:1)+l.length)%l.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,t,r,a])},Po=e=>{const{selectionStore:t,chartId:r}=s.useGraphContext();(0,f.useEffect)(()=>{let a=null;const o=()=>{e.focus({preventScroll:!0})},i=d=>{const{selection:c,clearSelection:u}=t.getState();c.length!==0&&(ee(d.target,e,r)||u())},l=d=>{t.getState().selection.length!==0&&ee(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(ee(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",o),document.addEventListener("focusin",i),document.addEventListener("focusout",l),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",o),document.removeEventListener("focusin",i),document.removeEventListener("focusout",l)}},[e,t,r])},Lo=`[${s.EDIT_TARGET_KIND_ATTRIBUTE}]`,$n=(e,t,r)=>{if(typeof document.elementsFromPoint!="function")return null;const a=document.elementsFromPoint(e,t);return Mo(a,r)},Mo=(e,t)=>{for(const r of e){const a=r.closest(Lo);if(a===null||!t.contains(a))continue;const o=Eo(a);if(o!==null)return o;if(a!==r)return null}return null},Eo=e=>{const t=e.getAttribute(s.EDIT_TARGET_KIND_ATTRIBUTE);if(t!=="annotation")return null;const r=e.getAttribute(s.EDIT_TARGET_ID_ATTRIBUTE);return r===null||r===""?null:{kind:t,id:r}},ko=class extends de{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return s.readMovedAnnotationFor(s.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,press:r,readInputs:a}=this.params,{annotations:o,panelRect:i}=a(),l=(0,p.findAnnotation)(o,t);if(l===null)return null;const d=(0,p.clampAnnotationTranslation)(l,Me(r,e,i));return d===null?null:{kind:"move-drag",annotationId:t,translation:d}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;ca(e)&&r(new p.MoveAnnotationCommand({id:t,translation:e}))}},_o=(e,t,r)=>{const{commands:a,selectionStore:o}=s.useGraphContext(),i=s.useEditorStore(),l=s.useLatestRef({annotations:s.useCompiledSelector(u=>u.spec.annotations),panelRect:r}),d=s.useLatestRef(t),c=(0,f.useRef)(null);(0,f.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,f.useEffect)(()=>{const u=x=>{const{editTargetUnderPointer:g,standingInteraction:v}=i.getState();return g!==null&&v===null&&x.pointerType==="mouse"&&Ro(x.target,e)?g:$n(x.clientX,x.clientY,e)},h=(x,g)=>{if(c.current!==null||!s.canMoveAnnotationOnCanvas(l.current.annotations,g.id))return;try{e.setPointerCapture(x.pointerId)}catch{return}x.preventDefault();const v=new ko({handle:e,pointerId:x.pointerId,annotationId:g.id,press:{x:x.clientX,y:x.clientY},readInputs:()=>l.current,editorStore:i,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=v,v.start()},m=x=>{if(x.button!==0||yn(x.target)||jn(x,d.current,i.getState().menuTrigger))return;const g=u(x),v=o.getState();if(g===null){v.clearSelection();return}v.setSelection([g]),h(x,g)};return document.addEventListener("pointerdown",m),()=>document.removeEventListener("pointerdown",m)},[e,i,o,a,l,d])},Ro=(e,t)=>e instanceof Node&&t.contains(e),Oo=e=>{const{selectionStore:t,commands:r,chartId:a}=s.useGraphContext(),o=s.useEditorStore(),i=(0,f.useCallback)(d=>{const{selection:c}=t.getState(),u=Dn(c);u!==null&&(d.preventDefault(),r.dispatch(new p.RemoveAnnotationCommand({id:u})),e.focus({preventScroll:!0}))},[e,r,t]),l=(0,f.useCallback)(d=>{const c=o.getState();switch(c.standingInteraction?.kind){case"difference-arrow-endpoint-drag":return c.releaseInteraction("difference-arrow-endpoint-drag");case"arrow-endpoint-drag":return c.releaseInteraction("arrow-endpoint-drag");case"move-drag":return c.releaseInteraction("move-drag");case"shape-resize-drag":return c.releaseInteraction("shape-resize-drag");case"chrome-popup":return;case"menu":return c.releaseInteraction("menu");default:if(bn(d.target,a)){e.focus({preventScroll:!0});return}t.getState().clearSelection();return}},[o,t,e,a]);(0,f.useEffect)(()=>{const d=c=>{if(ee(c.target,e,a)&&!No(c.target)&&!Wt(c.target))switch(c.key){case"Escape":return l(c);case"Delete":case"Backspace":return i(c);default:return}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,i,l,a])},No=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),Do=()=>{const e=s.useHoverState(o=>o.hover.primary),{layers:t,coordSystem:r}=s.useCompiledSelector((0,ne.useShallow)(o=>({layers:o.layers,coordSystem:o.coordSystem}))),{anchorResolver:a}=s.useGraphContext();return(0,f.useMemo)(()=>{if(e===null)return null;const o=t.find(d=>d.id===e.layerId);if(o===void 0)return null;const i=a.resolve(o.geom,e.observation,{coordSystem:r,position:o.position,purpose:"pin"});if(i===null)return null;const l=(0,p.buildObservationAnchor)(o,e.observation);return l===null?null:{position:i,color:(0,p.getColor)(e.observation),layer:o,at:l,observation:e.observation}},[e,t,r,a])},Ho={kind:"idle"},Xn=()=>{const e=s.useEditorState(a=>a.standingInteraction),t=s.useEditorState(a=>a.chromeUnderPointer),r=Do();return(0,f.useMemo)(()=>e!==null?e:r===null?Ho:{kind:"trigger",anchor:r,isEngaged:t==="menu-trigger"},[e,r,t])},zo=(e,t,r)=>{const a=s.useEditorStore(),{selectionStore:o}=s.useGraphContext(),{store:i,engine:l}=s.useHoverContext(),d=s.useLatestRef(e),c=s.useLatestRef(t),u=s.useLatestRef(r);(0,f.useEffect)(()=>{const h=C=>jn(C,c.current,a.getState().menuTrigger),m=C=>{if(h(C)||o.getState().selection.length>0)return;const A=u.current,I=c.current,y={x:C.clientX-I.x,y:C.clientY-I.y},T=Fo(y,A)?l.query((0,p.toPanelCursor)(y,A)):p.RESTING_HOVER_STATE;i.getState().setHoverState(T)};let x=!1;const g=()=>{x=d.current.kind==="menu"},v=C=>{if(yn(C.target))return;const{claimInteraction:A,releaseInteraction:I}=a.getState();if(!h(C)||x){I("menu"),x&&m(C);return}const y=d.current;y.kind==="trigger"&&A({kind:"menu",anchor:y.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",v),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",v)}},[a,o,d,i,l,c,u])},Fo=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,Go=(e,t)=>{const r=s.useEditorStore(),a=s.useLatestRef(t);(0,f.useEffect)(()=>{let o=null,i=null;const l=g=>{const{menuTrigger:v}=r.getState();return v===null?null:(0,p.isPointWithinEditMenuTrigger)(g,v)?"menu-trigger":null},d=()=>{o=null;const g=i;if(g===null)return;const v=a.current,C=r.getState();if(C.setChromeUnderPointer(l({x:g.x-v.x,y:g.y-v.y})),xe(C.standingInteraction))return;const A=$n(g.x,g.y,e);C.setEditTargetUnderPointer(A)},c=()=>{o===null&&(o=requestAnimationFrame(d))},u=()=>{const g=r.getState();g.setChromeUnderPointer(null),g.setEditTargetUnderPointer(null)},h=g=>{i={x:g.clientX,y:g.clientY},c()},m=()=>{i=null,o!==null&&(cancelAnimationFrame(o),o=null),u()},x=r.subscribe((g,v)=>{!xe(v.standingInteraction)||xe(g.standingInteraction)||i!==null&&c()});return e.addEventListener("pointermove",h),e.addEventListener("pointerleave",m),()=>{o!==null&&cancelAnimationFrame(o),x(),e.removeEventListener("pointermove",h),e.removeEventListener("pointerleave",m),u()}},[e,r,a])},xe=e=>{if(e===null)return!1;switch(e.kind){case"menu":case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":return!0;case"chrome-popup":return!1}},en="editor",nn=[],Vo=(e,t,r,a)=>{const o=Xn(),{store:i}=s.useHoverContext(),l=s.useGraphSelection().length>0,d=s.useEditorState(h=>h.menuTrigger),c=o.kind==="menu",u=(0,f.useMemo)(()=>d===null?nn:[(0,p.buildEditMenuTriggerRegion)(d)],[d]);Go(e,t),_o(e,t,r),zo(o,t,r),Po(e),Oo(e),Ao(e,a),(0,f.useEffect)(()=>(i.getState().publishPointerRegions(en,u),()=>i.getState().publishPointerRegions(en,nn)),[i,u]),(0,f.useEffect)(()=>(i.getState().setPointerSuspended(c||l),()=>i.getState().setPointerSuspended(!1)),[i,c,l]),(0,f.useEffect)(()=>{if(!l)return;const h=i.getState();h.setHoverState(p.RESTING_HOVER_STATE),h.setTooltipAnchor(null)},[i,l])},Bo=({frameElement:e,panelRect:t})=>{const{measureRef:r,screenRect:a}=s.useElementScreenRect(),o=s.useEditorStore();return(0,f.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,f.useEffect)(()=>()=>o.getState().releaseInteraction("menu"),[o]),a===null?null:(0,n.jsx)(qt,{children:(0,n.jsx)(Ko,{frameElement:e,frameRect:a,panelRect:t})})},Ko=({frameElement:e,frameRect:t,panelRect:r})=>{const a=(0,f.useMemo)(()=>({x:t.left+r.x,y:t.top+r.y}),[t.left,t.top,r.x,r.y]),[o,i]=(0,f.useState)(null);return Vo(e,a,r,o),(0,n.jsx)(Wo,{frameElement:e,frameRect:t,panelOrigin:a,panelRect:r,boxRef:i})},Wo=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:a,boxRef:o})=>{const i=we(),l=Xn();return(0,n.jsx)(s.OverlayPortal,{rect:t,zIndex:s.Z_INDEX.editorOverlay,container:i,"data-testid":"editor-overlay",boxRef:o,children:(0,n.jsxs)(s.PortalThemeProvider,{children:[(0,n.jsx)(Ba,{panelRect:a,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(ho,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(xa,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(Ya,{panelRect:a}),(0,n.jsx)(no,{panelRect:a}),(0,n.jsx)(Hr,{panelRect:a}),(0,n.jsx)(Xa,{panelRect:a}),(0,n.jsx)(wo,{interaction:l,panelRect:a}),(0,n.jsx)(Er,{interaction:l,panelOrigin:r})]})})},Uo=({slots:e,...t})=>(0,n.jsx)(s.EditorProvider,{children:(0,n.jsx)(s.GraphRenderer,{slots:(0,f.useMemo)(()=>({EditorSurface:Bo,...e}),[e]),...t})}),Yn=(0,f.createContext)(null),Jn=({labelId:e,controlId:t,children:r})=>{const a=(0,f.useMemo)(()=>{let o=null;return{labelId:e,controlId:t,claimControlId:i=>(o??=i,o===i)}},[e,t]);return(0,n.jsx)(Yn.Provider,{value:a,children:r})},W=({id:e,ariaLabel:t,ariaLabelledBy:r},a=!0)=>{const o=(0,f.useContext)(Yn),i=(0,f.useId)(),[l]=(0,f.useState)(()=>a?o?.claimControlId(i)??!1:!1),d=e??(l?o?.controlId:void 0),c=r??(t===void 0?o?.labelId:void 0);return{...d!==void 0&&{id:d},...t!==void 0&&{"aria-label":t},...c!==void 0&&{"aria-labelledby":c}}};var qo={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},Qn=({label:e,icon:t,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:l,id:d})=>{const c=W({id:d,ariaLabel:i,ariaLabelledBy:l}),u=a==="tile";return(0,n.jsxs)("button",{type:"button",className:qo[a],disabled:o,onClick:r,...c,children:[t!==void 0&&(0,n.jsx)("span",{className:"woi4bh0",children:t}),e!==void 0&&(0,n.jsx)("span",{className:u?"woi4bh2":"woi4bh1",children:e})]})},ke=(0,f.createContext)(null),E=()=>{const e=(0,f.useContext)(ke);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},et=({children:e,onKeyDown:t,...r})=>{const a=(0,f.useContext)(ke),o=i=>{if(t?.(i),!a||i.defaultPrevented)return;const l=s.resolveHistoryStep(i.nativeEvent);l&&(i.preventDefault(),l==="undo"?a.undo():a.redo())};return(0,n.jsx)("div",{onKeyDown:o,...r,children:e})},nt="keyboard",ue=e=>{const t=(0,f.useRef)(!1),r=(0,f.useRef)(!1),a=()=>{t.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){r.current=!0;return}e?.()},commitUnlessHeldKey:o=>{if(o){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},Zo="eh8dvc0",$o="eh8dvc1 uz3g760",Xo="eh8dvc2 uz3g761";var tt=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,placeholder:l,prefix:d,suffix:c,isDisabled:u,hasError:h,ariaLabel:m,ariaLabelledBy:x,id:g})=>{const v=W({id:g,ariaLabel:m,ariaLabelledBy:x}),{commitUnlessHeldKey:C,gestureHandlers:A}=ue(r);return(0,n.jsx)(ze.NumberField.Root,{className:Zo,value:e,onValueChange:I=>t(I),onValueCommitted:(I,y)=>{C(y.reason===nt)},min:a,max:o,step:i,disabled:u,children:(0,n.jsxs)(et,{className:$o,"data-error":h===!0,"data-disabled":u===!0?"":void 0,children:[d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d}),(0,n.jsx)(ze.NumberField.Input,{className:Xo,placeholder:l,...A,"aria-invalid":h===!0?!0:void 0,...v}),c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c})]})})},Yo="_1b7s5f0",$={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Jo="_1b7s5f7";var Qo=6,rt=({options:e,value:t,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:l,ariaLabel:d,ariaLabelledBy:c,id:u})=>{const h=W({id:u,ariaLabel:d,ariaLabelledBy:c}),m=i==="swatch",{commitAfterChange:x,gestureHandlers:g}=ue(a);return(0,n.jsx)(Cn.RadioGroup,{className:(0,B.default)(Yo,ei(o??e.length)),value:t,onValueChange:v=>{r(v),x()},...g,disabled:l,...h,children:e.map(v=>(0,n.jsxs)(fn.Radio.Root,{value:v.value,disabled:v.isDisabled,className:(0,B.default)(Jo,m&&"_1b7s5f8"),"aria-label":m?v.label:void 0,children:[v.icon,!m&&(0,n.jsx)("span",{className:"_1b7s5f9",children:v.label})]},v.value))})},ei=e=>{switch(Math.min(Math.max(Math.round(e),1),Qo)){case 1:return $[1];case 2:return $[2];case 3:return $[3];case 4:return $[4];case 5:return $[5];default:return $[6]}},ni="_1g5x15w0 uz3g760",ti="_1g5x15w1",ri="_1g5x15w2",tn="_1g5x15w3",ai="_1g5x15w4",oi="_1g5x15w5",ii="_1g5x15w6",si="_1g5x15w7";var at=({options:e,value:t,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const u=W({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,n.jsxs)(F.Select.Root,{value:t,onValueChange:h=>h!==null&&r(h),disabled:o,items:e.map(h=>({value:h.value,label:h.label})),children:[(0,n.jsxs)(F.Select.Trigger,{className:ni,"data-error":i===!0,...u,children:[(0,n.jsx)(F.Select.Value,{className:ti,children:h=>li(e,h,a)}),(0,n.jsx)(F.Select.Icon,{className:tn,children:(0,n.jsx)(s.ChevronDownIcon,{size:"sm"})})]}),(0,n.jsx)(F.Select.Portal,{container:s.resolvePortalContainer(),children:(0,n.jsx)(s.PortalThemeProvider,{children:(0,n.jsx)(F.Select.Positioner,{className:ai,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(F.Select.Popup,{className:oi,children:e.map(h=>(0,n.jsxs)(F.Select.Item,{value:h.value,disabled:h.isDisabled,className:ii,children:[h.icon,(0,n.jsxs)("span",{className:si,children:[(0,n.jsx)(F.Select.ItemText,{children:h.label}),h.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:h.description})]}),(0,n.jsx)(F.Select.ItemIndicator,{className:tn,children:(0,n.jsx)(s.CheckIcon,{size:"sm"})})]},h.value))})})})})]})},li=(e,t,r)=>t===null?(0,n.jsx)("span",{className:ri,children:r}):ci(e,t),ci=(e,t)=>e.find(r=>r.value===t)?.label??t,di="vod76w0",ui="vod76w1",hi="vod76w2",pi="vod76w3",mi="vod76w4",gi="vod76w5";var ot=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,suffix:l,formatValue:d,isDisabled:c,ariaLabel:u,ariaLabelledBy:h})=>{const m=W({ariaLabel:u,ariaLabelledBy:h},!1),x=xi(e,l,d),{commitUnlessHeldKey:g,gestureHandlers:v}=ue(r);return(0,n.jsxs)("div",{className:di,children:[(0,n.jsx)(Y.Slider.Root,{className:ui,value:e,onValueChange:C=>t(C),onValueCommitted:(C,A)=>{g(A.reason===nt)},min:a,max:o,step:i,disabled:c,children:(0,n.jsx)(Y.Slider.Control,{className:hi,children:(0,n.jsxs)(Y.Slider.Track,{className:pi,children:[(0,n.jsx)(Y.Slider.Indicator,{className:mi}),(0,n.jsx)(Y.Slider.Thumb,{className:gi,...v,...m})]})})}),x!==null&&(0,n.jsx)("span",{className:"vod76w6",children:x})]})},xi=(e,t,r)=>r!==void 0?r(e):t!==void 0?`${e}${t}`:null,vi="_1hyrlw60",fi="_1hyrlw61",it=({isChecked:e,onChange:t,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const l=W({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,n.jsx)(Fe.Switch.Root,{checked:e,onCheckedChange:d=>t(d),disabled:r,className:vi,...l,children:(0,n.jsx)(Fe.Switch.Thumb,{className:fi})})},Ci="uz3g761",Si="tpcnun0 uz3g760",st=({value:e,onChange:t,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const u=W({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,n.jsx)(et,{className:Si,"data-error":i===!0,children:(0,n.jsx)(Vt.Input,{className:Ci,value:e,onValueChange:h=>t(h),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...u})})},bi="cnu9yl0",yi="cnu9yl1";var lt=({options:e,value:t,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const u=W({id:c,ariaLabel:l,ariaLabelledBy:d}),h=o==="stacked",{commitAfterChange:m,gestureHandlers:x}=ue(a);return(0,n.jsx)(Cn.RadioGroup,{className:bi,value:t,onValueChange:g=>{r(g),m()},...x,disabled:i,...u,children:e.map(g=>(0,n.jsxs)(fn.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,B.default)(yi,h&&"cnu9yl2"),"aria-label":ji(g,h),children:[g.icon,ct(g,h)&&(0,n.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},ct=(e,t)=>e.icon===void 0||t,ji=(e,t)=>{if(!ct(e,t))return e.label},dt={ToggleGroup:lt,Switch:it,Slider:ot,RadioGrid:rt,Button:Qn,TextField:st,NumberField:tt,Select:at},ut=(0,f.createContext)(dt),wi=({controls:e,children:t})=>{const r=(0,f.useMemo)(()=>({...dt,...e}),[e]);return(0,n.jsx)(ut.Provider,{value:r,children:t})},k=()=>(0,f.useContext)(ut),Ii="_12lhx9e0",ht=({children:e})=>(0,n.jsx)("div",{className:Ii,children:e}),Ti="_139ohwv0",D=({children:e})=>(0,n.jsx)("div",{className:Ti,children:e}),pt=(0,f.createContext)(null),Ai=pt.Provider,mt=()=>{const e=(0,f.useContext)(pt);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},Pi="_1jlczkt0",gt="data-graphy-editor-panel",Li={List:D,Grid:ht};function Mi(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var Ei=({handle:e,children:t,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=s.useGraphHandle(e),{themeClass:l,inlineVarsStyle:d}=s.useThemeContext(),[c,u]=(0,f.useState)(()=>a?[a]:[]),h=(0,f.useMemo)(()=>({expandSection:m=>u([m]),collapseAllSections:()=>u([])}),[]);return(0,n.jsx)(ke.Provider,{value:i,children:(0,n.jsx)(wi,{controls:r,children:(0,n.jsx)(Ai,{value:h,children:(0,n.jsx)(Q.Accordion.Root,{[gt]:"",className:(0,B.default)(Pi,o,{[l]:!Mi(o)}),style:d,value:c,onValueChange:m=>u(m),children:t})})})})},_e={Root:Ei,Controls:Li},rn={stack:"pr583x0",grid:"pr583x1"},an="pr583x2",ki={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},b=({label:e,layout:t="grid",icon:r,children:a})=>{const o=(0,f.useId)(),i=(0,f.useId)();return e===void 0?(0,n.jsx)("div",{className:rn[t],children:(0,n.jsx)("div",{className:an,children:a})}):(0,n.jsxs)("div",{className:rn[t],children:[(0,n.jsxs)("label",{id:o,htmlFor:i,className:ki[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:an,children:(0,n.jsx)(Jn,{labelId:o,controlId:i,children:a})})]})},_i=e=>(0,n.jsx)(s.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"})})}),Re="_40zvwv0",Oe="_40zvwv1",Ri="_40zvwv2",xt="_40zvwv3",Oi="_40zvwv4 _40zvwv3";var Ni="_40zvwv6";var Di="_40zvwv8",R=({title:e,layout:t="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>t==="collapsible"?(0,n.jsx)(zi,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(Hi,{title:e,accessory:a,children:i}):(0,n.jsxs)("div",{className:Re,children:[(0,n.jsxs)("div",{className:Oe,children:[(0,n.jsx)("span",{className:xt,children:e}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:r}),a!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,n.jsx)("div",{children:i})]}),Hi=({title:e,accessory:t,children:r})=>{const a=(0,f.useId)(),o=(0,f.useId)();return(0,n.jsx)("div",{className:Re,children:(0,n.jsxs)("div",{className:Oe,children:[(0,n.jsx)("label",{id:a,htmlFor:o,className:Oi,children:e}),(0,n.jsx)("span",{className:Ni,children:(0,n.jsx)(Jn,{labelId:a,controlId:o,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},zi=({title:e,preview:t,accessory:r,onOpenChange:a,children:o})=>{const i=s.useI18n();return(0,n.jsxs)(Q.Accordion.Item,{value:e,className:Re,onOpenChange:a,children:[(0,n.jsxs)(Q.Accordion.Header,{className:Oe,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(Q.Accordion.Trigger,{className:Ri,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:xt,children:e}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:t}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:r}),(0,n.jsx)("span",{className:Di,children:(0,n.jsx)(_i,{size:"sm"})})]}),(0,n.jsx)(Q.Accordion.Panel,{children:(0,n.jsx)("div",{children:o})})]})},vt=({title:e,isChecked:t,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:l,collapseAllSections:d}=mt(),{Switch:c}=k(),u=m=>{r(m),m?l(e):d()},h=m=>{m&&!t&&a!==!0&&r(!0)};return(0,n.jsx)(R,{title:e,layout:"collapsible",preview:o,onOpenChange:h,accessory:(0,n.jsx)(c,{isChecked:t,onChange:u,isDisabled:a,ariaLabel:e}),children:i})},Fi={horizontal:["bottom","top"],vertical:["left","right"]},Gi={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Vi={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},Ce=({axis:e,title:t,layout:r="collapsible",preview:a})=>{const o=E(),i=s.useHandleCompiled(o),l=s.useI18n(),{NumberField:d,Switch:c,TextField:u,ToggleGroup:h}=k();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",x=i.config.axes[e],g=i.scales[e],v=g?.spec,C=v?.scaleType==="continuous"?v:void 0;if(m==="circular"||m==="radial"&&C===void 0)return null;const A=v!==void 0&&"reverse"in v?v:void 0,I=v?.scaleType==="continuous"||v?.scaleType==="datetime",y=e==="y"&&C!==void 0&&i.layers.some(j=>j.yScaleType==="primary"&&j.geom==="bar"),T=C?.transform==="log",S=C?.domainMax??null,P=Bi(C),N=(j,G)=>j.map(te=>({value:te,label:G(te)})),_=i.guides.axes.find(j=>j.scaleAestheticKey===e)?.position,H=Fi[_==="bottom"||_==="top"||_===void 0&&e==="x"?"horizontal":"vertical"],M=i.guides.legends.drawn.some(j=>H.some(G=>G===j.position)),w=H.map(j=>({value:j,label:l(Gi[j])})),O=N(["auto","edges"],j=>l(j==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),U=N(["linear","log"],j=>l(j==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Tt=N(["auto","zero","custom"],j=>l(j==="zero"?"editor.axesPanel.startFrom.zero":j==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),At=N(["auto","custom"],j=>l(j==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Pt=N(["no","yes"],j=>l(j==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),Lt=j=>{o.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:j}))},Mt=j=>{o.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:j===""?null:j}),{transient:!0})},Et=j=>{o.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:j}))},kt=j=>{o.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:j==="edges"?"edges":"auto"}))},_t=j=>{o.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:j==="yes"}))},Rt=j=>{o.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:j==="log"?"log":"linear"}))},He=j=>{o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...j}),{transient:!0})},Ot=j=>{j!==null&&He({domainMin:j})},Nt=j=>{j!==null&&He({domainMax:j})},Dt=j=>{if(C){if(j==="custom"){C.zero&&o.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:on(g?.domain,"start")}));return}C.domainMin!==null&&o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),o.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:j==="zero"}))}},Ht=j=>{const G=j==="custom"?on(g?.domain,"end"):null;o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:G}))},zt=j=>{const G=H.find(te=>te===j);G&&o.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:G}))};return(0,n.jsx)(R,{title:t??l(Vi[e]),layout:r,preview:a,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:l("editor.axesPanel.controls.visible"),children:(0,n.jsx)(c,{isChecked:x.isVisible,onChange:Lt})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:l("editor.axesPanel.controls.title"),children:(0,n.jsx)(u,{value:x.label??"",onChange:Mt,onCommit:o.commands.seal})}),(0,n.jsx)(b,{label:l("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(c,{isChecked:x.ticks.isVisible,onChange:Et})})]}),I&&(0,n.jsx)(b,{label:l("editor.axesPanel.controls.labels"),children:(0,n.jsx)(h,{value:x.ticks.mode,options:O,onChange:kt})}),C&&m==="linear"&&!M&&(0,n.jsx)(b,{label:l("editor.axesPanel.controls.position"),children:(0,n.jsx)(h,{value:_??x.position,options:w,onChange:zt})}),A!==void 0&&(0,n.jsx)(b,{label:l("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(h,{value:A.reverse===!0?"yes":"no",options:Pt,onChange:_t})}),C&&!y&&(0,n.jsx)(b,{label:l("editor.axesPanel.controls.scale"),children:(0,n.jsx)(h,{value:T?"log":"linear",options:U,onChange:Rt})}),C&&!T&&(0,n.jsxs)(n.Fragment,{children:[!y&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:l("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(h,{value:P,options:Tt,onChange:Dt})}),P==="custom"&&(0,n.jsx)(b,{label:l("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:C.domainMin??null,onChange:Ot,onCommit:o.commands.seal})})]}),(0,n.jsx)(b,{label:l("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(h,{value:S===null?"auto":"custom",options:At,onChange:Ht})}),S!==null&&(0,n.jsx)(b,{label:l("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:S,onChange:Nt,onCommit:o.commands.seal})})]})]})})},Bi=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",on=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},Ne=({value:e,onChange:t})=>{const r=E(),a=s.useI18n(),{TextField:o}=k(),i=e!==null&&typeof e!="string",l=d=>t(d===""?null:d);return(0,n.jsx)(b,{label:a("editor.elementsPanel.contentValue"),children:(0,n.jsx)(o,{value:typeof e=="string"?e:"",onChange:l,onCommit:r.commands.seal,isDisabled:i})})},ft=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=k();if(!o)return null;const d=o.config.content,c=h=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"caption",isVisible:h}))},u=h=>{a.commands.dispatch(new p.SetContentCaptionCommand({caption:h}),{transient:!0})};return(0,n.jsx)(R,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isCaptionVisible,onChange:c})}),(0,n.jsx)(Ne,{value:d.caption,onChange:u})]})})},sn=/^[a-z][a-z\d+.-]*:/i,Ki={},Ct=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=k();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"source",isVisible:u}))};return(0,n.jsx)(R,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isSourceVisible,onChange:c})}),(0,n.jsx)(Wi,{source:d.source??Ki})]})})},Wi=({source:e})=>{const t=E(),r=s.useI18n(),{TextField:a}=k(),o=c=>{const u=(c.label??"")!==""||(c.url??"")!=="";t.commands.dispatch(new p.SetContentSourceCommand({source:u?c:null}),{transient:!0})},i=()=>{const c=e.url??"";c!==""&&!sn.test(c)&&o({...e,url:`https://${c}`}),t.commands.seal()},l=c=>o({...e,url:c}),d=c=>o({...e,label:c});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(a,{value:e.url??"",onChange:l,onCommit:i,hasError:sn.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,n.jsx)(b,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(a,{value:e.label??"",onChange:d,onCommit:t.commands.seal})})]})},St=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=k();if(!o)return null;const d=o.config.content,c=h=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:h}))},u=h=>{a.commands.dispatch(new p.SetContentSubtitleCommand({subtitle:h}),{transient:!0})};return(0,n.jsx)(R,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isSubtitleVisible,onChange:c})}),(0,n.jsx)(Ne,{value:d.subtitle,onChange:u})]})})},Se=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],Ui=Se.length/2,bt=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=k();if(!o)return null;const{textScale:d}=o.config.appearance,c=m=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${m}`}),u=Se.map(m=>({value:`${m}`,label:c(m)})),h=m=>{const x=Se.find(g=>`${g}`===m);x!==void 0&&a.commands.dispatch(new p.SetAppearanceTextScaleCommand({textScale:x}))};return(0,n.jsx)(R,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??c(d),children:(0,n.jsx)(l,{value:`${d}`,options:u,columns:Ui,onChange:h,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},yt=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=k();if(!o)return null;const d=o.config.content,c=h=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"title",isVisible:h}))},u=h=>{a.commands.dispatch(new p.SetContentTitleCommand({title:h}),{transient:!0})};return(0,n.jsx)(R,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isTitleVisible,onChange:c})}),(0,n.jsx)(Ne,{value:d.title,onChange:u})]})})},qi=({children:e,...t})=>(0,n.jsx)(_e.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(yt,{}),(0,n.jsx)(St,{}),(0,n.jsx)(ft,{}),(0,n.jsx)(Ct,{}),(0,n.jsx)(bt,{})]})}),Zi=({children:e,...t})=>(0,n.jsx)(_e.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ce,{axis:"x"}),(0,n.jsx)(Ce,{axis:"y"})]})}),he=e=>`${e}px`,jt=e=>`${Math.round(e*100)}%`,$i=e=>`${e}°`,Xi=24,Yi={select:{target:"graph"}},ln=["dim","desaturate"],Ji=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=k();if(!o)return null;const c=(0,p.createStyleResolver)().chromeReaders(o.chrome).graph.get("borderRadius"),u=(0,p.readHighlightDimStyle)(o.spec),h=ln.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),m=g=>{const v=(0,p.findStyleRule)(o.spec.styles.overrides,Yi)?.declarations??{};a.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...v,borderRadius:g}}}),{transient:!0})},x=g=>{const v=ln.find(C=>C===g);v&&a.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:v}))};return(0,n.jsx)(R,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(l,{value:c,min:0,max:Xi,step:1,formatValue:he,onChange:m,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(d,{value:u,options:h,onChange:x})})]})})},De=(e,t)=>{const{colorScheme:r}=s.useThemeContext();return(0,f.useMemo)(()=>{const a=e?.layers.find(o=>o.id===t);return a===void 0?null:(0,p.createStyleResolver)({colorScheme:r}).geomReaders(a)},[e,t,r])},Qi=.05,es=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=k(),c=o?(0,p.findLayerByGeom)(o.spec.layers,"bar"):void 0,u=De(o,c?.id??null);if(!o||!c||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const h=g=>{a.commands.dispatch(new p.SetBarWidthCommand({layerId:c.id,width:g}),{transient:!0})},m=g=>{const v=p.BORDER_RADIUS_TOKENS.find(C=>C===g);v&&a.commands.dispatch(new p.SetBarBorderRadiusCommand({layerId:c.id,borderRadius:v}))},x=p.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:i(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,n.jsx)(R,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(l,{value:c.params.width,min:p.MIN_BAR_WIDTH,max:p.MAX_BAR_WIDTH,step:Qi,formatValue:jt,onChange:h,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(d,{value:u?.get("borderRadius")??p.DEFAULT_BAR_BORDER_RADIUS,options:x,onChange:m})})]})})},pe=({children:e})=>{const t=(0,f.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("g",{filter:`url(#${t})`,children:e}),(0,n.jsx)("defs",{children:(0,n.jsxs)("filter",{id:t,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,n.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,n.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},me="qdaoth0",ns=e=>(0,n.jsxs)(s.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(pe,{children:(0,n.jsx)("path",{className:me,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,n.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"})]}),ts=e=>(0,n.jsx)(s.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(pe,{children:[(0,n.jsx)("path",{className:me,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,n.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"})]})}),rs=e=>(0,n.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(pe,{children:(0,n.jsx)("path",{className:me,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,n.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"})]}),as=e=>(0,n.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(pe,{children:(0,n.jsx)("path",{className:me,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,n.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"})]}),os={x:.5,y:.5},is=.2,ss={x:.375,y:.25,width:.25,height:.5},ls={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},cs={x:.4,y:.6},ds={x:.6,y:.4},us="relative-difference",hs=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Button:l}=k();if(!o)return null;const d=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"text",annotation:{...p.TEXT_ANNOTATION_DEFAULTS,content:ps(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...os},width:is}}))},c=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"arrow",annotation:{...p.ARROW_DEFAULTS,start:{anchorType:"panel",...cs},end:{anchorType:"panel",...ds}}}))},u=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"shape",annotation:{...p.SHAPE_DEFAULTS,...ls,region:{anchorType:"panel",...ss}}}))},h=()=>{const x=(0,p.inferDefaultDifferenceArrowEndpoints)(o);x!==null&&a.commands.dispatch(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...x,label:us}}))},m=o.coordSystem.type==="cartesian";return(0,n.jsx)(R,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(ht,{children:[(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(as,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(ns,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:c}),(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(ts,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:u}),m&&(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(rs,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:h})]})})},ps=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),ms=.1,gs=20,xs=({title:e,preview:t})=>{const r=E(),a=s.useHandleCompiled(r),o=s.useI18n(),{NumberField:i,TextField:l}=k();if(!a||a.coordSystem.type==="polar")return null;const d=(0,p.findGoalLineLayer)(a.spec.layers),c=e??o("editor.annotationsPanel.goalSection.title"),u=(0,p.extractConstantValue)(d?.mapping.y),h=typeof u=="number"?u:null,m=v=>{const C=new p.ToggleGoalLineCommand({showGoalLine:v,value:vs(a),...d!==void 0&&{layerId:d.id}});r.commands.dispatch(C)},x=v=>{if(d===void 0)return;const C=new p.SetRuleLabelCommand({layerId:d.id,label:v===""?null:v});r.commands.dispatch(C,{transient:!0})},g=v=>{if(d===void 0||v===null)return;const C=new p.SetRuleValueCommand({layerId:d.id,value:v});r.commands.dispatch(C,{transient:!0})};return(0,n.jsx)(vt,{title:c,preview:t,isChecked:d!==void 0,onToggle:m,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(l,{value:d?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:x,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(b,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:h,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},vs=e=>{const t=(e.scales.y?.domain??[]).filter(l=>typeof l=="number");if(t.length===0)return 0;const r=Math.max(...t),a=r-Math.min(...t),o=a>0?a:Math.abs(r);if(o===0)return 0;const i=Math.min(gs,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*ms).toFixed(i))},fs=({layerId:e,title:t,layout:r="collapsible",preview:a})=>{const o=E(),i=s.useHandleCompiled(o),l=s.useI18n(),{Switch:d}=k();if(!i)return null;const c=e===void 0?i.spec.layers[0]:i.spec.layers.find(_=>_.id===e);if(!c)return null;const{showDataLabels:u,format:h,showStackTotals:m,showCategoryLabels:x}=c.dataLabels,g=i.coordSystem.type==="polar",v=c.geom==="bar",C=c.position==="stack"||c.position==="fill",A=v&&!g&&c.position==="stack",I=v&&(!g||u),y=v||c.geom==="area"&&C;if(!(0,p.canPlaceDataLabels)(c.geom,i.coordSystem.type))return null;const T=_=>{const H=new p.ToggleDataLabelsCommand({layerId:c.id,showDataLabels:_});o.commands.dispatch(H)},S=_=>{const H=new p.SetDataLabelsFormatCommand({layerId:c.id,format:_?"percentage":"absolute"});o.commands.dispatch(H)},P=_=>{const H=new p.ToggleStackTotalsCommand({layerId:c.id,showStackTotals:_});o.commands.dispatch(H)},N=_=>{const H=new p.ToggleCategoryLabelsCommand({layerId:c.id,showCategoryLabels:_});o.commands.dispatch(H)};return(0,n.jsx)(R,{title:t??l("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:l("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(d,{isChecked:u,onChange:T})}),u&&y&&(0,n.jsx)(b,{label:l("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(d,{isChecked:h==="percentage",onChange:S})}),A&&(0,n.jsx)(b,{label:l("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(d,{isChecked:m,onChange:P})}),I&&(0,n.jsx)(b,{label:l("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(d,{isChecked:x,onChange:N})})]})})},Cs=e=>(0,n.jsxs)(s.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"})]}),Ss=e=>(0,n.jsx)(s.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"})]})}),bs=e=>(0,n.jsx)(s.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"})]})}),ys=e=>(0,n.jsx)(s.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"})]})}),js=e=>(0,n.jsxs)(s.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"})]}),ws=e=>(0,n.jsxs)(s.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"})]}),Is=e=>(0,n.jsxs)(s.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"})]}),Ts=e=>(0,n.jsx)(s.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"})]})}),As=e=>(0,n.jsx)(s.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"})]})]})}),Ps=e=>(0,n.jsxs)(s.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"})]}),Ls=e=>(0,n.jsx)(s.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"})]})}),Ms=.55,be=[{name:"column",icon:js,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Is,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:ws,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Ss,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:ys,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:bs,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:As,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Cs,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"scatter",icon:Ls,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Ps,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Ts,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Ms}}],Es=.05,ks=e=>e===null?null:be.find(t=>Rs(t.summary,e))??null,_s=(e,t)=>{const{summary:r}=e;return r.coordType!=="polar"||!se(r.innerRadius)||t===null||t.coordType!=="polar"||!se(t.innerRadius)?r:{...r,innerRadius:t.innerRadius}},Rs=(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&&se(e.innerRadius)===se(t.innerRadius),se=e=>e>=Es,Os=3,Ns=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=k(),d=(0,f.useMemo)(()=>be.map(({name:m,icon:x})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(x,{size:"md"})})),[i]);if(!o)return null;const c=(0,p.readChartType)(o.spec),u=ks(c),h=m=>{const x=be.find(g=>g.name===m);x&&a.commands.dispatch(new p.SetChartTypeCommand(_s(x,c)))};return(0,n.jsx)(R,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:r??i(u===null?"editor.graphTypes.combo":`editor.graphTypes.${u.name}`),children:(0,n.jsx)(l,{value:u?.name??"",options:d,columns:Os,onChange:h,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},cn=["solid","dashed","dotted"],Ds=Number.parseFloat(s.chromeTokens.gridLineWidth),Hs=8,zs=0,Fs=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,Switch:d,ToggleGroup:c}=k(),{themeValues:u}=s.useThemeContext();if(!o)return null;const h=o.guides.axes.filter(Gs);if(h.length===0)return null;const m=o.coordSystem.type!=="polar",x=h.some(y=>y.gridVisible),g=o.config.axes.y.grid,v=cn.map(y=>({value:y,label:i(`editor.graphPanel.gridSection.lineStyles.${y}`)})),C=y=>T=>{a.commands.dispatch(new p.SetGridVisibilityCommand({axis:y,isVisible:T}))},A=y=>{const T=cn.find(S=>S===y);T&&a.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:T}))},I=y=>{a.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:y}),{transient:!0})};return(0,n.jsx)(R,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[h.map(y=>(0,n.jsx)(b,{label:i(Vs(y)),children:(0,n.jsx)(d,{isChecked:y.gridVisible,onChange:C(y.scaleAestheticKey)})},y.scaleAestheticKey)),m&&x&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(c,{value:g.lineStyle,options:v,onChange:A})}),(0,n.jsx)(b,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(l,{value:g.lineWidth??s.parsePx(u.gridLineWidth,Ds),min:zs,max:Hs,step:.5,formatValue:he,onChange:I,onCommit:a.commands.seal})})]})]})})},Gs=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",Vs=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",Bs="total",wt=["total","average","current"],Ks=["total"],dn=["previous","first"],un=["auto","small","medium","large"],Ws=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l,ToggleGroup:d}=k();if(!o)return null;const c=o.config.headline,u=c.show!=="none",h=o.coordSystem,m=h.type==="polar",x=h.type==="polar"&&h.innerRadius>0,g=o.layers.some(w=>w.summary.grandTotal!==void 0);if(m&&!g)return null;const v=m?Ks:wt,C=o.guides.headline,A=C?.kind==="perGroup"&&C.items.some(w=>w.comparison!==null),I=v.map(w=>({value:w,label:i(`editor.graphPanel.headlineNumberSection.metrics.${w}`)})),y=dn.map(w=>({value:w,label:i(`editor.graphPanel.headlineNumberSection.comparison.${w}`)})),T=un.map(w=>({value:w,label:i(w==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${w}`)})),S=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],P=w=>{a.commands.dispatch(new p.SetHeadlineShowCommand({show:w?Bs:"none"}))},N=w=>{const O=v.find(U=>U===w);O&&a.commands.dispatch(new p.SetHeadlineShowCommand({show:O}))},_=w=>{const O=dn.find(U=>U===w);O&&a.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:O}))},H=w=>{const O=un.find(U=>U===w);O&&a.commands.dispatch(new p.SetHeadlineSizeCommand({size:O}))},M=w=>{a.commands.dispatch(new p.SetHeadlinePositionCommand({position:w==="center"?"center":"above"}))};return(0,n.jsx)(R,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??Us(i,c.show),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(l,{isChecked:u,onChange:P})}),u&&(0,n.jsxs)(n.Fragment,{children:[I.length>1&&(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(d,{value:c.show,options:I,onChange:N})}),A&&(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(d,{value:(0,p.resolveComparisonBasis)(c.compareWith),options:y,onChange:_})}),(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(d,{value:c.size,options:T,onChange:H})}),x&&(0,n.jsx)(b,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(d,{value:c.position,options:S,onChange:M})})]})]})})},Us=(e,t)=>{const r=wt.find(a=>a===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},ve=["top","bottom","left","right","none"],hn=["auto","start","center","end"],pn=["auto","pill","direct"],qs=({positions:e,title:t,layout:r="collapsible",preview:a})=>{const o=E(),i=s.useHandleCompiled(o),l=s.useI18n(),{ToggleGroup:d}=k();if(!i)return null;const c=i.config.legend.position,u=e??ve,h=i.guides.legends.drawn[0],m=(0,p.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),x=i.guides.headline?.kind==="perGroup",g=i.guides.colorGroups.length>0;if(c==="auto"&&h===void 0&&!m&&(x||!g))return null;const v=h?.position??"none",C=c==="auto"?v:c,A=ve.filter(M=>M===C||u.includes(M)).map(M=>({value:M,label:l(`editor.graphPanel.legendSection.${M}`)})),I=M=>{const w=ve.find(O=>O===M);w&&o.commands.dispatch(new p.SetLegendPositionCommand({position:w}))},y=M=>{const w=hn.find(O=>O===M);w&&o.commands.dispatch(new p.SetLegendAlignCommand({align:w}))},T=M=>{const w=pn.find(O=>O===M);w&&o.commands.dispatch(new p.SetLegendDisplayCommand({display:w}))},S=hn.map(M=>({value:M,label:l(`editor.graphPanel.legendSection.align.${M}`)})),P=pn.map(M=>({value:M,label:l(`editor.graphPanel.legendSection.display.${M}`)})),N=t??l("editor.graphPanel.legendSection.title"),_=A.find(M=>M.value===C)?.label,H=h!==void 0;return(0,n.jsx)(R,{title:N,layout:r,preview:a??_,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:l("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(d,{value:C,options:A,onChange:I})}),H&&(0,n.jsx)(b,{label:l("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(d,{value:i.config.legend.align,options:S,onChange:y})}),m&&(0,n.jsx)(b,{label:l("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(d,{value:i.config.legend.display,options:P,onChange:T})})]})})},Zs=1,$s=20,Xs=.5,It=({layerId:e})=>{const t=E(),r=s.useHandleCompiled(t),{Slider:a}=k(),o=De(r,e);if(!r)return null;const i=l=>{const d=new p.SetPointSizeCommand({layerId:e,size:l});t.commands.dispatch(d,{transient:!0})};return(0,n.jsx)(a,{value:o?.get("size")??p.DEFAULT_POINT_SIZE,min:Zs,max:$s,step:Xs,formatValue:he,onChange:i,onCommit:t.commands.seal})},Ys=1,Js=10,Qs=.1,el=["gap","zero","connect"],nl=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Slider:d,Switch:c,ToggleGroup:u}=k(),h=o?.spec.layers??[],m=(0,p.findLayerByGeom)(h,"line","area"),x=De(o,m?.id??null);if(!o||!m)return null;const g=o.coordSystem.type==="polar",v=al(i,m),C=rl(m,h),A=mn(o.spec,m.geom,"strokeWidth",m.id),I=typeof A=="number",y=m.geom==="line"?m:void 0,T=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],S=w=>{a.commands.dispatch(new p.ToggleLinePointsVisibilityCommand({layerId:m.id,showPoints:w}))},P=w=>{y&&a.commands.dispatch(new p.ToggleLineFillCommand({layerId:y.id,showFill:w}))},N=w=>{a.commands.dispatch(new p.SetLineInterpolationCommand({layerId:m.id,interpolate:w?"catmull-rom":"linear"}))},_=w=>{const O=x?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH;a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:w==="custom"?O:null}))},H=w=>{a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:w}),{transient:!0})},M=w=>{const O=tl(w);O&&a.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:m.id,missingValues:O}))};return(0,n.jsx)(R,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(c,{isChecked:C!==void 0,onChange:S})}),C&&(0,n.jsx)(b,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(It,{layerId:C.id})}),y&&!g&&(0,n.jsx)(b,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(c,{isChecked:mn(o.spec,"line","fillAlpha",y.id)!==void 0,onChange:P})}),!g&&(0,n.jsx)(b,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(c,{isChecked:m.params.interpolate==="catmull-rom",onChange:N})}),(0,n.jsx)(b,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(u,{value:I?"custom":"auto",options:T,onChange:_})}),I&&(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:A,min:Ys,max:Js,step:Qs,formatValue:he,onChange:H,onCommit:a.commands.seal})}),!g&&v.length>1&&(0,n.jsx)(b,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(l,{value:m.params.missingValues,options:v,onChange:M})})]})})},tl=e=>el.find(t=>t===e),mn=(e,t,r,a)=>(0,p.findKindStyleDeclarations)(e.styles.overrides,(0,p.buildLayerStyleAddress)(t,a))?.[r],rl=(e,t)=>(0,p.filterLayersByGeoms)(t,"point").find(r=>(0,p.isCompanionLayer)(r,[e])),al=(e,t)=>{const r=[{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"&&r.push({value:"connect",label:e("editor.graphPanel.treatEmptyValues.connectGaps.label")}),t.geom==="area"?r.filter(a=>a.value!=="gap"):r},ye="\0none",ol=["x","y","color","size","label"],il={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},sl=({title:e,layout:t="collapsible"})=>{const r=E(),a=s.useHandleCompiled(r),o=s.useI18n(),{Select:i}=k(),l=o("editor.graphPanel.mappingSection.none"),d=a?.spec,c=(0,f.useMemo)(()=>d===void 0?[]:(0,p.readMappableAesthetics)(d,ol).map(({aesthetic:u,variables:h,isRequired:m})=>{const x=(0,p.readMappedVariable)(d.mapping,u);return{aesthetic:u,label:o(il[u]),value:x??(m?null:ye),options:ll(h,x,m?null:l),chooseColumn:g=>{r.commands.dispatch(new p.SetMappingCommand({aesthetic:u,variable:g===ye?null:g}))}}}),[d,o,l,r]);return a?(0,n.jsx)(R,{title:e??o("editor.graphPanel.mappingSection.title"),layout:t,children:(0,n.jsx)(D,{children:c.map(({aesthetic:u,label:h,value:m,options:x,chooseColumn:g})=>(0,n.jsx)(b,{label:h,children:(0,n.jsx)(i,{value:m,options:x,placeholder:l,onChange:g})},u))})}):null},ll=(e,t,r)=>{const a=t!==null&&!e.includes(t)?[t,...e]:e;return[...r===null?[]:[{value:ye,label:r}],...a.map(o=>({value:o,label:o}))]},cl="k",dl=2,ul=0,hl=5,je=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],pl=["auto","none"],ml=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{NumberField:l,ToggleGroup:d}=k();if(!o)return null;const{abbreviation:c,decimals:u}=o.config.numberFormat,h=gl(c)!==void 0,m=u!=="auto",x=T=>T.map(S=>({value:S,label:i(`editor.graphPanel.numberFormat.options.${S}`)})),g=je.map(({value:T,labelKey:S})=>({value:T,label:i(`common.abbreviations.${S}`)})),v=T=>{a.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:T}))},C=T=>{const S=pl.find(P=>P===T);v(S??cl)},A=T=>{const S=je.find(P=>P.value===T);S&&v(S.value)},I=T=>{a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:T==="custom"?dl:"auto"}))},y=T=>{T!==null&&a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:T}),{transient:!0})};return(0,n.jsx)(R,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(d,{value:h?"custom":c,options:x(["auto","none","custom"]),onChange:C})}),h&&(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:c,options:g,onChange:A})}),(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(d,{value:m?"custom":"auto",options:x(["auto","custom"]),onChange:I})}),m&&(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(l,{value:u,min:ul,max:hl,onChange:y,onCommit:a.commands.seal})})]})})},gl=e=>je.find(t=>t.value===e),xl=({title:e,layout:t="collapsible",preview:r})=>{const a=s.useHandleCompiled(E()),o=s.useI18n();if(!a)return null;const i=vl(a.spec.layers);return i?(0,n.jsx)(R,{title:e??o("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsx)(D,{children:(0,n.jsx)(b,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(It,{layerId:i.id})})})}):null},vl=e=>{const t=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(r=>!(0,p.isCompanionLayer)(r,t))},fl=.9,Cl=360,Sl=.05,bl=15,yl=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l}=k();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:c}=o.spec.coords.params,u=m=>{a.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},h=m=>{a.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(R,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(l,{value:d,min:0,max:fl,step:Sl,formatValue:jt,onChange:u,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(l,{value:c,min:0,max:Cl-1,step:bl,formatValue:$i,onChange:h,onCommit:a.commands.seal})})]})})},jl=e=>(0,n.jsxs)(s.Icon,{...e,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.4796 12.2222L17.6085 12.2291L17.6029 10.7291L19.474 10.7222L19.4796 12.2222ZM15.3662 12.2375L13.124 12.2459L13.1184 10.7459L15.3606 10.7375L15.3662 12.2375ZM10.8817 12.2542L8.63945 12.2626L8.63386 10.7626L10.8761 10.7542L10.8817 12.2542ZM6.39719 12.2709L4.52607 12.2779L4.52048 10.7779L6.3916 10.7709L6.39719 12.2709Z",fill:"currentColor"})]}),gn=e=>(0,n.jsxs)(s.Icon,{...e,children:[(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",opacity:"0.12",d:"M2 10C2 7.19974 2 5.79961 2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497C5.79961 2 7.19974 2 10 2H14C16.8003 2 18.2004 2 19.27 2.54497C20.2108 3.02433 20.9757 3.78924 21.455 4.73005C22 5.79961 22 7.19974 22 10V14C22 16.8003 22 18.2004 21.455 19.27C20.9757 20.2108 20.2108 20.9757 19.27 21.455C18.2004 22 16.8003 22 14 22H10C7.19974 22 5.79961 22 4.73005 21.455C3.78924 20.9757 3.02433 20.2108 2.54497 19.27C2 18.2004 2 16.8003 2 14V10Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.96644 1.25C8.59472 1.25 7.51929 1.24999 6.65494 1.32061C5.77479 1.39252 5.04768 1.54138 4.38955 1.87671C3.30762 2.42798 2.42798 3.30762 1.87671 4.38955C1.54138 5.04768 1.39252 5.77479 1.32061 6.65494C1.24999 7.51929 1.25 8.59472 1.25 9.96644V14.0336C1.25 15.4053 1.24999 16.4807 1.32061 17.3451C1.39252 18.2252 1.54138 18.9523 1.87671 19.6104C2.42798 20.6924 3.30762 21.572 4.38955 22.1233C5.04768 22.4586 5.77479 22.6075 6.65494 22.6794C7.51927 22.75 8.59469 22.75 9.96637 22.75H14.0336C15.4053 22.75 16.4807 22.75 17.3451 22.6794C18.2252 22.6075 18.9523 22.4586 19.6104 22.1233C20.6924 21.572 21.572 20.6924 22.1233 19.6104C22.4586 18.9523 22.6075 18.2252 22.6794 17.3451C22.75 16.4807 22.75 15.4053 22.75 14.0336V9.96642C22.75 8.59473 22.75 7.51927 22.6794 6.65494C22.6075 5.77479 22.4586 5.04768 22.1233 4.38955C21.572 3.30762 20.6924 2.42798 19.6104 1.87671C18.9523 1.54138 18.2252 1.39252 17.3451 1.32061C16.4807 1.24999 15.4053 1.25 14.0336 1.25H9.96644ZM5.07054 3.21322C5.48197 3.00359 5.9897 2.87996 6.77708 2.81563C7.57322 2.75058 8.58749 2.75 10 2.75H14C15.4125 2.75 16.4268 2.75058 17.2229 2.81563C18.0103 2.87996 18.518 3.00359 18.9295 3.21322C19.7291 3.62068 20.3793 4.27085 20.7868 5.07054C20.9964 5.48197 21.12 5.9897 21.1844 6.77708C21.2494 7.57322 21.25 8.58749 21.25 10V14C21.25 15.4125 21.2494 16.4268 21.1844 17.2229C21.12 18.0103 20.9964 18.518 20.7868 18.9295C20.3793 19.7291 19.7291 20.3793 18.9295 20.7868C18.518 20.9964 18.0103 21.12 17.2229 21.1844C16.4268 21.2494 15.4125 21.25 14 21.25H10C8.58749 21.25 7.57322 21.2494 6.77708 21.1844C5.9897 21.12 5.48197 20.9964 5.07054 20.7868C4.27085 20.3793 3.62068 19.7291 3.21322 18.9295C3.00359 18.518 2.87996 18.0103 2.81563 17.2229C2.75058 16.4268 2.75 15.4125 2.75 14V10C2.75 8.58749 2.75058 7.57322 2.81563 6.77708C2.87996 5.9897 3.00359 5.48197 3.21322 5.07054C3.62068 4.27085 4.27085 3.62068 5.07054 3.21322Z",fill:"currentColor"}),(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.6749 8.04877L17.1069 9.06975L16.2884 7.81273L17.8564 6.79175L18.6749 8.04877ZM15.2278 10.2932L13.3488 11.5167L12.5303 10.2597L14.4093 9.03622L15.2278 10.2932ZM11.4697 12.7402L9.59064 13.9637L8.77217 12.7067L10.6512 11.4832L11.4697 12.7402ZM7.71158 15.1872L6.14354 16.2082L5.32507 14.9511L6.89311 13.9302L7.71158 15.1872Z",fill:"currentColor"})]}),wl=e=>(0,f.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:r}=e.config,a=e.guides.colorGroups.map(o=>{const i=(0,p.createValueFormatter)({valueFormat:o.valueFormat,locale:t,numberFormat:r}),l=o.value instanceof Date?o.value.getTime():o.value;return{value:l,option:{value:String(l),label:o.label??i(o.value)}}});return{options:a.map(({option:o})=>o),findValue:o=>a.find(i=>i.option.value===o)?.value}},[e]),xn=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],Il="linear",Tl=({title:e,layout:t="collapsible",preview:r})=>{const a=E(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Switch:d}=k(),{options:c,findValue:u}=wl(o);if(!o||o.coordSystem.type==="polar")return null;const h=(0,p.findTrendLineLayer)(o.spec.layers),m=(0,p.findAverageLineLayer)(o.spec.layers),x=h?.stat.type==="smooth"?h.stat.method:Il,g=Al(m),v=xn.map(S=>({value:S,label:i(`editor.annotationsPanel.trendType.options.${S}`)})),C=(S,P={})=>{const N=h??m,_=new p.SetStatLineCommand({line:S,...P,...N!==void 0&&{layerId:N.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(_)},A=S=>C(S?"trend":"none",{method:x}),I=S=>C(S?"average":"none",{group:g??u(c[0]?.value??"")}),y=S=>{const P=xn.find(N=>N===S);P!==void 0&&C("trend",{method:P})},T=S=>{const P=S===null?void 0:u(S);P!==void 0&&C("average",{group:P})};return(0,n.jsx)(R,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(gn,{size:"lg"}),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(gn,{size:"lg"}),children:(0,n.jsx)(d,{isChecked:h!==void 0,onChange:A})}),h!==void 0&&(0,n.jsx)(b,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(l,{value:x,options:v,onChange:y,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(b,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(jl,{size:"lg"}),children:(0,n.jsx)(d,{isChecked:m!==void 0,onChange:I})}),m!==void 0&&c.length>0&&(0,n.jsx)(b,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(l,{value:g===void 0?null:String(g),options:c,onChange:T,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},Al=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=Ji;exports.AxesPanel=Zi;exports.AxisSection=Ce;exports.BarSection=es;exports.Button=Qn;exports.CalloutsSection=hs;exports.CaptionSection=ft;exports.EditableGraphRenderer=Uo;exports.EditorPanel=_e;exports.ElementsPanel=qi;exports.GoalSection=xs;exports.GraphOptionsSection=fs;exports.GraphTypeSection=Ns;exports.GridSection=Fs;exports.HeadlineSection=Ws;exports.IntlProvider=s.IntlProvider;exports.LegendSection=qs;exports.LineSection=nl;exports.MappingSection=sl;exports.NumberField=tt;exports.NumberFormatSection=ml;exports.PANEL_ROOT_ATTRIBUTE=gt;exports.PointSection=xl;exports.PolarSection=yl;exports.RadioGrid=rt;exports.Row=b;exports.Section=R;exports.Select=at;exports.Slider=ot;exports.SourceSection=Ct;exports.SubtitleSection=St;exports.Switch=it;exports.TextField=st;exports.TextSizeSection=bt;exports.TitleSection=yt;exports.ToggleGroup=lt;exports.ToggledSection=vt;exports.TrendsAndAveragesSection=Tl;exports.useControls=k;exports.usePanelExpansion=mt;exports.usePanelGraph=E;