@graphysdk/react-renderer 1.8.1-beta.1786707936521 → 1.8.1-beta.1786951728553
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 +1 -1
- package/dist/editable.css +1 -1
- package/dist/editable.d.ts +72 -0
- package/dist/editable.mjs +2057 -1609
- package/dist/graph-config.cjs +1 -1
- package/dist/graph-config.d.ts +0 -1
- package/dist/graph-config.mjs +1 -1
- package/dist/{history-chords-CmDNkDXT.js → history-chords-BSDaizeR.js} +2200 -2094
- package/dist/history-chords-CL65ERxg.cjs +1 -0
- package/dist/history-chords.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +101 -101
- package/dist/{typography-Bd5awt67.cjs → typography-CsG_IWDd.cjs} +2 -2
- package/dist/{typography-CiDZDGza.js → typography-DUFp65Tx.js} +0 -1
- package/package.json +2 -2
- package/dist/history-chords-RtuhuAiT.cjs +0 -1
package/dist/editable.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-RtuhuAiT.cjs"),ut=require("./typography-Bd5awt67.cjs");let h=require("@graphysdk/viz-engine"),C=require("react"),n=require("react/jsx-runtime"),me=require("zustand/react/shallow"),ht=require("react-dom"),G=require("clsx");G=l.__toESM(G,1);let Ze=require("@vanilla-extract/dynamic"),k=require("@base-ui/react/menu"),z=require("@base-ui/react"),X=require("@base-ui/react/accordion"),ye=require("@base-ui/react/number-field"),$e=require("@base-ui/react/radio"),Xe=require("@base-ui/react/radio-group"),F=require("@base-ui/react/select"),Z=require("@base-ui/react/slider"),Ie=require("@base-ui/react/switch"),mt=require("@base-ui/react/input");var pt="data-graphy-chart-chrome",gt="data-graphy-chart-menu",Ye={[gt]:""},ee=e=>({[pt]:e}),Je=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,vt=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,Qe=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,en=(e,t,r)=>r!==null&&(0,h.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),Y=(e,t,r)=>e instanceof Node&&(t.contains(e)||Je(e,r)),xt="cml7ha0",nn=(0,C.createContext)(null),Ct=({children:e})=>{const{chartId:t}=l.useGraphContext(),[r]=(0,C.useState)(l.resolvePortalContainer),[a,o]=(0,C.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,ht.createPortal)((0,n.jsx)("div",{ref:o,className:xt,...ee(t)}),r),(0,n.jsx)(nn.Provider,{value:a,children:e})]})},pe=()=>(0,C.useContext)(nn),tn=e=>(0,n.jsxs)(l.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 rn="efjmb40",an="efjmb41",q="efjmb42",U="efjmb43",ft="efjmb44",bt="efjmb45",St=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),ge=({label:e,icon:t,onOpened:r,children:a})=>{const o=pe(),[i,s]=(0,C.useState)(!1),d=(c,m)=>{c?(s(!0),r?.()):St.has(m.reason)&&s(!1)};return(0,n.jsxs)(z.Menu.SubmenuRoot,{open:i,onOpenChange:d,children:[(0,n.jsx)(jt,{label:e,icon:t}),(0,n.jsx)(z.Menu.Portal,{container:o,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(z.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:rn,...Ye,children:(0,n.jsx)(z.Menu.Popup,{className:an,children:a})})})})]})},jt=({label:e,icon:t})=>(0,n.jsxs)(z.Menu.SubmenuTrigger,{className:q,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:U,children:e}),(0,n.jsx)("span",{className:bt,children:(0,n.jsx)(l.ChevronDownIcon,{size:"sm"})})]}),yt="_1qe7q450",It="_1qe7q451",Tt="_1qe7q452",wt=({label:e,placeholder:t,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,C.useRef)(null),[s,d]=(0,C.useState)(""),{dispatch:c}=l.useGraphCommands(),m=s.trim(),u=()=>{m.length!==0&&(c(new h.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:Pt(m)}})),o())},p=v=>{v.key==="Enter"&&(v.preventDefault(),u()),v.key!=="Escape"&&v.stopPropagation()},x=v=>{d(v.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)(ge,{label:e,icon:(0,n.jsx)(tn,{}),onOpened:g,children:(0,n.jsxs)("div",{className:yt,children:[(0,n.jsx)("input",{ref:i,className:It,value:s,placeholder:t,onChange:x,onKeyDown:p}),(0,n.jsx)("button",{type:"button",className:Tt,disabled:m.length===0,onClick:u,children:r})]})})},Pt=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),At=e=>(0,n.jsx)(l.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"})}),Lt="relative-difference",Mt=({label:e,layer:t,at:r,onRequestClose:a})=>{const{dispatch:o}=l.useGraphCommands(),i=l.useCompiledSelector(c=>c.coordSystem),s=(0,C.useMemo)(()=>(0,h.inferDifferenceArrowEndpoints)({layer:t,at:r,coordSystem:i}),[t,r,i]);if(s===null)return null;const d=()=>{o(new h.AddAnnotationCommand({kind:"differenceArrow",annotation:{...h.DIFFERENCE_ARROW_DEFAULTS,...s,label:Lt}})),a()};return(0,n.jsxs)(k.Menu.Item,{className:q,onClick:d,children:[(0,n.jsx)(At,{}),(0,n.jsx)("span",{className:U,children:e})]})};function _t(e,t){if(e.type==="polar"&&!Et(t))return[{scope:"series",labelKey:"pieSlice"}];const r=(0,h.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 Et=e=>{const t=(0,h.extractVariableName)(e.mapping.x);return t!==null&&t!==h.CONSTANT_VARIABLES.x},Ot=e=>(0,n.jsxs)(l.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"})]}),Nt=e=>(0,n.jsxs)(l.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"})]}),Rt=e=>(0,n.jsxs)(l.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"})]}),kt=e=>(0,n.jsxs)(l.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"})]}),Dt=e=>(0,n.jsxs)(l.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"})]}),Ht=e=>(0,n.jsxs)(l.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"})]}),Ft=e=>(0,n.jsxs)(l.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"})]}),Vt=e=>(0,n.jsxs)(l.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)"})]}),zt=e=>(0,n.jsxs)(l.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)"})]}),Gt={bar:Ot,barGroup:Nt,barStack:kt,barSeries:Rt,linePoint:Dt,lineSeries:Ht,scatterPoint:Vt,scatterSeries:zt,pieSlice:Ft},on=({labelKey:e})=>{const t=Gt[e];return(0,n.jsx)(t,{})},sn=e=>(0,n.jsxs)(l.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"})]}),Bt=({label:e,options:t,onSelect:r})=>{const a=l.useI18n();return(0,n.jsx)(ge,{label:e,icon:(0,n.jsx)(sn,{}),children:t.map(o=>(0,n.jsxs)(z.Menu.Item,{className:q,onClick:()=>r(o.scope),children:[(0,n.jsx)(on,{labelKey:o.labelKey}),(0,n.jsx)("span",{className:U,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},Kt=({label:e,layer:t,observation:r,highlights:a,onRequestClose:o})=>{const i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),d=l.useCompiledSelector(g=>g.coordSystem),c=(0,C.useMemo)(()=>(0,h.buildObservationPredicate)(t,r),[t,r]),m=(0,C.useMemo)(()=>_t(d,t),[d,t]),u=(0,C.useMemo)(()=>{const g=new Set(a.map(v=>v.scope));return m.filter(v=>!g.has(v.scope))},[m,a]),[p]=u;if(c===null||p===void 0)return null;const x=g=>{s(new h.AddHighlightCommand({predicate:c,scope:g,layerId:t.id})),o()};if(u.length===1){const g=m.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${p.labelKey}`)});return(0,n.jsxs)(z.Menu.Item,{className:q,onClick:()=>x(p.scope),children:[(0,n.jsx)(on,{labelKey:p.labelKey}),(0,n.jsx)("span",{className:U,children:g})]})}return(0,n.jsx)(Bt,{label:e,options:u,onSelect:x})},qt="_1aafi1g0",Ut="_1aafi1g1",ln=({children:e})=>(0,n.jsxs)("span",{className:qt,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:Ut})]}),Wt=({label:e,highlights:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=t.at(-1);if(o===void 0)return null;const i=()=>{a(new h.RemoveHighlightCommand({id:o.id})),r()};return(0,n.jsxs)(k.Menu.Item,{className:q,onClick:i,children:[(0,n.jsx)(ln,{children:(0,n.jsx)(sn,{})}),(0,n.jsx)("span",{className:U,children:e})]})},Zt=(e,t)=>{const r=l.useCompiledSelector(o=>o.spec.highlights),a=l.useCompiledSelector(o=>o.config.parsingLocale);return(0,C.useMemo)(()=>(0,h.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:a}),[e,r,t,a])},cn=e=>(0,n.jsxs)(l.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"})]}),$t=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=()=>{a(new h.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:t}})),r()};return(0,n.jsxs)(k.Menu.Item,{className:q,onClick:o,children:[(0,n.jsx)(cn,{}),(0,n.jsx)("span",{className:U,children:e})]})},dn=e=>(0,n.jsxs)(l.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"})]}),un={pinnedNumber:{icon:cn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:tn,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:dn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},Xt=e=>(0,h.isObservationAttachmentKind)(e.kind)&&un[e.kind]!==null,Yt=({attachment:e,onRequestClose:t})=>{const r=l.useI18n(),{dispatch:a}=l.useGraphCommands(),{icon:o,labelKey:i}=un[e.kind],s=()=>{a(new h.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(k.Menu.Item,{className:q,onClick:s,children:[(0,n.jsx)(ln,{children:(0,n.jsx)(o,{})}),(0,n.jsx)("span",{className:U,children:r(i)})]})},Jt="ceeojg0",Qt="ceeojg1",er="ceeojg2",nr=({label:e,at:t,onRequestClose:r})=>{const{dispatch:a}=l.useGraphCommands(),o=i=>{a(new h.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...t},sticker:i}})),r()};return(0,n.jsx)(ge,{label:e,icon:(0,n.jsx)(dn,{}),children:(0,n.jsx)("div",{className:Jt,children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>(0,n.jsx)(z.Menu.Item,{className:Qt,"aria-label":i,onClick:()=>o(i),children:(0,n.jsx)("img",{className:er,src:s.src,alt:i})},i))})})},tr=({interaction:e,panelOrigin:t})=>{const r=l.useEditorStore(),a=l.useEditorState(i=>i.menuTrigger);if(e.kind!=="menu"||a===null)return null;const o=()=>{r.getState().releaseInteraction("menu")};return(0,n.jsx)(rr,{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})},rr=({trigger:e,layer:t,at:r,observation:a,onClose:o})=>{const i=l.useI18n(),s=pe(),d=l.useCompiledSelector(S=>S.spec.annotations),c=l.useCompiledSelector(S=>S.config.parsingLocale),m=or(),{x:u,y:p,radius:x}=e,g=(0,C.useMemo)(()=>ar(u,p,x),[u,p,x]),v=(0,h.findObservationAttachment)(d,r,(0,C.useMemo)(()=>(0,h.createObservationAnchorParser)(t,c),[t,c])),f=v!==null&&Xt(v)?v:null,P=Zt(t,a),I=(S,w)=>{!S&&ir(w.reason)&&o()};return(0,n.jsx)(k.Menu.Root,{open:m,modal:!1,onOpenChange:I,children:(0,n.jsx)(k.Menu.Portal,{container:s,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(k.Menu.Positioner,{anchor:g,side:"right",align:"start",sideOffset:8,className:rn,...Ye,children:(0,n.jsxs)(k.Menu.Popup,{className:an,"data-testid":"observation-menu",children:[f!==null&&(0,n.jsx)(Yt,{attachment:f,onRequestClose:o}),(0,n.jsx)(Wt,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:P,onRequestClose:o}),(0,n.jsx)(k.Menu.Separator,{className:ft}),f===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($t,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:o}),(0,n.jsx)(wt,{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)(nr,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:o})]}),t.highlight!==null&&(0,n.jsx)(Kt,{label:i("graph.annotations.baseMenu.highlight"),layer:t,observation:a,highlights:P,onRequestClose:o}),(0,n.jsx)(Mt,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:t,at:r,onRequestClose:o})]})})})})})},ar=(e,t,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,t-r,r*2,r*2)}),or=()=>{const[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{t(!0)},[]),e},ir=e=>e==="outside-press"||e==="escape-key"||e==="item-press",hn=()=>{const e=l.useGraphSelection();return mn(e)},mn=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},sr=e=>(0,n.jsx)(l.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"})]})}),lr=e=>(0,n.jsx)(l.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"})]})}),cr={kind:"chrome-popup"},dr="var(--q7gcrz0)",ur="var(--q7gcrz1)",hr="q7gcrz2",mr="q7gcrz3";var pr="q7gcrz5",gr="q7gcrz6",vr="q7gcrz7",xr="q7gcrz8",pn="q7gcrz9",Cr="q7gcrza";var Te="q7gcrzd q7gcrzc",gn="q7gcrze q7gcrzc",fr=["absolute-difference","relative-difference","proportion"],we=["absolute-difference","relative-difference"],br=["relative-difference","proportion"],Sr={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},jr=e=>{const{formattingLocale:t}=l.useGraphContext(),r=l.useCompiledSelector(o=>o.config.parsingLocale),a=t??r;return(0,C.useMemo)(()=>{const o=(0,h.areEndpointsComparable)(e.start,e.end);return fr.filter(i=>o||!we.includes(i)||i===e.label).map(i=>({kind:i,nameKey:Sr[i],preview:(0,h.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!we.includes(i),isSuspect:br.includes(i)&&e.start.measurementValue===0}))},[e,a])},$=8,yr=({labelBox:e,panelRect:t,frameWidth:r,frameHeight:a})=>{const o=t.y+e.y,i=o+e.height,s=o-8-36,d=i+8,c=Ir($,s>=$?s:d,a-$-36),m=$;return{top:c,left:m,available:Math.max(0,r-$*2),centre:t.x+e.x+e.width/2-m}},Ir=(e,t,r)=>Math.max(e,Math.min(t,r)),ie=[{id:"small",nameKey:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",nameKey:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",nameKey:"graph.annotations.differenceArrowToolbar.size.large"}],Tr=({arrow:e,labelBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{chartId:d,commands:c}=l.useGraphContext(),m=l.useEditorStore(),[u,p]=(0,C.useState)(null),x=jr(e),g=yr({labelBox:t,panelRect:r,frameWidth:a,frameHeight:o}),v=(I,S)=>{c.dispatch(new h.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:I}),S)};(0,C.useEffect)(()=>()=>c.seal(),[c]),(0,C.useEffect)(()=>{const{claimInteraction:I,releaseInteraction:S}=m.getState();return u===null?S("chrome-popup"):I(cr),()=>S("chrome-popup")},[m,u]);const f=I=>{p(I?"color":null),I||c.seal()},P=()=>{c.dispatch(new h.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})};return(0,n.jsx)("div",{className:hr,style:{top:g.top,left:g.left,width:g.available},children:(0,n.jsxs)(l.FloatingToolbar.Root,{"aria-label":s("graph.annotations.differenceArrowToolbar.label"),className:mr,"data-testid":"difference-arrow-toolbar",...ee(d),style:(0,Ze.assignInlineVars)({[dr]:`${g.centre}px`,[ur]:`${g.available}px`}),children:[(0,n.jsx)(wr,{options:x,current:e.label,isOpen:u==="labelKind",onOpenChange:I=>p(I?"labelKind":null),onPick:I=>{v({label:I}),p(null)}}),(0,n.jsx)(l.FloatingToolbar.Separator,{}),(0,n.jsx)(l.FloatingToolbar.ColorPicker,{color:e.color,label:s("graph.annotations.differenceArrowToolbar.color"),onChange:I=>v({color:I},{transient:!0}),isOpen:u==="color",onOpenChange:f,popupAttributes:ee(d),children:(0,n.jsx)("span",{className:gr,style:{background:e.color??"transparent"}})}),(0,n.jsx)(Pr,{current:e.size,isOpen:u==="size",onOpenChange:I=>p(I?"size":null),onPick:I=>{v({size:I}),p(null)}}),(0,n.jsx)(l.FloatingToolbar.Separator,{}),(0,n.jsx)(l.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.swap"),className:Te,onClick:()=>v({start:e.end.anchor,end:e.start.anchor}),children:(0,n.jsx)(sr,{size:"sm",title:""})}),(0,n.jsx)(l.FloatingToolbar.Button,{"aria-label":s("graph.annotations.differenceArrowToolbar.remove"),className:Te,onClick:P,children:(0,n.jsx)(lr,{size:"sm",title:""})})]})})},wr=({options:e,current:t,isOpen:r,onOpenChange:a,onPick:o})=>{const i=l.useI18n(),s=e.find(c=>c.kind===t),d=e.some(c=>c.isPickable&&c.kind!==t);return(0,n.jsxs)(k.Menu.Root,{open:r,modal:!1,onOpenChange:a,children:[(0,n.jsxs)(k.Menu.Trigger,{render:(0,n.jsx)(l.FloatingToolbar.Button,{}),"aria-label":i("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),className:gn,disabled:!d,onMouseDown:c=>c.preventDefault(),children:[(0,n.jsx)("span",{className:pr,children:s===void 0?"":i(s.nameKey)}),s!==void 0&&(0,n.jsxs)("span",{className:"q7gcrz4",children:["(",s.preview,")"]}),(0,n.jsx)(l.ChevronDownIcon,{size:"sm"})]}),(0,n.jsx)(vn,{children:e.map(c=>(0,n.jsxs)(k.Menu.Item,{className:pn,"data-selected":c.kind===t,disabled:!c.isPickable,onClick:()=>o(c.kind),children:[(0,n.jsx)("span",{children:i(c.nameKey)}),(c.isSuspect||!c.isPickable)&&(0,n.jsx)("span",{"aria-label":i(c.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrzb",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:Cr,children:c.preview})]},c.kind))})]})},Pr=({current:e,isOpen:t,onOpenChange:r,onPick:a})=>{const o=l.useI18n(),i=ie.find(s=>s.id===e)??ie[0];return(0,n.jsxs)(k.Menu.Root,{open:t,modal:!1,onOpenChange:r,children:[(0,n.jsxs)(k.Menu.Trigger,{render:(0,n.jsx)(l.FloatingToolbar.Button,{}),"aria-label":o("graph.annotations.differenceArrowToolbar.size.ariaLabel"),className:gn,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{children:i===void 0?"":o(i.nameKey)}),(0,n.jsx)(l.ChevronDownIcon,{size:"sm"})]}),(0,n.jsx)(vn,{children:ie.map(s=>(0,n.jsx)(k.Menu.Item,{className:pn,"data-selected":s.id===e,onClick:()=>a(s.id),children:o(s.nameKey)},s.id))})]})},vn=({children:e})=>{const{chartId:t}=l.useGraphContext();return(0,n.jsx)(k.Menu.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(k.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:vr,children:(0,n.jsx)(k.Menu.Popup,{className:xr,onMouseDown:r=>r.preventDefault(),...ee(t),children:e})})})})};var Ar="ydgo3h0",Lr="ydgo3h1",Mr="ydgo3h2",xn=e=>e==="start"?"end":"start",Cn=({dispatch:e,arrow:t,endpoint:r,anchor:a})=>{(0,h.areAnchorsEqual)(a,t[r].anchor)||e(new h.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:a}}))},_r=({clientPoint:e,panelOrigin:t,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:s,fixedAnchor:d,align:c})=>{const m=Er({x:e.x-t.x,y:e.y-t.y},r),{primary:u}=a.query((0,h.toPanelCursor)(m,r));if(u===null)return null;const p=o.find(g=>g.id===u.layerId);if(p===void 0)return null;const x=(0,h.resolveObservationPoint)({resolver:s,layer:p,observation:u.observation,coordSystem:i,align:c});return x===null||(0,h.areAnchorsEqual)(x.anchor,d)?null:x},Er=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),Or=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.handleMove=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.hasMoved=!0,this.scheduledFrame===null&&(this.scheduledFrame=requestAnimationFrame(this.runFrame)))},this.handleUp=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,this.finish(!0))},this.handleLost=t=>{t.pointerId===this.params.pointerId&&this.finish(!1)},this.runFrame=()=>{this.scheduledFrame=null;const t=this.pendingEvent;if(this.pendingEvent=null,t===null)return;const{editorStore:r,engine:a,anchorResolver:o,endpoint:i,readInputs:s}=this.params,{arrow:d,panelOrigin:c,panelRect:m,layers:u,coordSystem:p}=s(),x=r.getState();if(this.hasPublished&&l.readDraggedEndpointFor(l.readStanding(x,"endpoint-drag"),d.id,i)===null)return;const g=_r({clientPoint:{x:t.clientX,y:t.clientY},panelOrigin:c,panelRect:m,engine:a,layers:u,coordSystem:p,resolver:o,fixedAnchor:d[xn(i)].anchor,align:d[i].anchor.align});g!==null&&this.publish(g)}}start(){const{handle:e}=this.params,{signal:t}=this.listeners;e.addEventListener("pointermove",this.handleMove,{signal:t}),e.addEventListener("pointerup",this.handleUp,{signal:t}),e.addEventListener("lostpointercapture",this.handleLost,{signal:t})}finish(e){this.params.onSettled(),this.listeners.abort(),this.cancelFrame(),e&&this.hasMoved&&this.runFrame(),this.pendingEvent=null;const{editorStore:t,endpoint:r,readInputs:a,dispatch:o}=this.params,{arrow:i}=a(),s=t.getState(),d=l.readDraggedEndpointFor(l.readStanding(s,"endpoint-drag"),i.id,r);d!==null&&(s.releaseInteraction("endpoint-drag"),e&&Cn({dispatch:o,arrow:i,endpoint:r,anchor:d.point.anchor}))}publish(e){const{editorStore:t,readInputs:r,endpoint:a}=this.params;t.getState().claimInteraction({kind:"endpoint-drag",annotationId:r().arrow.id,endpoint:a,point:e}),this.hasPublished=!0}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},Nr=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:a,anchorResolver:o}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),d=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...l.useCompiledSelector((0,me.useShallow)(m=>({layers:m.layers,coordSystem:m.coordSystem})))}),c=(0,C.useRef)(null);return(0,C.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,C.useCallback)(m=>({onPointerDown:u=>{if(u.button!==0||c.current!==null)return;try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault();const p=new Or({handle:u.currentTarget,pointerId:u.pointerId,endpoint:m,readInputs:()=>d.current,editorStore:s,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=p,p.start()}}),[d,s,i,o,a])},Rr=[" ","Enter"],kr=({arrow:e})=>{const{commands:t,anchorResolver:r}=l.useGraphContext(),a=l.useEditorStore(),{layers:o,coordSystem:i,mainAxis:s}=l.useCompiledSelector((0,me.useShallow)(c=>({layers:c.layers,coordSystem:c.coordSystem,mainAxis:c.coordSystem.type==="cartesian"?c.coordSystem.mainAxis:"x"}))),d=e.id;return(0,C.useEffect)(()=>()=>{const c=a.getState();l.readStanding(c,"endpoint-drag")?.annotationId===d&&c.releaseInteraction("endpoint-drag")},[a,d]),(0,C.useCallback)(c=>({onKeyDown:m=>{if(m.altKey||m.ctrlKey||m.metaKey||m.shiftKey)return;const u=a.getState(),p=l.readDraggedEndpointFor(l.readStanding(u,"endpoint-drag"),e.id,c);if(Rr.includes(m.key)){if(m.preventDefault(),m.repeat)return;if(p===null)return u.claimInteraction({kind:"endpoint-drag",annotationId:e.id,endpoint:c,point:e[c]});u.releaseInteraction("endpoint-drag"),Cn({dispatch:t.dispatch,arrow:e,endpoint:c,anchor:p.point.anchor});return}if(p===null)return;const x=Dr(m.key,s);if(x===null)return;m.preventDefault();const g=Hr({arrow:e,endpoint:c,from:p.point.anchor,move:x,layers:o,coordSystem:i,resolver:r});g!==null&&u.claimInteraction({kind:"endpoint-drag",annotationId:e.id,endpoint:c,point:g})}}),[e,a,t,r,o,i,s])},Dr=(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}},Hr=({arrow:e,endpoint:t,from:r,move:a,layers:o,coordSystem:i,resolver:s})=>{const d=o.find(m=>m.id===r.layerId);if(d===void 0)return null;const c=(0,h.stepDifferenceArrowEndpoint)({layer:d,from:r,partner:e[xn(t)].anchor,axis:a.axis,step:a.step,canLandOn:m=>(0,h.resolveObservationPoint)({resolver:s,layer:d,observation:m,coordSystem:i,align:e[t].anchor.align})!==null});return c===null?null:(0,h.resolveObservationPoint)({resolver:s,layer:d,observation:c.observation,coordSystem:i,align:e[t].anchor.align})},Fr=e=>{const t=hn();return t===null?null:(0,n.jsx)(Vr,{annotationId:t,...e})},Vr=({annotationId:e,...t})=>{const r=l.useDifferenceArrowGeometries(),a=(0,C.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,n.jsx)(zr,{committedArrow:a.committedArrow,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...t})},zr=({committedArrow:e,committedLabelBox:t,labelBox:r,start:a,end:o,panelRect:i,panelOrigin:s,frameRect:d,frameElement:c,isDragged:m})=>{const u=Nr({arrow:e,panelOrigin:s,panelRect:i}),p=kr({arrow:e});return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!m&&(0,n.jsx)(Tr,{arrow:e,labelBox:t,panelRect:i,frameWidth:d.width,frameHeight:d.height,frameElement:c}),(0,n.jsx)("div",{"aria-hidden":"true",className:Mr,"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)(Pe,{endpoint:"start",point:a,panelRect:i,dragHandlers:u("start"),keyboardHandlers:p("start")}),(0,n.jsx)(Pe,{endpoint:"end",point:o,panelRect:i,dragHandlers:u("end"),keyboardHandlers:p("end")})]})},Pe=({endpoint:e,point:t,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{className:Ar,"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:Lr})});var Gr={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},Br={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"};var Kr=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,qr=(e,t,r)=>({x:Ae(t.x-e.x,r.width),y:Ae(t.y-e.y,r.height)}),Ur=e=>e.x!==0||e.y!==0,fn=(e,t)=>({x:e.x*t.width,y:e.y*t.height}),Ae=(e,t)=>t>0?e/t:0,Wr=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),a=hn(),o=l.useEditorState(u=>l.readStanding(u,"move-drag")),i=l.useEditorState(u=>{const p=u.editTargetUnderPointer;return p?.kind==="annotation"?p.id:null}),s=(0,C.useMemo)(()=>({panelWidth:e.width,panelHeight:e.height,measuredBoxes:r}),[e.width,e.height,r]),d=Le(t,a,s),c=Le(t,i===a?null:i,s),m=u=>{if(o?.annotationId!==u)return e;const p=fn(o.translation,e);return{x:e.x+p.x,y:e.y+p.y}};return(0,n.jsxs)(n.Fragment,{children:[c!==null&&(0,n.jsx)(Me,{annotationId:c.id,geometry:c.geometry,state:"hovered",origin:m(c.id)}),d!==null&&(0,n.jsx)(Me,{annotationId:d.id,geometry:d.geometry,state:"selected",origin:m(d.id)})]})},Le=(e,t,r)=>{if(t===null)return null;const a=l.resolveAnnotationChromeGeometry(e,t,r);return a===null?null:{id:t,geometry:a}},Me=({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)(_e,{point:t.start,state:r,origin:a}),(0,n.jsx)(_e,{point:t.end,state:r,origin:a})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:Gr[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}}),_e=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:Br[t],style:{left:r.x+e.x,top:r.y+e.y}}),Zr="_1uwdwh60",$r=({panelRect:e})=>{const t=l.useEditorState(o=>l.readStanding(o,"move-drag")),r=l.useResolvedAnnotations(e);if(t===null)return null;const a=fn(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:Zr,width:e.width,height:e.height,style:{left:e.x+a.x,top:e.y+a.y},"data-testid":"annotation-ghost","data-annotation-id":t.annotationId,children:Jr(r,t.annotationId,e)})},Xr=({annotation:e})=>(0,n.jsx)(l.TextAnnotation,{annotation:e,blockRef:l.useMeasuredBoxRef(e.id)}),Q=(e,t,r)=>{const a=e.find(o=>o.id===t);return a===void 0?null:r(a)},Yr={text:(e,t)=>Q(e.textAnnotations,t,r=>(0,n.jsx)(Xr,{annotation:r})),shape:(e,t)=>Q(e.shapes,t,r=>(0,n.jsx)(l.ShapeAnnotation,{shape:r})),image:(e,t)=>Q(e.images,t,r=>(0,n.jsx)(l.ImageAnnotation,{image:r})),arrow:(e,t,r)=>Q(e.arrows,t,a=>{const o=(0,h.computeArrow)({arrow:a,panelWidth:r.width,panelHeight:r.height});return o===null?null:(0,n.jsx)(l.ArrowAnnotation,{computed:o,isAddressable:!1})})},Jr=(e,t,r)=>{for(const a of Object.values(Yr)){const o=a(e,t,r);if(o!==null)return o}return null},Qr=e=>(0,n.jsx)(l.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"})]})}),ea="var(--_1tyillx0)",na={rest:.5,hovered:.75,open:1};var ta="_1tyillx1",ra={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},aa="_1tyillx5",oa={closed:"_1tyillx6",open:"_1tyillx7"},ia=({interaction:e,panelRect:t})=>{const r=l.useEditorStore(),a=l.useCompiledSelector(d=>d.coordSystem),o=e.kind==="trigger"||e.kind==="menu"?e.anchor:null,i=sa(e),s=(0,C.useMemo)(()=>{if(o===null)return null;const d=(0,h.projectAnchorToPanel)(o.position,t,a);return{center:d,radius:19*na[i],target:{kind:"observation",cursor:(0,h.toPanelCursor)(d,t)}}},[o,t,a,i]);return(0,C.useEffect)(()=>{r.getState().setMenuTrigger(s)},[r,s]),(0,C.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),o===null||s===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,G.default)(ta,ra[i]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,Ze.assignInlineVars)({[ea]:o.color??ut.vars.border50})},children:(0,n.jsx)("span",{className:(0,G.default)(aa,oa[i==="open"?"open":"closed"]),children:(0,n.jsx)(Qr,{size:"lg"})})})},sa=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",la='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',ca=(e,t)=>{const{chartId:r}=l.useGraphContext(),a=l.useEditorStore();(0,C.useEffect)(()=>{if(t===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!Y(i.target,e,r)||a.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(la)];if(s.length===0)return;i.preventDefault();const d=s.findIndex(c=>c===document.activeElement);s[d===-1?i.shiftKey?s.length-1:0:(d+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,t,r,a])},da=e=>{const{selectionStore:t,chartId:r}=l.useGraphContext();(0,C.useEffect)(()=>{let a=null;const o=()=>{e.focus({preventScroll:!0})},i=d=>{const{selection:c,clearSelection:m}=t.getState();c.length!==0&&(Y(d.target,e,r)||m())},s=d=>{t.getState().selection.length!==0&&Y(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(Y(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",o),document.addEventListener("focusin",i),document.addEventListener("focusout",s),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",o),document.removeEventListener("focusin",i),document.removeEventListener("focusout",s)}},[e,t,r])},ua=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}]`,bn=(e,t,r)=>{if(typeof document.elementsFromPoint!="function")return null;const a=document.elementsFromPoint(e,t);return ha(a,r)},ha=(e,t)=>{for(const r of e){const a=r.closest(ua);if(!(a===null||!t.contains(a))&&!ma(a,r))return pa(a)}return null},ma=(e,t)=>e===t&&e.getAttribute("data-edit-kind")==="observation",pa=e=>{const t=e.getAttribute(l.EDIT_TARGET_KIND_ATTRIBUTE);if(t!=="annotation")return null;const r=e.getAttribute(l.EDIT_TARGET_ID_ATTRIBUTE);return r===null||r===""?null:{kind:t,id:r}},ga=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasPublished=!1,this.handleMove=t=>{t.pointerId===this.params.pointerId&&(this.pendingEvent=t,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:r,annotationId:a,press:o,readInputs:i}=this.params,s=r.getState(),d=l.readStanding(s,"move-drag");if(this.hasPublished&&l.readMovedAnnotationFor(d,a)===null)return;const c={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!Kr(o,c))return;const{annotations:m,panelRect:u}=i(),p=(0,h.findAnnotation)(m,a);if(p===null)return;const x=(0,h.clampAnnotationTranslation)(p,qr(o,c,u));x!==null&&(s.claimInteraction({kind:"move-drag",annotationId:a,translation:x}),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.runFrame()}finally{this.settle(e)}}settle(e){this.pendingEvent=null;const{editorStore:t,annotationId:r}=this.params,a=t.getState(),o=l.readMovedAnnotationFor(l.readStanding(a,"move-drag"),r);o!==null&&a.releaseInteraction("move-drag"),!(!e||o===null)&&this.commit(o.translation)}commit(e){const{annotationId:t,dispatch:r}=this.params;Ur(e)&&r(new h.MoveAnnotationCommand({id:t,translation:e}))}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},va=(e,t,r)=>{const{commands:a,selectionStore:o}=l.useGraphContext(),i=l.useEditorStore(),s=l.useLatestRef({annotations:l.useCompiledSelector(m=>m.spec.annotations),panelRect:r}),d=l.useLatestRef(t),c=(0,C.useRef)(null);(0,C.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,C.useEffect)(()=>{const m=x=>{const{editTargetUnderPointer:g,standingInteraction:v}=i.getState();return g!==null&&v===null&&x.pointerType==="mouse"&&xa(x.target,e)?g:bn(x.clientX,x.clientY,e)},u=(x,g)=>{if(c.current!==null||!l.canMoveAnnotationOnCanvas(s.current.annotations,g.id))return;try{e.setPointerCapture(x.pointerId)}catch{return}x.preventDefault();const v=new ga({handle:e,pointerId:x.pointerId,annotationId:g.id,press:{x:x.clientX,y:x.clientY},readInputs:()=>s.current,editorStore:i,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=v,v.start()},p=x=>{if(x.button!==0||Qe(x.target)||en(x,d.current,i.getState().menuTrigger))return;const g=m(x),v=o.getState();if(g===null){v.clearSelection();return}v.setSelection([g]),u(x,g)};return document.addEventListener("pointerdown",p),()=>document.removeEventListener("pointerdown",p)},[e,i,o,a,s,d])},xa=(e,t)=>e instanceof Node&&t.contains(e),Ca=e=>{const{selectionStore:t,commands:r,chartId:a}=l.useGraphContext(),o=l.useEditorStore(),i=(0,C.useCallback)(d=>{const{selection:c}=t.getState(),m=mn(c);m!==null&&(d.preventDefault(),r.dispatch(new h.RemoveAnnotationCommand({id:m})),e.focus({preventScroll:!0}))},[e,r,t]),s=(0,C.useCallback)(d=>{const c=o.getState();switch(c.standingInteraction?.kind){case"endpoint-drag":c.releaseInteraction("endpoint-drag");return;case"move-drag":c.releaseInteraction("move-drag");return;case"chrome-popup":return;case"menu":c.releaseInteraction("menu");return;default:if(Je(d.target,a)){e.focus({preventScroll:!0});return}t.getState().clearSelection();return}},[o,t,e,a]);(0,C.useEffect)(()=>{const d=c=>{if(Y(c.target,e,a)&&!fa(c.target)&&!vt(c.target))switch(c.key){case"Escape":return s(c);case"Delete":case"Backspace":return i(c);default:return}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,i,s,a])},fa=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),ba=()=>{const e=l.useHoverState(o=>o.hover.primary),{layers:t,coordSystem:r}=l.useCompiledSelector((0,me.useShallow)(o=>({layers:o.layers,coordSystem:o.coordSystem}))),{anchorResolver:a}=l.useGraphContext();return(0,C.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 s=(0,h.buildObservationAnchor)(o,e.observation);return s===null?null:{position:i,color:(0,h.getColor)(e.observation),layer:o,at:s,observation:e.observation}},[e,t,r,a])},Sa={kind:"idle"},Sn=()=>{const e=l.useEditorState(a=>a.standingInteraction),t=l.useEditorState(a=>a.chromeUnderPointer),r=ba();return(0,C.useMemo)(()=>e!==null?e:r===null?Sa:{kind:"trigger",anchor:r,isEngaged:t==="menu-trigger"},[e,r,t])},ja=(e,t,r)=>{const a=l.useEditorStore(),{selectionStore:o}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),d=l.useLatestRef(e),c=l.useLatestRef(t),m=l.useLatestRef(r);(0,C.useEffect)(()=>{const u=f=>en(f,c.current,a.getState().menuTrigger),p=f=>{if(u(f)||o.getState().selection.length>0)return;const P=m.current,I=c.current,S={x:f.clientX-I.x,y:f.clientY-I.y},w=ya(S,P)?s.query((0,h.toPanelCursor)(S,P)):h.RESTING_HOVER_STATE;i.getState().setHoverState(w)};let x=!1;const g=()=>{x=d.current.kind==="menu"},v=f=>{if(Qe(f.target))return;const{claimInteraction:P,releaseInteraction:I}=a.getState();if(!u(f)||x){I("menu"),x&&p(f);return}const S=d.current;S.kind==="trigger"&&P({kind:"menu",anchor:S.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",v),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",v)}},[a,o,d,i,s,c,m])},ya=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,Ia=(e,t)=>{const r=l.useEditorStore(),a=l.useLatestRef(t);(0,C.useEffect)(()=>{let o=null,i=null;const s=g=>{const{menuTrigger:v}=r.getState();return v===null?null:(0,h.isPointWithinEditMenuTrigger)(g,v)?"menu-trigger":null},d=()=>{o=null;const g=i;if(g===null)return;const v=a.current,f=r.getState();if(f.setChromeUnderPointer(s({x:g.x-v.x,y:g.y-v.y})),se(f.standingInteraction))return;const P=bn(g.x,g.y,e);f.setEditTargetUnderPointer(P)},c=()=>{o===null&&(o=requestAnimationFrame(d))},m=()=>{const g=r.getState();g.setChromeUnderPointer(null),g.setEditTargetUnderPointer(null)},u=g=>{i={x:g.clientX,y:g.clientY},c()},p=()=>{i=null,o!==null&&(cancelAnimationFrame(o),o=null),m()},x=r.subscribe((g,v)=>{!se(v.standingInteraction)||se(g.standingInteraction)||i!==null&&c()});return e.addEventListener("pointermove",u),e.addEventListener("pointerleave",p),()=>{o!==null&&cancelAnimationFrame(o),x(),e.removeEventListener("pointermove",u),e.removeEventListener("pointerleave",p),m()}},[e,r,a])},se=e=>e?.kind==="menu"||e?.kind==="move-drag",Ee="editor",Oe=[],Ta=(e,t,r,a)=>{const o=Sn(),{store:i}=l.useHoverContext(),s=l.useGraphSelection().length>0,d=l.useEditorState(u=>u.menuTrigger),c=o.kind==="menu",m=(0,C.useMemo)(()=>d===null?Oe:[(0,h.buildEditMenuTriggerRegion)(d)],[d]);Ia(e,t),va(e,t,r),ja(o,t,r),da(e),Ca(e),ca(e,a),(0,C.useEffect)(()=>(i.getState().publishPointerRegions(Ee,m),()=>i.getState().publishPointerRegions(Ee,Oe)),[i,m]),(0,C.useEffect)(()=>(i.getState().setPointerSuspended(c||s),()=>i.getState().setPointerSuspended(!1)),[i,c,s]),(0,C.useEffect)(()=>{if(!s)return;const u=i.getState();u.setHoverState(h.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[i,s])},wa=({frameElement:e,panelRect:t})=>{const{measureRef:r,screenRect:a}=l.useElementScreenRect(),o=l.useEditorStore();return(0,C.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,C.useEffect)(()=>()=>o.getState().releaseInteraction("menu"),[o]),a===null?null:(0,n.jsx)(Ct,{children:(0,n.jsx)(Pa,{frameElement:e,frameRect:a,panelRect:t})})},Pa=({frameElement:e,frameRect:t,panelRect:r})=>{const a=(0,C.useMemo)(()=>({x:t.left+r.x,y:t.top+r.y}),[t.left,t.top,r.x,r.y]),[o,i]=(0,C.useState)(null);return Ta(e,a,r,o),(0,n.jsx)(Aa,{frameElement:e,frameRect:t,panelOrigin:a,panelRect:r,boxRef:i})},Aa=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:a,boxRef:o})=>{const i=pe(),s=Sn();return(0,n.jsx)(l.OverlayPortal,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:i,"data-testid":"editor-overlay",boxRef:o,children:(0,n.jsxs)(l.PortalThemeProvider,{children:[(0,n.jsx)(Fr,{panelRect:a,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)($r,{panelRect:a}),(0,n.jsx)(Wr,{panelRect:a}),(0,n.jsx)(ia,{interaction:s,panelRect:a}),(0,n.jsx)(tr,{interaction:s,panelOrigin:r})]})})},La=({slots:e,...t})=>(0,n.jsx)(l.EditorProvider,{children:(0,n.jsx)(l.GraphRenderer,{slots:(0,C.useMemo)(()=>({EditorSurface:wa,...e}),[e]),...t})}),jn=(0,C.createContext)(null),yn=({labelId:e,controlId:t,children:r})=>{const a=(0,C.useMemo)(()=>{let o=null;return{labelId:e,controlId:t,claimControlId:i=>(o??=i,o===i)}},[e,t]);return(0,n.jsx)(jn.Provider,{value:a,children:r})},B=({id:e,ariaLabel:t,ariaLabelledBy:r},a=!0)=>{const o=(0,C.useContext)(jn),i=(0,C.useId)(),[s]=(0,C.useState)(()=>a?o?.claimControlId(i)??!1:!1),d=e??(s?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 Ma={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},In=({label:e,icon:t,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:s,id:d})=>{const c=B({id:d,ariaLabel:i,ariaLabelledBy:s}),m=a==="tile";return(0,n.jsxs)("button",{type:"button",className:Ma[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:m?"woi4bh2":"woi4bh1",children:e})]})},ve=(0,C.createContext)(null),L=()=>{const e=(0,C.useContext)(ve);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},Tn=({children:e,onKeyDown:t,...r})=>{const a=(0,C.useContext)(ve),o=i=>{if(t?.(i),!a||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?a.undo():a.redo())};return(0,n.jsx)("div",{onKeyDown:o,...r,children:e})},wn="keyboard",te=e=>{const t=(0,C.useRef)(!1),r=(0,C.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()}}}},_a="eh8dvc0",Ea="eh8dvc1 uz3g760",Oa="eh8dvc2 uz3g761";var Pn=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,placeholder:s,prefix:d,suffix:c,isDisabled:m,hasError:u,ariaLabel:p,ariaLabelledBy:x,id:g})=>{const v=B({id:g,ariaLabel:p,ariaLabelledBy:x}),{commitUnlessHeldKey:f,gestureHandlers:P}=te(r);return(0,n.jsx)(ye.NumberField.Root,{className:_a,value:e,onValueChange:I=>t(I),onValueCommitted:(I,S)=>{f(S.reason===wn)},min:a,max:o,step:i,disabled:m,children:(0,n.jsxs)(Tn,{className:Ea,"data-error":u===!0,"data-disabled":m===!0?"":void 0,children:[d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d}),(0,n.jsx)(ye.NumberField.Input,{className:Oa,placeholder:s,...P,"aria-invalid":u===!0?!0:void 0,...v}),c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c})]})})},Na="_1b7s5f0",W={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Ra="_1b7s5f7";var ka=6,An=({options:e,value:t,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:s,ariaLabel:d,ariaLabelledBy:c,id:m})=>{const u=B({id:m,ariaLabel:d,ariaLabelledBy:c}),p=i==="swatch",{commitAfterChange:x,gestureHandlers:g}=te(a);return(0,n.jsx)(Xe.RadioGroup,{className:(0,G.default)(Na,Da(o??e.length)),value:t,onValueChange:v=>{r(v),x()},...g,disabled:s,...u,children:e.map(v=>(0,n.jsxs)($e.Radio.Root,{value:v.value,disabled:v.isDisabled,className:(0,G.default)(Ra,p&&"_1b7s5f8"),"aria-label":p?v.label:void 0,children:[v.icon,!p&&(0,n.jsx)("span",{className:"_1b7s5f9",children:v.label})]},v.value))})},Da=e=>{switch(Math.min(Math.max(Math.round(e),1),ka)){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]}},Ha="_1g5x15w0 uz3g760",Fa="_1g5x15w1",Va="_1g5x15w2",Ne="_1g5x15w3",za="_1g5x15w4",Ga="_1g5x15w5",Ba="_1g5x15w6",Ka="_1g5x15w7";var Ln=({options:e,value:t,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:d,id:c})=>{const m=B({id:c,ariaLabel:s,ariaLabelledBy:d});return(0,n.jsxs)(F.Select.Root,{value:t,onValueChange:u=>u!==null&&r(u),disabled:o,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,n.jsxs)(F.Select.Trigger,{className:Ha,"data-error":i===!0,...m,children:[(0,n.jsx)(F.Select.Value,{className:Fa,children:u=>qa(e,u,a)}),(0,n.jsx)(F.Select.Icon,{className:Ne,children:(0,n.jsx)(l.ChevronDownIcon,{size:"sm"})})]}),(0,n.jsx)(F.Select.Portal,{container:l.resolvePortalContainer(),children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(F.Select.Positioner,{className:za,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(F.Select.Popup,{className:Ga,children:e.map(u=>(0,n.jsxs)(F.Select.Item,{value:u.value,disabled:u.isDisabled,className:Ba,children:[u.icon,(0,n.jsxs)("span",{className:Ka,children:[(0,n.jsx)(F.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,n.jsx)(F.Select.ItemIndicator,{className:Ne,children:(0,n.jsx)(l.CheckIcon,{size:"sm"})})]},u.value))})})})})]})},qa=(e,t,r)=>t===null?(0,n.jsx)("span",{className:Va,children:r}):Ua(e,t),Ua=(e,t)=>e.find(r=>r.value===t)?.label??t,Wa="vod76w0",Za="vod76w1",$a="vod76w2",Xa="vod76w3",Ya="vod76w4",Ja="vod76w5";var Mn=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,suffix:s,formatValue:d,isDisabled:c,ariaLabel:m,ariaLabelledBy:u})=>{const p=B({ariaLabel:m,ariaLabelledBy:u},!1),x=Qa(e,s,d),{commitUnlessHeldKey:g,gestureHandlers:v}=te(r);return(0,n.jsxs)("div",{className:Wa,children:[(0,n.jsx)(Z.Slider.Root,{className:Za,value:e,onValueChange:f=>t(f),onValueCommitted:(f,P)=>{g(P.reason===wn)},min:a,max:o,step:i,disabled:c,children:(0,n.jsx)(Z.Slider.Control,{className:$a,children:(0,n.jsxs)(Z.Slider.Track,{className:Xa,children:[(0,n.jsx)(Z.Slider.Indicator,{className:Ya}),(0,n.jsx)(Z.Slider.Thumb,{className:Ja,...v,...p})]})})}),x!==null&&(0,n.jsx)("span",{className:"vod76w6",children:x})]})},Qa=(e,t,r)=>r!==void 0?r(e):t!==void 0?`${e}${t}`:null,eo="_1hyrlw60",no="_1hyrlw61",_n=({isChecked:e,onChange:t,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const s=B({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,n.jsx)(Ie.Switch.Root,{checked:e,onCheckedChange:d=>t(d),disabled:r,className:eo,...s,children:(0,n.jsx)(Ie.Switch.Thumb,{className:no})})},to="uz3g761",ro="tpcnun0 uz3g760",En=({value:e,onChange:t,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:d,id:c})=>{const m=B({id:c,ariaLabel:s,ariaLabelledBy:d});return(0,n.jsx)(Tn,{className:ro,"data-error":i===!0,children:(0,n.jsx)(mt.Input,{className:to,value:e,onValueChange:u=>t(u),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...m})})},ao="cnu9yl0",oo="cnu9yl1";var On=({options:e,value:t,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:s,ariaLabelledBy:d,id:c})=>{const m=B({id:c,ariaLabel:s,ariaLabelledBy:d}),u=o==="stacked",{commitAfterChange:p,gestureHandlers:x}=te(a);return(0,n.jsx)(Xe.RadioGroup,{className:ao,value:t,onValueChange:g=>{r(g),p()},...x,disabled:i,...m,children:e.map(g=>(0,n.jsxs)($e.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,G.default)(oo,u&&"cnu9yl2"),"aria-label":io(g,u),children:[g.icon,Nn(g,u)&&(0,n.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Nn=(e,t)=>e.icon===void 0||t,io=(e,t)=>{if(!Nn(e,t))return e.label},Rn={ToggleGroup:On,Switch:_n,Slider:Mn,RadioGrid:An,Button:In,TextField:En,NumberField:Pn,Select:Ln},kn=(0,C.createContext)(Rn),so=({controls:e,children:t})=>{const r=(0,C.useMemo)(()=>({...Rn,...e}),[e]);return(0,n.jsx)(kn.Provider,{value:r,children:t})},M=()=>(0,C.useContext)(kn),lo="_12lhx9e0",Dn=({children:e})=>(0,n.jsx)("div",{className:lo,children:e}),co="_139ohwv0",D=({children:e})=>(0,n.jsx)("div",{className:co,children:e}),Hn=(0,C.createContext)(null),uo=Hn.Provider,Fn=()=>{const e=(0,C.useContext)(Hn);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},ho="_1jlczkt0",Vn="data-graphy-editor-panel",mo={List:D,Grid:Dn};function po(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var go=({handle:e,children:t,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:d}=l.useThemeContext(),[c,m]=(0,C.useState)(()=>a?[a]:[]),u=(0,C.useMemo)(()=>({expandSection:p=>m([p]),collapseAllSections:()=>m([])}),[]);return(0,n.jsx)(ve.Provider,{value:i,children:(0,n.jsx)(so,{controls:r,children:(0,n.jsx)(uo,{value:u,children:(0,n.jsx)(X.Accordion.Root,{[Vn]:"",className:(0,G.default)(ho,o,{[s]:!po(o)}),style:d,value:c,onValueChange:p=>m(p),children:t})})})})},xe={Root:go,Controls:mo},Re={stack:"pr583x0",grid:"pr583x1"},ke="pr583x2",vo={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},b=({label:e,layout:t="grid",icon:r,children:a})=>{const o=(0,C.useId)(),i=(0,C.useId)();return e===void 0?(0,n.jsx)("div",{className:Re[t],children:(0,n.jsx)("div",{className:ke,children:a})}):(0,n.jsxs)("div",{className:Re[t],children:[(0,n.jsxs)("label",{id:o,htmlFor:i,className:vo[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:ke,children:(0,n.jsx)(yn,{labelId:o,controlId:i,children:a})})]})},xo=e=>(0,n.jsx)(l.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"})})}),Ce="_40zvwv0",fe="_40zvwv1",Co="_40zvwv2",zn="_40zvwv3",fo="_40zvwv4 _40zvwv3";var bo="_40zvwv6";var So="_40zvwv8",N=({title:e,layout:t="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>t==="collapsible"?(0,n.jsx)(yo,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(jo,{title:e,accessory:a,children:i}):(0,n.jsxs)("div",{className:Ce,children:[(0,n.jsxs)("div",{className:fe,children:[(0,n.jsx)("span",{className:zn,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})]}),jo=({title:e,accessory:t,children:r})=>{const a=(0,C.useId)(),o=(0,C.useId)();return(0,n.jsx)("div",{className:Ce,children:(0,n.jsxs)("div",{className:fe,children:[(0,n.jsx)("label",{id:a,htmlFor:o,className:fo,children:e}),(0,n.jsx)("span",{className:bo,children:(0,n.jsx)(yn,{labelId:a,controlId:o,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},yo=({title:e,preview:t,accessory:r,onOpenChange:a,children:o})=>{const i=l.useI18n();return(0,n.jsxs)(X.Accordion.Item,{value:e,className:Ce,onOpenChange:a,children:[(0,n.jsxs)(X.Accordion.Header,{className:fe,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(X.Accordion.Trigger,{className:Co,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:zn,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:So,children:(0,n.jsx)(xo,{size:"sm"})})]}),(0,n.jsx)(X.Accordion.Panel,{children:(0,n.jsx)("div",{children:o})})]})},Gn=({title:e,isChecked:t,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:s,collapseAllSections:d}=Fn(),{Switch:c}=M(),m=p=>{r(p),p?s(e):d()},u=p=>{p&&!t&&a!==!0&&r(!0)};return(0,n.jsx)(N,{title:e,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,n.jsx)(c,{isChecked:t,onChange:m,isDisabled:a,ariaLabel:e}),children:i})},Io={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"},wo={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},ce=({axis:e,title:t,layout:r="collapsible",preview:a})=>{const o=L(),i=l.useHandleCompiled(o),s=l.useI18n(),{NumberField:d,Switch:c,TextField:m,ToggleGroup:u}=M();if(!i)return null;const p=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",x=i.config.axes[e],g=i.scales[e],v=g?.spec,f=v?.scaleType==="continuous"?v:void 0;if(p==="circular"||p==="radial"&&f===void 0)return null;const P=v!==void 0&&"reverse"in v?v:void 0,I=v?.scaleType==="continuous"||v?.scaleType==="datetime",S=e==="y"&&f!==void 0&&i.layers.some(j=>j.yScaleType==="primary"&&j.geom==="bar"),w=f?.transform==="log",T=f?.domainMax??null,_=Po(f),R=(j,V)=>j.map(J=>({value:J,label:V(J)})),E=i.guides.axes.find(j=>j.scaleAestheticKey===e)?.position,H=Io[E==="bottom"||E==="top"||E===void 0&&e==="x"?"horizontal":"vertical"],A=i.guides.legends.drawn.some(j=>H.some(V=>V===j.position)),y=H.map(j=>({value:j,label:s(To[j])})),O=R(["auto","edges"],j=>s(j==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),K=R(["linear","log"],j=>s(j==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Yn=R(["auto","zero","custom"],j=>s(j==="zero"?"editor.axesPanel.startFrom.zero":j==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),Jn=R(["auto","custom"],j=>s(j==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),Qn=R(["no","yes"],j=>s(j==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),et=j=>{o.commands.dispatch(new h.SetAxisVisibilityCommand({axis:e,isVisible:j}))},nt=j=>{o.commands.dispatch(new h.SetAxisLabelCommand({axis:e,label:j===""?null:j}),{transient:!0})},tt=j=>{o.commands.dispatch(new h.SetAxisTicksVisibilityCommand({axis:e,isVisible:j}))},rt=j=>{o.commands.dispatch(new h.SetAxisTickModeCommand({axis:e,tickMode:j==="edges"?"edges":"auto"}))},at=j=>{o.commands.dispatch(new h.SetScaleReverseCommand({scaledAesthetic:e,reverse:j==="yes"}))},ot=j=>{o.commands.dispatch(new h.SetScaleTransformCommand({scaledAesthetic:e,transform:j==="log"?"log":"linear"}))},je=j=>{o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:e,...j}),{transient:!0})},it=j=>{j!==null&&je({domainMin:j})},st=j=>{j!==null&&je({domainMax:j})},lt=j=>{if(f){if(j==="custom"){f.zero&&o.commands.dispatch(new h.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:e,domainMin:De(g?.domain,"start")}));return}f.domainMin!==null&&o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),o.commands.dispatch(new h.SetScaleZeroCommand({scaledAesthetic:e,zero:j==="zero"}))}},ct=j=>{const V=j==="custom"?De(g?.domain,"end"):null;o.commands.dispatch(new h.SetScaleDomainCommand({scaledAesthetic:e,domainMax:V}))},dt=j=>{const V=H.find(J=>J===j);V&&o.commands.dispatch(new h.SetAxisPositionCommand({axis:e,position:V}))};return(0,n.jsx)(N,{title:t??s(wo[e]),layout:r,preview:a,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(c,{isChecked:x.isVisible,onChange:et})}),p==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(m,{value:x.label??"",onChange:nt,onCommit:o.commands.seal})}),(0,n.jsx)(b,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(c,{isChecked:x.ticks.isVisible,onChange:tt})})]}),I&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(u,{value:x.ticks.mode,options:O,onChange:rt})}),f&&p==="linear"&&!A&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(u,{value:E??x.position,options:y,onChange:dt})}),P!==void 0&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(u,{value:P.reverse===!0?"yes":"no",options:Qn,onChange:at})}),f&&!S&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(u,{value:w?"log":"linear",options:K,onChange:ot})}),f&&!w&&(0,n.jsxs)(n.Fragment,{children:[!S&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(u,{value:_,options:Yn,onChange:lt})}),_==="custom"&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:f.domainMin??null,onChange:it,onCommit:o.commands.seal})})]}),(0,n.jsx)(b,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(u,{value:T===null?"auto":"custom",options:Jn,onChange:ct})}),T!==null&&(0,n.jsx)(b,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:T,onChange:st,onCommit:o.commands.seal})})]})]})})},Po=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",De=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},be=({value:e,onChange:t})=>{const r=L(),a=l.useI18n(),{TextField:o}=M(),i=e!==null&&typeof e!="string",s=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:s,onCommit:r.commands.seal,isDisabled:i})})},Bn=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Switch:s}=M();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},m=u=>{a.commands.dispatch(new h.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,n.jsx)(N,{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)(s,{isChecked:d.isCaptionVisible,onChange:c})}),(0,n.jsx)(be,{value:d.caption,onChange:m})]})})},He=/^[a-z][a-z\d+.-]*:/i,Ao={},Kn=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Switch:s}=M();if(!o)return null;const d=o.config.content,c=m=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"source",isVisible:m}))};return(0,n.jsx)(N,{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)(s,{isChecked:d.isSourceVisible,onChange:c})}),(0,n.jsx)(Lo,{source:d.source??Ao})]})})},Lo=({source:e})=>{const t=L(),r=l.useI18n(),{TextField:a}=M(),o=c=>{const m=(c.label??"")!==""||(c.url??"")!=="";t.commands.dispatch(new h.SetContentSourceCommand({source:m?c:null}),{transient:!0})},i=()=>{const c=e.url??"";c!==""&&!He.test(c)&&o({...e,url:`https://${c}`}),t.commands.seal()},s=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:s,onCommit:i,hasError:He.test(e.url??"")&&!(0,h.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})})]})},qn=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Switch:s}=M();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},m=u=>{a.commands.dispatch(new h.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,n.jsx)(N,{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)(s,{isChecked:d.isSubtitleVisible,onChange:c})}),(0,n.jsx)(be,{value:d.subtitle,onChange:m})]})})},de=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],Mo=de.length/2,Un=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{RadioGrid:s}=M();if(!o)return null;const{textScale:d}=o.config.appearance,c=p=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${p}`}),m=de.map(p=>({value:`${p}`,label:c(p)})),u=p=>{const x=de.find(g=>`${g}`===p);x!==void 0&&a.commands.dispatch(new h.SetAppearanceTextScaleCommand({textScale:x}))};return(0,n.jsx)(N,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??c(d),children:(0,n.jsx)(s,{value:`${d}`,options:m,columns:Mo,onChange:u,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},Wn=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Switch:s}=M();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new h.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},m=u=>{a.commands.dispatch(new h.SetContentTitleCommand({title:u}),{transient:!0})};return(0,n.jsx)(N,{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)(s,{isChecked:d.isTitleVisible,onChange:c})}),(0,n.jsx)(be,{value:d.title,onChange:m})]})})},_o=({children:e,...t})=>(0,n.jsx)(xe.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Wn,{}),(0,n.jsx)(qn,{}),(0,n.jsx)(Bn,{}),(0,n.jsx)(Kn,{}),(0,n.jsx)(Un,{})]})}),Eo=({children:e,...t})=>(0,n.jsx)(xe.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ce,{axis:"x"}),(0,n.jsx)(ce,{axis:"y"})]})}),re=e=>`${e}px`,Zn=e=>`${Math.round(e*100)}%`,Oo=e=>`${e}°`,No=24,Ro={select:{target:"graph"}},Fe=["dim","desaturate"],ko=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Slider:s,ToggleGroup:d}=M();if(!o)return null;const c=(0,h.createStyleResolver)().chromeReaders(o.chrome).graph.get("borderRadius"),m=(0,h.readHighlightDimStyle)(o.spec),u=Fe.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),p=g=>{const v=(0,h.findStyleRule)(o.spec.styles.overrides,Ro)?.declarations??{};a.commands.dispatch(new h.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...v,borderRadius:g}}}),{transient:!0})},x=g=>{const v=Fe.find(f=>f===g);v&&a.commands.dispatch(new h.SetHighlightDimStyleCommand({dimStyle:v}))};return(0,n.jsx)(N,{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)(s,{value:c,min:0,max:No,step:1,formatValue:re,onChange:p,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(d,{value:m,options:u,onChange:x})})]})})},Se=(e,t)=>{const{colorScheme:r}=l.useThemeContext();return(0,C.useMemo)(()=>{const a=e?.layers.find(o=>o.id===t);return a===void 0?null:(0,h.createStyleResolver)({colorScheme:r}).geomReaders(a)},[e,t,r])},Do=.05,Ho=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Slider:s,ToggleGroup:d}=M(),c=o?(0,h.findLayerByGeom)(o.spec.layers,"bar"):void 0,m=Se(o,c?.id??null);if(!o||!c||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=g=>{a.commands.dispatch(new h.SetBarWidthCommand({layerId:c.id,width:g}),{transient:!0})},p=g=>{const v=h.BORDER_RADIUS_TOKENS.find(f=>f===g);v&&a.commands.dispatch(new h.SetBarBorderRadiusCommand({layerId:c.id,borderRadius:v}))},x=h.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:i(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,n.jsx)(N,{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)(s,{value:c.params.width,min:h.MIN_BAR_WIDTH,max:h.MAX_BAR_WIDTH,step:Do,formatValue:Zn,onChange:u,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(d,{value:m?.get("borderRadius")??h.DEFAULT_BAR_BORDER_RADIUS,options:x,onChange:p})})]})})},ae=({children:e})=>{const t=(0,C.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"})]})})]})},oe="qdaoth0",Fo=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(ae,{children:(0,n.jsx)("path",{className:oe,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"})]}),Vo=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(ae,{children:[(0,n.jsx)("path",{className:oe,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"})]})}),zo=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(ae,{children:(0,n.jsx)("path",{className:oe,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"})]}),Go=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(ae,{children:(0,n.jsx)("path",{className:oe,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"})]}),Bo={x:.5,y:.5},Ko=.2,qo={x:.375,y:.25,width:.25,height:.5},Uo={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},Wo={x:.4,y:.6},Zo={x:.6,y:.4},$o="relative-difference",Xo=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Button:s}=M();if(!o)return null;const d=()=>{a.commands.dispatch(new h.AddAnnotationCommand({kind:"text",annotation:{...h.TEXT_ANNOTATION_DEFAULTS,content:Yo(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...Bo},width:Ko}}))},c=()=>{a.commands.dispatch(new h.AddAnnotationCommand({kind:"arrow",annotation:{...h.ARROW_DEFAULTS,start:{anchorType:"panel",...Wo},end:{anchorType:"panel",...Zo}}}))},m=()=>{a.commands.dispatch(new h.AddAnnotationCommand({kind:"shape",annotation:{...h.SHAPE_DEFAULTS,...Uo,region:{anchorType:"panel",...qo}}}))},u=()=>{const x=(0,h.inferDefaultDifferenceArrowEndpoints)(o);x!==null&&a.commands.dispatch(new h.AddAnnotationCommand({kind:"differenceArrow",annotation:{...h.DIFFERENCE_ARROW_DEFAULTS,...x,label:$o}}))},p=o.coordSystem.type==="cartesian";return(0,n.jsx)(N,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(Dn,{children:[(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Go,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Fo,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:c}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(Vo,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:m}),p&&(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(zo,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},Yo=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Jo=.1,Qo=20,ei=({title:e,preview:t})=>{const r=L(),a=l.useHandleCompiled(r),o=l.useI18n(),{NumberField:i,TextField:s}=M();if(!a||a.coordSystem.type==="polar")return null;const d=(0,h.findGoalLineLayer)(a.spec.layers),c=e??o("editor.annotationsPanel.goalSection.title"),m=(0,h.extractConstantValue)(d?.mapping.y),u=typeof m=="number"?m:null,p=v=>{const f=new h.ToggleGoalLineCommand({showGoalLine:v,value:ni(a),...d!==void 0&&{layerId:d.id}});r.commands.dispatch(f)},x=v=>{if(d===void 0)return;const f=new h.SetRuleLabelCommand({layerId:d.id,label:v===""?null:v});r.commands.dispatch(f,{transient:!0})},g=v=>{if(d===void 0||v===null)return;const f=new h.SetRuleValueCommand({layerId:d.id,value:v});r.commands.dispatch(f,{transient:!0})};return(0,n.jsx)(Gn,{title:c,preview:t,isChecked:d!==void 0,onToggle:p,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(s,{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:u,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},ni=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="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(Qo,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*Jo).toFixed(i))},ti=({layerId:e,title:t,layout:r="collapsible",preview:a})=>{const o=L(),i=l.useHandleCompiled(o),s=l.useI18n(),{Switch:d}=M();if(!i)return null;const c=e===void 0?i.spec.layers[0]:i.spec.layers.find(E=>E.id===e);if(!c)return null;const{showDataLabels:m,format:u,showStackTotals:p,showCategoryLabels:x}=c.dataLabels,g=i.coordSystem.type==="polar",v=c.geom==="bar",f=c.position==="stack"||c.position==="fill",P=v&&!g&&c.position==="stack",I=v&&(!g||m),S=v||c.geom==="area"&&f;if(!(0,h.canPlaceDataLabels)(c.geom,i.coordSystem.type))return null;const w=E=>{const H=new h.ToggleDataLabelsCommand({layerId:c.id,showDataLabels:E});o.commands.dispatch(H)},T=E=>{const H=new h.SetDataLabelsFormatCommand({layerId:c.id,format:E?"percentage":"absolute"});o.commands.dispatch(H)},_=E=>{const H=new h.ToggleStackTotalsCommand({layerId:c.id,showStackTotals:E});o.commands.dispatch(H)},R=E=>{const H=new h.ToggleCategoryLabelsCommand({layerId:c.id,showCategoryLabels:E});o.commands.dispatch(H)};return(0,n.jsx)(N,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(d,{isChecked:m,onChange:w})}),m&&S&&(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(d,{isChecked:u==="percentage",onChange:T})}),P&&(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(d,{isChecked:p,onChange:_})}),I&&(0,n.jsx)(b,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(d,{isChecked:x,onChange:R})})]})})},ri=e=>(0,n.jsxs)(l.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"})]}),ai=e=>(0,n.jsx)(l.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"})]})}),oi=e=>(0,n.jsx)(l.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"})]})}),ii=e=>(0,n.jsx)(l.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"})]})}),si=e=>(0,n.jsxs)(l.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"})]}),li=e=>(0,n.jsxs)(l.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"})]}),ci=e=>(0,n.jsxs)(l.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"})]}),di=e=>(0,n.jsx)(l.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"})]})}),ui=e=>(0,n.jsx)(l.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"})]})]})}),hi=e=>(0,n.jsxs)(l.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"})]}),mi=e=>(0,n.jsx)(l.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"})]})}),pi=.55,ue=[{name:"column",icon:si,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:ci,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:li,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:ai,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:ii,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:oi,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:ui,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:ri,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"scatter",icon:mi,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:hi,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:di,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:pi}}],gi=.05,vi=e=>e===null?null:ue.find(t=>Ci(t.summary,e))??null,xi=(e,t)=>{const{summary:r}=e;return r.coordType!=="polar"||!ne(r.innerRadius)||t===null||t.coordType!=="polar"||!ne(t.innerRadius)?r:{...r,innerRadius:t.innerRadius}},Ci=(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&&ne(e.innerRadius)===ne(t.innerRadius),ne=e=>e>=gi,fi=3,bi=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{RadioGrid:s}=M(),d=(0,C.useMemo)(()=>ue.map(({name:p,icon:x})=>({value:p,label:i(`editor.graphTypes.${p}`),icon:(0,n.jsx)(x,{size:"md"})})),[i]);if(!o)return null;const c=(0,h.readChartType)(o.spec),m=vi(c),u=p=>{const x=ue.find(g=>g.name===p);x&&a.commands.dispatch(new h.SetChartTypeCommand(xi(x,c)))};return(0,n.jsx)(N,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:r??i(m===null?"editor.graphTypes.combo":`editor.graphTypes.${m.name}`),children:(0,n.jsx)(s,{value:m?.name??"",options:d,columns:fi,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Ve=["solid","dashed","dotted"],Si=Number.parseFloat(l.chromeTokens.gridLineWidth),ji=8,yi=0,Ii=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Slider:s,Switch:d,ToggleGroup:c}=M(),{themeValues:m}=l.useThemeContext();if(!o)return null;const u=o.guides.axes.filter(Ti);if(u.length===0)return null;const p=o.coordSystem.type!=="polar",x=u.some(S=>S.gridVisible),g=o.config.axes.y.grid,v=Ve.map(S=>({value:S,label:i(`editor.graphPanel.gridSection.lineStyles.${S}`)})),f=S=>w=>{a.commands.dispatch(new h.SetGridVisibilityCommand({axis:S,isVisible:w}))},P=S=>{const w=Ve.find(T=>T===S);w&&a.commands.dispatch(new h.SetGridLineStyleCommand({axis:"both",lineStyle:w}))},I=S=>{a.commands.dispatch(new h.SetGridLineWidthCommand({axis:"both",lineWidth:S}),{transient:!0})};return(0,n.jsx)(N,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[u.map(S=>(0,n.jsx)(b,{label:i(wi(S)),children:(0,n.jsx)(d,{isChecked:S.gridVisible,onChange:f(S.scaleAestheticKey)})},S.scaleAestheticKey)),p&&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:P})}),(0,n.jsx)(b,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:g.lineWidth??l.parsePx(m.gridLineWidth,Si),min:yi,max:ji,step:.5,formatValue:re,onChange:I,onCommit:a.commands.seal})})]})]})})},Ti=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",wi=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",Pi="total",$n=["total","average","current"],Ai=["total"],ze=["previous","first"],Ge=["auto","small","medium","large"],Li=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Switch:s,ToggleGroup:d}=M();if(!o)return null;const c=o.config.headline,m=c.show!=="none",u=o.coordSystem,p=u.type==="polar",x=u.type==="polar"&&u.innerRadius>0,g=o.layers.some(y=>y.summary.grandTotal!==void 0);if(p&&!g)return null;const v=p?Ai:$n,f=o.guides.headline,P=f?.kind==="perGroup"&&f.items.some(y=>y.comparison!==null),I=v.map(y=>({value:y,label:i(`editor.graphPanel.headlineNumberSection.metrics.${y}`)})),S=ze.map(y=>({value:y,label:i(`editor.graphPanel.headlineNumberSection.comparison.${y}`)})),w=Ge.map(y=>({value:y,label:i(y==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${y}`)})),T=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],_=y=>{a.commands.dispatch(new h.SetHeadlineShowCommand({show:y?Pi:"none"}))},R=y=>{const O=v.find(K=>K===y);O&&a.commands.dispatch(new h.SetHeadlineShowCommand({show:O}))},E=y=>{const O=ze.find(K=>K===y);O&&a.commands.dispatch(new h.SetHeadlineCompareWithCommand({compareWith:O}))},H=y=>{const O=Ge.find(K=>K===y);O&&a.commands.dispatch(new h.SetHeadlineSizeCommand({size:O}))},A=y=>{a.commands.dispatch(new h.SetHeadlinePositionCommand({position:y==="center"?"center":"above"}))};return(0,n.jsx)(N,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??Mi(i,c.show),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{isChecked:m,onChange:_})}),m&&(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:R})}),P&&(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(d,{value:(0,h.resolveComparisonBasis)(c.compareWith),options:S,onChange:E})}),(0,n.jsx)(b,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(d,{value:c.size,options:w,onChange:H})}),x&&(0,n.jsx)(b,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(d,{value:c.position,options:T,onChange:A})})]})]})})},Mi=(e,t)=>{const r=$n.find(a=>a===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},le=["top","bottom","left","right","none"],Be=["auto","start","center","end"],Ke=["auto","pill","direct"],_i=({positions:e,title:t,layout:r="collapsible",preview:a})=>{const o=L(),i=l.useHandleCompiled(o),s=l.useI18n(),{ToggleGroup:d}=M();if(!i)return null;const c=i.config.legend.position,m=e??le,u=i.guides.legends.drawn[0],p=(0,h.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"&&u===void 0&&!p&&(x||!g))return null;const v=u?.position??"none",f=c==="auto"?v:c,P=le.filter(A=>A===f||m.includes(A)).map(A=>({value:A,label:s(`editor.graphPanel.legendSection.${A}`)})),I=A=>{const y=le.find(O=>O===A);y&&o.commands.dispatch(new h.SetLegendPositionCommand({position:y}))},S=A=>{const y=Be.find(O=>O===A);y&&o.commands.dispatch(new h.SetLegendAlignCommand({align:y}))},w=A=>{const y=Ke.find(O=>O===A);y&&o.commands.dispatch(new h.SetLegendDisplayCommand({display:y}))},T=Be.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.align.${A}`)})),_=Ke.map(A=>({value:A,label:s(`editor.graphPanel.legendSection.display.${A}`)})),R=t??s("editor.graphPanel.legendSection.title"),E=P.find(A=>A.value===f)?.label,H=u!==void 0;return(0,n.jsx)(N,{title:R,layout:r,preview:a??E,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(d,{value:f,options:P,onChange:I})}),H&&(0,n.jsx)(b,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(d,{value:i.config.legend.align,options:T,onChange:S})}),p&&(0,n.jsx)(b,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(d,{value:i.config.legend.display,options:_,onChange:w})})]})})},Ei=1,Oi=20,Ni=.5,Xn=({layerId:e})=>{const t=L(),r=l.useHandleCompiled(t),{Slider:a}=M(),o=Se(r,e);if(!r)return null;const i=s=>{const d=new h.SetPointSizeCommand({layerId:e,size:s});t.commands.dispatch(d,{transient:!0})};return(0,n.jsx)(a,{value:o?.get("size")??h.DEFAULT_POINT_SIZE,min:Ei,max:Oi,step:Ni,formatValue:re,onChange:i,onCommit:t.commands.seal})},Ri=1,ki=10,Di=.1,Hi=["gap","zero","connect"],Fi=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Select:s,Slider:d,Switch:c,ToggleGroup:m}=M(),u=o?.spec.layers??[],p=(0,h.findLayerByGeom)(u,"line","area"),x=Se(o,p?.id??null);if(!o||!p)return null;const g=o.coordSystem.type==="polar",v=Gi(i,p),f=zi(p,u),P=qe(o.spec,p.geom,"strokeWidth",p.id),I=typeof P=="number",S=p.geom==="line"?p:void 0,w=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],T=y=>{a.commands.dispatch(new h.ToggleLinePointsVisibilityCommand({layerId:p.id,showPoints:y}))},_=y=>{S&&a.commands.dispatch(new h.ToggleLineFillCommand({layerId:S.id,showFill:y}))},R=y=>{a.commands.dispatch(new h.SetLineInterpolationCommand({layerId:p.id,interpolate:y?"catmull-rom":"linear"}))},E=y=>{const O=x?.get("strokeWidth")??h.DEFAULT_STROKE_WIDTH;a.commands.dispatch(new h.SetLineWidthCommand({layerId:p.id,lineWidth:y==="custom"?O:null}))},H=y=>{a.commands.dispatch(new h.SetLineWidthCommand({layerId:p.id,lineWidth:y}),{transient:!0})},A=y=>{const O=Vi(y);O&&a.commands.dispatch(new h.SetLineMissingValuesCommand({layerId:p.id,missingValues:O}))};return(0,n.jsx)(N,{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:f!==void 0,onChange:T})}),f&&(0,n.jsx)(b,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(Xn,{layerId:f.id})}),S&&!g&&(0,n.jsx)(b,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(c,{isChecked:qe(o.spec,"line","fillAlpha",S.id)!==void 0,onChange:_})}),!g&&(0,n.jsx)(b,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(c,{isChecked:p.params.interpolate==="catmull-rom",onChange:R})}),(0,n.jsx)(b,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(m,{value:I?"custom":"auto",options:w,onChange:E})}),I&&(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:P,min:Ri,max:ki,step:Di,formatValue:re,onChange:H,onCommit:a.commands.seal})}),!g&&v.length>1&&(0,n.jsx)(b,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:p.params.missingValues,options:v,onChange:A})})]})})},Vi=e=>Hi.find(t=>t===e),qe=(e,t,r,a)=>(0,h.findKindStyleDeclarations)(e.styles.overrides,(0,h.buildLayerStyleAddress)(t,a))?.[r],zi=(e,t)=>(0,h.filterLayersByGeoms)(t,"point").find(r=>(0,h.isCompanionLayer)(r,[e])),Gi=(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},Bi="k",Ki=2,qi=0,Ui=5,he=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],Wi=["auto","none"],Zi=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{NumberField:s,ToggleGroup:d}=M();if(!o)return null;const{abbreviation:c,decimals:m}=o.config.numberFormat,u=$i(c)!==void 0,p=m!=="auto",x=w=>w.map(T=>({value:T,label:i(`editor.graphPanel.numberFormat.options.${T}`)})),g=he.map(({value:w,labelKey:T})=>({value:w,label:i(`common.abbreviations.${T}`)})),v=w=>{a.commands.dispatch(new h.SetNumberFormatAbbreviationCommand({abbreviation:w}))},f=w=>{const T=Wi.find(_=>_===w);v(T??Bi)},P=w=>{const T=he.find(_=>_.value===w);T&&v(T.value)},I=w=>{a.commands.dispatch(new h.SetNumberFormatDecimalsCommand({decimals:w==="custom"?Ki:"auto"}))},S=w=>{w!==null&&a.commands.dispatch(new h.SetNumberFormatDecimalsCommand({decimals:w}),{transient:!0})};return(0,n.jsx)(N,{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:u?"custom":c,options:x(["auto","none","custom"]),onChange:f})}),u&&(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:c,options:g,onChange:P})}),(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(d,{value:p?"custom":"auto",options:x(["auto","custom"]),onChange:I})}),p&&(0,n.jsx)(b,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:m,min:qi,max:Ui,onChange:S,onCommit:a.commands.seal})})]})})},$i=e=>he.find(t=>t.value===e),Xi=({title:e,layout:t="collapsible",preview:r})=>{const a=l.useHandleCompiled(L()),o=l.useI18n();if(!a)return null;const i=Yi(a.spec.layers);return i?(0,n.jsx)(N,{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)(Xn,{layerId:i.id})})})}):null},Yi=e=>{const t=(0,h.filterLayersByGeoms)(e,"line","area");return(0,h.filterLayersByGeoms)(e,"point").find(r=>!(0,h.isCompanionLayer)(r,t))},Ji=.9,Qi=360,es=.05,ns=15,ts=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Slider:s}=M();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:c}=o.spec.coords.params,m=p=>{a.commands.dispatch(new h.SetPolarInnerRadiusCommand({innerRadius:p}),{transient:!0})},u=p=>{a.commands.dispatch(new h.SetPolarStartAngleCommand({startAngle:p}),{transient:!0})};return(0,n.jsx)(N,{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)(s,{value:d,min:0,max:Ji,step:es,formatValue:Zn,onChange:m,onCommit:a.commands.seal})}),(0,n.jsx)(b,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:c,min:0,max:Qi-1,step:ns,formatValue:Oo,onChange:u,onCommit:a.commands.seal})})]})})},rs=e=>(0,n.jsxs)(l.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"})]}),Ue=e=>(0,n.jsxs)(l.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"})]}),as=e=>(0,C.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:t,numberFormat:r}=e.config,a=e.guides.colorGroups.map(o=>{const i=(0,h.createValueFormatter)({valueFormat:o.valueFormat,locale:t,numberFormat:r}),s=o.value instanceof Date?o.value.getTime():o.value;return{value:s,option:{value:String(s),label:o.label??i(o.value)}}});return{options:a.map(({option:o})=>o),findValue:o=>a.find(i=>i.option.value===o)?.value}},[e]),We=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],os="linear",is=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=l.useHandleCompiled(a),i=l.useI18n(),{Select:s,Switch:d}=M(),{options:c,findValue:m}=as(o);if(!o||o.coordSystem.type==="polar")return null;const u=(0,h.findTrendLineLayer)(o.spec.layers),p=(0,h.findAverageLineLayer)(o.spec.layers),x=u?.stat.type==="smooth"?u.stat.method:os,g=ss(p),v=We.map(T=>({value:T,label:i(`editor.annotationsPanel.trendType.options.${T}`)})),f=(T,_={})=>{const R=u??p,E=new h.SetStatLineCommand({line:T,..._,...R!==void 0&&{layerId:R.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(E)},P=T=>f(T?"trend":"none",{method:x}),I=T=>f(T?"average":"none",{group:g??m(c[0]?.value??"")}),S=T=>{const _=We.find(R=>R===T);_!==void 0&&f("trend",{method:_})},w=T=>{const _=T===null?void 0:m(T);_!==void 0&&f("average",{group:_})};return(0,n.jsx)(N,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(Ue,{size:"lg"}),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(b,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(Ue,{size:"lg"}),children:(0,n.jsx)(d,{isChecked:u!==void 0,onChange:P})}),u!==void 0&&(0,n.jsx)(b,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(s,{value:x,options:v,onChange:S,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(b,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(rs,{size:"lg"}),children:(0,n.jsx)(d,{isChecked:p!==void 0,onChange:I})}),p!==void 0&&c.length>0&&(0,n.jsx)(b,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(s,{value:g===void 0?null:String(g),options:c,onChange:w,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},ss=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=ko;exports.AxesPanel=Eo;exports.AxisSection=ce;exports.BarSection=Ho;exports.Button=In;exports.CalloutsSection=Xo;exports.CaptionSection=Bn;exports.EditableGraphRenderer=La;exports.EditorPanel=xe;exports.ElementsPanel=_o;exports.GoalSection=ei;exports.GraphOptionsSection=ti;exports.GraphTypeSection=bi;exports.GridSection=Ii;exports.HeadlineSection=Li;exports.IntlProvider=l.IntlProvider;exports.LegendSection=_i;exports.LineSection=Fi;exports.NumberField=Pn;exports.NumberFormatSection=Zi;exports.PANEL_ROOT_ATTRIBUTE=Vn;exports.PointSection=Xi;exports.PolarSection=ts;exports.RadioGrid=An;exports.Row=b;exports.Section=N;exports.Select=Ln;exports.Slider=Mn;exports.SourceSection=Kn;exports.SubtitleSection=qn;exports.Switch=_n;exports.TextField=En;exports.TextSizeSection=Un;exports.TitleSection=Wn;exports.ToggleGroup=On;exports.ToggledSection=Gn;exports.TrendsAndAveragesSection=is;exports.useControls=M;exports.usePanelExpansion=Fn;exports.usePanelGraph=L;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const s=require("./history-chords-CL65ERxg.cjs"),It=require("./typography-CsG_IWDd.cjs");let p=require("@graphysdk/viz-engine"),C=require("react"),n=require("react/jsx-runtime"),oe=require("zustand/react/shallow"),Tt=require("react-dom"),B=require("clsx");B=s.__toESM(B,1);let rn=require("@vanilla-extract/dynamic"),X=require("@base-ui/react/slider"),z=require("@base-ui/react/menu"),G=require("@base-ui/react"),ee=require("lodash-es/clamp");ee=s.__toESM(ee,1);let J=require("@base-ui/react/accordion"),_e=require("@base-ui/react/number-field"),an=require("@base-ui/react/radio"),on=require("@base-ui/react/radio-group"),F=require("@base-ui/react/select"),Ee=require("@base-ui/react/switch"),At=require("@base-ui/react/input");var Pt="data-graphy-chart-chrome",Lt="data-graphy-chart-menu",sn={[Lt]:""},ie=e=>({[Pt]:e}),ln=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,Mt=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,cn=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,dn=(e,t,r)=>r!==null&&(0,p.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),Q=(e,t,r)=>e instanceof Node&&(t.contains(e)||ln(e,r)),_t="cml7ha0",un=(0,C.createContext)(null),Et=({children:e})=>{const{chartId:t}=s.useGraphContext(),[r]=(0,C.useState)(s.resolvePortalContainer),[a,o]=(0,C.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Tt.createPortal)((0,n.jsx)("div",{ref:o,className:_t,...ie(t)}),r),(0,n.jsx)(un.Provider,{value:a,children:e})]})},fe=()=>(0,C.useContext)(un),hn=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 pn="efjmb40",mn="efjmb41",W="efjmb42",q="efjmb43",Rt="efjmb44",Ot="efjmb45",kt=new Set(["item-press","escape-key","outside-press","close-press","sibling-open","trigger-press"]),be=({label:e,icon:t,onOpened:r,children:a})=>{const o=fe(),[i,l]=(0,C.useState)(!1),d=(c,h)=>{c?(l(!0),r?.()):kt.has(h.reason)&&l(!1)};return(0,n.jsxs)(G.Menu.SubmenuRoot,{open:i,onOpenChange:d,children:[(0,n.jsx)(Nt,{label:e,icon:t}),(0,n.jsx)(G.Menu.Portal,{container:o,children:(0,n.jsx)(s.PortalThemeProvider,{children:(0,n.jsx)(G.Menu.Positioner,{side:"right",align:"start",sideOffset:4,className:pn,...sn,children:(0,n.jsx)(G.Menu.Popup,{className:mn,children:a})})})})]})},Nt=({label:e,icon:t})=>(0,n.jsxs)(G.Menu.SubmenuTrigger,{className:W,openOnHover:!1,children:[t,(0,n.jsx)("span",{className:q,children:e}),(0,n.jsx)("span",{className:Ot,children:(0,n.jsx)(s.ChevronDownIcon,{size:"sm"})})]}),Dt="_1qe7q450",Ht="_1qe7q451",zt="_1qe7q452",Ft=({label:e,placeholder:t,addLabel:r,at:a,onRequestClose:o})=>{const i=(0,C.useRef)(null),[l,d]=(0,C.useState)(""),{dispatch:c}=s.useGraphCommands(),h=l.trim(),u=()=>{h.length!==0&&(c(new p.AddAnnotationCommand({kind:"comment",annotation:{at:a,content:Vt(h)}})),o())},m=x=>{x.key==="Enter"&&(x.preventDefault(),u()),x.key!=="Escape"&&x.stopPropagation()},v=x=>{d(x.target.value)},g=()=>{requestAnimationFrame(()=>i.current?.focus())};return(0,n.jsx)(be,{label:e,icon:(0,n.jsx)(hn,{}),onOpened:g,children:(0,n.jsxs)("div",{className:Dt,children:[(0,n.jsx)("input",{ref:i,className:Ht,value:l,placeholder:t,onChange:v,onKeyDown:m}),(0,n.jsx)("button",{type:"button",className:zt,disabled:h.length===0,onClick:u,children:r})]})})},Vt=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Gt=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"})}),Bt="relative-difference",Kt=({label:e,layer:t,at:r,onRequestClose:a})=>{const{dispatch:o}=s.useGraphCommands(),i=s.useCompiledSelector(c=>c.coordSystem),l=(0,C.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:Bt}})),a()};return(0,n.jsxs)(z.Menu.Item,{className:W,onClick:d,children:[(0,n.jsx)(Gt,{}),(0,n.jsx)("span",{className:q,children:e})]})};function Ut(e,t){if(e.type==="polar"&&!Wt(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 Wt=e=>{const t=(0,p.extractVariableName)(e.mapping.x);return t!==null&&t!==p.CONSTANT_VARIABLES.x},qt=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"})]}),Zt=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"})]}),$t=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"})]}),Xt=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"})]}),Yt=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"})]}),Jt=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"})]}),Qt=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"})]}),er=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)"})]}),nr=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)"})]}),tr={bar:qt,barGroup:Zt,barStack:Xt,barSeries:$t,linePoint:Yt,lineSeries:Jt,scatterPoint:er,scatterSeries:nr,pieSlice:Qt},gn=({labelKey:e})=>{const t=tr[e];return(0,n.jsx)(t,{})},vn=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"})]}),rr=({label:e,options:t,onSelect:r})=>{const a=s.useI18n();return(0,n.jsx)(be,{label:e,icon:(0,n.jsx)(vn,{}),children:t.map(o=>(0,n.jsxs)(G.Menu.Item,{className:W,onClick:()=>r(o.scope),children:[(0,n.jsx)(gn,{labelKey:o.labelKey}),(0,n.jsx)("span",{className:q,children:a(`graph.annotations.highlights.labels.${o.labelKey}`)})]},o.scope))})},ar=({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,C.useMemo)(()=>(0,p.buildObservationPredicate)(t,r),[t,r]),h=(0,C.useMemo)(()=>Ut(d,t),[d,t]),u=(0,C.useMemo)(()=>{const g=new Set(a.map(x=>x.scope));return h.filter(x=>!g.has(x.scope))},[h,a]),[m]=u;if(c===null||m===void 0)return null;const v=g=>{l(new p.AddHighlightCommand({predicate:c,scope:g,layerId:t.id})),o()};if(u.length===1){const g=h.length===1?e:i("graph.annotations.baseMenu.highlightWithLabel",{label:i(`graph.annotations.highlights.labels.${m.labelKey}`)});return(0,n.jsxs)(G.Menu.Item,{className:W,onClick:()=>v(m.scope),children:[(0,n.jsx)(gn,{labelKey:m.labelKey}),(0,n.jsx)("span",{className:q,children:g})]})}return(0,n.jsx)(rr,{label:e,options:u,onSelect:v})},or="_1aafi1g0",ir="_1aafi1g1",xn=({children:e})=>(0,n.jsxs)("span",{className:or,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:ir})]}),sr=({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:W,onClick:i,children:[(0,n.jsx)(xn,{children:(0,n.jsx)(vn,{})}),(0,n.jsx)("span",{className:q,children:e})]})},lr=(e,t)=>{const r=s.useCompiledSelector(o=>o.spec.highlights),a=s.useCompiledSelector(o=>o.config.parsingLocale);return(0,C.useMemo)(()=>(0,p.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:a}),[e,r,t,a])},Cn=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"})]}),cr=({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:W,onClick:o,children:[(0,n.jsx)(Cn,{}),(0,n.jsx)("span",{className:q,children:e})]})},fn=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"})]}),bn={pinnedNumber:{icon:Cn,labelKey:"graph.annotations.baseMenu.unpinNumber"},comment:{icon:hn,labelKey:"graph.annotations.baseMenu.removeAnnotation"},sticker:{icon:fn,labelKey:"graph.annotations.baseMenu.removeSticker"},image:null},dr=e=>(0,p.isObservationAttachmentKind)(e.kind)&&bn[e.kind]!==null,ur=({attachment:e,onRequestClose:t})=>{const r=s.useI18n(),{dispatch:a}=s.useGraphCommands(),{icon:o,labelKey:i}=bn[e.kind],l=()=>{a(new p.RemoveAnnotationCommand({id:e.annotation.id})),t()};return(0,n.jsxs)(z.Menu.Item,{className:W,onClick:l,children:[(0,n.jsx)(xn,{children:(0,n.jsx)(o,{})}),(0,n.jsx)("span",{className:q,children:r(i)})]})},hr="ceeojg0",pr="ceeojg1",mr="ceeojg2",gr=({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)(be,{label:e,icon:(0,n.jsx)(fn,{}),children:(0,n.jsx)("div",{className:hr,children:Object.entries(s.STICKER_ASSETS).map(([i,l])=>(0,n.jsx)(G.Menu.Item,{className:pr,"aria-label":i,onClick:()=>o(i),children:(0,n.jsx)("img",{className:mr,src:l.src,alt:i})},i))})})},vr=({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)(xr,{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})},xr=({trigger:e,layer:t,at:r,observation:a,onClose:o})=>{const i=s.useI18n(),l=fe(),d=s.useCompiledSelector(j=>j.spec.annotations),c=s.useCompiledSelector(j=>j.config.parsingLocale),h=fr(),{x:u,y:m,radius:v}=e,g=(0,C.useMemo)(()=>Cr(u,m,v),[u,m,v]),x=(0,p.findObservationAttachment)(d,r,(0,C.useMemo)(()=>(0,p.createObservationAnchorParser)(t,c),[t,c])),f=x!==null&&dr(x)?x:null,b=lr(t,a),I=(j,A)=>{!j&&br(A.reason)&&o()};return(0,n.jsx)(z.Menu.Root,{open:h,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:pn,...sn,children:(0,n.jsxs)(z.Menu.Popup,{className:mn,"data-testid":"observation-menu",children:[f!==null&&(0,n.jsx)(ur,{attachment:f,onRequestClose:o}),(0,n.jsx)(sr,{label:i("graph.annotations.baseMenu.removeHighlight"),highlights:b,onRequestClose:o}),(0,n.jsx)(z.Menu.Separator,{className:Rt}),f===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(cr,{label:i("graph.annotations.baseMenu.pinNumber"),at:r,onRequestClose:o}),(0,n.jsx)(Ft,{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)(gr,{label:i("graph.annotations.baseMenu.addSticker"),at:r,onRequestClose:o})]}),t.highlight!==null&&(0,n.jsx)(ar,{label:i("graph.annotations.baseMenu.highlight"),layer:t,observation:a,highlights:b,onRequestClose:o}),(0,n.jsx)(Kt,{label:i("graph.annotations.baseMenu.differenceArrow"),layer:t,at:r,onRequestClose:o})]})})})})})},Cr=(e,t,r)=>({getBoundingClientRect:()=>new DOMRect(e-r,t-r,r*2,r*2)}),fr=()=>{const[e,t]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{t(!0)},[]),e},br=e=>e==="outside-press"||e==="escape-key"||e==="item-press",Se=()=>{const e=s.useGraphSelection();return Sn(e)},Sn=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},Sr=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"})]})}),yn=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"})]})}),yr="var(--pvjfpx0)",jr="var(--pvjfpx1)",wr="pvjfpx2",Ir="pvjfpx3",Tr="pvjfpx4",Ar="pvjfpx6 pvjfpx5",Pr="pvjfpx7 pvjfpx6 pvjfpx5",Lr="pvjfpx8 pvjfpx5",Y=8,Mr=({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,ee.default)(l>=Y?l:d,Y,a-Y-36),h=Y;return{top:c,left:h,available:Math.max(0,r-Y*2),centre:t.x+e.x+e.width/2-h}},_r=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a,label:o,testId:i,children:l})=>{const{chartId:d}=s.useGraphContext(),c=Mr({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:a});return(0,n.jsx)("div",{className:wr,style:{top:c.top,left:c.left,width:c.available},children:(0,n.jsx)(s.FloatingToolbar.Root,{"aria-label":o,className:Ir,"data-testid":i,...ie(d),style:(0,rn.assignInlineVars)({[yr]:`${c.centre}px`,[jr]:`${c.available}px`}),children:l})})},Er=({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:Lr,disabled:o,onMouseDown:d=>d.preventDefault(),children:[t,(0,n.jsx)(s.ChevronDownIcon,{size:"sm"})]}),(0,n.jsx)(s.FloatingToolbar.MenuPopup,{popupAttributes:ie(l),children:i})]})},Rr=e=>{const{chartId:t}=s.useGraphContext();return(0,n.jsx)(s.FloatingToolbar.ColorPicker,{...e,popupAttributes:ie(t)})},Or=({color:e,opacity:t})=>(0,n.jsx)("span",{className:Tr,style:{background:e,opacity:t}}),kr=({label:e,onClick:t,children:r})=>(0,n.jsx)(s.FloatingToolbar.Button,{"aria-label":e,className:Ar,onClick:t,children:r}),Nr=({label:e,isPressed:t,onClick:r,children:a})=>(0,n.jsx)(s.FloatingToolbar.Button,{"aria-label":e,"aria-pressed":t,className:Pr,onClick:r,children:a}),N={Root:_r,Dropdown:Er,MenuItem:s.FloatingToolbar.MenuItem,ColorPicker:Rr,Swatch:Or,IconButton:kr,ToggleButton:Nr,Button:s.FloatingToolbar.Button,Separator:s.FloatingToolbar.Separator},Dr={kind:"chrome-popup"},jn=()=>{const{commands:e}=s.useGraphContext(),t=s.useEditorStore(),[r,a]=(0,C.useState)(null);(0,C.useEffect)(()=>()=>e.seal(),[e]),(0,C.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:l}=t.getState();return r===null?l("chrome-popup"):i(Dr),()=>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}},Hr="q7gcrz0",zr="q7gcrz1",Fr="q7gcrz2";var Vr=["absolute-difference","relative-difference","proportion"],Re=["absolute-difference","relative-difference"],Gr=["relative-difference","proportion"],Br={"absolute-difference":"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference","relative-difference":"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},Kr=e=>{const{formattingLocale:t}=s.useGraphContext(),r=s.useCompiledSelector(o=>o.config.parsingLocale),a=t??r;return(0,C.useMemo)(()=>{const o=(0,p.areEndpointsComparable)(e.start,e.end);return Vr.filter(i=>o||!Re.includes(i)||i===e.label).map(i=>({kind:i,nameKey:Br[i],preview:(0,p.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),isPickable:o||!Re.includes(i),isSuspect:Gr.includes(i)&&e.start.measurementValue===0}))},[e,a])},ue=[{id:"small",nameKey:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",nameKey:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",nameKey:"graph.annotations.differenceArrowToolbar.size.large"}],Ur=({arrow:e,labelBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),c=jn(),h=Kr(e),u=h.find(b=>b.kind===e.label),m=h.some(b=>b.isPickable&&b.kind!==e.label),v=ue.find(b=>b.id===e.size)??ue[0],g=(b,I)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:b}),I)},x=b=>{g(b),c.close()},f=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})};return(0,n.jsxs)(N.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(N.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(Wr,{option:u}),isDisabled:!m,...c.bind("labelKind"),children:h.map(b=>(0,n.jsxs)(N.MenuItem,{isSelected:b.kind===e.label,isDisabled:!b.isPickable,onClick:()=>x({label:b.kind}),children:[(0,n.jsx)("span",{children:l(b.nameKey)}),(b.isSuspect||!b.isPickable)&&(0,n.jsx)("span",{"aria-label":l(b.isPickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:Fr,children:b.preview})]},b.kind))}),(0,n.jsx)(N.Separator,{}),(0,n.jsx)(N.ColorPicker,{color:e.color,label:l("graph.annotations.differenceArrowToolbar.color"),onChange:b=>g({color:b},{transient:!0}),...c.bind("color"),children:(0,n.jsx)(N.Swatch,{color:e.color??"transparent"})}),(0,n.jsx)(N.Dropdown,{label:l("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:v===void 0?"":l(v.nameKey),...c.bind("size"),children:ue.map(b=>(0,n.jsx)(N.MenuItem,{isSelected:b.id===e.size,onClick:()=>x({size:b.id}),children:l(b.nameKey)},b.id))}),(0,n.jsx)(N.Separator,{}),(0,n.jsx)(N.IconButton,{label:l("graph.annotations.differenceArrowToolbar.swap"),onClick:()=>g({start:e.end.anchor,end:e.start.anchor}),children:(0,n.jsx)(Sr,{size:"sm",title:""})}),(0,n.jsx)(N.IconButton,{label:l("graph.annotations.differenceArrowToolbar.remove"),onClick:f,children:(0,n.jsx)(yn,{size:"sm",title:""})})]})},Wr=({option:e})=>{const t=s.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:zr,children:t(e.nameKey)}),(0,n.jsxs)("span",{className:Hr,children:["(",e.preview,")"]})]})};var qr="ydgo3h0",Zr="ydgo3h1",$r="ydgo3h2";var Xr=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,ye=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 Xr(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)}},Yr=({clientPoint:e,panelOrigin:t,panelRect:r,engine:a,layers:o,coordSystem:i,resolver:l,fixedAnchor:d,align:c})=>{const h=Jr({x:e.x-t.x,y:e.y-t.y},r),{primary:u}=a.query((0,p.toPanelCursor)(h,r));if(u===null)return null;const m=o.find(g=>g.id===u.layerId);if(m===void 0)return null;const v=(0,p.resolveObservationPoint)({resolver:l,layer:m,observation:u.observation,coordSystem:i,align:c});return v===null||(0,p.areAnchorsEqual)(v.anchor,d)?null:v},Jr=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),wn=e=>e==="start"?"end":"start",In=({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}}))},Qr=class extends ye{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:h}=r(),u=Yr({clientPoint:e,panelOrigin:l,panelRect:d,engine:a,layers:c,coordSystem:h,resolver:o,fixedAnchor:i[wn(t)].anchor,align:i[t].anchor.align});return u===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:u}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:a}=this.params;In({dispatch:r,arrow:a().arrow,endpoint:t,anchor:e.anchor})}},ea=({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,oe.useShallow)(h=>({layers:h.layers,coordSystem:h.coordSystem})))}),c=(0,C.useRef)(null);return(0,C.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,C.useCallback)(h=>({onPointerDown:u=>{if(u.button!==0||c.current!==null)return;try{u.currentTarget.setPointerCapture(u.pointerId)}catch{return}u.currentTarget.focus({preventScroll:!0}),u.preventDefault();const m=new Qr({handle:u.currentTarget,pointerId:u.pointerId,press:{x:u.clientX,y:u.clientY},endpoint:h,readInputs:()=>d.current,editorStore:l,engine:i,anchorResolver:o,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=m,m.start()}}),[d,l,i,o,a])},na=[" ","Enter"],ta=({arrow:e})=>{const{commands:t,anchorResolver:r}=s.useGraphContext(),a=s.useEditorStore(),{layers:o,coordSystem:i,mainAxis:l}=s.useCompiledSelector((0,oe.useShallow)(c=>({layers:c.layers,coordSystem:c.coordSystem,mainAxis:c.coordSystem.type==="cartesian"?c.coordSystem.mainAxis:"x"}))),d=e.id;return(0,C.useEffect)(()=>()=>{const c=a.getState();s.readStanding(c,"difference-arrow-endpoint-drag")?.annotationId===d&&c.releaseInteraction("difference-arrow-endpoint-drag")},[a,d]),(0,C.useCallback)(c=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const u=a.getState(),m=s.readDraggedDifferenceArrowEndpointFor(s.readStanding(u,"difference-arrow-endpoint-drag"),e.id,c);if(na.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:e[c]});u.releaseInteraction("difference-arrow-endpoint-drag"),In({dispatch:t.dispatch,arrow:e,endpoint:c,anchor:m.point.anchor});return}if(m===null)return;const v=ra(h.key,l);if(v===null)return;h.preventDefault();const g=aa({arrow:e,endpoint:c,from:m.point.anchor,move:v,layers:o,coordSystem:i,resolver:r});g!==null&&u.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:c,point:g})}}),[e,a,t,r,o,i,l])},ra=(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}},aa=({arrow:e,endpoint:t,from:r,move:a,layers:o,coordSystem:i,resolver:l})=>{const d=o.find(h=>h.id===r.layerId);if(d===void 0)return null;const c=(0,p.stepDifferenceArrowEndpoint)({layer:d,from:r,partner:e[wn(t)].anchor,axis:a.axis,step:a.step,canLandOn:h=>(0,p.resolveObservationPoint)({resolver:l,layer:d,observation:h,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})},oa=e=>{const t=Se();return t===null?null:(0,n.jsx)(ia,{annotationId:t,...e})},ia=({annotationId:e,...t})=>{const r=s.useDifferenceArrowGeometries(),a=(0,C.useMemo)(()=>r.find(o=>o.id===e),[r,e]);return a===void 0?null:(0,n.jsx)(sa,{committedArrow:a.committedArrow,committedLabelBox:a.committedLabelBox,labelBox:a.labelBox,start:a.start,end:a.end,isDragged:a.isDragged,...t})},sa=({committedArrow:e,committedLabelBox:t,labelBox:r,start:a,end:o,panelRect:i,panelOrigin:l,frameRect:d,frameElement:c,isDragged:h})=>{const u=ea({arrow:e,panelOrigin:l,panelRect:i}),m=ta({arrow:e});return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",children:[!h&&(0,n.jsx)(Ur,{arrow:e,labelBox:t,panelRect:i,frameWidth:d.width,frameHeight:d.height,frameElement:c}),(0,n.jsx)("div",{"aria-hidden":"true",className:$r,"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)(Oe,{endpoint:"start",point:a,panelRect:i,dragHandlers:u("start"),keyboardHandlers:m("start")}),(0,n.jsx)(Oe,{endpoint:"end",point:o,panelRect:i,dragHandlers:u("end"),keyboardHandlers:m("end")})]})},Oe=({endpoint:e,point:t,panelRect:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{className:qr,"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:Zr})}),$=(e,t)=>t>0?e/t:0,ke=({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 h=Math.min(0,e),u=Math.min(Math.max(1,e),i-l),m=(0,ee.default)(e+a,h,u);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,ee.default)(i+a,d,c)-e}},la=["top-left","top-right","bottom-right","bottom-left"];var Tn=({width:e,height:t})=>({x:$(16,e),y:$(16,t)}),ca=(e,t)=>({x:Ln(t)?e.x:e.x+e.width,y:Mn(t)?e.y:e.y+e.height}),je=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),An=({region:e,corner:t,delta:r,minSize:a})=>{const o=ke({start:e.x,extent:e.width,isStartMoving:Ln(t),delta:r.x,minExtent:a.x}),i=ke({start:e.y,extent:e.height,isStartMoving:Mn(t),delta:r.y,minExtent:a.y});return{anchorType:"panel",x:o.start,y:i.start,width:o.extent,height:i.extent}},Pn=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ln=e=>e==="top-left"||e==="bottom-left",Mn=e=>e==="top-left"||e==="top-right";var da={hovered:"_1ee8fau1 _1ee8fau0",selected:"_1ee8fau2 _1ee8fau0"},ua={hovered:"_1ee8fau4 _1ee8fau3",selected:"_1ee8fau5 _1ee8fau3"},_n=(e,t,r)=>({x:$(t.x-e.x,r.width),y:$(t.y-e.y,r.height)}),ha=e=>e.x!==0||e.y!==0,En=(e,t)=>({x:e.x*t.width,y:e.y*t.height}),pa=({panelRect:e})=>{const t=s.useResolvedAnnotations(e),r=s.useMeasuredBoxes(),a=Se(),o=s.useEditorState(v=>s.readStanding(v,"move-drag")),i=s.useEditorState(v=>s.readStanding(v,"shape-resize-drag")),l=s.useEditorState(v=>{const g=v.editTargetUnderPointer;return g?.kind==="annotation"?g.id:null}),d=(0,C.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r}),[e.width,e.height,r]),c=Ne(t,a,d),h=Ne(t,l===a?null:l,d),u=v=>{if(i?.annotationId!==v.id)return v.geometry;const g=t.shapes.find(x=>x.id===v.id);return g===void 0?v.geometry:s.measureShapeRegion(je(i.region),g.strokeWidth,d.panel)},m=v=>{if(o?.annotationId!==v)return e;const g=En(o.translation,e);return{x:e.x+g.x,y:e.y+g.y}};return(0,n.jsxs)(n.Fragment,{children:[h!==null&&(0,n.jsx)(De,{annotationId:h.id,geometry:u(h),state:"hovered",origin:m(h.id)}),c!==null&&(0,n.jsx)(De,{annotationId:c.id,geometry:u(c),state:"selected",origin:m(c.id)})]})},Ne=(e,t,r)=>{if(t===null)return null;const a=s.resolveAnnotationChromeGeometry(e,t,r);return a===null?null:{id:t,geometry:a}},De=({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)(He,{point:t.start,state:r,origin:a}),(0,n.jsx)(He,{point:t.end,state:r,origin:a})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:da[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}}),He=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:ua[t],style:{left:r.x+e.x,top:r.y+e.y}}),Rn="l8tsqe0",ma=({panelRect:e})=>{const t=s.useEditorState(o=>s.readStanding(o,"move-drag")),r=s.useResolvedAnnotations(e);if(t===null)return null;const a=En(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:Rn,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:xa(r,t.annotationId,e)})},ga=({annotation:e})=>(0,n.jsx)(s.TextAnnotation,{annotation:e,blockRef:s.useMeasuredBoxRef(e.id)}),te=(e,t,r)=>{const a=e.find(o=>o.id===t);return a===void 0?null:r(a)},va={text:(e,t)=>te(e.textAnnotations,t,r=>(0,n.jsx)(ga,{annotation:r})),shape:(e,t)=>te(e.shapes,t,r=>(0,n.jsx)(s.ShapeAnnotation,{shape:r})),image:(e,t)=>te(e.images,t,r=>(0,n.jsx)(s.ImageAnnotation,{image:r})),arrow:(e,t,r)=>te(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})})},xa=(e,t,r)=>{for(const a of Object.values(va)){const o=a(e,t,r);if(o!==null)return o}return null},Ca=({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:Rn,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:je(t.region)}})})},fa=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"})]})}),me=[{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"}],ba=e=>[...me].reverse().find(t=>t.width<=e)??me[0],Sa=({shape:e,shapeBox:t,panelRect:r,frameWidth:a,frameHeight:o,frameElement:i})=>{const l=s.useI18n(),{commands:d}=s.useGraphContext(),{themeValues:c}=s.useThemeContext(),h=jn(),u=e.fillColor??c.defaultAnnotationShapeFill,m=ba(e.strokeWidth),v=(I,j)=>{d.dispatch(new p.UpdateAnnotationCommand({kind:"shape",id:e.id,patch:I}),j)},g=()=>{d.dispatch(new p.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},x=I=>v({fillColor:I,strokeColor:null},{transient:!0}),f=I=>v({fillOpacity:I},{transient:!0}),b=I=>()=>{v({strokeWidth:I}),h.close()};return(0,n.jsxs)(N.Root,{anchorBox:t,panelRect:r,frameWidth:a,frameHeight:o,label:l("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(N.ColorPicker,{color:u,label:l("graph.annotations.shapeToolbar.color"),onChange:x,opacity:e.fillOpacity,onOpacityChange:f,...h.bind("color"),children:(0,n.jsx)(N.Swatch,{color:u,opacity:e.fillOpacity})}),(0,n.jsx)(N.Dropdown,{label:l("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(fa,{size:"sm",title:""}),...h.bind("border"),children:me.map(I=>(0,n.jsx)(N.MenuItem,{isSelected:I.width===m?.width,onClick:b(I.width),children:l(I.key)},I.width))}),(0,n.jsx)(N.Separator,{}),(0,n.jsx)(N.IconButton,{label:l("graph.annotations.shapeToolbar.remove"),onClick:g,children:(0,n.jsx)(yn,{size:"sm",title:""})})]})},ya="_1a8z7ku0",ja="_1a8z7ku1",re=(e,t)=>{const r=e.shapes.find(a=>a.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},wa=class extends ye{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=re(i,t);return d===null?null:{kind:"shape-resize-drag",annotationId:t,region:An({region:d,corner:r,delta:_n(a,e,l),minSize:Tn(l)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:a}=this.params,o=re(a().annotations,t);o===null||Pn(o,e)||r(new p.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},Ia=({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,C.useRef)(null);return(0,C.useEffect)(()=>()=>i.current?.finish(!1),[]),(0,C.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 wa({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])},Ta=[" ","Enter"],ze=4,Aa=({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,C.useEffect)(()=>()=>{Fe({editorStore:a,annotationId:e,annotations:i.current,dispatch:l.current})},[a,e,i,l]),(0,C.useCallback)(d=>({onKeyDown:c=>{if(c.altKey||c.ctrlKey||c.metaKey||c.shiftKey)return;const h=a.getState(),u=s.readResizedShapeFor(s.readStanding(h,"shape-resize-drag"),e);if(Ta.includes(c.key)){if(c.preventDefault(),c.repeat)return;if(u!==null){Fe({editorStore:a,annotationId:e,annotations:o,dispatch:r.dispatch});return}const v=re(o,e);if(v===null)return;h.claimInteraction({kind:"shape-resize-drag",annotationId:e,region:v});return}if(u===null)return;const m=Pa(c.key,t);m!==null&&(c.preventDefault(),h.claimInteraction({kind:"shape-resize-drag",annotationId:e,region:An({region:u.region,corner:d,delta:m,minSize:Tn(t)})}))}}),[e,o,t,a,r])},Fe=({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=re(r,t);l===null||Pn(l,i.region)||a(new p.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:i.region}}))},Pa=(e,t)=>{const r=$(ze,t.width),a=$(ze,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}},La=e=>{const t=Se(),r=Ea(t),a=Ra(t);if(r===null)return null;const o=a.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return o===null?null:(0,n.jsx)(Ma,{shape:r,region:o,isSettled:a.resizedRegion===null&&!a.isMoved,isMoved:a.isMoved,...e})},Ma=({shape:e,region:t,isSettled:r,isMoved:a,panelRect:o,frameRect:i,frameElement:l})=>{const d=s.useI18n(),c=Ia({annotationId:e.id,panelRect:o}),h=Aa({annotationId:e.id,panelRect:o}),{rect:u}=s.measureShapeRegion(je(t),e.strokeWidth,o);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(Sa,{shape:e,shapeBox:u,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:l}),!a&&la.map(m=>{const v=ca(u,m);return(0,n.jsx)(_a,{corner:m,point:{x:o.x+v.x,y:o.y+v.y},label:d(`graph.annotations.shapeToolbar.resize.${m}`),dragHandlers:c(m),keyboardHandlers:h(m)},m)})]})},_a=({corner:e,point:t,label:r,dragHandlers:a,keyboardHandlers:o})=>(0,n.jsx)("div",{"aria-label":r,className:ja,"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:ya})}),Ea=e=>{const t=s.useCompiledSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},Ra=e=>s.useEditorState((0,oe.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})),Oa=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"})]})}),ka="var(--_1tyillx0)",Na={rest:.5,hovered:.75,open:1};var Da="_1tyillx1",Ha={rest:"_1tyillx2",hovered:"_1tyillx3",open:"_1tyillx4"},za="_1tyillx5",Fa={closed:"_1tyillx6",open:"_1tyillx7"},Va=({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=Ga(e),l=(0,C.useMemo)(()=>{if(o===null)return null;const d=(0,p.projectAnchorToPanel)(o.position,t,a);return{center:d,radius:19*Na[i],target:{kind:"observation",cursor:(0,p.toPanelCursor)(d,t)}}},[o,t,a,i]);return(0,C.useEffect)(()=>{r.getState().setMenuTrigger(l)},[r,l]),(0,C.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)(Da,Ha[i]),style:{left:t.x+l.center.x,top:t.y+l.center.y,...(0,rn.assignInlineVars)({[ka]:o.color??It.vars.border50})},children:(0,n.jsx)("span",{className:(0,B.default)(za,Fa[i==="open"?"open":"closed"]),children:(0,n.jsx)(Oa,{size:"lg"})})})},Ga=e=>e.kind==="menu"?"open":e.kind==="trigger"&&e.isEngaged?"hovered":"rest",Ba='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',Ka=(e,t)=>{const{chartId:r}=s.useGraphContext(),a=s.useEditorStore();(0,C.useEffect)(()=>{if(t===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!Q(i.target,e,r)||a.getState().standingInteraction?.kind==="chrome-popup")return;const l=[...t.querySelectorAll(Ba)];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])},Ua=e=>{const{selectionStore:t,chartId:r}=s.useGraphContext();(0,C.useEffect)(()=>{let a=null;const o=()=>{e.focus({preventScroll:!0})},i=d=>{const{selection:c,clearSelection:h}=t.getState();c.length!==0&&(Q(d.target,e,r)||h())},l=d=>{t.getState().selection.length!==0&&Q(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(Q(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])},Wa=`[${s.EDIT_TARGET_KIND_ATTRIBUTE}]`,On=(e,t,r)=>{if(typeof document.elementsFromPoint!="function")return null;const a=document.elementsFromPoint(e,t);return qa(a,r)},qa=(e,t)=>{for(const r of e){const a=r.closest(Wa);if(a===null||!t.contains(a))continue;const o=Za(a);if(o!==null)return o;if(a!==r)return null}return null},Za=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}},$a=class extends ye{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,_n(r,e,i));return d===null?null:{kind:"move-drag",annotationId:t,translation:d}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;ha(e)&&r(new p.MoveAnnotationCommand({id:t,translation:e}))}},Xa=(e,t,r)=>{const{commands:a,selectionStore:o}=s.useGraphContext(),i=s.useEditorStore(),l=s.useLatestRef({annotations:s.useCompiledSelector(h=>h.spec.annotations),panelRect:r}),d=s.useLatestRef(t),c=(0,C.useRef)(null);(0,C.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,C.useEffect)(()=>{const h=v=>{const{editTargetUnderPointer:g,standingInteraction:x}=i.getState();return g!==null&&x===null&&v.pointerType==="mouse"&&Ya(v.target,e)?g:On(v.clientX,v.clientY,e)},u=(v,g)=>{if(c.current!==null||!s.canMoveAnnotationOnCanvas(l.current.annotations,g.id))return;try{e.setPointerCapture(v.pointerId)}catch{return}v.preventDefault();const x=new $a({handle:e,pointerId:v.pointerId,annotationId:g.id,press:{x:v.clientX,y:v.clientY},readInputs:()=>l.current,editorStore:i,dispatch:a.dispatch,onSettled:()=>{c.current=null}});c.current=x,x.start()},m=v=>{if(v.button!==0||cn(v.target)||dn(v,d.current,i.getState().menuTrigger))return;const g=h(v),x=o.getState();if(g===null){x.clearSelection();return}x.setSelection([g]),u(v,g)};return document.addEventListener("pointerdown",m),()=>document.removeEventListener("pointerdown",m)},[e,i,o,a,l,d])},Ya=(e,t)=>e instanceof Node&&t.contains(e),Ja=e=>{const{selectionStore:t,commands:r,chartId:a}=s.useGraphContext(),o=s.useEditorStore(),i=(0,C.useCallback)(d=>{const{selection:c}=t.getState(),h=Sn(c);h!==null&&(d.preventDefault(),r.dispatch(new p.RemoveAnnotationCommand({id:h})),e.focus({preventScroll:!0}))},[e,r,t]),l=(0,C.useCallback)(d=>{const c=o.getState();switch(c.standingInteraction?.kind){case"difference-arrow-endpoint-drag":c.releaseInteraction("difference-arrow-endpoint-drag");return;case"move-drag":c.releaseInteraction("move-drag");return;case"shape-resize-drag":c.releaseInteraction("shape-resize-drag");return;case"chrome-popup":return;case"menu":c.releaseInteraction("menu");return;default:if(ln(d.target,a)){e.focus({preventScroll:!0});return}t.getState().clearSelection();return}},[o,t,e,a]);(0,C.useEffect)(()=>{const d=c=>{if(Q(c.target,e,a)&&!Qa(c.target)&&!Mt(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])},Qa=e=>e instanceof HTMLElement&&(e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),eo=()=>{const e=s.useHoverState(o=>o.hover.primary),{layers:t,coordSystem:r}=s.useCompiledSelector((0,oe.useShallow)(o=>({layers:o.layers,coordSystem:o.coordSystem}))),{anchorResolver:a}=s.useGraphContext();return(0,C.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])},no={kind:"idle"},kn=()=>{const e=s.useEditorState(a=>a.standingInteraction),t=s.useEditorState(a=>a.chromeUnderPointer),r=eo();return(0,C.useMemo)(()=>e!==null?e:r===null?no:{kind:"trigger",anchor:r,isEngaged:t==="menu-trigger"},[e,r,t])},to=(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),h=s.useLatestRef(r);(0,C.useEffect)(()=>{const u=f=>dn(f,c.current,a.getState().menuTrigger),m=f=>{if(u(f)||o.getState().selection.length>0)return;const b=h.current,I=c.current,j={x:f.clientX-I.x,y:f.clientY-I.y},A=ro(j,b)?l.query((0,p.toPanelCursor)(j,b)):p.RESTING_HOVER_STATE;i.getState().setHoverState(A)};let v=!1;const g=()=>{v=d.current.kind==="menu"},x=f=>{if(cn(f.target))return;const{claimInteraction:b,releaseInteraction:I}=a.getState();if(!u(f)||v){I("menu"),v&&m(f);return}const j=d.current;j.kind==="trigger"&&b({kind:"menu",anchor:j.anchor})};return document.addEventListener("pointerdown",g,!0),document.addEventListener("click",x),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("click",x)}},[a,o,d,i,l,c,h])},ro=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,ao=(e,t)=>{const r=s.useEditorStore(),a=s.useLatestRef(t);(0,C.useEffect)(()=>{let o=null,i=null;const l=g=>{const{menuTrigger:x}=r.getState();return x===null?null:(0,p.isPointWithinEditMenuTrigger)(g,x)?"menu-trigger":null},d=()=>{o=null;const g=i;if(g===null)return;const x=a.current,f=r.getState();if(f.setChromeUnderPointer(l({x:g.x-x.x,y:g.y-x.y})),he(f.standingInteraction))return;const b=On(g.x,g.y,e);f.setEditTargetUnderPointer(b)},c=()=>{o===null&&(o=requestAnimationFrame(d))},h=()=>{const g=r.getState();g.setChromeUnderPointer(null),g.setEditTargetUnderPointer(null)},u=g=>{i={x:g.clientX,y:g.clientY},c()},m=()=>{i=null,o!==null&&(cancelAnimationFrame(o),o=null),h()},v=r.subscribe((g,x)=>{!he(x.standingInteraction)||he(g.standingInteraction)||i!==null&&c()});return e.addEventListener("pointermove",u),e.addEventListener("pointerleave",m),()=>{o!==null&&cancelAnimationFrame(o),v(),e.removeEventListener("pointermove",u),e.removeEventListener("pointerleave",m),h()}},[e,r,a])},he=e=>{if(e===null)return!1;switch(e.kind){case"menu":case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":return!0;case"chrome-popup":return!1}},Ve="editor",Ge=[],oo=(e,t,r,a)=>{const o=kn(),{store:i}=s.useHoverContext(),l=s.useGraphSelection().length>0,d=s.useEditorState(u=>u.menuTrigger),c=o.kind==="menu",h=(0,C.useMemo)(()=>d===null?Ge:[(0,p.buildEditMenuTriggerRegion)(d)],[d]);ao(e,t),Xa(e,t,r),to(o,t,r),Ua(e),Ja(e),Ka(e,a),(0,C.useEffect)(()=>(i.getState().publishPointerRegions(Ve,h),()=>i.getState().publishPointerRegions(Ve,Ge)),[i,h]),(0,C.useEffect)(()=>(i.getState().setPointerSuspended(c||l),()=>i.getState().setPointerSuspended(!1)),[i,c,l]),(0,C.useEffect)(()=>{if(!l)return;const u=i.getState();u.setHoverState(p.RESTING_HOVER_STATE),u.setTooltipAnchor(null)},[i,l])},io=({frameElement:e,panelRect:t})=>{const{measureRef:r,screenRect:a}=s.useElementScreenRect(),o=s.useEditorStore();return(0,C.useEffect)(()=>(r(e),()=>r(null)),[r,e]),(0,C.useEffect)(()=>()=>o.getState().releaseInteraction("menu"),[o]),a===null?null:(0,n.jsx)(Et,{children:(0,n.jsx)(so,{frameElement:e,frameRect:a,panelRect:t})})},so=({frameElement:e,frameRect:t,panelRect:r})=>{const a=(0,C.useMemo)(()=>({x:t.left+r.x,y:t.top+r.y}),[t.left,t.top,r.x,r.y]),[o,i]=(0,C.useState)(null);return oo(e,a,r,o),(0,n.jsx)(lo,{frameElement:e,frameRect:t,panelOrigin:a,panelRect:r,boxRef:i})},lo=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:a,boxRef:o})=>{const i=fe(),l=kn();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)(oa,{panelRect:a,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(La,{panelRect:a,frameRect:t,frameElement:e}),(0,n.jsx)(ma,{panelRect:a}),(0,n.jsx)(Ca,{panelRect:a}),(0,n.jsx)(pa,{panelRect:a}),(0,n.jsx)(Va,{interaction:l,panelRect:a}),(0,n.jsx)(vr,{interaction:l,panelOrigin:r})]})})},co=({slots:e,...t})=>(0,n.jsx)(s.EditorProvider,{children:(0,n.jsx)(s.GraphRenderer,{slots:(0,C.useMemo)(()=>({EditorSurface:io,...e}),[e]),...t})}),Nn=(0,C.createContext)(null),Dn=({labelId:e,controlId:t,children:r})=>{const a=(0,C.useMemo)(()=>{let o=null;return{labelId:e,controlId:t,claimControlId:i=>(o??=i,o===i)}},[e,t]);return(0,n.jsx)(Nn.Provider,{value:a,children:r})},K=({id:e,ariaLabel:t,ariaLabelledBy:r},a=!0)=>{const o=(0,C.useContext)(Nn),i=(0,C.useId)(),[l]=(0,C.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 uo={default:"woi4bh4 woi4bh3",tile:"woi4bh5 woi4bh3"},Hn=({label:e,icon:t,onClick:r,variant:a="default",isDisabled:o,ariaLabel:i,ariaLabelledBy:l,id:d})=>{const c=K({id:d,ariaLabel:i,ariaLabelledBy:l}),h=a==="tile";return(0,n.jsxs)("button",{type:"button",className:uo[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:h?"woi4bh2":"woi4bh1",children:e})]})},we=(0,C.createContext)(null),L=()=>{const e=(0,C.useContext)(we);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},zn=({children:e,onKeyDown:t,...r})=>{const a=(0,C.useContext)(we),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})},Fn="keyboard",se=e=>{const t=(0,C.useRef)(!1),r=(0,C.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()}}}},ho="eh8dvc0",po="eh8dvc1 uz3g760",mo="eh8dvc2 uz3g761";var Vn=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,placeholder:l,prefix:d,suffix:c,isDisabled:h,hasError:u,ariaLabel:m,ariaLabelledBy:v,id:g})=>{const x=K({id:g,ariaLabel:m,ariaLabelledBy:v}),{commitUnlessHeldKey:f,gestureHandlers:b}=se(r);return(0,n.jsx)(_e.NumberField.Root,{className:ho,value:e,onValueChange:I=>t(I),onValueCommitted:(I,j)=>{f(j.reason===Fn)},min:a,max:o,step:i,disabled:h,children:(0,n.jsxs)(zn,{className:po,"data-error":u===!0,"data-disabled":h===!0?"":void 0,children:[d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d}),(0,n.jsx)(_e.NumberField.Input,{className:mo,placeholder:l,...b,"aria-invalid":u===!0?!0:void 0,...x}),c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c})]})})},go="_1b7s5f0",Z={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},vo="_1b7s5f7";var xo=6,Gn=({options:e,value:t,onChange:r,onCommit:a,columns:o,itemLayout:i="tile",isDisabled:l,ariaLabel:d,ariaLabelledBy:c,id:h})=>{const u=K({id:h,ariaLabel:d,ariaLabelledBy:c}),m=i==="swatch",{commitAfterChange:v,gestureHandlers:g}=se(a);return(0,n.jsx)(on.RadioGroup,{className:(0,B.default)(go,Co(o??e.length)),value:t,onValueChange:x=>{r(x),v()},...g,disabled:l,...u,children:e.map(x=>(0,n.jsxs)(an.Radio.Root,{value:x.value,disabled:x.isDisabled,className:(0,B.default)(vo,m&&"_1b7s5f8"),"aria-label":m?x.label:void 0,children:[x.icon,!m&&(0,n.jsx)("span",{className:"_1b7s5f9",children:x.label})]},x.value))})},Co=e=>{switch(Math.min(Math.max(Math.round(e),1),xo)){case 1:return Z[1];case 2:return Z[2];case 3:return Z[3];case 4:return Z[4];case 5:return Z[5];default:return Z[6]}},fo="_1g5x15w0 uz3g760",bo="_1g5x15w1",So="_1g5x15w2",Be="_1g5x15w3",yo="_1g5x15w4",jo="_1g5x15w5",wo="_1g5x15w6",Io="_1g5x15w7";var Bn=({options:e,value:t,onChange:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=K({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,n.jsxs)(F.Select.Root,{value:t,onValueChange:u=>u!==null&&r(u),disabled:o,items:e.map(u=>({value:u.value,label:u.label})),children:[(0,n.jsxs)(F.Select.Trigger,{className:fo,"data-error":i===!0,...h,children:[(0,n.jsx)(F.Select.Value,{className:bo,children:u=>To(e,u,a)}),(0,n.jsx)(F.Select.Icon,{className:Be,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:yo,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(F.Select.Popup,{className:jo,children:e.map(u=>(0,n.jsxs)(F.Select.Item,{value:u.value,disabled:u.isDisabled,className:wo,children:[u.icon,(0,n.jsxs)("span",{className:Io,children:[(0,n.jsx)(F.Select.ItemText,{children:u.label}),u.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:u.description})]}),(0,n.jsx)(F.Select.ItemIndicator,{className:Be,children:(0,n.jsx)(s.CheckIcon,{size:"sm"})})]},u.value))})})})})]})},To=(e,t,r)=>t===null?(0,n.jsx)("span",{className:So,children:r}):Ao(e,t),Ao=(e,t)=>e.find(r=>r.value===t)?.label??t,Po="vod76w0",Lo="vod76w1",Mo="vod76w2",_o="vod76w3",Eo="vod76w4",Ro="vod76w5";var Kn=({value:e,onChange:t,onCommit:r,min:a,max:o,step:i,suffix:l,formatValue:d,isDisabled:c,ariaLabel:h,ariaLabelledBy:u})=>{const m=K({ariaLabel:h,ariaLabelledBy:u},!1),v=Oo(e,l,d),{commitUnlessHeldKey:g,gestureHandlers:x}=se(r);return(0,n.jsxs)("div",{className:Po,children:[(0,n.jsx)(X.Slider.Root,{className:Lo,value:e,onValueChange:f=>t(f),onValueCommitted:(f,b)=>{g(b.reason===Fn)},min:a,max:o,step:i,disabled:c,children:(0,n.jsx)(X.Slider.Control,{className:Mo,children:(0,n.jsxs)(X.Slider.Track,{className:_o,children:[(0,n.jsx)(X.Slider.Indicator,{className:Eo}),(0,n.jsx)(X.Slider.Thumb,{className:Ro,...x,...m})]})})}),v!==null&&(0,n.jsx)("span",{className:"vod76w6",children:v})]})},Oo=(e,t,r)=>r!==void 0?r(e):t!==void 0?`${e}${t}`:null,ko="_1hyrlw60",No="_1hyrlw61",Un=({isChecked:e,onChange:t,isDisabled:r,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const l=K({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,n.jsx)(Ee.Switch.Root,{checked:e,onCheckedChange:d=>t(d),disabled:r,className:ko,...l,children:(0,n.jsx)(Ee.Switch.Thumb,{className:No})})},Do="uz3g761",Ho="tpcnun0 uz3g760",Wn=({value:e,onChange:t,onCommit:r,placeholder:a,isDisabled:o,hasError:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=K({id:c,ariaLabel:l,ariaLabelledBy:d});return(0,n.jsx)(zn,{className:Ho,"data-error":i===!0,children:(0,n.jsx)(At.Input,{className:Do,value:e,onValueChange:u=>t(u),onBlur:r,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...h})})},zo="cnu9yl0",Fo="cnu9yl1";var qn=({options:e,value:t,onChange:r,onCommit:a,itemLayout:o="inline",isDisabled:i,ariaLabel:l,ariaLabelledBy:d,id:c})=>{const h=K({id:c,ariaLabel:l,ariaLabelledBy:d}),u=o==="stacked",{commitAfterChange:m,gestureHandlers:v}=se(a);return(0,n.jsx)(on.RadioGroup,{className:zo,value:t,onValueChange:g=>{r(g),m()},...v,disabled:i,...h,children:e.map(g=>(0,n.jsxs)(an.Radio.Root,{value:g.value,disabled:g.isDisabled,className:(0,B.default)(Fo,u&&"cnu9yl2"),"aria-label":Vo(g,u),children:[g.icon,Zn(g,u)&&(0,n.jsx)("span",{className:"cnu9yl3",children:g.label})]},g.value))})},Zn=(e,t)=>e.icon===void 0||t,Vo=(e,t)=>{if(!Zn(e,t))return e.label},$n={ToggleGroup:qn,Switch:Un,Slider:Kn,RadioGrid:Gn,Button:Hn,TextField:Wn,NumberField:Vn,Select:Bn},Xn=(0,C.createContext)($n),Go=({controls:e,children:t})=>{const r=(0,C.useMemo)(()=>({...$n,...e}),[e]);return(0,n.jsx)(Xn.Provider,{value:r,children:t})},M=()=>(0,C.useContext)(Xn),Bo="_12lhx9e0",Yn=({children:e})=>(0,n.jsx)("div",{className:Bo,children:e}),Ko="_139ohwv0",D=({children:e})=>(0,n.jsx)("div",{className:Ko,children:e}),Jn=(0,C.createContext)(null),Uo=Jn.Provider,Qn=()=>{const e=(0,C.useContext)(Jn);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},Wo="_1jlczkt0",et="data-graphy-editor-panel",qo={List:D,Grid:Yn};function Zo(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var $o=({handle:e,children:t,controls:r,defaultExpandedSection:a=void 0,className:o})=>{const i=s.useGraphHandle(e),{themeClass:l,inlineVarsStyle:d}=s.useThemeContext(),[c,h]=(0,C.useState)(()=>a?[a]:[]),u=(0,C.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,n.jsx)(we.Provider,{value:i,children:(0,n.jsx)(Go,{controls:r,children:(0,n.jsx)(Uo,{value:u,children:(0,n.jsx)(J.Accordion.Root,{[et]:"",className:(0,B.default)(Wo,o,{[l]:!Zo(o)}),style:d,value:c,onValueChange:m=>h(m),children:t})})})})},Ie={Root:$o,Controls:qo},Ke={stack:"pr583x0",grid:"pr583x1"},Ue="pr583x2",Xo={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},S=({label:e,layout:t="grid",icon:r,children:a})=>{const o=(0,C.useId)(),i=(0,C.useId)();return e===void 0?(0,n.jsx)("div",{className:Ke[t],children:(0,n.jsx)("div",{className:Ue,children:a})}):(0,n.jsxs)("div",{className:Ke[t],children:[(0,n.jsxs)("label",{id:o,htmlFor:i,className:Xo[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:Ue,children:(0,n.jsx)(Dn,{labelId:o,controlId:i,children:a})})]})},Yo=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"})})}),Te="_40zvwv0",Ae="_40zvwv1",Jo="_40zvwv2",nt="_40zvwv3",Qo="_40zvwv4 _40zvwv3";var ei="_40zvwv6";var ni="_40zvwv8",O=({title:e,layout:t="fixed",preview:r,accessory:a,onOpenChange:o,children:i})=>t==="collapsible"?(0,n.jsx)(ri,{title:e,preview:r,accessory:a,onOpenChange:o,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(ti,{title:e,accessory:a,children:i}):(0,n.jsxs)("div",{className:Te,children:[(0,n.jsxs)("div",{className:Ae,children:[(0,n.jsx)("span",{className:nt,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})]}),ti=({title:e,accessory:t,children:r})=>{const a=(0,C.useId)(),o=(0,C.useId)();return(0,n.jsx)("div",{className:Te,children:(0,n.jsxs)("div",{className:Ae,children:[(0,n.jsx)("label",{id:a,htmlFor:o,className:Qo,children:e}),(0,n.jsx)("span",{className:ei,children:(0,n.jsx)(Dn,{labelId:a,controlId:o,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},ri=({title:e,preview:t,accessory:r,onOpenChange:a,children:o})=>{const i=s.useI18n();return(0,n.jsxs)(J.Accordion.Item,{value:e,className:Te,onOpenChange:a,children:[(0,n.jsxs)(J.Accordion.Header,{className:Ae,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(J.Accordion.Trigger,{className:Jo,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:nt,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:ni,children:(0,n.jsx)(Yo,{size:"sm"})})]}),(0,n.jsx)(J.Accordion.Panel,{children:(0,n.jsx)("div",{children:o})})]})},tt=({title:e,isChecked:t,onToggle:r,isDisabled:a,preview:o,children:i})=>{const{expandSection:l,collapseAllSections:d}=Qn(),{Switch:c}=M(),h=m=>{r(m),m?l(e):d()},u=m=>{m&&!t&&a!==!0&&r(!0)};return(0,n.jsx)(O,{title:e,layout:"collapsible",preview:o,onOpenChange:u,accessory:(0,n.jsx)(c,{isChecked:t,onChange:h,isDisabled:a,ariaLabel:e}),children:i})},ai={horizontal:["bottom","top"],vertical:["left","right"]},oi={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},ii={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},ge=({axis:e,title:t,layout:r="collapsible",preview:a})=>{const o=L(),i=s.useHandleCompiled(o),l=s.useI18n(),{NumberField:d,Switch:c,TextField:h,ToggleGroup:u}=M();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",v=i.config.axes[e],g=i.scales[e],x=g?.spec,f=x?.scaleType==="continuous"?x:void 0;if(m==="circular"||m==="radial"&&f===void 0)return null;const b=x!==void 0&&"reverse"in x?x:void 0,I=x?.scaleType==="continuous"||x?.scaleType==="datetime",j=e==="y"&&f!==void 0&&i.layers.some(y=>y.yScaleType==="primary"&&y.geom==="bar"),A=f?.transform==="log",T=f?.domainMax??null,_=si(f),k=(y,V)=>y.map(ne=>({value:ne,label:V(ne)})),E=i.guides.axes.find(y=>y.scaleAestheticKey===e)?.position,H=ai[E==="bottom"||E==="top"||E===void 0&&e==="x"?"horizontal":"vertical"],P=i.guides.legends.drawn.some(y=>H.some(V=>V===y.position)),w=H.map(y=>({value:y,label:l(oi[y])})),R=k(["auto","edges"],y=>l(y==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),U=k(["linear","log"],y=>l(y==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),ut=k(["auto","zero","custom"],y=>l(y==="zero"?"editor.axesPanel.startFrom.zero":y==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),ht=k(["auto","custom"],y=>l(y==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),pt=k(["no","yes"],y=>l(y==="yes"?"editor.axesPanel.yesNo.yes":"editor.axesPanel.yesNo.no")),mt=y=>{o.commands.dispatch(new p.SetAxisVisibilityCommand({axis:e,isVisible:y}))},gt=y=>{o.commands.dispatch(new p.SetAxisLabelCommand({axis:e,label:y===""?null:y}),{transient:!0})},vt=y=>{o.commands.dispatch(new p.SetAxisTicksVisibilityCommand({axis:e,isVisible:y}))},xt=y=>{o.commands.dispatch(new p.SetAxisTickModeCommand({axis:e,tickMode:y==="edges"?"edges":"auto"}))},Ct=y=>{o.commands.dispatch(new p.SetScaleReverseCommand({scaledAesthetic:e,reverse:y==="yes"}))},ft=y=>{o.commands.dispatch(new p.SetScaleTransformCommand({scaledAesthetic:e,transform:y==="log"?"log":"linear"}))},Me=y=>{o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,...y}),{transient:!0})},bt=y=>{y!==null&&Me({domainMin:y})},St=y=>{y!==null&&Me({domainMax:y})},yt=y=>{if(f){if(y==="custom"){f.zero&&o.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:!1})),o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:We(g?.domain,"start")}));return}f.domainMin!==null&&o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMin:null})),o.commands.dispatch(new p.SetScaleZeroCommand({scaledAesthetic:e,zero:y==="zero"}))}},jt=y=>{const V=y==="custom"?We(g?.domain,"end"):null;o.commands.dispatch(new p.SetScaleDomainCommand({scaledAesthetic:e,domainMax:V}))},wt=y=>{const V=H.find(ne=>ne===y);V&&o.commands.dispatch(new p.SetAxisPositionCommand({axis:e,position:V}))};return(0,n.jsx)(O,{title:t??l(ii[e]),layout:r,preview:a,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:l("editor.axesPanel.controls.visible"),children:(0,n.jsx)(c,{isChecked:v.isVisible,onChange:mt})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S,{label:l("editor.axesPanel.controls.title"),children:(0,n.jsx)(h,{value:v.label??"",onChange:gt,onCommit:o.commands.seal})}),(0,n.jsx)(S,{label:l("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(c,{isChecked:v.ticks.isVisible,onChange:vt})})]}),I&&(0,n.jsx)(S,{label:l("editor.axesPanel.controls.labels"),children:(0,n.jsx)(u,{value:v.ticks.mode,options:R,onChange:xt})}),f&&m==="linear"&&!P&&(0,n.jsx)(S,{label:l("editor.axesPanel.controls.position"),children:(0,n.jsx)(u,{value:E??v.position,options:w,onChange:wt})}),b!==void 0&&(0,n.jsx)(S,{label:l("editor.axesPanel.controls.reverse"),children:(0,n.jsx)(u,{value:b.reverse===!0?"yes":"no",options:pt,onChange:Ct})}),f&&!j&&(0,n.jsx)(S,{label:l("editor.axesPanel.controls.scale"),children:(0,n.jsx)(u,{value:A?"log":"linear",options:U,onChange:ft})}),f&&!A&&(0,n.jsxs)(n.Fragment,{children:[!j&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S,{label:l("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(u,{value:_,options:ut,onChange:yt})}),_==="custom"&&(0,n.jsx)(S,{label:l("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:f.domainMin??null,onChange:bt,onCommit:o.commands.seal})})]}),(0,n.jsx)(S,{label:l("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(u,{value:T===null?"auto":"custom",options:ht,onChange:jt})}),T!==null&&(0,n.jsx)(S,{label:l("editor.axesPanel.controls.value"),children:(0,n.jsx)(d,{value:T,onChange:St,onCommit:o.commands.seal})})]})]})})},si=e=>e===void 0?"auto":e.domainMin!==null&&e.domainMin!==void 0?"custom":e.zero===!0?"zero":"auto",We=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},Pe=({value:e,onChange:t})=>{const r=L(),a=s.useI18n(),{TextField:o}=M(),i=e!==null&&typeof e!="string",l=d=>t(d===""?null:d);return(0,n.jsx)(S,{label:a("editor.elementsPanel.contentValue"),children:(0,n.jsx)(o,{value:typeof e=="string"?e:"",onChange:l,onCommit:r.commands.seal,isDisabled:i})})},rt=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=M();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"caption",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentCaptionCommand({caption:u}),{transient:!0})};return(0,n.jsx)(O,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isCaptionVisible,onChange:c})}),(0,n.jsx)(Pe,{value:d.caption,onChange:h})]})})},qe=/^[a-z][a-z\d+.-]*:/i,li={},at=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=M();if(!o)return null;const d=o.config.content,c=h=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"source",isVisible:h}))};return(0,n.jsx)(O,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isSourceVisible,onChange:c})}),(0,n.jsx)(ci,{source:d.source??li})]})})},ci=({source:e})=>{const t=L(),r=s.useI18n(),{TextField:a}=M(),o=c=>{const h=(c.label??"")!==""||(c.url??"")!=="";t.commands.dispatch(new p.SetContentSourceCommand({source:h?c:null}),{transient:!0})},i=()=>{const c=e.url??"";c!==""&&!qe.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)(S,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(a,{value:e.url??"",onChange:l,onCommit:i,hasError:qe.test(e.url??"")&&!(0,p.isSafeUrl)(e.url)})}),(0,n.jsx)(S,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(a,{value:e.label??"",onChange:d,onCommit:t.commands.seal})})]})},ot=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=M();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"subtitle",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentSubtitleCommand({subtitle:u}),{transient:!0})};return(0,n.jsx)(O,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isSubtitleVisible,onChange:c})}),(0,n.jsx)(Pe,{value:d.subtitle,onChange:h})]})})},ve=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],di=ve.length/2,it=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=M();if(!o)return null;const{textScale:d}=o.config.appearance,c=m=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${m}`}),h=ve.map(m=>({value:`${m}`,label:c(m)})),u=m=>{const v=ve.find(g=>`${g}`===m);v!==void 0&&a.commands.dispatch(new p.SetAppearanceTextScaleCommand({textScale:v}))};return(0,n.jsx)(O,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??c(d),children:(0,n.jsx)(l,{value:`${d}`,options:h,columns:di,onChange:u,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},st=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l}=M();if(!o)return null;const d=o.config.content,c=u=>{a.commands.dispatch(new p.ToggleContentVisibilityCommand({slot:"title",isVisible:u}))},h=u=>{a.commands.dispatch(new p.SetContentTitleCommand({title:u}),{transient:!0})};return(0,n.jsx)(O,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(l,{isChecked:d.isTitleVisible,onChange:c})}),(0,n.jsx)(Pe,{value:d.title,onChange:h})]})})},ui=({children:e,...t})=>(0,n.jsx)(Ie.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(st,{}),(0,n.jsx)(ot,{}),(0,n.jsx)(rt,{}),(0,n.jsx)(at,{}),(0,n.jsx)(it,{})]})}),hi=({children:e,...t})=>(0,n.jsx)(Ie.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ge,{axis:"x"}),(0,n.jsx)(ge,{axis:"y"})]})}),le=e=>`${e}px`,lt=e=>`${Math.round(e*100)}%`,pi=e=>`${e}°`,mi=24,gi={select:{target:"graph"}},Ze=["dim","desaturate"],vi=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=M();if(!o)return null;const c=(0,p.createStyleResolver)().chromeReaders(o.chrome).graph.get("borderRadius"),h=(0,p.readHighlightDimStyle)(o.spec),u=Ze.map(g=>({value:g,label:i(g==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.grey")})),m=g=>{const x=(0,p.findStyleRule)(o.spec.styles.overrides,gi)?.declarations??{};a.commands.dispatch(new p.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...x,borderRadius:g}}}),{transient:!0})},v=g=>{const x=Ze.find(f=>f===g);x&&a.commands.dispatch(new p.SetHighlightDimStyleCommand({dimStyle:x}))};return(0,n.jsx)(O,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(l,{value:c,min:0,max:mi,step:1,formatValue:le,onChange:m,onCommit:a.commands.seal})}),(0,n.jsx)(S,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(d,{value:h,options:u,onChange:v})})]})})},Le=(e,t)=>{const{colorScheme:r}=s.useThemeContext();return(0,C.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])},xi=.05,Ci=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,ToggleGroup:d}=M(),c=o?(0,p.findLayerByGeom)(o.spec.layers,"bar"):void 0,h=Le(o,c?.id??null);if(!o||!c||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const u=g=>{a.commands.dispatch(new p.SetBarWidthCommand({layerId:c.id,width:g}),{transient:!0})},m=g=>{const x=p.BORDER_RADIUS_TOKENS.find(f=>f===g);x&&a.commands.dispatch(new p.SetBarBorderRadiusCommand({layerId:c.id,borderRadius:x}))},v=p.BORDER_RADIUS_TOKENS.map(g=>({value:g,label:i(`editor.graphPanel.barSection.roundingOptions.${g}`)}));return(0,n.jsx)(O,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{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:xi,formatValue:lt,onChange:u,onCommit:a.commands.seal})}),(0,n.jsx)(S,{label:i("editor.graphPanel.barSection.rounding"),layout:"stack",children:(0,n.jsx)(d,{value:h?.get("borderRadius")??p.DEFAULT_BAR_BORDER_RADIUS,options:v,onChange:m})})]})})},ce=({children:e})=>{const t=(0,C.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"})]})})]})},de="qdaoth0",fi=e=>(0,n.jsxs)(s.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(ce,{children:(0,n.jsx)("path",{className:de,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"})]}),bi=e=>(0,n.jsx)(s.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(ce,{children:[(0,n.jsx)("path",{className:de,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"})]})}),Si=e=>(0,n.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(ce,{children:(0,n.jsx)("path",{className:de,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"})]}),yi=e=>(0,n.jsxs)(s.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(ce,{children:(0,n.jsx)("path",{className:de,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"})]}),ji={x:.5,y:.5},wi=.2,Ii={x:.375,y:.25,width:.25,height:.5},Ti={fillColor:null,fillOpacity:.25,strokeWidth:0,zOrder:"background"},Ai={x:.4,y:.6},Pi={x:.6,y:.4},Li="relative-difference",Mi=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Button:l}=M();if(!o)return null;const d=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"text",annotation:{...p.TEXT_ANNOTATION_DEFAULTS,content:_i(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...ji},width:wi}}))},c=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"arrow",annotation:{...p.ARROW_DEFAULTS,start:{anchorType:"panel",...Ai},end:{anchorType:"panel",...Pi}}}))},h=()=>{a.commands.dispatch(new p.AddAnnotationCommand({kind:"shape",annotation:{...p.SHAPE_DEFAULTS,...Ti,region:{anchorType:"panel",...Ii}}}))},u=()=>{const v=(0,p.inferDefaultDifferenceArrowEndpoints)(o);v!==null&&a.commands.dispatch(new p.AddAnnotationCommand({kind:"differenceArrow",annotation:{...p.DIFFERENCE_ARROW_DEFAULTS,...v,label:Li}}))},m=o.coordSystem.type==="cartesian";return(0,n.jsx)(O,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(Yn,{children:[(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(yi,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:d}),(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(fi,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:c}),(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(bi,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,n.jsx)(l,{variant:"tile",icon:(0,n.jsx)(Si,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:u})]})})},_i=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Ei=.1,Ri=20,Oi=({title:e,preview:t})=>{const r=L(),a=s.useHandleCompiled(r),o=s.useI18n(),{NumberField:i,TextField:l}=M();if(!a||a.coordSystem.type==="polar")return null;const d=(0,p.findGoalLineLayer)(a.spec.layers),c=e??o("editor.annotationsPanel.goalSection.title"),h=(0,p.extractConstantValue)(d?.mapping.y),u=typeof h=="number"?h:null,m=x=>{const f=new p.ToggleGoalLineCommand({showGoalLine:x,value:ki(a),...d!==void 0&&{layerId:d.id}});r.commands.dispatch(f)},v=x=>{if(d===void 0)return;const f=new p.SetRuleLabelCommand({layerId:d.id,label:x===""?null:x});r.commands.dispatch(f,{transient:!0})},g=x=>{if(d===void 0||x===null)return;const f=new p.SetRuleValueCommand({layerId:d.id,value:x});r.commands.dispatch(f,{transient:!0})};return(0,n.jsx)(tt,{title:c,preview:t,isChecked:d!==void 0,onToggle:m,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(l,{value:d?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:v,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(S,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:u,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:g,onCommit:r.commands.seal,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},ki=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(Ri,Math.max(0,1-Math.floor(Math.log10(o))));return Number((r+o*Ei).toFixed(i))},Ni=({layerId:e,title:t,layout:r="collapsible",preview:a})=>{const o=L(),i=s.useHandleCompiled(o),l=s.useI18n(),{Switch:d}=M();if(!i)return null;const c=e===void 0?i.spec.layers[0]:i.spec.layers.find(E=>E.id===e);if(!c)return null;const{showDataLabels:h,format:u,showStackTotals:m,showCategoryLabels:v}=c.dataLabels,g=i.coordSystem.type==="polar",x=c.geom==="bar",f=c.position==="stack"||c.position==="fill",b=x&&!g&&c.position==="stack",I=x&&(!g||h),j=x||c.geom==="area"&&f;if(!(0,p.canPlaceDataLabels)(c.geom,i.coordSystem.type))return null;const A=E=>{const H=new p.ToggleDataLabelsCommand({layerId:c.id,showDataLabels:E});o.commands.dispatch(H)},T=E=>{const H=new p.SetDataLabelsFormatCommand({layerId:c.id,format:E?"percentage":"absolute"});o.commands.dispatch(H)},_=E=>{const H=new p.ToggleStackTotalsCommand({layerId:c.id,showStackTotals:E});o.commands.dispatch(H)},k=E=>{const H=new p.ToggleCategoryLabelsCommand({layerId:c.id,showCategoryLabels:E});o.commands.dispatch(H)};return(0,n.jsx)(O,{title:t??l("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:a,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:l("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(d,{isChecked:h,onChange:A})}),h&&j&&(0,n.jsx)(S,{label:l("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(d,{isChecked:u==="percentage",onChange:T})}),b&&(0,n.jsx)(S,{label:l("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(d,{isChecked:m,onChange:_})}),I&&(0,n.jsx)(S,{label:l("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(d,{isChecked:v,onChange:k})})]})})},Di=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"})]}),Hi=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"})]})}),zi=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"})]})}),Fi=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"})]})}),Vi=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"})]}),Gi=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"})]}),Bi=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"})]}),Ki=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"})]})}),Ui=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"})]})]})}),Wi=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"})]}),qi=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"})]})}),Zi=.55,xe=[{name:"column",icon:Vi,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Bi,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Gi,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Hi,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:Fi,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:zi,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:Ui,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:Di,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"scatter",icon:qi,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:Wi,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Ki,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Zi}}],$i=.05,Xi=e=>e===null?null:xe.find(t=>Ji(t.summary,e))??null,Yi=(e,t)=>{const{summary:r}=e;return r.coordType!=="polar"||!ae(r.innerRadius)||t===null||t.coordType!=="polar"||!ae(t.innerRadius)?r:{...r,innerRadius:t.innerRadius}},Ji=(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&&ae(e.innerRadius)===ae(t.innerRadius),ae=e=>e>=$i,Qi=3,es=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{RadioGrid:l}=M(),d=(0,C.useMemo)(()=>xe.map(({name:m,icon:v})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(v,{size:"md"})})),[i]);if(!o)return null;const c=(0,p.readChartType)(o.spec),h=Xi(c),u=m=>{const v=xe.find(g=>g.name===m);v&&a.commands.dispatch(new p.SetChartTypeCommand(Yi(v,c)))};return(0,n.jsx)(O,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:r??i(h===null?"editor.graphTypes.combo":`editor.graphTypes.${h.name}`),children:(0,n.jsx)(l,{value:h?.name??"",options:d,columns:Qi,onChange:u,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},$e=["solid","dashed","dotted"],ns=Number.parseFloat(s.chromeTokens.gridLineWidth),ts=8,rs=0,as=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l,Switch:d,ToggleGroup:c}=M(),{themeValues:h}=s.useThemeContext();if(!o)return null;const u=o.guides.axes.filter(os);if(u.length===0)return null;const m=o.coordSystem.type!=="polar",v=u.some(j=>j.gridVisible),g=o.config.axes.y.grid,x=$e.map(j=>({value:j,label:i(`editor.graphPanel.gridSection.lineStyles.${j}`)})),f=j=>A=>{a.commands.dispatch(new p.SetGridVisibilityCommand({axis:j,isVisible:A}))},b=j=>{const A=$e.find(T=>T===j);A&&a.commands.dispatch(new p.SetGridLineStyleCommand({axis:"both",lineStyle:A}))},I=j=>{a.commands.dispatch(new p.SetGridLineWidthCommand({axis:"both",lineWidth:j}),{transient:!0})};return(0,n.jsx)(O,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[u.map(j=>(0,n.jsx)(S,{label:i(is(j)),children:(0,n.jsx)(d,{isChecked:j.gridVisible,onChange:f(j.scaleAestheticKey)})},j.scaleAestheticKey)),m&&v&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(c,{value:g.lineStyle,options:x,onChange:b})}),(0,n.jsx)(S,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(l,{value:g.lineWidth??s.parsePx(h.gridLineWidth,ns),min:rs,max:ts,step:.5,formatValue:le,onChange:I,onCommit:a.commands.seal})})]})]})})},os=e=>e.scaleAestheticKey==="x"||e.scaleAestheticKey==="y",is=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",ss="total",ct=["total","average","current"],ls=["total"],Xe=["previous","first"],Ye=["auto","small","medium","large"],cs=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Switch:l,ToggleGroup:d}=M();if(!o)return null;const c=o.config.headline,h=c.show!=="none",u=o.coordSystem,m=u.type==="polar",v=u.type==="polar"&&u.innerRadius>0,g=o.layers.some(w=>w.summary.grandTotal!==void 0);if(m&&!g)return null;const x=m?ls:ct,f=o.guides.headline,b=f?.kind==="perGroup"&&f.items.some(w=>w.comparison!==null),I=x.map(w=>({value:w,label:i(`editor.graphPanel.headlineNumberSection.metrics.${w}`)})),j=Xe.map(w=>({value:w,label:i(`editor.graphPanel.headlineNumberSection.comparison.${w}`)})),A=Ye.map(w=>({value:w,label:i(w==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${w}`)})),T=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],_=w=>{a.commands.dispatch(new p.SetHeadlineShowCommand({show:w?ss:"none"}))},k=w=>{const R=x.find(U=>U===w);R&&a.commands.dispatch(new p.SetHeadlineShowCommand({show:R}))},E=w=>{const R=Xe.find(U=>U===w);R&&a.commands.dispatch(new p.SetHeadlineCompareWithCommand({compareWith:R}))},H=w=>{const R=Ye.find(U=>U===w);R&&a.commands.dispatch(new p.SetHeadlineSizeCommand({size:R}))},P=w=>{a.commands.dispatch(new p.SetHeadlinePositionCommand({position:w==="center"?"center":"above"}))};return(0,n.jsx)(O,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??ds(i,c.show),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(l,{isChecked:h,onChange:_})}),h&&(0,n.jsxs)(n.Fragment,{children:[I.length>1&&(0,n.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(d,{value:c.show,options:I,onChange:k})}),b&&(0,n.jsx)(S,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(d,{value:(0,p.resolveComparisonBasis)(c.compareWith),options:j,onChange:E})}),(0,n.jsx)(S,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(d,{value:c.size,options:A,onChange:H})}),v&&(0,n.jsx)(S,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(d,{value:c.position,options:T,onChange:P})})]})]})})},ds=(e,t)=>{const r=ct.find(a=>a===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)},pe=["top","bottom","left","right","none"],Je=["auto","start","center","end"],Qe=["auto","pill","direct"],us=({positions:e,title:t,layout:r="collapsible",preview:a})=>{const o=L(),i=s.useHandleCompiled(o),l=s.useI18n(),{ToggleGroup:d}=M();if(!i)return null;const c=i.config.legend.position,h=e??pe,u=i.guides.legends.drawn[0],m=(0,p.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),v=i.guides.headline?.kind==="perGroup",g=i.guides.colorGroups.length>0;if(c==="auto"&&u===void 0&&!m&&(v||!g))return null;const x=u?.position??"none",f=c==="auto"?x:c,b=pe.filter(P=>P===f||h.includes(P)).map(P=>({value:P,label:l(`editor.graphPanel.legendSection.${P}`)})),I=P=>{const w=pe.find(R=>R===P);w&&o.commands.dispatch(new p.SetLegendPositionCommand({position:w}))},j=P=>{const w=Je.find(R=>R===P);w&&o.commands.dispatch(new p.SetLegendAlignCommand({align:w}))},A=P=>{const w=Qe.find(R=>R===P);w&&o.commands.dispatch(new p.SetLegendDisplayCommand({display:w}))},T=Je.map(P=>({value:P,label:l(`editor.graphPanel.legendSection.align.${P}`)})),_=Qe.map(P=>({value:P,label:l(`editor.graphPanel.legendSection.display.${P}`)})),k=t??l("editor.graphPanel.legendSection.title"),E=b.find(P=>P.value===f)?.label,H=u!==void 0;return(0,n.jsx)(O,{title:k,layout:r,preview:a??E,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:l("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(d,{value:f,options:b,onChange:I})}),H&&(0,n.jsx)(S,{label:l("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(d,{value:i.config.legend.align,options:T,onChange:j})}),m&&(0,n.jsx)(S,{label:l("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(d,{value:i.config.legend.display,options:_,onChange:A})})]})})},hs=1,ps=20,ms=.5,dt=({layerId:e})=>{const t=L(),r=s.useHandleCompiled(t),{Slider:a}=M(),o=Le(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:hs,max:ps,step:ms,formatValue:le,onChange:i,onCommit:t.commands.seal})},gs=1,vs=10,xs=.1,Cs=["gap","zero","connect"],fs=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Slider:d,Switch:c,ToggleGroup:h}=M(),u=o?.spec.layers??[],m=(0,p.findLayerByGeom)(u,"line","area"),v=Le(o,m?.id??null);if(!o||!m)return null;const g=o.coordSystem.type==="polar",x=ys(i,m),f=Ss(m,u),b=en(o.spec,m.geom,"strokeWidth",m.id),I=typeof b=="number",j=m.geom==="line"?m:void 0,A=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto")},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],T=w=>{a.commands.dispatch(new p.ToggleLinePointsVisibilityCommand({layerId:m.id,showPoints:w}))},_=w=>{j&&a.commands.dispatch(new p.ToggleLineFillCommand({layerId:j.id,showFill:w}))},k=w=>{a.commands.dispatch(new p.SetLineInterpolationCommand({layerId:m.id,interpolate:w?"catmull-rom":"linear"}))},E=w=>{const R=v?.get("strokeWidth")??p.DEFAULT_STROKE_WIDTH;a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:w==="custom"?R:null}))},H=w=>{a.commands.dispatch(new p.SetLineWidthCommand({layerId:m.id,lineWidth:w}),{transient:!0})},P=w=>{const R=bs(w);R&&a.commands.dispatch(new p.SetLineMissingValuesCommand({layerId:m.id,missingValues:R}))};return(0,n.jsx)(O,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(c,{isChecked:f!==void 0,onChange:T})}),f&&(0,n.jsx)(S,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(dt,{layerId:f.id})}),j&&!g&&(0,n.jsx)(S,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(c,{isChecked:en(o.spec,"line","fillAlpha",j.id)!==void 0,onChange:_})}),!g&&(0,n.jsx)(S,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(c,{isChecked:m.params.interpolate==="catmull-rom",onChange:k})}),(0,n.jsx)(S,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(h,{value:I?"custom":"auto",options:A,onChange:E})}),I&&(0,n.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:b,min:gs,max:vs,step:xs,formatValue:le,onChange:H,onCommit:a.commands.seal})}),!g&&x.length>1&&(0,n.jsx)(S,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(l,{value:m.params.missingValues,options:x,onChange:P})})]})})},bs=e=>Cs.find(t=>t===e),en=(e,t,r,a)=>(0,p.findKindStyleDeclarations)(e.styles.overrides,(0,p.buildLayerStyleAddress)(t,a))?.[r],Ss=(e,t)=>(0,p.filterLayersByGeoms)(t,"point").find(r=>(0,p.isCompanionLayer)(r,[e])),ys=(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},js="k",ws=2,Is=0,Ts=5,Ce=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],As=["auto","none"],Ps=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{NumberField:l,ToggleGroup:d}=M();if(!o)return null;const{abbreviation:c,decimals:h}=o.config.numberFormat,u=Ls(c)!==void 0,m=h!=="auto",v=A=>A.map(T=>({value:T,label:i(`editor.graphPanel.numberFormat.options.${T}`)})),g=Ce.map(({value:A,labelKey:T})=>({value:A,label:i(`common.abbreviations.${T}`)})),x=A=>{a.commands.dispatch(new p.SetNumberFormatAbbreviationCommand({abbreviation:A}))},f=A=>{const T=As.find(_=>_===A);x(T??js)},b=A=>{const T=Ce.find(_=>_.value===A);T&&x(T.value)},I=A=>{a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:A==="custom"?ws:"auto"}))},j=A=>{A!==null&&a.commands.dispatch(new p.SetNumberFormatDecimalsCommand({decimals:A}),{transient:!0})};return(0,n.jsx)(O,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(d,{value:u?"custom":c,options:v(["auto","none","custom"]),onChange:f})}),u&&(0,n.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(d,{value:c,options:g,onChange:b})}),(0,n.jsx)(S,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(d,{value:m?"custom":"auto",options:v(["auto","custom"]),onChange:I})}),m&&(0,n.jsx)(S,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(l,{value:h,min:Is,max:Ts,onChange:j,onCommit:a.commands.seal})})]})})},Ls=e=>Ce.find(t=>t.value===e),Ms=({title:e,layout:t="collapsible",preview:r})=>{const a=s.useHandleCompiled(L()),o=s.useI18n();if(!a)return null;const i=_s(a.spec.layers);return i?(0,n.jsx)(O,{title:e??o("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsx)(D,{children:(0,n.jsx)(S,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(dt,{layerId:i.id})})})}):null},_s=e=>{const t=(0,p.filterLayersByGeoms)(e,"line","area");return(0,p.filterLayersByGeoms)(e,"point").find(r=>!(0,p.isCompanionLayer)(r,t))},Es=.9,Rs=360,Os=.05,ks=15,Ns=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Slider:l}=M();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:d,startAngle:c}=o.spec.coords.params,h=m=>{a.commands.dispatch(new p.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},u=m=>{a.commands.dispatch(new p.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(O,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(l,{value:d,min:0,max:Es,step:Os,formatValue:lt,onChange:h,onCommit:a.commands.seal})}),(0,n.jsx)(S,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(l,{value:c,min:0,max:Rs-1,step:ks,formatValue:pi,onChange:u,onCommit:a.commands.seal})})]})})},Ds=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"})]}),nn=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"})]}),Hs=e=>(0,C.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]),tn=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],zs="linear",Fs=({title:e,layout:t="collapsible",preview:r})=>{const a=L(),o=s.useHandleCompiled(a),i=s.useI18n(),{Select:l,Switch:d}=M(),{options:c,findValue:h}=Hs(o);if(!o||o.coordSystem.type==="polar")return null;const u=(0,p.findTrendLineLayer)(o.spec.layers),m=(0,p.findAverageLineLayer)(o.spec.layers),v=u?.stat.type==="smooth"?u.stat.method:zs,g=Vs(m),x=tn.map(T=>({value:T,label:i(`editor.annotationsPanel.trendType.options.${T}`)})),f=(T,_={})=>{const k=u??m,E=new p.SetStatLineCommand({line:T,..._,...k!==void 0&&{layerId:k.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(E)},b=T=>f(T?"trend":"none",{method:v}),I=T=>f(T?"average":"none",{group:g??h(c[0]?.value??"")}),j=T=>{const _=tn.find(k=>k===T);_!==void 0&&f("trend",{method:_})},A=T=>{const _=T===null?void 0:h(T);_!==void 0&&f("average",{group:_})};return(0,n.jsx)(O,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(nn,{size:"lg"}),children:(0,n.jsxs)(D,{children:[(0,n.jsx)(S,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(nn,{size:"lg"}),children:(0,n.jsx)(d,{isChecked:u!==void 0,onChange:b})}),u!==void 0&&(0,n.jsx)(S,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(l,{value:v,options:x,onChange:j,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(S,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(Ds,{size:"lg"}),children:(0,n.jsx)(d,{isChecked:m!==void 0,onChange:I})}),m!==void 0&&c.length>0&&(0,n.jsx)(S,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(l,{value:g===void 0?null:String(g),options:c,onChange:A,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},Vs=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=vi;exports.AxesPanel=hi;exports.AxisSection=ge;exports.BarSection=Ci;exports.Button=Hn;exports.CalloutsSection=Mi;exports.CaptionSection=rt;exports.EditableGraphRenderer=co;exports.EditorPanel=Ie;exports.ElementsPanel=ui;exports.GoalSection=Oi;exports.GraphOptionsSection=Ni;exports.GraphTypeSection=es;exports.GridSection=as;exports.HeadlineSection=cs;exports.IntlProvider=s.IntlProvider;exports.LegendSection=us;exports.LineSection=fs;exports.NumberField=Vn;exports.NumberFormatSection=Ps;exports.PANEL_ROOT_ATTRIBUTE=et;exports.PointSection=Ms;exports.PolarSection=Ns;exports.RadioGrid=Gn;exports.Row=S;exports.Section=O;exports.Select=Bn;exports.Slider=Kn;exports.SourceSection=at;exports.SubtitleSection=ot;exports.Switch=Un;exports.TextField=Wn;exports.TextSizeSection=it;exports.TitleSection=st;exports.ToggleGroup=qn;exports.ToggledSection=tt;exports.TrendsAndAveragesSection=Fs;exports.useControls=M;exports.usePanelExpansion=Qn;exports.usePanelGraph=L;
|