@graphysdk/react-renderer 1.9.0-beta.1794219709942 → 1.9.0-beta.1794228873898
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 +77 -4
- package/dist/editable.mjs +6751 -5595
- package/dist/{history-chords-_27rxx0Z.js → history-chords-CjizoBMc.js} +3132 -2966
- package/dist/history-chords-DN7mzxHh.cjs +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +519 -504
- package/package.json +3 -3
- package/dist/history-chords-JM5EoSWE.cjs +0 -2
package/dist/editable.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-JM5EoSWE.cjs");let u=require("@graphysdk/viz-engine"),v=require("react"),n=require("react/jsx-runtime"),gi=require("motion/react"),J=require("zustand/react/shallow"),Q=require("@vanilla-extract/dynamic"),U=require("clsx");U=l.__toESM(U,1);let re=require("lodash-es"),se=require("@floating-ui/react-dom"),Ot=require("react-dom"),H=require("@base-ui/react/popover"),pn=require("react-colorful"),q=require("@base-ui/react/tooltip"),mn=require("@base-ui/react/number-field"),jr=require("@base-ui/react/radio"),wr=require("@base-ui/react/radio-group"),Z=require("@base-ui/react/select"),le=require("@base-ui/react/slider"),gn=require("@base-ui/react/switch"),vi=require("@base-ui/react/input"),_t=require("@base-ui/react/direction-provider"),xi=require("@base-ui/react/separator"),Tr=require("@tiptap/core"),fi=require("@tiptap/extension-bold"),Me=require("@tiptap/extension-document"),bi=require("@tiptap/extension-hard-break"),Si=require("@tiptap/extension-heading"),yi=require("@tiptap/extension-italic"),Ci=require("@tiptap/extension-link"),ji=require("@tiptap/extension-text"),wi=require("@tiptap/extension-text-align"),Re=require("@tiptap/extension-text-style"),Ti=require("@tiptap/extension-underline"),$e=require("@tiptap/extensions"),kr=require("@tiptap/extension-paragraph"),We=require("@tiptap/react"),te=require("@base-ui/react/toolbar"),W=require("@base-ui/react/menu"),ki=require("@base-ui/react/toggle"),de=require("@base-ui/react/accordion");var Ar=(e,t)=>{if(e.scope!=="observation")return null;const r=(0,u.findLayerById)(t.layers,e.layerId);if(r===void 0)return null;const[o]=(0,u.resolveObservationsTarget)({layer:r,target:e,parsingLocale:t.config.parsingLocale}),a=o===void 0?void 0:r.data.getAt(o);if(a==null)return null;const i=(0,u.createObservationAnchorBuilder)(r)(a);return i===null?null:{layer:r,observation:a,at:i}},Pr=e=>{const t=l.useSceneSelector((0,J.useShallow)(r=>({layers:r.layers,config:r.config})));return(0,v.useMemo)(()=>Ar(e,t),[e,t])},Ai=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M4 3v12M4 6h12M4 10h10M4 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),Pi=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M14 3v12M2 6h12M4 10h10M6 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),Li=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 14 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),Ii=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 14C2.5 7 6.1 5.5 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),Ei=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 8h14M2 8v3M16 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),Mi=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,n.jsx)("path",{d:"M2 8h14M3 8v3M7.3 8v3M11.6 8v3M15 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),ie=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:"m6 9 6 6 6-6"})})}),Lr=(0,v.createContext)(null),Ir=({labelId:e,controlId:t,children:r})=>{const o=(0,v.useMemo)(()=>{let a=null;return{labelId:e,controlId:t,claimControlId:i=>(a??=i,a===i)}},[e,t]);return(0,n.jsx)(Lr.Provider,{value:o,children:r})},ne=({id:e,ariaLabel:t,ariaLabelledBy:r},o=!0)=>{const a=(0,v.useContext)(Lr),i=(0,v.useId)(),[s]=(0,v.useState)(()=>o?a?.claimControlId(i)??!1:!1),c=e??(s?a?.controlId:void 0),d=r??(t===void 0?a?.labelId:void 0);return{...c!==void 0&&{id:c},...t!==void 0&&{"aria-label":t},...d!==void 0&&{"aria-labelledby":d}}},Ri="woi4bh0",Oi="woi4bh1";var _i={default:"woi4bh6 woi4bh5",tile:"woi4bh7 woi4bh5",icon:"woi4bh8 woi4bh5"},Er=({label:e,icon:t,onClick:r,variant:o="default",expanded:a,disabled:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const p=ne({id:d,ariaLabel:s,ariaLabelledBy:c}),h=o==="tile";return(0,n.jsxs)("button",{type:"button",className:_i[o],disabled:i,"aria-expanded":a,onClick:r,...p,children:[t!==void 0&&(0,n.jsx)("span",{className:(0,U.default)("woi4bh0",o==="icon"&&"woi4bh4"),children:t}),e!==void 0&&(0,n.jsx)("span",{className:h?"woi4bh3":"woi4bh1",children:e}),a!==void 0&&o==="default"&&(0,n.jsx)("span",{className:"woi4bh2","aria-hidden":"true",children:(0,n.jsx)(ie,{size:"sm"})})]})},Ni={accent:"var(--graphy-editor-accent, var(--graphy-editor-default-accent))",surface:"var(--graphy-editor-surface, var(--graphy-editor-default-surface))",text:"var(--graphy-editor-text, var(--graphy-editor-default-text))",textSecondary:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 70%)",textDisabled:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",sunken:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 5%)",raised:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 7%)",border:"var(--graphy-editor-border, color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 12%))",fontFamily:"var(--graphy-editor-font-family, var(--graphy-font-family))",borderStrong:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",focus:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 55.00000000000001%)",focusWidth:"2px",shadow:"var(--graphy-editor-default-shadow)"},Di="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",Mr="_14ty2ng0",vn="_14ty2ng1",Fi="_14ty2ng2",Gi="_14ty2ng3",Rr="_14ty2ng4",Bi="_14ty2ng5",zi="_14ty2ng6",Or="transparent",_r=e=>e==="transparent"?{background:Di,border:`1px solid ${l.vars.border100}`}:{background:e,border:`1px solid ${Ni.border}`},Nr=({title:e,colors:t,value:r,onChange:o,trailing:a,clearable:i=!1,disabled:s,id:c,ariaLabel:d,ariaLabelledBy:p})=>{const h=l.useI18n(),m=ne({id:c,ariaLabel:d,ariaLabelledBy:p},!1),g=a!==void 0||i,x=f=>(0,n.jsx)("button",{type:"button","aria-label":f==="transparent"?h("graph.colorDropdown.transparent"):f,className:Gi,"data-active":Dr(f,r),disabled:s,onMouseDown:b=>b.preventDefault(),onClick:()=>o(f),children:(0,n.jsx)("span",{className:Rr,style:_r(f)})},f);return(0,n.jsxs)("div",{className:Mr,children:[e!==void 0&&(0,n.jsx)("div",{className:"_14ty2ng1",children:e}),(0,n.jsxs)("div",{className:Fi,...m,children:[t.map(x),g&&(0,n.jsxs)("span",{className:"_14ty2ng5",children:[(0,n.jsx)("span",{className:"_14ty2ng6","aria-hidden":"true"}),a,i&&x("transparent")]})]})]})},Dr=(e,t)=>t!==null&&e.toLowerCase()===t.toLowerCase(),ee="_18ja6qr0",Hi="data-graphy-chart-chrome",Vi="data-graphy-chart-menu",$i={[Vi]:""},Ue=e=>({[Hi]:e}),Ie=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,Fr=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,vt=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,Gr=(e,t,r)=>r!==null&&(0,u.isPointWithinEditMenuTrigger)({x:e.clientX-t.x,y:e.clientY-t.y},r),ue=(e,t,r)=>e instanceof Node&&(t.contains(e)||Ie(e,r)),Wi="cml7ha0",Br=(0,v.createContext)(null),Ui=({children:e})=>{const{chartId:t}=l.useGraphContext(),[r]=(0,v.useState)(l.resolvePortalContainer),[o,a]=(0,v.useState)(null);return r===null?null:(0,n.jsxs)(n.Fragment,{children:[(0,Ot.createPortal)((0,n.jsx)("div",{ref:a,className:Wi,...Ue(t)}),r),(0,n.jsx)(Br.Provider,{value:o,children:e})]})},qe=()=>(0,v.useContext)(Br),qi="_178jeit0",Ki="_178jeit1 _14ty2ng3",Xi="_178jeit2 _14ty2ng4",Zi="_178jeit3",Yi="_178jeit4",Ji="_178jeit5",Qi="_178jeit6",es="_178jeit7",ts={side:"flip",align:"shift",fallbackAxisSide:"end"},zr=({value:e,onChange:t,onCommit:r,popupAttributes:o,variant:a="default"})=>{const i=l.useI18n(),s=qe(),[c,d]=(0,v.useState)(!1),p=g=>{d(g),g||r?.()},h=e!==null&&l.isValidCssColor(e)?e:"#000000",m=l.isHex(h)?h.toUpperCase():"#000000";return(0,n.jsxs)(H.Popover.Root,{open:c,onOpenChange:p,children:[a==="chip"?(0,n.jsx)(H.Popover.Trigger,{className:Ki,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:(0,n.jsx)("span",{className:Xi})}):(0,n.jsxs)("div",{className:Mr,children:[(0,n.jsx)("div",{className:vn,children:i("graph.colorDropdown.custom")}),(0,n.jsxs)(H.Popover.Trigger,{className:Zi,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:[(0,n.jsx)("span",{className:Rr,style:_r(h)}),(0,n.jsx)("span",{className:Yi,children:m})]})]}),(0,n.jsx)(H.Popover.Portal,{container:s??l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{side:"right",align:"start",sideOffset:18,collisionAvoidance:ts,collisionPadding:12,disableAnchorTracking:a==="chip",className:qi,children:(0,n.jsxs)(H.Popover.Popup,{className:Ji,onMouseDown:g=>g.preventDefault(),...o,children:[(0,n.jsx)("div",{className:vn,children:i("graph.colorDropdown.pickColor")}),(0,n.jsx)(pn.HexColorPicker,{color:m,onChange:t,className:Qi}),(0,n.jsx)(pn.HexColorInput,{color:m,onChange:t,prefixed:!0,className:es,onMouseDown:g=>g.stopPropagation()})]})})})})]})},xn=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 3v12"}),(0,n.jsx)("path",{d:"m17 8-5-5-5 5"}),(0,n.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"})]})}),Nt=({children:e})=>{const{themeValues:t}=l.useThemeContext();return(0,n.jsx)(l.PortalThemeProvider,{style:(0,v.useMemo)(()=>(0,Q.assignInlineVars)({[l.vars.fontFamily]:t.fontFamily,[l.vars.textScale]:t.textScale}),[t]),children:e})};var Hr="srewh00",ns="srewh01",rs={pointer:null,focus:null,last:"pointer"},Vr=(0,v.createContext)({hovered:!1,dismissed:!1,reachedTooltipId:null,reach:()=>{},release:()=>{},dismiss:()=>{}}),xt=({className:e,children:t})=>{const[r,o]=(0,v.useState)(!1),[a,i]=(0,v.useState)(!1),[s,c]=(0,v.useState)(rs),d=(0,v.useCallback)((f,b)=>{i(!1),c(S=>({...S,[b]:f,last:b}))},[]),p=(0,v.useCallback)((f,b)=>{c(S=>S[b]===f?{...S,[b]:null}:S)},[]),h=(0,v.useCallback)(()=>i(!0),[]),m=os(s),g=(0,v.useMemo)(()=>({hovered:r,dismissed:a,reachedTooltipId:m,reach:d,release:p,dismiss:h}),[r,a,m,d,p,h]),x=f=>{f.pointerType!=="touch"&&(o(!0),i(!1))};return(0,n.jsx)("div",{className:e,onPointerEnter:x,onPointerLeave:()=>o(!1),children:(0,n.jsx)(Vr.Provider,{value:g,children:t})})},pe=({label:e,checked:t=!1,children:r})=>{const{hovered:o,dismissed:a,reachedTooltipId:i,reach:s,release:c,dismiss:d}=(0,v.useContext)(Vr),p=(0,v.useId)(),[h,m]=(0,v.useState)(!1),g=o?!a&&(i===p||t&&i===null):h;(0,v.useEffect)(()=>()=>{c(p,"pointer"),c(p,"focus")},[p,c]);const x=(f,b)=>{b.reason==="escape-key"&&(d(),b.allowPropagation()),m(f)};return(0,n.jsxs)(q.Tooltip.Root,{open:g,onOpenChange:x,disableHoverablePopup:!0,children:[(0,n.jsx)(q.Tooltip.Trigger,{render:r,"aria-label":e,onPointerEnter:f=>f.pointerType!=="touch"&&s(p,"pointer"),onPointerLeave:()=>c(p,"pointer"),onFocus:()=>s(p,"focus"),onBlur:()=>c(p,"focus")}),(0,n.jsx)(q.Tooltip.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(Nt,{children:(0,n.jsx)(q.Tooltip.Positioner,{sideOffset:6,className:ns,children:(0,n.jsx)(q.Tooltip.Popup,{className:Hr,children:e})})})})]})},os=({pointer:e,focus:t,last:r})=>r==="focus"?t??e:e??t,as="a1l6m80 woi4bh6 woi4bh5",is="a1l6m81 _14ty2ng3",ss="a1l6m82",$r=({label:e,accept:t,onFile:r,disabled:o,id:a,variant:i="default"})=>{const s=(0,v.useId)(),c=a??s,d=i==="chip",p=(0,n.jsx)("input",{id:c,type:"file",accept:t,disabled:o,"aria-label":d?e:void 0,className:ss,onChange:h=>{const m=h.target.files?.[0];h.target.value="",m!==void 0&&r(m)}});return d?(0,n.jsx)(pe,{label:e,children:(0,n.jsxs)("label",{htmlFor:c,className:is,children:[(0,n.jsx)(xn,{size:"xs"}),p]})}):(0,n.jsxs)("label",{htmlFor:c,className:as,children:[(0,n.jsx)("span",{className:Ri,children:(0,n.jsx)(xn,{})}),(0,n.jsx)("span",{className:Oi,children:e}),p]})},Ke=(0,v.createContext)(null),F=()=>{const e=(0,v.useContext)(Ke);if(!e)throw new Error("An editing section must sit inside an <EditorPanel.Root> bound to a graph — pass it a `handle`, or render the panel inside a <GraphProvider>.");return e},Wr=({children:e,onKeyDown:t,...r})=>{const o=(0,v.useContext)(Ke),a=i=>{if(t?.(i),!o||i.defaultPrevented)return;const s=l.resolveHistoryStep(i.nativeEvent);s&&(i.preventDefault(),s==="undo"?o.undo():o.redo())};return(0,n.jsx)("div",{onKeyDown:a,...r,children:e})},Ur="keyboard",Xe=e=>{const t=(0,v.useRef)(!1),r=(0,v.useRef)(!1),o=()=>{t.current=!1,r.current&&(r.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){r.current=!0;return}e?.()},commitUnlessHeldKey:a=>{if(a){r.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:o,onBlur:a=>{a.relatedTarget instanceof Node&&a.currentTarget.contains(a.relatedTarget)||o()}}}},ls="eh8dvc0",cs="eh8dvc1 uz3g760",ds="eh8dvc2 uz3g761";var qr=({value:e,onChange:t,onCommit:r,min:o,max:a,step:i,placeholder:s,prefix:c,suffix:d,disabled:p,hasError:h,ariaLabel:m,ariaLabelledBy:g,id:x})=>{const f=ne({id:x,ariaLabel:m,ariaLabelledBy:g}),{commitUnlessHeldKey:b,gestureHandlers:S}=Xe(r);return(0,n.jsx)(mn.NumberField.Root,{className:ls,value:e,onValueChange:C=>t(C),onValueCommitted:(C,A)=>{b(A.reason===Ur)},min:o,max:a,step:i,disabled:p,children:(0,n.jsxs)(Wr,{className:cs,"data-error":h===!0,"data-disabled":p===!0?"":void 0,children:[c!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:c}),(0,n.jsx)(mn.NumberField.Input,{className:ds,placeholder:s,...S,"aria-invalid":h===!0?!0:void 0,...f}),d!==void 0&&(0,n.jsx)("span",{className:"eh8dvc3",children:d})]})})},us="_1b7s5f0",oe={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},hs="_1b7s5f7";var ps=6,Kr=({options:e,value:t,onChange:r,onCommit:o,columns:a,itemLayout:i="tile",disabled:s,ariaLabel:c,ariaLabelledBy:d,id:p})=>{const h=ne({id:p,ariaLabel:c,ariaLabelledBy:d}),m=i==="tile",g=i==="swatch",x=i==="icon",f=i==="track",b=i==="chip",{commitAfterChange:S,gestureHandlers:C}=Xe(o);return(0,n.jsx)(wr.RadioGroup,{className:(0,U.default)(us,ms(a??e.length),x&&"_1b7s5f9",f&&"_1b7s5fb",b&&"_1b7s5fd"),value:t,onValueChange:A=>{r(A),S()},...C,disabled:s,...h,children:e.map(A=>{const T=(0,n.jsxs)(jr.Radio.Root,{value:A.value,disabled:A.disabled,className:(0,U.default)(hs,g&&"_1b7s5f8",x&&"_1b7s5fa",f&&"_1b7s5fc",b&&"_1b7s5fe"),style:{gridRow:A.gridRow,gridColumn:A.gridColumn},"aria-label":m?void 0:A.label,children:[A.icon,m&&(0,n.jsx)("span",{className:"_1b7s5ff",children:A.label})]},A.value);if(!g&&!x&&!b)return T;const k=(x||b)&&A.value===t;return(0,n.jsx)(pe,{label:A.label,checked:k,children:T},A.value)})})},ms=e=>{switch(Math.min(Math.max(Math.round(e),1),ps)){case 1:return oe[1];case 2:return oe[2];case 3:return oe[3];case 4:return oe[4];case 5:return oe[5];default:return oe[6]}},Xr=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:"M20 6 9 17l-5-5"})})}),gs="_1g5x15w0 uz3g760",vs="_1g5x15w1",xs="_1g5x15w2",fn="_1g5x15w3",fs="_1g5x15w4",bs="_1g5x15w5",Ss="_1g5x15w6",ys="_1g5x15w7";var Zr=({options:e,value:t,onChange:r,placeholder:o,disabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const p=ne({id:d,ariaLabel:s,ariaLabelledBy:c}),h=qe();return(0,n.jsxs)(Z.Select.Root,{value:t,onValueChange:m=>m!==null&&r(m),disabled:a,items:e.map(m=>({value:m.value,label:m.label})),children:[(0,n.jsxs)(Z.Select.Trigger,{className:gs,"data-error":i===!0,...p,children:[(0,n.jsx)(Z.Select.Value,{className:vs,children:m=>Cs(e,m,o)}),(0,n.jsx)(Z.Select.Icon,{className:fn,children:(0,n.jsx)(ie,{size:"sm"})})]}),(0,n.jsx)(Z.Select.Portal,{container:h??l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(Z.Select.Positioner,{className:fs,sideOffset:4,alignItemWithTrigger:!1,children:(0,n.jsx)(Z.Select.Popup,{className:bs,children:e.map(m=>(0,n.jsxs)(Z.Select.Item,{value:m.value,disabled:m.disabled,className:Ss,children:[m.icon,(0,n.jsxs)("span",{className:ys,children:[(0,n.jsx)(Z.Select.ItemText,{children:m.label}),m.description!==void 0&&(0,n.jsx)("span",{className:"_1g5x15w8",children:m.description})]}),(0,n.jsx)(Z.Select.ItemIndicator,{className:fn,children:(0,n.jsx)(Xr,{size:"sm"})})]},m.value))})})})})]})},Cs=(e,t,r)=>t===null?(0,n.jsx)("span",{className:xs,children:r}):js(e,t),js=(e,t)=>e.find(r=>r.value===t)?.label??t,ws="vod76w0",Ts="vod76w1",ks="vod76w2",As="vod76w3",Ps="vod76w4",Ls="vod76w5";var Yr=({value:e,onChange:t,onCommit:r,min:o,max:a,step:i,suffix:s,formatValue:c,showValue:d=!0,disabled:p,ariaLabel:h,ariaLabelledBy:m})=>{const g=ne({ariaLabel:h,ariaLabelledBy:m},!1),x=Is(e,s,c),{commitUnlessHeldKey:f,gestureHandlers:b}=Xe(r);return(0,n.jsxs)("div",{className:ws,children:[(0,n.jsx)(le.Slider.Root,{className:Ts,value:e,onValueChange:S=>t(S),onValueCommitted:(S,C)=>{f(C.reason===Ur)},min:o,max:a,step:i,disabled:p,children:(0,n.jsx)(le.Slider.Control,{className:ks,children:(0,n.jsxs)(le.Slider.Track,{className:As,children:[(0,n.jsx)(le.Slider.Indicator,{className:Ps}),(0,n.jsx)(le.Slider.Thumb,{className:Ls,...b,...g})]})})}),d&&(0,n.jsx)("span",{className:"vod76w6",children:x})]})},Is=(e,t,r)=>r!==void 0?r(e):`${e}${t??""}`,Es="_1hyrlw60",Ms="_1hyrlw61",Jr=({checked:e,onChange:t,disabled:r,ariaLabel:o,ariaLabelledBy:a,id:i})=>{const s=ne({id:i,ariaLabel:o,ariaLabelledBy:a});return(0,n.jsx)(gn.Switch.Root,{checked:e,onCheckedChange:c=>t(c),disabled:r,className:Es,...s,children:(0,n.jsx)(gn.Switch.Thumb,{className:Ms})})},Rs="uz3g761",Os="tpcnun0 uz3g760",Qr=({value:e,onChange:t,onCommit:r,placeholder:o,disabled:a,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const p=ne({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,n.jsx)(Wr,{className:Os,"data-error":i===!0,children:(0,n.jsx)(vi.Input,{className:Rs,value:e,onValueChange:h=>t(h),onBlur:r,placeholder:o,disabled:a,"aria-invalid":i===!0?!0:void 0,...p})})},_s="cnu9yl0",Ns="cnu9yl1";var Dt=({options:e,value:t,onChange:r,onCommit:o,itemLayout:a="inline",hasEqualWidths:i=!1,disabled:s,ariaLabel:c,ariaLabelledBy:d,id:p})=>{const h=ne({id:p,ariaLabel:c,ariaLabelledBy:d}),m=a==="stacked",{commitAfterChange:g,gestureHandlers:x}=Xe(o);return(0,n.jsx)(wr.RadioGroup,{className:_s,value:t,onValueChange:f=>{r(f),g()},...x,disabled:s,...h,children:e.map(f=>{const b=Ds(f,m),S=(0,n.jsxs)(jr.Radio.Root,{value:f.value,disabled:f.disabled,className:(0,U.default)(Ns,m&&"cnu9yl3",i&&"cnu9yl2"),"aria-label":b,children:[f.icon,eo(f,m)&&(0,n.jsx)("span",{className:"cnu9yl4",children:f.label})]},f.value);return b===void 0?S:(0,n.jsx)(pe,{label:b,checked:f.value===t,children:S},f.value)})})},eo=(e,t)=>e.icon===void 0||t,Ds=(e,t)=>{if(!eo(e,t))return e.label},Fs={ToggleGroup:Dt,Switch:Jr,Slider:Yr,RadioGrid:Kr,Button:Er,TextField:Qr,NumberField:qr,Select:Zr,ColorSwatches:Nr,CustomColor:zr,FileInput:$r},ft=(0,v.createContext)(Fs),to=({controls:e,children:t})=>{const r=(0,v.useContext)(ft),o=(0,v.useMemo)(()=>({ToggleGroup:e?.ToggleGroup??r.ToggleGroup,Switch:e?.Switch??r.Switch,Slider:e?.Slider??r.Slider,RadioGrid:e?.RadioGrid??r.RadioGrid,Button:e?.Button??r.Button,TextField:e?.TextField??r.TextField,NumberField:e?.NumberField??r.NumberField,Select:e?.Select??r.Select,ColorSwatches:e?.ColorSwatches??r.ColorSwatches,CustomColor:e?.CustomColor??r.CustomColor,FileInput:e?.FileInput??r.FileInput}),[r,e?.ToggleGroup,e?.Switch,e?.Slider,e?.RadioGrid,e?.Button,e?.TextField,e?.NumberField,e?.Select,e?.ColorSwatches,e?.CustomColor,e?.FileInput]);return(0,n.jsx)(ft.Provider,{value:o,children:t})},O=()=>(0,v.useContext)(ft),bn={stack:"pr583x0",grid:"pr583x1"},Sn="pr583x2",Gs={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},P=({label:e,layout:t="grid",icon:r,children:o})=>{const a=(0,v.useId)(),i=(0,v.useId)();return e===void 0?(0,n.jsx)(xt,{className:bn[t],children:(0,n.jsx)("div",{className:Sn,children:o})}):(0,n.jsxs)(xt,{className:bn[t],children:[(0,n.jsxs)("label",{id:a,htmlFor:i,className:Gs[r===void 0?"plain":"withIcon"],children:[r!==void 0&&(0,n.jsx)("span",{"aria-hidden":"true",children:r}),e]}),(0,n.jsx)("div",{className:Sn,children:(0,n.jsx)(Ir,{labelId:a,controlId:i,children:o})})]})},Ft=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(Bs,{graph:t,axis:e.axis})};Ft.hasRows=(e,{scene:t})=>t.coordSystem.type!=="polar";var Bs=({graph:e,axis:t})=>{const r=l.useHandleScene(e),o=l.useI18n(),{NumberField:a,TextField:i,ToggleGroup:s}=O(),c=r?.guides.axes.find(I=>I.scaledAesthetic===t);if((0,v.useEffect)(()=>()=>e.commands.commit(),[e.commands]),r===null||c?.geometry!=="linear")return null;const d=!c.visible,p=c.visible||c.showGrid,h=r.scales[t]?.spec.scaleType,m=h==="continuous"||h==="datetime",g=r.guides.legends.drawn.some(I=>I.position==="left"||I.position==="right"),x=t!=="x"&&h==="continuous"&&(c.position==="left"||c.position==="right")&&!g,f=t==="x"?void 0:r.scales[t]?.spec,b=f?.scaleType==="continuous"?f:void 0,S=b!==void 0&&(c.position==="left"||c.position==="right")&&!(0,u.isZeroAnchoredAxis)(r,t),C=b?.transform==="log"?"log":"linear",A=S&&b.transform!=="log",T=b?.domainMin??null,k=b!==void 0&&(c.position==="left"||c.position==="right")&&b.transform!=="log",w=b?.domainMax??null,L=r.config.axes[t]?.label??c.label??"",E=I=>{const G=t==="ySecondary"?{axis:t,label:I}:{axis:t,label:I};e.commands.dispatch(new u.SetAxisLabelCommand(G),{transient:!0})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{label:o("editor.axesPanel.controls.title"),children:(0,n.jsx)(i,{value:L,placeholder:o("editor.axesPanel.controls.titlePlaceholder"),onChange:E,onCommit:e.commands.commit,disabled:d})}),m&&(0,n.jsx)(P,{label:o("editor.axesPanel.controls.labels"),children:(0,n.jsx)(s,{value:c.tickMode,disabled:!p,options:[{value:"auto",label:o("editor.axesPanel.labelMode.auto"),icon:(0,n.jsx)(Mi,{})},{value:"edges",label:o("editor.axesPanel.labelMode.edges"),icon:(0,n.jsx)(Ei,{})}],onChange:I=>{const G=I==="edges"?"edges":"auto";e.commands.dispatch(new u.SetAxisTickModeCommand({axis:t,tickMode:G,keepSecondaryAxis:!0}))}})}),x&&(0,n.jsx)(P,{label:o("editor.axesPanel.controls.position"),children:(0,n.jsx)(s,{value:c.position,disabled:d,options:[{value:"left",label:o("editor.axesPanel.position.left"),icon:(0,n.jsx)(Ai,{})},{value:"right",label:o("editor.axesPanel.position.right"),icon:(0,n.jsx)(Pi,{})}],onChange:I=>{if(I!=="left"&&I!=="right")return;const G=t==="y"?I:I==="left"?"right":"left";e.commands.dispatch(new u.SetAxisPositionCommand({axis:"y",position:G}))}})}),S&&(0,n.jsx)(P,{label:o("editor.axesPanel.controls.scale"),children:(0,n.jsx)(s,{value:C,options:[{value:"linear",label:o("editor.axesPanel.scale.auto"),icon:(0,n.jsx)(Li,{})},{value:"log",label:o("editor.axesPanel.scale.log"),icon:(0,n.jsx)(Ii,{})}],onChange:I=>{e.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:t,transform:I==="log"?"log":"linear"}))}})}),A&&(0,n.jsx)(P,{label:o("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(a,{value:T,placeholder:o("editor.axesPanel.startFrom.auto"),onChange:I=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMin:I}),{transient:!0})},onCommit:e.commands.commit})}),k&&(0,n.jsx)(P,{label:o("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(a,{value:w,placeholder:o("editor.axesPanel.endAt.auto"),onChange:I=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMax:I}),{transient:!0})},onCommit:e.commands.commit})})]})},zs={narrow:3,regular:6,wide:11},Hs=({barWidth:e,...t})=>{const r=zs[e];return(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("rect",{x:(18-r)/2,y:3,width:r,height:12,fill:"currentColor"})})},Vs=6,Y=({target:e})=>{const{commands:t,findGeom:r}=l.useGraphContext(),o=l.useI18n(),a=l.useStyleReaderTree(),i=l.useSceneSelector(h=>h),s=ro(e,i,r);(0,v.useEffect)(()=>()=>t.commit(),[t]);const c=(0,v.useMemo)(()=>(0,u.readObservationsColor)({readers:a,layers:i.layers,target:e,parsingLocale:i.config.parsingLocale}),[a,i.config.parsingLocale,i.layers,e]);if(s===null)return null;const d=(h,m)=>{const g=s[0]?.part;t.dispatch(new u.SetObservationsColorCommand({target:e,color:h,...g===void 0?{}:{part:g}}),m?{transient:!0}:void 0)},p=s[0]?.property==="stroke"?o("editor.overlayMenu.lineColor"):o("editor.overlayMenu.fillColor");return(0,n.jsx)(no,{label:p,palette:(0,u.readColorChoices)(i.scales.color),selectedColor:c,paint:d,commit:()=>t.commit()})},no=({label:e,palette:t,selectedColor:r,paint:o,commit:a})=>{const{ColorSwatches:i,CustomColor:s}=O();return(0,n.jsx)(P,{label:e,layout:"stack",children:(0,n.jsx)(i,{colors:$s(t.slice(0,Vs),r),value:r,onChange:c=>o(c,!1),trailing:(0,n.jsx)(s,{variant:"chip",value:r,onChange:c=>o(c,!0),onCommit:a})})})};Y.hasRows=(e,{scene:t,findGeom:r})=>ro(e,t,r)!==null;var ro=(e,t,r)=>{if((0,u.findLayerById)(t.layers,e.layerId)===void 0)return null;const o=(0,u.readObservationsColorPart)({layers:t.layers,target:e});return(0,u.readObservationsColorRoute)(t.spec,e,r,o)},$s=(e,t)=>t===null||e.some(r=>Dr(r,t))?e:[...e,t],rt=[{name:"narrow",width:.4},{name:"regular",width:.7},{name:"wide",width:.95}],Gt=({target:e})=>{const t=l.useSceneSelector(g=>g),r=l.useGraphCommands(),o=l.useI18n(),{ToggleGroup:a}=O(),i=(0,u.findLayerById)(t.spec.layers,e.layerId),s=(0,u.isLayerSpecOf)(i,"bar")?i:null,c=t.coordSystem.type==="polar"&&t.coordSystem.bandAxis===null,d=g=>{const x=rt.find(({name:f})=>f===g);x!==void 0&&r.dispatch(new u.SetBarWidthCommand({layerId:e.layerId,width:x.width}))},p=rt.map(({name:g})=>({value:g,label:o(`editor.graphPanel.barSection.widths.${g}`),icon:(0,n.jsx)(Hs,{barWidth:g})})),h=s===null?null:(0,u.resolveBarBandFraction)(s.params,t.coordSystem.type),m=rt.find(({width:g})=>g===h)?.name??"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Y,{target:e}),s!==null&&!c?(0,n.jsx)(P,{label:o("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(a,{value:m,options:p,onChange:d})}):null]})};Gt.hasRows=Y.hasRows;var Ws={smooth:"M2 13C6 13 7 5 10 5s4 6 6 6",linear:"M2 13l5-8 4 6 5-4"},Us=({curve:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:Ws[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),qs={gap:"M2 12l4-5M12 10l4-4",connect:"M2 12l4-5M6 7l6 3M12 10l4-4",zero:"M2 12l4-5v7h6V10l4-4"},Ks=({missingValues:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:qs[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),yn={supportsDataLabels:!1,supportsPercentages:!1,supportsStackTotals:!1,supportsCategoryLabels:!1},oo=(e,t,r)=>{if(!r.hasCapability(e.geom,t)||Xs(e))return yn;const{showDataLabels:o}=e.dataLabels,a=e.geom==="bar",i=t==="polar";return{supportsDataLabels:!0,supportsPercentages:o&&r.hasPercentageFormat(e,t),supportsStackTotals:a&&!i&&e.position==="stack",supportsCategoryLabels:a&&i&&e.position==="fill"&&o}},Xs=e=>{const t=(0,u.readVariableName)(e.mapping.color);return e.geom==="tile"&&t!==null&&e.data.getType(t)==="categorical"},ao=(e,t)=>{switch(t){case"gap":return e("editor.graphPanel.treatEmptyValues.leaveGap.label");case"zero":return e("editor.graphPanel.treatEmptyValues.fillZero.label");case"connect":return e("editor.graphPanel.treatEmptyValues.connectGaps.label");default:return t}};var bt=["gap","zero","connect"],Bt=(e,t,r)=>{const o=(0,u.findLayerById)(e.spec.layers,r);if(!(0,u.isLayerSpecOf)(o,"line","area"))return null;const a=e.coordSystem.type==="polar",i=(0,u.buildLayerStyleAddress)(o.geom,o.id),s=(0,u.readStyleCoord)(e.spec),c=e.spec.styles.overrides,d=(0,u.combineKindStyleDeclarations)(c,i,s),p=(0,u.combineKindStyleDeclarations)((0,u.readStyleRulesBeneath)(c,i,s),i,s),h=typeof d?.strokeWidth=="number"?d.strokeWidth:null,m=Zs(o,e.spec.layers),g=a?[]:Js(o),x=g.length>1,f=o.geom==="line"&&!a,b=f?el(e,t,o):0;return{layerId:o.id,showPoints:m!==void 0&&Ys(e,t,m.id),pointLayerId:m?.id??null,showFill:f?b>0:null,drawnFillAlpha:b,smooth:a?null:o.params.curve==="smooth",widthMode:h===null?"auto":"custom",hasUnderlyingStrokeWidth:p?.strokeWidth!==void 0,strokeWidth:h??Qs(e,t,o)??u.DEFAULT_STROKE_WIDTH_PX,missingValues:x?o.params.missingValues:null,missingValueOptions:x?g:[]}},Zs=(e,t)=>(0,u.filterLayersByGeoms)(t,"point").find(r=>(0,u.isCompanionLayer)(r,[e])),Ys=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r);if(o?.geom!=="point")return!1;const a=t.geom.point(o);return o.data.findFirst(i=>a.get("size",i)>0)!==null},Js=e=>{const t=["gap","zero"];return e.position!=="stack"&&e.position!=="fill"&&t.push("connect"),e.geom==="area"?t.filter(r=>r!=="gap"):t},Qs=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.id);if(o?.geom==="line")return t.geom.line(o).get("strokeWidth");if(o?.geom==="area")return t.geom.area(o).get("strokeWidth")},el=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.id);return o?.geom==="line"?t.geom.line(o).get("fillAlpha")??0:0},tl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 11 5.5 5.5 10.5 9 16 4v12H0z"}),(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 11 5.5 5.5 10.5 9 16 4V0H0z"})]}),nl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,n.jsx)("rect",{width:"3.2",height:"3.5",y:"12.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.3",y:"9.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4.5",x:"4.267",y:"11.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"3.3",x:"4.267",y:"7.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.5",x:"8.533",y:"13.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"1.8",x:"8.533",y:"11",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"4",x:"12.8",y:"12",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"2.8",x:"12.8",y:"8.5",rx:".533"})]}),(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,n.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,n.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),io=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"})]})]})}),rl=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"})]}),ol=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"})]})}),al=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"})]})}),il=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"})]})}),sl=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"})]}),ll=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"})]}),cl=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"})]}),dl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,n.jsx)("rect",{width:"3.2",height:"6.5",y:"9.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"8.5",x:"4.267",y:"7.5",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"5",x:"8.533",y:"11",rx:".533"}),(0,n.jsx)("rect",{width:"3.2",height:"7.5",x:"12.8",y:"8.5",rx:".533"})]}),(0,n.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,n.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,n.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,n.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),ul=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"})]})}),hl=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"0.533",fillOpacity:"0.3",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"0.533",fillOpacity:"0.55",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"0.533",fillOpacity:"0.2",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"5.867",fillOpacity:"0.55",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"5.867",fillOpacity:"0.9",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"5.867",fillOpacity:"0.45",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",y:"11.2",fillOpacity:"0.2",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"11.2",fillOpacity:"0.45",rx:".533"}),(0,n.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"11.2",fillOpacity:"0.75",rx:".533"})]})}),pl=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"})]}),ml=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",children:[(0,n.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",strokeOpacity:"0.3",strokeWidth:".8"}),(0,n.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",strokeOpacity:"0.8",strokeWidth:"1.2"})]})}),gl=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,n.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeOpacity:"0.3",strokeWidth:".8"}),(0,n.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",fill:"currentColor",fillOpacity:"0.6"})]}),vl=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",transform:"rotate(-90 8 8)",children:[(0,n.jsxs)("g",{strokeOpacity:"0.2",children:[(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6.6"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"4.4"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.2"})]}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"6.6",pathLength:"100",strokeDasharray:"72 100",strokeOpacity:"0.8"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"4.4",pathLength:"100",strokeDasharray:"52 100",strokeOpacity:"0.6"}),(0,n.jsx)("circle",{cx:"8",cy:"8",r:"2.2",pathLength:"100",strokeDasharray:"34 100",strokeOpacity:"0.45"})]})}),xl=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsx)("path",{fill:"currentColor",fillOpacity:"0.75",d:"M8.4 7.31 8.4 1.01A7 7 0 0 1 13.85 4.16ZM8.8 8 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8ZM8.4 8.69 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59ZM7.6 8.69 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74ZM7.2 8 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31ZM7.6 7.31 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52Z"})}),fl=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("path",{fillOpacity:"0.35",d:"M8.4 3.82 8.4 1.01A7 7 0 0 1 13.85 4.16L11.42 5.56A4.2 4.2 0 0 0 8.4 3.82ZM11.46 6.47 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8L11.46 9.53A3.78 3.78 0 0 0 11.46 6.47ZM10.69 10.01 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59L8.4 11.34A3.36 3.36 0 0 0 10.69 10.01ZM7.6 10.85 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74L5.73 9.77A2.88 2.88 0 0 0 7.6 10.85ZM5.7 8.87 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31L5.7 7.13A2.46 2.46 0 0 0 5.7 8.87ZM6.41 6.62 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52L7.6 5.94A2.1 2.1 0 0 0 6.41 6.62Z"}),(0,n.jsx)("path",{fillOpacity:"0.9",d:"M8.4 7.31 8.4 3.82A4.2 4.2 0 0 1 11.42 5.56ZM8.8 8 11.46 6.47A3.78 3.78 0 0 1 11.46 9.53ZM8.4 8.69 10.69 10.01A3.36 3.36 0 0 1 8.4 11.34ZM7.6 8.69 7.6 10.85A2.88 2.88 0 0 1 5.73 9.77ZM7.2 8 5.7 8.87A2.46 2.46 0 0 1 5.7 7.13ZM7.6 7.31 6.41 6.62A2.1 2.1 0 0 1 7.6 5.94Z"})]})}),bl=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"})]})}),Sl=.55,yl=.15,he=[{name:"column",icon:sl,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:cl,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:ll,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:ol,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:il,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:al,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:io,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:rl,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:dl,summary:{coordType:"cartesian",comboType:"groupedBars"}},{name:"scatter",icon:bl,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:pl,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:ul,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:Sl}},{name:"radialBar",icon:vl,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:yl}},{name:"rose",icon:xl,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:fl,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:ml,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:gl,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:hl,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],Cl=.05,so=(e,t)=>(0,u.isComboGraphType)(e)?(0,u.canBecomeCombo)(t):e.geom==="tile"?(0,u.canBecomeHeatmap)(t):!0,Oe=e=>e===null?null:he.find(t=>jl(t.summary,e))??null,lo=(e,t)=>t===null||(0,u.isComboGraphType)(e)?e:e.position==="dodge"&&co(t)?{...e,position:"identity"}:e.coordType!=="polar"||!_e(e.innerRadius)||t.coordType!=="polar"||!_e(t.innerRadius)?e:{...e,innerRadius:t.innerRadius},co=e=>!(0,u.isComboGraphType)(e)&&e.geom==="bar"&&e.position==="identity",jl=(e,t)=>{if((0,u.isComboGraphType)(e)||(0,u.isComboGraphType)(t))return(0,u.isComboGraphType)(e)&&(0,u.isComboGraphType)(t);const r=e.position===t.position||e.position==="dodge"&&co(t);return e.coordType!==t.coordType||e.geom!==t.geom||!r?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&_e(e.innerRadius)===_e(t.innerRadius)},_e=e=>e>=Cl;var wl="_1a90obs1",Tl=[{summary:{coordType:"cartesian",geom:"area",position:"fill"},icon:tl},{summary:{coordType:"cartesian",comboType:"stackedBars"},icon:nl},{summary:{coordType:"cartesian",comboType:"lines"},icon:io}],kl=[["column","column"],["bar","bar"],["line","line"],["area","areaStacked"],["combo","combo"],["scatter","scatter"],["pie","pie"],["donut","donut"],["heatmap","heatmap"]],Al=4,Pl={dodge:"grouped",identity:"grouped",stack:"stacked",fill:"filled"},Ll={groupedBars:"grouped",stackedBars:"stacked",lines:"lines"},Il=()=>{const e=l.useSceneSelector(L=>L.spec),t=l.useSceneSelector(({layers:L})=>L.some(E=>(0,u.hasMultipleGroups)(E.data,E.mapping))),r=l.useGraphCommands(),o=l.useI18n(),{Button:a,RadioGrid:i}=O(),[s,c]=(0,v.useState)(!1),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!s)return;const L=({target:E,detail:I})=>{I>0&&Ml(E)&&d.current?.contains(E)&&c(!1)};return document.addEventListener("click",L),()=>document.removeEventListener("click",L)},[s]);const p=(0,u.readGraphType)(e);if(p===null)return null;const h=Rl(p),m=Ne(p),g=Oe(p),x=h??g,f=o(x===null?"editor.overlayMenu.customChartType":`editor.graphTypes.${x.name}`),b=(h===void 0?g:jn(h,m))?.icon,S=h!==void 0&&h.arrangements.length>1,C=S&&(t||h.name==="combo"),A=()=>c(!s),T=({summary:L})=>{r.dispatch(new u.SetGraphTypeCommand(lo(L,p)),{transient:!0})},k=L=>{const E=Cn.find(I=>I.name===L);E!==void 0&&T(jn(E,S?m:null))},w=Cn.map(({name:L,arrangements:[E]})=>({value:L,label:o(`editor.graphTypes.${L}`),icon:(0,n.jsx)(E.icon,{size:"md"}),disabled:!so(E.summary,e)}));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{label:o("editor.overlayMenu.chartType"),children:b===void 0?(0,n.jsx)(a,{label:f,expanded:s,onClick:A}):(0,n.jsx)(a,{variant:"icon",icon:(0,n.jsx)(b,{size:"sm"}),ariaLabel:f,expanded:s,onClick:A})}),s&&(0,n.jsx)(P,{layout:"stack",children:(0,n.jsx)("div",{ref:d,className:"_1a90obs0",children:(0,n.jsx)(i,{options:w,value:h?.name??"",onChange:k,onCommit:r.commit,columns:Al,itemLayout:"swatch",ariaLabel:o("editor.overlayMenu.chartType")})})}),C&&(0,n.jsx)(El,{type:h,arrangement:m,onPick:T,onCommit:r.commit})]})},uo=(e,t)=>(0,u.isComboGraphType)(e)||(0,u.isComboGraphType)(t)?(0,u.isComboGraphType)(e)&&(0,u.isComboGraphType)(t):e.coordType==="polar"?Oe(e)===Oe(t):e.coordType===t.coordType&&e.geom===t.geom,ho=kl.flatMap(([e,t])=>{const r=he.find(o=>o.name===t);return r===void 0?[]:[{name:e,arrangements:[r,...[...he,...Tl].filter(o=>o!==r&&uo(r.summary,o.summary))]}]}),Cn=ho.filter(({name:e})=>e!=="combo"),El=({type:e,arrangement:t,onPick:r,onCommit:o})=>{const a=l.useI18n(),{ToggleGroup:i}=O(),s=e.arrangements.map(({summary:d,icon:p})=>{const h=Ne(d);return{value:h,label:a(`editor.overlayMenu.arrangements.${h}`),icon:(0,n.jsx)(p,{size:"sm"})}}),c=d=>{const p=e.arrangements.find(({summary:h})=>Ne(h)===d);p!==void 0&&r(p)};return(0,n.jsx)(P,{label:a("editor.overlayMenu.arrange"),children:(0,n.jsx)("div",{className:wl,children:(0,n.jsx)(i,{options:s,value:t,onChange:c,onCommit:o})})})},Ml=e=>e instanceof Element&&e.closest('[role="radio"]:not([aria-disabled="true"])')!==null,Ne=e=>(0,u.isComboGraphType)(e)?Ll[e.comboType]:Pl[e.position],jn=(e,t)=>e.arrangements.find(({summary:r})=>Ne(r)===t)??e.arrangements[0],Rl=e=>ho.find(({arrangements:[t]})=>uo(t.summary,e)),Ol=()=>{const e=l.useSceneSelector(c=>c.scales.color),t=l.useGraphCommands(),r=l.useI18n(),[o,a]=(0,v.useState)(null);(0,v.useEffect)(()=>()=>t.commit(),[t]);const i=(0,u.readColorChoices)(e),s=(0,u.readColormapColor)(e,o===null?i:[o,...i]);return(s===null?[{label:r("editor.overlayMenu.lowColor"),color:(0,u.readDivergingColor)(e,"low"),buildRange:c=>(0,u.buildDivergingRange)(e,"low",c)},{label:r("editor.overlayMenu.highColor"),color:(0,u.readDivergingColor)(e,"high"),buildRange:c=>(0,u.buildDivergingRange)(e,"high",c)}]:[{label:r("editor.overlayMenu.fillColor"),color:s,buildRange:c=>(0,u.buildColormapRange)(e,c)}]).map(({label:c,color:d,buildRange:p})=>{if(d===null)return null;const h=(m,g)=>{const x=p(m);x!==null&&(a(m),t.dispatch(new u.SetScaleRangeCommand({scaledAesthetic:"color",range:x}),g?{transient:!0}:void 0))};return(0,n.jsx)(no,{label:c,palette:i,selectedColor:d,paint:h,commit:()=>t.commit()},c)})},po=({lineStyle:e,...t})=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 18 18",...t,children:[e==="solid"&&(0,n.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:2}),e==="dashed"&&(0,n.jsx)("path",{d:"M1 9h4m2 0h4m2 0h4",stroke:"currentColor",strokeWidth:2}),e==="dotted"&&(0,n.jsxs)("g",{fill:"currentColor",children:[(0,n.jsx)("circle",{cx:2.4,cy:9,r:1.4}),(0,n.jsx)("circle",{cx:9,cy:9,r:1.4}),(0,n.jsx)("circle",{cx:15.6,cy:9,r:1.4})]})]}),mo=({lineWidth:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:e})}),_l={small:2,medium:3.8,large:5.6},Nl=({pointSize:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("circle",{cx:9,cy:9,r:_l[e],fill:"currentColor"})});var Dl=({symbol:e,...t})=>{const r=(0,u.buildPointSymbolInBox)(e,12,12),o=18/2;return(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("path",{d:r.path,fill:"currentColor",transform:`translate(${o+r.offsetX} ${o+r.offsetY})`})})},Fl="_1yjsaqt0",Gl="_1yjsaqt1",Bl="_1yjsaqt2",zl="_1yjsaqt3";var p2=512*1024,Hl=e=>new Promise(t=>{if(e.size>524288){t({rejection:"oversized"});return}if(!e.type.startsWith("image/")){t({rejection:"undecodable"});return}const r=new FileReader;r.onerror=()=>t({rejection:"undecodable"}),r.onload=()=>{const o=r.result;if(typeof o!="string"||!o.startsWith("data:image/")){t({rejection:"undecodable"});return}const a=new Image;a.onload=()=>t({image:o}),a.onerror=()=>t({rejection:"undecodable"}),a.src=o},r.readAsDataURL(e)}),wn=["solid","dashed","dotted"],ot=[{name:"thin",widthPx:2},{name:"medium",widthPx:3},{name:"thick",widthPx:5}],at=[{name:"small",sizePx:6},{name:"medium",sizePx:8},{name:"large",sizePx:10}],Vl=["circle","square","diamond","triangle","cross","star"],go=({widthPx:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=ot.find(({name:c})=>c===i);s!==void 0&&t(s.widthPx)};return(0,n.jsx)(P,{label:r("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(o,{value:ot.find(i=>i.widthPx===e)?.name??"",options:ot.map(({name:i,widthPx:s})=>({value:i,label:r(`editor.graphPanel.gridSection.lineWidths.${i}`),icon:(0,n.jsx)(mo,{lineWidth:s})})),onChange:a})})},vo=({lineStyle:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=wn.find(c=>c===i);s!==void 0&&t(s)};return(0,n.jsx)(P,{label:r("editor.fineTunePanel.lineStyleSection.title"),children:(0,n.jsx)(o,{value:e??"",options:wn.map(i=>({value:i,label:r(`editor.graphPanel.gridSection.lineStyles.${i}`),icon:(0,n.jsx)(po,{lineStyle:i})})),onChange:a})})},zt=({symbol:e,coordType:t,onChange:r})=>{const o=l.useI18n(),{RadioGrid:a}=O(),[i,s]=(0,v.useState)(null),c=(0,v.useContext)(Ke),d=l.useGlyphRegistry(),p=l.useGeomRendererResolver(),h=c?c.getPointSymbols(t):p("point",t)?.symbols,m=c?new Map(c.getGlyphs().map(({name:w,definition:L})=>[w,L])):d;if(h===void 0||h.length===0)return null;const g=w=>typeof w=="string"&&h.includes(w),x=w=>g(w)||(0,u.isImageSymbol)(w)||!(0,u.isGeometricSymbol)(w)&&m.has(w),f=w=>!(0,u.isGeometricSymbol)(w)||Vl.some(L=>L===w),b=[...m.keys()].filter(w=>!(0,u.isGeometricSymbol)(w)&&!g(w)),S=[...h.filter(f),...b],C=e===null?"":Se(e),A=e===null||S.some(w=>Se(w)===C)||!x(e)?S:[...S,e],T=w=>(0,u.isGeometricSymbol)(w)?o(`editor.graphPanel.pointSymbol.symbols.${w}`):(0,u.isImageSymbol)(w)?o("editor.graphPanel.pointSymbol.custom"):w,k=w=>{s(null);const L=A.find(E=>Se(E)===w);L!==void 0&&r(L)};return(0,n.jsx)(P,{label:o("editor.graphPanel.pointSymbol.label"),layout:"stack",children:(0,n.jsxs)("div",{className:Fl,children:[(0,n.jsxs)("div",{className:Gl,children:[(0,n.jsx)(a,{itemLayout:"chip",value:C,options:A.map(w=>({value:Se(w),label:T(w),icon:(0,n.jsx)(Wl,{symbol:w,glyphs:m})})),onChange:k}),(0,n.jsxs)("span",{className:Bi,children:[(0,n.jsx)("span",{className:zi,"aria-hidden":"true"}),(0,n.jsx)($l,{label:o("editor.graphPanel.pointSymbol.custom"),onChange:w=>{s(null),r(w)},onReject:s})]})]}),i!==null&&(0,n.jsx)("p",{className:"_1yjsaqt4",role:"status",children:o(`editor.graphPanel.pointSymbol.${i}`)})]})})},Ht=({sizePx:e,onChange:t})=>{const r=l.useI18n(),{ToggleGroup:o}=O(),a=i=>{const s=at.find(({name:c})=>c===i);s!==void 0&&t(s.sizePx)};return(0,n.jsx)(P,{label:r("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(o,{value:at.find(i=>i.sizePx===e)?.name??"",options:at.map(({name:i})=>({value:i,label:r(`editor.graphPanel.pointSize.sizes.${i}`),icon:(0,n.jsx)(Nl,{pointSize:i})})),onChange:a})})},$l=({label:e,onChange:t,onReject:r})=>{const{FileInput:o}=O(),a=i=>{Hl(i).then(s=>{"image"in s?t({image:s.image}):r(s.rejection)})};return(0,n.jsx)(o,{variant:"chip",label:e,accept:"image/*",onFile:a})},Wl=({symbol:e,glyphs:t})=>{if((0,u.isGeometricSymbol)(e))return(0,n.jsx)(Dl,{symbol:e});const r=Ul(e,t);if(r!==null&&l.tintsGlyphImage(r))return(0,n.jsx)("span",{className:zl,style:{maskImage:`url(${JSON.stringify(r)})`}});if(r!==null)return(0,n.jsx)("img",{className:Bl,src:r,alt:""});const o=18/2;return(0,n.jsx)("svg",{viewBox:`${-o} ${-o} 18 18`,width:16,height:16,"aria-hidden":"true",children:(0,n.jsx)(l.GlyphMark,{symbol:e,glyphs:t,size:12,fill:"currentColor"})})},Se=e=>typeof e=="string"?e:e.image,Ul=(e,t)=>{if((0,u.isImageSymbol)(e))return e.image;const r=t.get(e);return r!==void 0&&typeof r!="function"&&"image"in r?r.image:null},xo=(0,v.createContext)({}),ql=xo.Provider,Kl=()=>(0,v.useContext)(xo),Xl="_1qh3fon0",St="theme",Zl=3,ye=14,Tn=9,fo=()=>{const e=l.useSceneSelector(h=>h.scales.color),t=Kl(),r=l.useGraphCommands(),o=l.useI18n(),{RadioGrid:a}=O();if(Object.keys(t).length===0||e?.kind!=="visual"||e.spec.scaleType!=="discrete"||e.defaultPalette===void 0)return null;const{defaultPalette:i,spec:s}=e,c=Object.entries(t),d=[{value:St,label:o("editor.overlayMenu.themePalette"),icon:(0,n.jsx)(kn,{colors:i})},...c.map(([h,m])=>({value:yt(h),label:h,icon:(0,n.jsx)(kn,{colors:m})}))],p=h=>{const m=c.find(([x])=>yt(x)===h);if(h!==St&&m===void 0)return;const g=m===void 0?null:[...m[1]];r.dispatch(new u.SetScaleRangeCommand({scaledAesthetic:"color",range:g}),{transient:!0})};return(0,n.jsx)(P,{label:o("editor.overlayMenu.palette"),layout:"stack",children:(0,n.jsx)(a,{options:d,value:Yl(s.range,c),onChange:p,onCommit:r.commit,columns:4,itemLayout:"track"})})},yt=e=>`preset:${e}`,Yl=(e,t)=>{if(e===null)return St;const r=t.find(([,o])=>(0,re.isEqual)(o,e));return r===void 0?"":yt(r[0])},kn=({colors:e})=>{const t=e.slice(0,Zl),r=ye/2,o=ye+(t.length-1)*Tn;return(0,n.jsx)("svg",{width:o,height:ye,viewBox:`0 0 ${o} ${ye}`,"aria-hidden":"true",children:t.map((a,i)=>(0,n.jsx)("circle",{className:Xl,cx:r+i*Tn,cy:r,r:r-.5,fill:a},i)).reverse()})},An=["smooth","linear"],Vt=()=>{const e=l.useSceneSelector(j=>j),t=l.useStyleReaderTree(),r=l.useDataLabelPlacementResolver(),o=l.useGraphCommands(),a=l.useI18n(),{Switch:i,ToggleGroup:s}=O(),c=bo(e.layers,e.coordSystem.type,r),d=j=>c.filter(({support:y})=>j(y)).map(({layer:y})=>y),p=Jl(e,t),h=p.filter(j=>j.smooth!==null),m=p.filter(j=>j.missingValues!==null&&j.missingValueOptions.length>1),g=bt.filter(j=>m.some(y=>y.missingValueOptions.includes(j))),x=nc(h),f=rc(m),b=j=>{o.dispatch(new u.SequenceCommand({commands:p.map(y=>new u.ToggleLinePointsCommand({layerId:y.layerId,showPoints:j}))}))},S=j=>{const y=An.find(R=>R===j);y!==void 0&&o.dispatch(new u.SequenceCommand({commands:h.map(R=>new u.SetLineCurveCommand({layerId:R.layerId,curve:y}))}))},C=j=>{const y=bt.find(D=>D===j);if(y===void 0)return;const R=m.filter(D=>D.missingValueOptions.includes(y)).map(D=>new u.SetLineMissingValuesCommand({layerId:D.layerId,missingValues:y}));R.length!==0&&o.dispatch(new u.SequenceCommand({commands:R}))},A=p.filter(j=>j.showFill!==null),T=p.filter(j=>j.showPoints),k=Ql(e,t,p),w=A.some(j=>ec(e,j)),L=j=>{j.length>0&&o.dispatch(new u.SequenceCommand({commands:j}))},E=j=>{L(p.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,strokeWidth:j})))},I=j=>{L(p.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,lineStyle:j})))},G=j=>{L(A.map(y=>new u.SetLineStyleCommand({layerId:y.layerId,showFill:j,drawnFillAlpha:y.drawnFillAlpha})))},N=j=>{L(T.flatMap(({pointLayerId:y})=>y===null?[]:[new u.SetPointSizeCommand({layerId:y,size:j})]))};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Il,{}),(0,n.jsx)(Ce,{label:a("editor.graphPanel.graphOptions.dataLabels"),layers:d(j=>j.supportsDataLabels),isOn:j=>j.showDataLabels,buildCommand:(j,y)=>new u.ToggleDataLabelsCommand({layerId:j,showDataLabels:y})}),(0,n.jsx)(Ce,{label:a("editor.graphPanel.graphOptions.showPercentages"),layers:d(j=>j.supportsPercentages),isOn:j=>j.format==="percentage",buildCommand:(j,y)=>new u.SetDataLabelsFormatCommand({layerId:j,format:y?"percentage":"absolute"})}),(0,n.jsx)(Ce,{label:a("editor.graphPanel.graphOptions.stackTotals"),layers:d(j=>j.supportsStackTotals),isOn:j=>j.showStackTotals,buildCommand:(j,y)=>new u.ToggleStackTotalsCommand({layerId:j,showStackTotals:y})}),(0,n.jsx)(Ce,{label:a("editor.graphPanel.graphOptions.categoryLabels"),layers:d(j=>j.supportsCategoryLabels),isOn:j=>j.showCategoryLabels,buildCommand:(j,y)=>new u.ToggleCategoryLabelsCommand({layerId:j,showCategoryLabels:y})}),(0,n.jsx)(P,{label:a("editor.elementsPanel.headerSection.toggleTitle"),children:(0,n.jsx)(i,{checked:e.config.content.showTitle,onChange:j=>o.dispatch(new u.ToggleContentVisibilityCommand({part:"title",visible:j}))})}),(0,n.jsx)(P,{label:a("editor.elementsPanel.headerSection.subtitle"),children:(0,n.jsx)(i,{checked:e.config.content.showSubtitle,onChange:j=>o.dispatch(new u.ToggleContentVisibilityCommand({part:"subtitle",visible:j}))})}),(0,n.jsx)(P,{label:a("editor.elementsPanel.footerSection.caption"),children:(0,n.jsx)(i,{checked:e.config.content.showCaption,onChange:j=>o.dispatch(new u.ToggleContentVisibilityCommand({part:"caption",visible:j}))})}),h.length>0&&(0,n.jsx)(P,{label:a("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(s,{value:x,options:An.map(j=>({value:j,label:a(`editor.graphPanel.graphOptions.curves.${j}`),icon:(0,n.jsx)(Us,{curve:j})})),onChange:S})}),g.length>1&&(0,n.jsx)(P,{label:a("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:f,options:g.map(j=>({value:j,label:ao(a,j),icon:(0,n.jsx)(Ks,{missingValues:j})})),onChange:C})}),p.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(go,{widthPx:it(k.map(j=>j.strokeWidth)),onChange:E}),(0,n.jsx)(vo,{lineStyle:it(k.map(j=>j.lineStyle)),onChange:I})]}),A.length>0&&(0,n.jsx)(P,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(i,{checked:w,onChange:G})}),p.length>0&&(0,n.jsx)(P,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(i,{checked:T.length>0,onChange:b})}),T.length>0&&(0,n.jsx)(Ht,{sizePx:it(tc(e,t,T)),onChange:N}),(0,n.jsx)(fo,{}),(0,n.jsx)(Ol,{})]})};Vt.hasRows=(e,{scene:t,dataLabelPlacement:r})=>(0,u.readGraphType)(t.spec)!==null||bo(t.layers,t.coordSystem.type,r).some(({support:o})=>o.supportsDataLabels)||t.spec.layers.some(o=>o.interactive&&(0,u.isLayerSpecOf)(o,"line","area"));var bo=(e,t,r)=>e.filter(o=>o.interactive).map(o=>({layer:o,support:oo(o,t,r)})),Jl=(e,t)=>{const r=[];for(const o of e.spec.layers){if(!o.interactive)continue;const a=Bt(e,t,o.id);a!==null&&r.push(a)}return r},Ql=(e,t,r)=>r.flatMap(o=>{const a=(0,u.findLayerById)(e.layers,o.layerId);if(a?.geom==="line"){const s=t.geom.line(a);return Array.from(a.data,c=>({strokeWidth:s.get("strokeWidth",c),lineStyle:(0,u.toDashPreset)(s.get("dashArray",c))}))}if(a?.geom!=="area")return[];const i=t.geom.area(a);return Array.from(a.data,s=>({strokeWidth:i.get("strokeWidth",s),lineStyle:(0,u.toDashPreset)(i.get("dashArray",s))}))}),ec=(e,t)=>{if(t.showFill===!0)return!0;const r=(0,u.buildLayerStyleAddress)("line",t.layerId),o=(0,u.readStyleCoord)(e.spec);return e.spec.styles.overrides.some(a=>!(0,u.isGeomStyleRule)(a)||a.when?.where===void 0?!1:(0,u.createStyleRuleMatcher)({...r,when:a.when},o)(a)&&"fillAlpha"in a.declarations&&(a.declarations.fillAlpha??0)>0)},tc=(e,t,r)=>r.flatMap(o=>{const a=o.pointLayerId===null?void 0:(0,u.findLayerById)(e.layers,o.pointLayerId);if(a?.geom!=="point")return[];const i=t.geom.point(a);return Array.from(a.data,s=>i.get("size",s)).filter(s=>s>0)}),it=e=>{const[t]=e;return t!==void 0&&e.every(r=>r===t)?t:null},nc=e=>e.every(t=>t.smooth===!0)?"smooth":e.every(t=>t.smooth!==!0)?"linear":"",rc=e=>{const[t,...r]=e,o=t?.missingValues??null;return o===null?"":r.every(a=>a.missingValues===o)?o:""},Ce=({label:e,layers:t,isOn:r,buildCommand:o})=>{const a=l.useGraphCommands(),{Switch:i}=O();if(t.length===0)return null;const s=c=>{a.dispatch(new u.SequenceCommand({commands:t.map(d=>o(d.id,c))}))};return(0,n.jsx)(P,{label:e,children:(0,n.jsx)(i,{checked:t.some(c=>r(c.dataLabels)),onChange:s})})},oc=(e,t)=>{const r=(0,u.findLayerById)(t.layers,e);if(r===void 0)return null;const o=(0,u.findLayerById)(t.spec.layers,e),a=o===void 0?null:(0,u.findHostLayer)(o,t.spec.layers),i=a!==null&&a.id!==r.id?a:r;return{geom:i.geom,coord:t.spec.coords.coordType,position:i.position}},je=(e,t)=>{for(const r of e){const o=t(r);if(o!==void 0)return o}return null},ac=({geom:e,coord:t,position:r},o,a="style",i=null)=>{for(const s of o){const c=Pn(Ln(s.layers,e)?.[t]?.[r],a),d=c!==void 0?c:Pn(Ln(s.geoms,e),a);if(d===null)return null;if(d!==void 0)return d}return i},ic=e=>typeof e=="object"&&("style"in e||"annotate"in e),Pn=(e,t)=>e==null?e:ic(e)?e[t]:t==="style"?e:void 0,Ln=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,De=["solid","dashed","dotted"];var So=e=>e.scaledAesthetic==="x"||e.scaledAesthetic==="y",yo=(e,t)=>{const r=e.guides.axes.filter(So);if(r.length===0)return null;const o=t.gridLine.y().resolve();return{axes:r,stylable:e.coordSystem.type!=="polar",lineStyle:(0,u.toDashPreset)(o.dashArray),strokeWidth:o.strokeWidth}},sc=(e,t)=>{if(e==="both")return t.axes.every(o=>!o.showGrid);const r=t.axes.find(o=>o.scaledAesthetic===e);return r===void 0||!r.showGrid},Co=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,lineStyle:e}),jo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,strokeWidth:e}),st=[{name:"thin",widthPx:1},{name:"medium",widthPx:2},{name:"thick",widthPx:4}],$t=({target:e})=>{const t=l.useSceneSelector(S=>S),r=l.useStyleReaderTree(),o=yo(t,r),a=l.useI18n(),i=l.useGraphCommands(),{ToggleGroup:s}=O();if(o===null||!o.stylable)return null;const c=e.axis==="both"?"y":e.axis,d=r.gridLine[c]().resolve(),p=(0,u.toDashPreset)(d.dashArray),h=sc(e.axis,o),m=De.map(S=>({value:S,label:a(`editor.graphPanel.gridSection.lineStyles.${S}`),icon:(0,n.jsx)(po,{lineStyle:S})})),g=st.map(({name:S,widthPx:C})=>({value:S,label:a(`editor.graphPanel.gridSection.lineWidths.${S}`),icon:(0,n.jsx)(mo,{lineWidth:C})})),x=st.find(({widthPx:S})=>S===d.strokeWidth)?.name??"",f=S=>{const C=De.find(A=>A===S);C!==void 0&&i.dispatch(Co(C,e.axis))},b=S=>{const C=st.find(({name:A})=>A===S);C!==void 0&&i.dispatch(jo(C.widthPx,e.axis))};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{label:a("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(s,{value:p,options:m,onChange:f,disabled:h})}),(0,n.jsx)(P,{label:a("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:x,options:g,onChange:b,disabled:h})})]})};$t.hasRows=(e,{scene:t})=>{if(t.coordSystem.type==="polar")return!1;const r=t.guides.axes.filter(So);return r.length===0?!1:e.axis==="both"?!0:r.some(o=>o.scaledAesthetic===e.axis)};var In=[{position:"top",align:"start",gridRow:1,gridColumn:1},{position:"top",align:"center",gridRow:1,gridColumn:2},{position:"top",align:"end",gridRow:1,gridColumn:3},{position:"right",align:"center",gridRow:2,gridColumn:3},{position:"bottom",align:"end",gridRow:3,gridColumn:3},{position:"bottom",align:"center",gridRow:3,gridColumn:2},{position:"bottom",align:"start",gridRow:3,gridColumn:1},{position:"left",align:"center",gridRow:2,gridColumn:1}],lc={start:"Start",center:"Center",end:"End"},wo=()=>{const e=l.useSceneSelector(d=>d.guides.legends.drawn[0]),t=l.useGraphCommands(),r=l.useI18n(),{RadioGrid:o}=O(),a=e===void 0,i=a?"":lt(e),s=In.map(d=>{const p=lt(d);return{value:p,label:r(`editor.overlayMenu.legendPlaces.${p}`),icon:(0,n.jsx)(l.ArrowIcon,{title:"",size:"xs",style:{transform:`rotate(${cc(d)}deg)`}}),gridRow:d.gridRow,gridColumn:d.gridColumn}}),c=d=>{const p=In.find(h=>lt(h)===d);p!==void 0&&t.dispatch(new u.SetLegendPlacementCommand({position:p.position,align:p.align}),{transient:!0})};return(0,n.jsx)(P,{label:r("editor.axesPanel.controls.position"),children:(0,n.jsx)(_t.DirectionProvider,{direction:"ltr",children:(0,n.jsx)("div",{dir:"ltr",children:(0,n.jsx)(o,{options:s,value:i,onChange:c,onCommit:t.commit,columns:3,itemLayout:"icon",disabled:a})})})})},lt=({position:e,align:t})=>e==="left"||e==="right"?e:`${e}${lc[t]}`,cc=({gridRow:e,gridColumn:t})=>Math.atan2(t-2,2-e)*180/Math.PI,To=(e,t,r,o)=>{const a=Ao(e,r,o)?.size;if(typeof a=="number")return a;const i=(0,u.findLayerById)(e.layers,r);return i?.geom==="point"?t.geom.point(i).get("size"):u.DEFAULT_POINT_SIZE_PX},ko=(e,t,r,o)=>{const a=Ao(e,r,o)?.symbol;if(a!==void 0)return a;const i=(0,u.findLayerById)(e.layers,r);return i?.geom==="point"?t.geom.point(i).get("symbol"):"circle"},Ao=(e,t,r)=>r===void 0?void 0:(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("point",t),when:{where:r}},(0,u.readStyleCoord)(e.spec)),Fe=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(dc,{graph:t,target:e})};Fe.hasRows=(e,{scene:t})=>e.scope==="group"&&Po(t,e.layerId)!==null;var dc=({graph:e,target:t})=>{const r=l.useHandleScene(e),o=l.useStyleReaderTree(),a=l.useI18n(),{Switch:i}=O(),s=r===null?null:Po(r,t.layerId),c=r===null||s===null?null:Bt(r,o,s.id);if(r===null||s===null||c===null)return null;const d=mc(r,t),p=d===void 0?{}:{where:d},h=d===void 0||s.geom!=="line"?void 0:pc(r,c.layerId,d),m=h===void 0?c.showFill:h>0,g=d===void 0?null:uc(r,s.geom,c.layerId,d),x=d===void 0?c.strokeWidth:g??hc(r,o,t)??c.strokeWidth,f=c.pointLayerId===null?null:To(r,o,c.pointLayerId,d),b=c.pointLayerId===null?null:ko(r,o,c.pointLayerId,d),S=f!==null&&f>0,C=I=>{e.commands.dispatch(new u.ToggleLinePointsCommand({layerId:c.layerId,showPoints:I,...p}))},A=I=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,showFill:I,drawnFillAlpha:c.drawnFillAlpha,...p}))},T=I=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,strokeWidth:I,...p}))},k=I=>{c.pointLayerId!==null&&e.commands.dispatch(new u.SetPointSizeCommand({layerId:c.pointLayerId,size:I,...p}))},w=I=>{c.pointLayerId!==null&&e.commands.dispatch(new u.SetPointSymbolCommand({layerId:c.pointLayerId,symbol:I,...p}))},L=I=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,lineStyle:I,...p}))},E=(0,u.readObservationsColorRoute)(r.spec,t)?.some(I=>I.geomKind==="line"||I.geomKind==="area")===!0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Y,{target:t}),(0,n.jsx)(go,{widthPx:x,onChange:T}),E&&(0,n.jsx)(vo,{lineStyle:gc(r,o,t),onChange:L}),c.showFill!==null&&(0,n.jsx)(P,{label:a("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(i,{checked:m===!0,onChange:A})}),(0,n.jsx)(P,{label:a("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(i,{checked:S,onChange:C})}),S&&(0,n.jsx)(Ht,{sizePx:f,onChange:k}),S&&(0,n.jsx)(zt,{symbol:b,coordType:r.coordSystem.type,onChange:w})]})},uc=(e,t,r,o)=>{const a=(t==="line"?(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",r),when:{where:o}},(0,u.readStyleCoord)(e.spec)):(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("area",r),when:{where:o}},(0,u.readStyleCoord)(e.spec)))?.strokeWidth;return typeof a=="number"?a:null},hc=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.layerId),a=o===void 0?void 0:(0,u.findHostLayer)(o,e.layers);if(a?.geom!=="line"&&a?.geom!=="area")return null;const[i]=(0,u.resolveObservationsTarget)({layer:a,target:r,parsingLocale:e.config.parsingLocale}),s=i===void 0?void 0:a.data.getAt(i)??void 0,c=a.geom==="line"?t.geom.line(a).get("strokeWidth",s):t.geom.area(a).get("strokeWidth",s);return typeof c=="number"?c:null},pc=(e,t,r)=>{const o=(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",t),when:{where:r}},(0,u.readStyleCoord)(e.spec))?.fillAlpha;return typeof o=="number"?o:void 0},mc=(e,t)=>(0,u.readObservationsColorRoute)(e.spec,t)?.find(r=>r.geomKind==="line"||r.geomKind==="area")?.where,gc=(e,t,r)=>{const o=(0,u.findLayerById)(e.layers,r.layerId),a=o===void 0?void 0:(0,u.findHostLayer)(o,e.layers);if(a?.geom!=="line"&&a?.geom!=="area")return"solid";const[i]=(0,u.resolveObservationsTarget)({layer:a,target:r,parsingLocale:e.config.parsingLocale}),s=i===void 0?null:a.data.getAt(i);return(0,u.toDashPreset)(a.geom==="line"?t.geom.line(a).get("dashArray",s??void 0):t.geom.area(a).get("dashArray",s??void 0))},Po=(e,t)=>{const r=(0,u.findLayerById)(e.spec.layers,t);if(r===void 0)return null;const o=(0,u.findHostLayer)(r,e.spec.layers);return(0,u.isLayerSpecOf)(o,"line","area")?o:null},Lo=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"})]}),vc="_1aafi1g0",xc="_1aafi1g1",En=({children:e})=>(0,n.jsxs)("span",{className:vc,"aria-hidden":"true",children:[e,(0,n.jsx)("span",{className:xc})]}),fc=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"})}),Io=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"})]}),Eo=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"})]}),Mo=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"})]}),bc=e=>{const t=[{scope:"observation",labelKey:"bar"}];if(!(0,u.hasMultipleGroups)(e.data,e.mapping))return t;const r=e.position==="stack"||e.position==="fill";return t.push({scope:"xValue",labelKey:r?"barStack":"barGroup"}),t.push({scope:"group",labelKey:"barSeries"}),t},Ro=e=>{const t=[{scope:"observation",labelKey:"linePoint"}];return(0,u.hasMultipleGroups)(e.data,e.mapping)&&t.push({scope:"group",labelKey:"lineSeries"}),t},Oo=e=>{const t=[{scope:"observation",labelKey:"scatterPoint"}];return(0,u.hasMultipleGroups)(e.data,e.mapping)&&t.push({scope:"group",labelKey:"scatterSeries"}),t},Sc=()=>[{scope:"group",labelKey:"pieSlice"}];function yc(e,t){if(e.type==="polar"&&!Cc(t))return Sc();switch(t.geom){case"bar":return bc(t);case"line":case"area":return Ro(t);case"point":return Oo(t);default:return[]}}var Cc=e=>{const t=(0,u.readVariableName)(e.mapping.x);return t!==null&&t!==u.CONSTANT_VARIABLES.x},_o=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"})]}),No=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"})]}),Do=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"})]}),jc=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"})]}),wc=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"})]}),Tc=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"})]}),kc=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"})]}),Ac=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)"})]}),Pc=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)"})]}),Lc={bar:_o,barGroup:No,barStack:jc,barSeries:Do,linePoint:wc,lineSeries:Tc,scatterPoint:Ac,scatterSeries:Pc,pieSlice:kc},Mn=({labelKey:e})=>{const t=Lc[e];return(0,n.jsx)(t,{})},Ic=(e,t)=>{const r=l.useSceneSelector(a=>a.spec.highlights),o=l.useSceneSelector(a=>a.config.parsingLocale);return(0,v.useMemo)(()=>(0,u.findHighlightsAtObservation)({layer:e,highlights:r,observation:t,parsingLocale:o}),[e,r,t,o])},Ec={pinnedNumber:!0,comment:!0,sticker:!0,image:!1},Mc=e=>(0,u.isObservationAttachmentKind)(e.kind)&&Ec[e.kind],Rc="_2m7wuq0",Fo=()=>(0,n.jsx)(xi.Separator,{className:Rc}),Go="vez73g0",Oc="vez73g1",_c="vez73g2",Nc="vez73g3",Dc="vez73g4",Fc="vez73g5",Gc="vez73g6",Bc="vez73g7",zc="vez73g8",Hc="relativeDifference",Bo={pinnedNumber:{phrase:"graph.annotations.baseMenu.unpinNumber",Icon:Eo},comment:{phrase:"graph.annotations.baseMenu.removeAnnotation",Icon:Lo},sticker:{phrase:"graph.annotations.baseMenu.removeSticker",Icon:Mo}},Wt=e=>{const t=({target:r})=>{const o=Pr(r);return o===null?null:(0,n.jsx)($c,{anchor:o,readHighlightOptions:e})};return t.hasRows=(r,{scene:o})=>Ar(r,o)!==null,t},Ee=Wt((e,t)=>yc(t,e)),Rn=Wt(Ro),Vc=Wt(Oo),$c=({anchor:e,readHighlightOptions:t})=>{const{layer:r,observation:o,at:a}=e,i=l.useI18n(),{dispatch:s}=l.useGraphCommands(),{selectionStore:c}=l.useGraphContext(),{Button:d}=O(),[p,h]=(0,v.useState)(null),m=l.useSceneSelector(w=>w.spec.annotations),g=l.useSceneSelector(w=>w.config.parsingLocale),x=(0,u.findObservationAttachment)(m,a,(0,v.useMemo)(()=>(0,u.createObservationAnchorParser)(r,g),[r,g])),f=x!==null&&Mc(x)?x:null,b=Ic(r,o),S=b.at(-1),C=l.useSceneSelector(w=>w.coordSystem),A=(0,v.useMemo)(()=>(0,u.inferDifferenceArrowEndpoints)({layer:r,at:a,coordSystem:C}),[r,a,C]),T=w=>{s(w),c.getState().clearSelection()},k=()=>h(null);return p==="comment"?(0,n.jsx)(ct,{title:i("graph.annotations.textMenu.title"),onBack:k,children:(0,n.jsx)(Uc,{at:a,onRun:T})}):p==="sticker"?(0,n.jsx)(ct,{title:i("graph.annotations.stickerMenu.title"),onBack:k,children:(0,n.jsx)(qc,{at:a,onRun:T})}):p==="highlight"?(0,n.jsx)(ct,{title:i("graph.annotations.highlights.menuTitle"),onBack:k,children:(0,n.jsx)(On,{layer:r,observation:o,highlights:b,options:t(r,C),expanded:!0,onOpen:k,onRun:T})}):(0,n.jsxs)("div",{className:Go,children:[f!==null&&(0,n.jsx)(d,{label:i(Bo[f.kind].phrase),icon:(0,n.jsx)(En,{children:Wc(f.kind)}),onClick:()=>T(new u.RemoveAnnotationCommand({id:f.annotation.id}))}),S!==void 0&&(0,n.jsx)(d,{label:i("graph.annotations.baseMenu.removeHighlight"),icon:(0,n.jsx)(En,{children:(0,n.jsx)(Io,{})}),onClick:()=>T(new u.RemoveHighlightCommand({id:S.id}))}),(f!==null||S!==void 0)&&(0,n.jsx)(Fo,{}),f===null&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d,{label:i("graph.annotations.baseMenu.pinNumber"),icon:(0,n.jsx)(Eo,{}),onClick:()=>T(new u.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:a}}))}),(0,n.jsx)(d,{label:i("graph.annotations.baseMenu.annotate"),icon:(0,n.jsx)(Lo,{}),expanded:!1,onClick:()=>h("comment")}),(0,n.jsx)(d,{label:i("graph.annotations.baseMenu.addSticker"),icon:(0,n.jsx)(Mo,{}),expanded:!1,onClick:()=>h("sticker")})]}),r.highlight!==null&&(0,n.jsx)(On,{layer:r,observation:o,highlights:b,options:t(r,C),expanded:!1,onOpen:()=>h("highlight"),onRun:T}),A!==null&&(0,n.jsx)(d,{label:i("graph.annotations.baseMenu.differenceArrow"),icon:(0,n.jsx)(fc,{}),onClick:()=>T(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...A,label:Hc}}))})]})},ct=({title:e,onBack:t,children:r})=>(0,n.jsxs)("div",{className:Oc,children:[(0,n.jsxs)("div",{className:_c,children:[(0,n.jsx)("button",{type:"button",className:Bc,"aria-label":e,onClick:t,children:(0,n.jsx)(ie,{size:"sm"})}),(0,n.jsx)("span",{className:Nc,children:e})]}),r]}),Wc=e=>{const t=Bo[e].Icon;return(0,n.jsx)(t,{})},Uc=({at:e,onRun:t})=>{const r=l.useI18n(),{Button:o,TextField:a}=O(),[i,s]=(0,v.useState)(""),c=(0,v.useRef)(null),d=i.trim();(0,v.useEffect)(()=>{c.current?.querySelector("input")?.focus()},[]);const p=()=>{d.length!==0&&t(new u.AddAnnotationCommand({kind:"comment",annotation:{at:e,content:Kc(d)}}))};return(0,n.jsxs)("form",{ref:c,className:Dc,onSubmit:h=>{h.preventDefault(),p()},children:[(0,n.jsx)(a,{value:i,onChange:s,placeholder:r("graph.annotations.textMenu.placeholder")}),(0,n.jsx)(o,{label:r("graph.annotations.textMenu.addButton"),onClick:p,disabled:d.length===0})]})},qc=({at:e,onRun:t})=>(0,n.jsx)("div",{className:Fc,children:Object.entries(l.STICKER_ASSETS).map(([r,o])=>(0,n.jsx)("button",{type:"button",className:zc,"aria-label":r,onClick:()=>t(new u.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...e},sticker:r}})),children:(0,n.jsx)("img",{className:Gc,src:o.src,alt:""})},r))}),On=({layer:e,observation:t,highlights:r,options:o,expanded:a,onOpen:i,onRun:s})=>{const c=l.useI18n(),{Button:d}=O(),p=(0,v.useMemo)(()=>(0,u.buildObservationPredicate)(e,t),[e,t]),h=new Set(r.map(f=>f.scope)),m=o.filter(f=>!h.has(f.scope)),[g]=m;if(p===null||g===void 0)return null;const x=f=>{s(new u.AddHighlightCommand({predicate:p,scope:f,layerId:e.id}))};return a?(0,n.jsx)("div",{className:Go,children:m.map(f=>(0,n.jsx)(d,{label:c(`graph.annotations.highlights.labels.${f.labelKey}`),icon:(0,n.jsx)(Mn,{labelKey:f.labelKey}),onClick:()=>x(f.scope)},f.scope))}):m.length===1?(0,n.jsx)(d,{label:o.length===1?c("graph.annotations.baseMenu.highlight"):c("graph.annotations.baseMenu.highlightWithLabel",{label:c(`graph.annotations.highlights.labels.${g.labelKey}`)}),icon:(0,n.jsx)(Mn,{labelKey:g.labelKey}),onClick:()=>x(g.scope)}):(0,n.jsx)(d,{label:c("graph.annotations.baseMenu.highlight"),icon:(0,n.jsx)(Io,{}),expanded:!1,onClick:i})},Kc=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Ut=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,n.jsx)(Xc,{graph:t,target:e})};Ut.hasRows=(e,t)=>(0,u.isLayerSpecOf)((0,u.findLayerById)(t.scene.spec.layers,e.layerId),"point")?!0:Y.hasRows(e,t);var Xc=({graph:e,target:t})=>{const r=l.useHandleScene(e),o=l.useStyleReaderTree(),a=r===null?void 0:(0,u.findLayerById)(r.spec.layers,t.layerId);if(r===null||!(0,u.isLayerSpecOf)(a,"point"))return(0,n.jsx)(Y,{target:t});const i=(0,u.readObservationsColorRoute)(r.spec,t)?.find(d=>d.geomKind==="point")?.where,s=i===void 0?{}:{where:i},c=(0,u.readVariableName)((0,u.findLayerById)(r.layers,a.id)?.mapping.size)!==null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Y,{target:t}),!c&&(0,n.jsx)(Ht,{sizePx:To(r,o,a.id,i),onChange:d=>{e.commands.dispatch(new u.SetPointSizeCommand({layerId:a.id,size:d,...s}))}}),(0,n.jsx)(zt,{symbol:ko(r,o,a.id,i),coordType:r.coordSystem.type,onChange:d=>{e.commands.dispatch(new u.SetPointSymbolCommand({layerId:a.id,symbol:d,...s}))}})]})},zo={geoms:{point:{style:Ut,annotate:Vc},line:{style:Fe,annotate:Rn},area:{style:Fe,annotate:Rn},bar:{style:Gt,annotate:Ee},rule:{style:null,annotate:Ee},tile:{style:Y,annotate:Ee}},legend:wo,axis:Ft,grid:$t,graph:Vt},qt=(0,v.createContext)([zo]),Zc=({editMenus:e,children:t})=>{const r=(0,v.useMemo)(()=>[e??{},zo],[e]);return(0,n.jsx)(qt.Provider,{value:r,children:t})},Yc=e=>{const t=(0,v.useContext)(qt),r=l.useSceneSelector(s=>s),{findGeom:o}=l.useGraphContext(),a=l.useDataLabelPlacementResolver(),i=Ho(l.useGraphMode());return(0,v.useMemo)(()=>e===null?null:Vo(e,t,{scene:r,dataLabelPlacement:a,findGeom:o},i),[e,t,r,a,o,i])},Jc=()=>{const e=(0,v.useContext)(qt),{store:t,findGeom:r}=l.useGraphContext(),o=l.useDataLabelPlacementResolver(),a=Ho(l.useGraphMode());return(0,v.useCallback)(i=>Vo(i,e,{scene:t.getState().scene,dataLabelPlacement:o,findGeom:r},a)!==null,[e,t,o,r,a])},Ho=e=>e===l.GRAPH_MODES.annotate?"annotate":"style",Vo=(e,t,r,o)=>{if(o==="annotate"&&e.kind!=="observations")return null;switch(e.kind){case"observations":{const a=oc(e.layerId,r.scene),i=a===null?null:ac(a,t,o,o==="annotate"?Ee:Y);return i===null||i.hasRows?.(e,r)===!1?null:(0,n.jsx)(i,{target:e})}case"legend":{const a=je(t,i=>i.legend);return a===null||a.hasRows?.(e,r)===!1?null:(0,n.jsx)(a,{target:e})}case"axis":{const a=je(t,i=>i.axis);return a===null||a.hasRows?.(e,r)===!1?null:(0,n.jsx)(a,{target:e})}case"grid":{const a=je(t,i=>i.grid);return a===null||a.hasRows?.(e,r)===!1?null:(0,n.jsx)(a,{target:e})}case"graph":{const a=je(t,i=>i.graph);return a===null||a.hasRows?.(e,r)===!1?null:(0,n.jsx)(a,{target:e})}default:return e}},Qc={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},ed={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",area:"مساحة",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",radar:"راداري",radarFilled:"راداري معبأ",scatter:"نقطي",bubble:"فقاعي",funnel:"قمعي",combo:"مركب",heatmap:"خريطة حرارية",waterfall:"شلالي",mekko:"ميكو",table:"جدول"},sizePanel:{toolbarButton:"الحجم",presetsSection:{title:"إعدادات مسبقة"},customSizeSection:{title:"حجم مخصص"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"ويب / بريد إلكتروني",linkedIn:"منشور LinkedIn",instagram:"منشور Instagram",tiktok:"TikTok / قصة Instagram",twitter:"X (Twitter)",mobile:"جوال"},inputs:{unitLabel:"بكسل"},validation:{maxSizeError:e=>`≤ ${e.max} بكسل`,minSizeError:e=>`≥ ${e.min} بكسل`}},graphPanel:{toolbarButton:"الرسم البياني",graphTypeSection:{title:"نوع الرسم البياني"},mappingSection:{title:"البيانات",x:"المحور السيني",y:"القيمة",color:"اللون",size:"الحجم",label:"التسمية",none:"بلا"},comboSection:{title:"مظهر الرسم البياني المركب",types:{groupedBars:"أعمدة مجمعة",stackedBars:"أعمدة مكدسة",lines:"خطوط فقط"}},polarSection:{title:"قطبي",innerRadius:"نصف القطر الداخلي",startAngle:"زاوية البداية"},barSection:{title:"الأعمدة",thickness:"سمك العمود",widths:{narrow:"ضيق",regular:"عادي",wide:"عريض"},baseRadius:"القاعدة",tipRadius:"الطرف",radiusOptions:{none:"مربع",md:"مستدير الحواف",full:"دائري"}},graphOptionsSection:{title:"خيارات الرسم البياني"},gridSection:{title:"الشبكة",horizontalGridLines:"خطوط أفقية",verticalGridLines:"خطوط رأسية",rings:"حلقات",spokes:"أشعة",gridStyle:"نمط الشبكة",gridThickness:"سمك الشبكة",lineStyles:{solid:"متصل",dashed:"متقطع",dotted:"منقط"},lineWidths:{thin:"رفيع",medium:"متوسط",thick:"سميك"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",curves:{smooth:"ناعم",linear:"مستقيم"},stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",center:"الوسط"},displayLabel:"النمط",display:{auto:"تلقائي",pill:"شارات",direct:"على الرسم"}},numberFormatSection:{title:"تنسيق الأرقام"},numberFormat:{abbreviationLabel:"الاختصار",valueLabel:"القيمة",decimalPlacesLabel:"المنازل العشرية",options:{auto:"تلقائي",custom:"مخصص",none:"بدون"}},headlineNumberSize:{sizeLabel:"الحجم",valueLabel:"القيمة",sizes:{small:"ص",medium:"م",large:"ك"}},lineThickness:{label:"سمك الخط"},pointSize:{label:"حجم النقطة",options:{auto:"تلقائي",custom:"مخصص"},sizes:{small:"صغير",medium:"متوسط",large:"كبير"}},pointSymbol:{label:"شكل النقطة",symbols:{circle:"دائرة",square:"مربع",diamond:"معين",triangle:"مثلث",cross:"صليب",star:"نجمة",wye:"واي"},custom:"شكل مخصص",oversized:"هذه الصورة كبيرة جدًا. اختر صورة أصغر من 512 كيلوبايت.",undecodable:"تعذر قراءة هذا الملف كصورة."},headlineNumberSection:{title:"الرقم الرئيسي",toggle:"مرئي",metricLabel:"المقياس",compareWithLabel:"مقارنة مع",metrics:{total:"المجموع",average:"المتوسط",current:"الأخير",conversion:"التحويل",left:"يسار"},comparison:{first:"الأول",previous:"السابق"},position:{above:"أعلى",center:"وسط"}},treatEmptyValues:{leaveGap:{label:"ترك فجوة في الرسم البياني",description:"يترك فاصلاً مرئياً في الخط حيث تكون البيانات مفقودة"},fillZero:{label:"ملء بالصفر",description:"يعرض نقاط البيانات المفقودة كصفر"},connectGaps:{label:"الاتصال عبر الفجوات",description:"يربط الخط بين النقاط المتاحة، متخطياً الفجوة"}}},axesPanel:{toolbarButton:"المحاور",mainAxisSection:{yAxis:"المحور الصادي",xAxis:"المحور السيني"},crossAxisSection:{xAxis:"المحور السيني",yAxis:"المحور الصادي"},controls:{title:"العنوان",titlePlaceholder:"إضافة عنوان",visible:"مرئي",ticks:"العلامات",labels:"التسميات",position:"الموضع",scale:"المقياس",startFrom:"البدء من",endAt:"الانتهاء عند",value:"القيمة",numberOfAxes:"عدد المحاور"},labelMode:{auto:"تلقائي",edges:"الحواف"},scale:{auto:"تلقائي",log:"لوغاريتمي"},startFrom:{auto:"تلقائي",zero:"صفر",custom:"مخصص"},endAt:{auto:"تلقائي",custom:"مخصص"},axisCount:{single:"مفرد",double:"مزدوج"},position:{left:"يسار",right:"يمين",top:"أعلى",bottom:"أسفل"}},colorPanel:{toolbarButton:"اللون",themeSection:{title:"السمة"},appearanceSection:{title:"المظهر",highlightStyle:"التمييز"},backgroundSection:{title:"الخلفية",black:"أسود",white:"أبيض",gray:"رمادي",tint:"صبغة",custom:"مخصص",none:"بدون"},borderSection:{title:"الحدود",borderColor:"لون الحدود",thickness:"السمك",cornerRadius:"نصف قطر الزاوية"},borderType:{solid:"صلب",gradient:"متدرج",gray:"رمادي",preset:"مسبق",custom:"مخصص",none:"بدون"},presetGradients:{lilac:"ليلكي",neonPink:"وردي نيون",blackberry:"توت أسود",sun:"شمس",iceland:"آيسلندا",sunset:"غروب",ultraviolet:"فوق بنفسجي",purple:"أرجواني",iceCream:"آيس كريم",mint:"نعناع",cool:"بارد",fresh:"منعش"}},designPanel:{toolbarButton:"التصميم",defaultExpanded:"لوحة الألوان"},annotatePanel:{toolbarButton:"التعليقات",callOutSection:{title:"وسائل الشرح",text:"نص",arrow:"سهم",box:"مربع",difference:"الفرق"},highlightSection:{title:"التمييز",button:"تمييز",colorLabel:"لون التمييز"}},annotationsPanel:{toolbarButton:"التعليقات",freeformSection:{title:"حر",text:"نص",arrow:"سهم",box:"مربع",difference:"فرق"},goalSection:{title:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",valueAriaLabel:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:"(اختياري)"},trendsAndAveragesSection:{title:"الاتجاهات والمتوسطات",trend:"الاتجاه",average:"المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},averageLineSeries:{label:"سلسلة خط المتوسط",placeholder:"اختر السلسلة",ariaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},highlightSection:{title:"التمييز",button:"تمييز",fadeColorLabel:"لون التلاشي"},titleAndSubtitleSection:{title:"العنوان والعنوان الفرعي",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},captionAndSourceSection:{title:"التسمية التوضيحية والمصدر",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"}},elementsPanel:{contentVisible:"مرئي",contentValue:"القيمة",toolbarButton:"العناصر",headerSection:{title:"الرأس",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},footerSection:{title:"التذييل",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"},textSizeSection:{title:"حجم النص",scaleFormat:e=>`${e.value}x`},fontSection:{title:"الخط"},sourceSection:{title:"المصدر",url:"الرابط",name:"الاسم"}},powerUpPanel:{toolbarButton:"التحسينات",goalSection:{title:"الهدف",toggle:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:" (اختياري)",xAxisReferenceAriaLabel:"قيمة مرجعية للمحور السيني",anyXAxisValue:"أي قيمة للمحور السيني",selectValuePlaceholder:"اختر القيمة"},trendSection:{title:"الاتجاه",toggle:"الاتجاه"},averageSection:{title:"المتوسط",toggle:"المتوسط",seriesLabel:"سلسلة خط المتوسط",seriesPlaceholder:"اختر السلسلة",seriesAriaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},valueInput:{percentagePlaceholder:"النسبة المئوية",numberPlaceholder:"الرقم",percentageSymbol:"٪"}},highlighting:{modeHelper:{title:"وضع التمييز",hover:"مرر",toHighlight:"للتمييز",anyElement:"أي عنصر",escToExit:"للخروج",esc:"ESC"},emptyState:"لا تتوفر خيارات تمييز",deleteAriaLabel:"حذف التمييز",highlightStyle:{tint:"صبغة",gray:"رمادي"}},fineTunePanel:{toolbarButton:"الضبط الدقيق",detailSection:{title:"التفاصيل",missingValues:"القيم المفقودة"},lineStyleSection:{title:"نمط الخط",lineCurve:"انحناء الخط",sharp:"حاد",smooth:"ناعم"}},customThemeEditor:{patternDropdownAriaLabel:"قائمة منسدلة للنمط للسلسلة",patterns:{solid:"صلب",pattern:"نمط",dotted:"منقط",dashed:"متقطع",hatched:"مظلل"},heatmapColorLabel:"اللون"},overlayMenu:{observation:"مشاهدة",group:"مجموعة",band:"نطاق",axis:"المحور",legend:"وسيلة الإيضاح",gridLines:"خطوط الشبكة",chart:"الرسم البياني",selection:"التحديد",thisBar:"هذا الشريط",thisPoint:"هذه النقطة",thisBubble:"هذه الفقاعة",thisSlice:"هذه الشريحة",allOf:e=>`كل ${e.name}`,all:"الكل",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"إخفاء",show:"إظهار",legendPlaces:{topStart:"أعلى اليسار",topCenter:"أعلى الوسط",topEnd:"أعلى اليمين",left:"اليسار",right:"اليمين",bottomStart:"أسفل اليسار",bottomCenter:"أسفل الوسط",bottomEnd:"أسفل اليمين"},fillColor:"لون التعبئة",lowColor:"لون القيم المنخفضة",highColor:"لون القيم المرتفعة",lineColor:"لون الخط",palette:"لوحة الألوان",themePalette:"السمة",chartType:"النوع",customChartType:"مخصص",arrange:"الترتيب",arrangements:{grouped:"مجمعة",stacked:"مكدسة",filled:"100%",lines:"خطوط فقط"}},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},td={titleEditor:{titlePlaceholder:"بدون عنوان",subtitlePlaceholder:"إضافة عنوان فرعي"},toolbar:{formatting:{bold:"عريض",italic:"مائل",underline:"تحته خط",link:"رابط"},link:{ariaLabel:"إنشاء رابط",placeholder:"اكتب أو الصق رابطاً...",submit:"إرسال",urlLabel:"عنوان الرابط",apply:"تطبيق الرابط"},font:{label:"الخط",ariaLabel:"عائلة الخط"},heading:{label:"مستوى العنوان",ariaLabel:"نمط النص",text:"نص",caption:"تسمية توضيحية",heading1:"عنوان 1",heading2:"عنوان 2",heading3:"عنوان 3"},textAlign:{left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين"},color:{label:"لون النص"}},colorDropdown:{colors:"الألوان",chartColors:"ألوان الرسم البياني",custom:"مخصص",opacity:"الشفافية",transparent:"شفاف",pickCustom:"اختيار لون مخصص",pickColor:"اختيار لون"},annotations:{differenceArrowToolbar:{label:"خيارات سهم الفرق",labelKind:{ariaLabel:"التسمية",absoluteDifference:"التغير المطلق",relativeDifference:"التغير المئوي",proportion:"النسبة",suspectValue:"تقسم هذه القيمة على أساس يساوي صفرًا.",incomparableEnds:"يقيس الطرفان كميتين مختلفتين، لذا لا معنى للفرق بينهما."},color:"لون السهم",size:{ariaLabel:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},swap:"عكس الاتجاه",remove:"إزالة السهم"},shapeToolbar:{label:"خيارات الشكل",color:"لون الشكل",border:{ariaLabel:"الحد",none:"بلا",thin:"رفيع (2 بكسل)",medium:"متوسط (8 بكسل)",thick:"سميك (16 بكسل)"},remove:"إزالة الشكل",resize:{"top-left":"تغيير الحجم من الزاوية العلوية اليسرى","top-right":"تغيير الحجم من الزاوية العلوية اليمنى","bottom-right":"تغيير الحجم من الزاوية السفلية اليمنى","bottom-left":"تغيير الحجم من الزاوية السفلية اليسرى"}},arrowToolbar:{label:"خيارات السهم",color:"لون السهم",thickness:{ariaLabel:"السماكة",thin:"رفيع",medium:"متوسط",thick:"سميك"},startArrowhead:"بداية السهم",endArrowhead:"نهاية السهم",arrowhead:{lineArrow:"رأس سهم",none:"بلا"},lineStyle:{ariaLabel:"نمط الخط",solid:"متصل",dashed:"متقطع",dotted:"منقّط"},sticker:"تأثير الملصق",remove:"إزالة السهم",moveEndpoint:{start:"تحريك بداية السهم",end:"تحريك نهاية السهم"}},textToolbar:{label:"خيارات النص",background:"لون الخلفية",color:"لون النص",font:{ariaLabel:"الخط",modern:"عصري",fresh:"منعش",timeless:"كلاسيكي",technical:"تقني",fineliner:"قلم رفيع"},fontSize:{ariaLabel:"حجم الخط",small:"صغير",medium:"متوسط",large:"كبير",extraLarge:"كبير جدًا",huge:"ضخم"},align:{left:"محاذاة إلى اليسار",center:"محاذاة إلى الوسط",right:"محاذاة إلى اليمين"},remove:"إزالة النص",resize:{left:"تغيير الحجم من اليسار",right:"تغيير الحجم من اليمين"}},text:{editLabel:"تحرير النص",placeholder:"اكتب شيئًا"},baseMenu:{pinNumber:"تثبيت الرقم",unpinNumber:"إلغاء تثبيت الرقم",annotate:"تعليق",removeAnnotation:"إزالة التعليق",highlight:"تمييز",highlightWithLabel:e=>`تمييز ${e.label}`,removeHighlight:"إزالة التمييز",differenceArrow:"سهم الفرق",addSticker:"إضافة ملصق",removeSticker:"إزالة الملصق"},textMenu:{title:"تعليق",placeholder:"إضافة تعليق",addButton:"إضافة"},highlights:{menuTitle:"تمييز",labels:{bar:"شريط",barGroup:"مجموعة",barStack:"مكدس",barSeries:"سلسلة",line:"خط",linePoint:"نقطة",lineSeries:"سلسلة",scatterPoint:"نقطة",scatterSeries:"سلسلة",pieSlice:"شريحة",pointOrBar:"نقطة / شريط",lineOrSeries:"خط / سلسلة"}},stickerMenu:{title:"إضافة ملصق"},delete:"حذف",arrow:{thickness:{label:"السمك",thin:"رفيع",medium:"متوسط",thick:"سميك"},arrowhead:{startPoint:"نقطة البداية",endPoint:"نقطة النهاية",lineArrow:"سهم الخط",none:"بدون"},lineStyle:{label:"نمط الخط",solid:"صلب",dotted:"منقط"},stickerEffect:"تأثير الملصق",toolbarAriaLabel:"شريط أدوات السهم الحر",editorAriaLabel:"محرر السهم"},differenceArrow:{type:{proportion:"النسبة",difference:({absoluteDifference:e})=>`الفرق (${e})`,increase:({absoluteDifference:e})=>`الزيادة (${e})`,decrease:({absoluteDifference:e})=>`النقصان (${e})`,percentageChange:({percentageChange:e})=>`تغيير النسبة المئوية (${e})`,percentIncrease:({percentageChange:e})=>`زيادة النسبة المئوية (${e})`,percentDecrease:({percentageChange:e})=>`نقصان النسبة المئوية (${e})`},size:{label:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},flipArrow:"عكس السهم",color:"اللون",toolbarAriaLabel:"شريط أدوات سهم الفرق",editorAriaLabel:"محرر سهم الفرق"},shape:{color:"اللون",border:{label:"الحدود",none:"بدون",thin:({value:e})=>`رفيع (${e})`,medium:({value:e})=>`متوسط (${e})`,thick:({value:e})=>`سميك (${e})`}}}},nd={common:Qc,editor:ed,graph:td},rd={save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",confirmDelete:e=>`Are you sure you want to delete ${e.item}?`,abbreviations:{thousands:"k",millions:"m",billions:"b"}},od={title:"Graphy Editor",description:"Edit your content here",graphTypes:{column:"Column",columnStacked:"Stacked column",columnStackedFill:"100% stacked column",bar:"Bar",barStacked:"Stacked bar",barStackedFill:"100% stacked bar",line:"Line",area:"Area",areaStacked:"Stacked area",pie:"Pie",donut:"Donut",radialBar:"Radial bar",rose:"Rose",roseStacked:"Stacked rose",radar:"Radar",radarFilled:"Filled radar",scatter:"Scatter",bubble:"Bubble",funnel:"Funnel",combo:"Combo",heatmap:"Heatmap",waterfall:"Waterfall",mekko:"Mekko",table:"Table"},sizePanel:{toolbarButton:"Size",presetsSection:{title:"Presets"},customSizeSection:{title:"Custom size"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"LinkedIn post",instagram:"Instagram post",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Mobile"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Graph",graphTypeSection:{title:"Graph type"},mappingSection:{title:"Data",x:"X-axis",y:"Value",color:"Colour",size:"Size",label:"Label",none:"None"},comboSection:{title:"Combo chart appearance",types:{groupedBars:"Grouped bars",stackedBars:"Stacked bars",lines:"Lines only"}},polarSection:{title:"Polar",innerRadius:"Inner radius",startAngle:"Start angle"},barSection:{title:"Bars",thickness:"Bar thickness",widths:{narrow:"Narrow",regular:"Regular",wide:"Wide"},baseRadius:"Base",tipRadius:"Tip",radiusOptions:{none:"Square",md:"Rounded",full:"Round"}},graphOptionsSection:{title:"Graph options"},gridSection:{title:"Grid",horizontalGridLines:"Horizontal lines",verticalGridLines:"Vertical lines",rings:"Rings",spokes:"Spokes",gridStyle:"Grid style",gridThickness:"Grid thickness",lineStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted"},lineWidths:{thin:"Thin",medium:"Medium",thick:"Thick"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",curves:{smooth:"Smooth",linear:"Straight"},stackTotals:"Stack totals",dataLabels:"Data labels",showPercentages:"Show percentages",categoryLabels:"Category labels"},legendSection:{title:"Legend",auto:"Auto",top:"Top",bottom:"Bottom",left:"Left",right:"Right",none:"None",alignLabel:"Alignment",align:{auto:"Auto",center:"Center"},displayLabel:"Style",display:{auto:"Auto",pill:"Pills",direct:"Direct"}},numberFormatSection:{title:"Number format"},numberFormat:{abbreviationLabel:"Abbreviation",valueLabel:"Value",decimalPlacesLabel:"Decimal places",options:{auto:"Auto",custom:"Custom",none:"None"}},headlineNumberSize:{sizeLabel:"Size",valueLabel:"Value",sizes:{small:"S",medium:"M",large:"L"}},lineThickness:{label:"Line thickness"},pointSize:{label:"Point size",options:{auto:"Auto",custom:"Custom"},sizes:{small:"Small",medium:"Medium",large:"Large"}},pointSymbol:{label:"Point shape",symbols:{circle:"Circle",square:"Square",diamond:"Diamond",triangle:"Triangle",cross:"Cross",star:"Star",wye:"Wye"},custom:"Custom shape",oversized:"This image is too large. Choose one under 512 KB.",undecodable:"This file could not be read as an image."},headlineNumberSection:{title:"Headline number",toggle:"Visible",metricLabel:"Metric",compareWithLabel:"Compare with",metrics:{total:"Total",average:"Avg.",current:"Last",conversion:"Conversion",left:"Left"},comparison:{first:"First",previous:"Previous"},position:{above:"Above",center:"Center"}},treatEmptyValues:{leaveGap:{label:"Leave gap in chart",description:"Leaves a visible break in the line where data is missing"},fillZero:{label:"Fill with zero",description:"Displays missing data points as zero"},connectGaps:{label:"Connect across gaps",description:"Joins the line between available points, skipping the gap"}}},axesPanel:{toolbarButton:"Axes",mainAxisSection:{yAxis:"Y-axis",xAxis:"X-axis"},crossAxisSection:{xAxis:"X-axis",yAxis:"Y-axis"},controls:{title:"Title",titlePlaceholder:"Add title",visible:"Visible",ticks:"Ticks",labels:"Labels",position:"Position",scale:"Scale",startFrom:"Start from",endAt:"End at",value:"Value",numberOfAxes:"Number of axes"},labelMode:{auto:"Auto",edges:"Edges"},scale:{auto:"Auto",log:"Log"},startFrom:{auto:"Auto",zero:"Zero",custom:"Custom"},endAt:{auto:"Auto",custom:"Custom"},axisCount:{single:"Single",double:"Double"},position:{left:"Left",right:"Right",top:"Top",bottom:"Bottom"}},colorPanel:{toolbarButton:"Color",themeSection:{title:"Theme"},appearanceSection:{title:"Appearance",highlightStyle:"Highlight"},backgroundSection:{title:"Background",black:"Black",white:"White",gray:"Grey",tint:"Tint",custom:"Custom",none:"None"},borderSection:{title:"Border",borderColor:"Border color",thickness:"Thickness",cornerRadius:"Corner radius"},borderType:{solid:"Solid",gradient:"Gradient",gray:"Grey",preset:"Preset",custom:"Custom",none:"None"},presetGradients:{lilac:"Lilac",neonPink:"Neon Pink",blackberry:"Blackberry",sun:"Sun",iceland:"Iceland",sunset:"Sunset",ultraviolet:"Ultraviolet",purple:"Purple",iceCream:"Ice Cream",mint:"Mint",cool:"Cool",fresh:"Fresh"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Palette"},annotatePanel:{toolbarButton:"Annotate",callOutSection:{title:"Callouts",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},highlightSection:{title:"Highlight",button:"Highlight",colorLabel:"Highlight color"}},annotationsPanel:{toolbarButton:"Annotate",freeformSection:{title:"Freeform",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},goalSection:{title:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",valueAriaLabel:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:"(optional)"},trendsAndAveragesSection:{title:"Trends and Averages",trend:"Trend",average:"Average"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},averageLineSeries:{label:"Average line series",placeholder:"Select series",ariaLabel:"Series dropdown for average line"},highlightSection:{title:"Highlight",button:"Highlight",fadeColorLabel:"Fade color"},titleAndSubtitleSection:{title:"Title & Subtitle",toggleTitle:"Title",subtitle:"Subtitle"},captionAndSourceSection:{title:"Caption & Source",caption:"Caption",source:"Source",url:"URL",name:"Name"}},elementsPanel:{contentVisible:"Visible",contentValue:"Value",toolbarButton:"Elements",headerSection:{title:"Header",toggleTitle:"Title",subtitle:"Subtitle"},footerSection:{title:"Footer",caption:"Caption",source:"Source",url:"URL",name:"Name"},textSizeSection:{title:"Text size",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Font"},sourceSection:{title:"Source",url:"URL",name:"Name"}},powerUpPanel:{toolbarButton:"Power-ups",goalSection:{title:"Goal",toggle:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:" (optional)",xAxisReferenceAriaLabel:"X-axis reference value",anyXAxisValue:"Any x-axis value",selectValuePlaceholder:"Select value"},trendSection:{title:"Trend",toggle:"Trend"},averageSection:{title:"Average",toggle:"Average",seriesLabel:"Average line series",seriesPlaceholder:"Select series",seriesAriaLabel:"Series dropdown for average line"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentage",numberPlaceholder:"Number",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Highlight mode",hover:"Hover",toHighlight:"to highlight",anyElement:"any element",escToExit:"to exit",esc:"ESC"},emptyState:"No highlight options available",deleteAriaLabel:"Delete highlight",highlightStyle:{tint:"Tint",gray:"Grey"}},fineTunePanel:{toolbarButton:"Fine tune",detailSection:{title:"Detail",missingValues:"Missing values"},lineStyleSection:{title:"Line style",lineCurve:"Line curve",sharp:"Sharp",smooth:"Smooth"}},customThemeEditor:{patternDropdownAriaLabel:"Pattern dropdown for series",patterns:{solid:"Solid",pattern:"Pattern",dotted:"Dotted",dashed:"Dashed",hatched:"Hatched"},heatmapColorLabel:"Color"},overlayMenu:{observation:"Observation",group:"Group",band:"Band",axis:"Axis",legend:"Legend",gridLines:"Grid lines",chart:"Chart",selection:"Selection",thisBar:"This bar",thisPoint:"This point",thisBubble:"This bubble",thisSlice:"This slice",allOf:e=>`All of ${e.name}`,all:"All",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Hide",show:"Show",legendPlaces:{topStart:"Top left",topCenter:"Top center",topEnd:"Top right",left:"Left",right:"Right",bottomStart:"Bottom left",bottomCenter:"Bottom center",bottomEnd:"Bottom right"},fillColor:"Fill color",lowColor:"Low color",highColor:"High color",lineColor:"Line color",palette:"Palette",themePalette:"Theme",chartType:"Type",customChartType:"Custom",arrange:"Arrange",arrangements:{grouped:"Grouped",stacked:"Stacked",filled:"100%",lines:"Lines only"}},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},ad={titleEditor:{titlePlaceholder:"Untitled",subtitlePlaceholder:"Add a subtitle"},toolbar:{formatting:{bold:"Bold",italic:"Italic",underline:"Underline",link:"Link"},link:{ariaLabel:"Create link",placeholder:"Type or paste a link...",submit:"Submit",urlLabel:"Link URL",apply:"Apply link"},font:{label:"Font",ariaLabel:"Font family"},heading:{label:"Heading level",ariaLabel:"Text style",text:"Text",caption:"Caption",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},textAlign:{left:"Align left",center:"Align center",right:"Align right"},color:{label:"Text color"}},colorDropdown:{colors:"Colors",chartColors:"Chart colors",custom:"Custom",opacity:"Opacity",transparent:"Transparent",pickCustom:"Pick custom color",pickColor:"Pick color"},annotations:{differenceArrowToolbar:{label:"Difference arrow options",labelKind:{ariaLabel:"Label",absoluteDifference:"Absolute change",relativeDifference:"Percentage change",proportion:"Proportion",suspectValue:"This value divides by a baseline of zero.",incomparableEnds:"The two ends measure different quantities, so a difference between them has no meaning."},color:"Arrow colour",size:{ariaLabel:"Size",small:"Small",medium:"Medium",large:"Large"},swap:"Swap direction",remove:"Remove arrow"},shapeToolbar:{label:"Shape options",color:"Shape colour",border:{ariaLabel:"Border",none:"None",thin:"Thin (2px)",medium:"Medium (8px)",thick:"Thick (16px)"},remove:"Remove shape",resize:{"top-left":"Resize from the top left","top-right":"Resize from the top right","bottom-right":"Resize from the bottom right","bottom-left":"Resize from the bottom left"}},arrowToolbar:{label:"Arrow options",color:"Arrow colour",thickness:{ariaLabel:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},startArrowhead:"Start of the arrow",endArrowhead:"End of the arrow",arrowhead:{lineArrow:"Line arrow",none:"None"},lineStyle:{ariaLabel:"Line style",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},sticker:"Sticker effect",remove:"Remove arrow",moveEndpoint:{start:"Move the start of the arrow",end:"Move the end of the arrow"}},textToolbar:{label:"Text options",background:"Background colour",color:"Text colour",font:{ariaLabel:"Font",modern:"Modern",fresh:"Fresh",timeless:"Timeless",technical:"Technical",fineliner:"Fineliner"},fontSize:{ariaLabel:"Font size",small:"Small",medium:"Medium",large:"Large",extraLarge:"Extra Large",huge:"Huge"},align:{left:"Align left",center:"Align centre",right:"Align right"},remove:"Remove text",resize:{left:"Resize from the left",right:"Resize from the right"}},text:{editLabel:"Edit text",placeholder:"Type something"},baseMenu:{pinNumber:"Pin number",unpinNumber:"Unpin number",annotate:"Annotate",removeAnnotation:"Remove annotation",highlight:"Highlight",highlightWithLabel:e=>`Highlight ${e.label}`,removeHighlight:"Remove highlight",differenceArrow:"Difference arrow",addSticker:"Add sticker",removeSticker:"Remove sticker"},textMenu:{title:"Annotate",placeholder:"Add a comment",addButton:"Add"},highlights:{menuTitle:"Highlight",labels:{bar:"bar",barGroup:"group",barStack:"stack",barSeries:"series",line:"line",linePoint:"point",lineSeries:"series",scatterPoint:"point",scatterSeries:"series",pieSlice:"slice",pointOrBar:"point / bar",lineOrSeries:"line / series"}},stickerMenu:{title:"Add sticker"},delete:"Delete",arrow:{thickness:{label:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},arrowhead:{startPoint:"Start point",endPoint:"End point",lineArrow:"Line arrow",none:"None"},lineStyle:{label:"Line style",solid:"Solid",dotted:"Dotted"},stickerEffect:"Sticker effect",toolbarAriaLabel:"Free-form arrow toolbar",editorAriaLabel:"Arrow editor"},differenceArrow:{type:{proportion:"Proportion",difference:({absoluteDifference:e})=>`Difference (${e})`,increase:({absoluteDifference:e})=>`Increase (${e})`,decrease:({absoluteDifference:e})=>`Decrease (${e})`,percentageChange:({percentageChange:e})=>`Percentage change (${e})`,percentIncrease:({percentageChange:e})=>`Percent increase (${e})`,percentDecrease:({percentageChange:e})=>`Percent decrease (${e})`},size:{label:"Size",small:"Small",medium:"Medium",large:"Large"},flipArrow:"Flip arrow",color:"Color",toolbarAriaLabel:"Difference arrow toolbar",editorAriaLabel:"Difference arrow editor"},shape:{color:"Color",border:{label:"Border",none:"None",thin:({value:e})=>`Thin (${e})`,medium:({value:e})=>`Medium (${e})`,thick:({value:e})=>`Thick (${e})`}}}},id={common:rd,editor:od,graph:ad},sd={colorPanel:{backgroundSection:{gray:"Gray"},borderType:{gray:"Gray"}},highlighting:{highlightStyle:{gray:"Gray"}}},ld={editor:sd},cd={save:"Guardar",cancel:"Cancelar",confirm:"Confirmar",delete:"Eliminar",confirmDelete:e=>`Tem a certeza que deseja eliminar ${e.item}?`,abbreviations:{thousands:"mil",millions:"M",billions:"MM"}},dd={title:"Editor Graphy",description:"Edite o seu conteúdo aqui",graphTypes:{column:"Colunas",columnStacked:"Colunas sobrepostas",columnStackedFill:"100% Colunas sobrepostas",bar:"Barras",barStacked:"Barras sobrepostas",barStackedFill:"100% Barras sobrepostas",line:"Linha",area:"Área",areaStacked:"Área sobreposta",pie:"Circular",donut:"Donut",radialBar:"Barras radiais",radar:"Radar",radarFilled:"Radar preenchido",scatter:"Dispersão",bubble:"Bolhas",funnel:"Funil",combo:"Combinado",heatmap:"Mapa de Calor",waterfall:"Cascata",mekko:"Mekko",table:"Tabela"},sizePanel:{toolbarButton:"Tamanho",presetsSection:{title:"Predefinições"},customSizeSection:{title:"Tamanho personalizado"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"Publicação LinkedIn",instagram:"Publicação Instagram",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Móvel"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Gráfico",graphTypeSection:{title:"Tipo de gráfico"},mappingSection:{title:"Dados",x:"Eixo X",y:"Valor",color:"Cor",size:"Tamanho",label:"Etiqueta",none:"Nenhum"},comboSection:{title:"Aspeto do gráfico combinado",types:{groupedBars:"Barras agrupadas",stackedBars:"Barras empilhadas",lines:"Apenas linhas"}},polarSection:{title:"Polar",innerRadius:"Raio interno",startAngle:"Ângulo inicial"},barSection:{title:"Barras",thickness:"Espessura da barra",widths:{narrow:"Estreita",regular:"Normal",wide:"Larga"},baseRadius:"Base",tipRadius:"Ponta",radiusOptions:{none:"Reto",md:"Arredondado",full:"Redondo"}},graphOptionsSection:{title:"Opções do gráfico"},gridSection:{title:"Grelha",horizontalGridLines:"Linhas horizontais",verticalGridLines:"Linhas verticais",rings:"Anéis",spokes:"Raios",gridStyle:"Estilo da grelha",gridThickness:"Espessura da grelha",lineStyles:{solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"},lineWidths:{thin:"Fina",medium:"Média",thick:"Espessa"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",curves:{smooth:"Suave",linear:"Reta"},stackTotals:"Totais sobrepostos",dataLabels:"Etiquetas de dados",showPercentages:"Mostrar percentagens",categoryLabels:"Etiquetas de categorias"},legendSection:{title:"Legenda",auto:"Automático",top:"Topo",bottom:"Fundo",left:"Esquerda",right:"Direita",none:"Nenhuma",alignLabel:"Alinhamento",align:{auto:"Automático",center:"Centro"},displayLabel:"Estilo",display:{auto:"Automático",pill:"Etiquetas",direct:"No gráfico"}},numberFormatSection:{title:"Formato numérico"},numberFormat:{abbreviationLabel:"Abreviação",valueLabel:"Valor",decimalPlacesLabel:"Casas decimais",options:{auto:"Automático",custom:"Personalizado",none:"Nenhum"}},headlineNumberSize:{sizeLabel:"Tamanho",valueLabel:"Valor",sizes:{small:"P",medium:"M",large:"G"}},lineThickness:{label:"Espessura da linha"},pointSize:{label:"Tamanho do ponto",options:{auto:"Automático",custom:"Personalizado"},sizes:{small:"Pequeno",medium:"Médio",large:"Grande"}},pointSymbol:{label:"Forma do ponto",symbols:{circle:"Círculo",square:"Quadrado",diamond:"Losango",triangle:"Triângulo",cross:"Cruz",star:"Estrela",wye:"Y"},custom:"Forma personalizada",oversized:"Esta imagem é demasiado grande. Escolha uma com menos de 512 KB.",undecodable:"Não foi possível ler este ficheiro como imagem."},headlineNumberSection:{title:"Número destaque",toggle:"Visível",metricLabel:"Métrica",compareWithLabel:"Comparar com",metrics:{total:"Total",average:"Média",current:"Último",conversion:"Conversão",left:"Esquerda"},comparison:{first:"Primeiro",previous:"Anterior"},position:{above:"Acima",center:"Centro"}},treatEmptyValues:{leaveGap:{label:"Deixar espaço no gráfico",description:"Deixa uma quebra visível na linha onde faltam dados"},fillZero:{label:"Preencher com zero",description:"Exibe pontos de dados em falta como zero"},connectGaps:{label:"Ligar através dos espaços",description:"Une a linha entre pontos disponíveis, ignorando o espaço"}}},axesPanel:{toolbarButton:"Eixos",mainAxisSection:{yAxis:"Eixo Y",xAxis:"Eixo X"},crossAxisSection:{xAxis:"Eixo X",yAxis:"Eixo Y"},controls:{title:"Título",titlePlaceholder:"Adicionar título",visible:"Visível",ticks:"Marcas",labels:"Etiquetas",position:"Posição",scale:"Escala",startFrom:"Iniciar de",endAt:"Terminar em",value:"Valor",numberOfAxes:"Número de eixos"},labelMode:{auto:"Automático",edges:"Extremos"},scale:{auto:"Automático",log:"Logarítmico"},startFrom:{auto:"Automático",zero:"Zero",custom:"Personalizado"},endAt:{auto:"Automático",custom:"Personalizado"},axisCount:{single:"Único",double:"Duplo"},position:{left:"Esquerda",right:"Direita",top:"Topo",bottom:"Fundo"}},colorPanel:{toolbarButton:"Cor",themeSection:{title:"Tema"},appearanceSection:{title:"Aparência",highlightStyle:"Destaque"},backgroundSection:{title:"Fundo",black:"Preto",white:"Branco",gray:"Cinzento",tint:"Tonalidade",custom:"Personalizado",none:"Nenhum"},borderSection:{title:"Contorno",borderColor:"Cor do contorno",thickness:"Espessura",cornerRadius:"Raio dos cantos"},borderType:{solid:"Sólido",gradient:"Gradiente",gray:"Cinzento",preset:"Predefinido",custom:"Personalizado",none:"Nenhum"},presetGradients:{lilac:"Lilás",neonPink:"Rosa Néon",blackberry:"Amora",sun:"Sol",iceland:"Islândia",sunset:"Pôr do Sol",ultraviolet:"Ultravioleta",purple:"Roxo",iceCream:"Gelado",mint:"Menta",cool:"Frio",fresh:"Fresco"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Paleta"},annotatePanel:{toolbarButton:"Anotar",callOutSection:{title:"Destaques",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},highlightSection:{title:"Realce",button:"Realçar",colorLabel:"Cor do realce"}},annotationsPanel:{toolbarButton:"Anotar",freeformSection:{title:"Forma livre",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},goalSection:{title:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",valueAriaLabel:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:"(opcional)"},trendsAndAveragesSection:{title:"Tendências e Médias",trend:"Tendência",average:"Média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},averageLineSeries:{label:"Série da linha de média",placeholder:"Selecionar série",ariaLabel:"Dropdown de séries para linha de média"},highlightSection:{title:"Realce",button:"Realçar",fadeColorLabel:"Cor de esmaecimento"},titleAndSubtitleSection:{title:"Título e Subtítulo",toggleTitle:"Título",subtitle:"Subtítulo"},captionAndSourceSection:{title:"Legenda e Fonte",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"}},elementsPanel:{contentVisible:"Visível",contentValue:"Valor",toolbarButton:"Elementos",headerSection:{title:"Cabeçalho",toggleTitle:"Título",subtitle:"Subtítulo"},footerSection:{title:"Rodapé",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"},textSizeSection:{title:"Tamanho do texto",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Tipo de letra"},sourceSection:{title:"Fonte",url:"URL",name:"Nome"}},powerUpPanel:{toolbarButton:"Extras",goalSection:{title:"Objetivo",toggle:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:" (opcional)",xAxisReferenceAriaLabel:"Valor de referência do eixo X",anyXAxisValue:"Qualquer valor do eixo X",selectValuePlaceholder:"Selecionar valor"},trendSection:{title:"Tendência",toggle:"Tendência"},averageSection:{title:"Média",toggle:"Média",seriesLabel:"Série da linha de média",seriesPlaceholder:"Selecionar série",seriesAriaLabel:"Dropdown de séries para linha de média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentagem",numberPlaceholder:"Número",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Modo de realce",hover:"Passe",toHighlight:"para realçar",anyElement:"qualquer elemento",escToExit:"para sair",esc:"ESC"},emptyState:"Sem opções de realce disponíveis",deleteAriaLabel:"Eliminar realce",highlightStyle:{tint:"Tonalidade",gray:"Cinzento"}},fineTunePanel:{toolbarButton:"Ajuste fino",detailSection:{title:"Detalhe",missingValues:"Valores em falta"},lineStyleSection:{title:"Estilo de linha",lineCurve:"Curva da linha",sharp:"Angulosa",smooth:"Suave"}},customThemeEditor:{patternDropdownAriaLabel:"Dropdown de padrões para série",patterns:{solid:"Sólido",pattern:"Padrão",dotted:"Pontilhado",dashed:"Tracejado",hatched:"Hachurado"},heatmapColorLabel:"Cor"},overlayMenu:{observation:"Observação",group:"Grupo",band:"Banda",axis:"Eixo",legend:"Legenda",gridLines:"Linhas de grelha",chart:"Gráfico",selection:"Seleção",thisBar:"Esta barra",thisPoint:"Este ponto",thisBubble:"Esta bolha",thisSlice:"Esta fatia",allOf:e=>`Tudo em ${e.name}`,all:"Tudo",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Ocultar",show:"Mostrar",legendPlaces:{topStart:"Topo à esquerda",topCenter:"Topo ao centro",topEnd:"Topo à direita",left:"Esquerda",right:"Direita",bottomStart:"Fundo à esquerda",bottomCenter:"Fundo ao centro",bottomEnd:"Fundo à direita"},fillColor:"Cor de preenchimento",lowColor:"Cor dos valores baixos",highColor:"Cor dos valores altos",lineColor:"Cor da linha",palette:"Paleta",themePalette:"Tema",chartType:"Tipo",customChartType:"Personalizado",arrange:"Disposição",arrangements:{grouped:"Agrupado",stacked:"Sobreposto",filled:"100%",lines:"Apenas linhas"}},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},ud={titleEditor:{titlePlaceholder:"Sem título",subtitlePlaceholder:"Adicionar subtítulo"},toolbar:{formatting:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",link:"Ligação"},link:{ariaLabel:"Criar ligação",placeholder:"Escreva ou cole uma ligação...",submit:"Submeter",urlLabel:"URL da ligação",apply:"Aplicar ligação"},font:{label:"Tipo de letra",ariaLabel:"Família do tipo de letra"},heading:{label:"Nível de título",ariaLabel:"Estilo de texto",text:"Texto",caption:"Legenda",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3"},textAlign:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},color:{label:"Cor do texto"}},colorDropdown:{colors:"Cores",chartColors:"Cores do gráfico",custom:"Personalizado",opacity:"Opacidade",transparent:"Transparente",pickCustom:"Escolher cor personalizada",pickColor:"Escolher cor"},annotations:{differenceArrowToolbar:{label:"Opções da seta de diferença",labelKind:{ariaLabel:"Etiqueta",absoluteDifference:"Variação absoluta",relativeDifference:"Variação percentual",proportion:"Proporção",suspectValue:"Este valor divide por uma base igual a zero.",incomparableEnds:"As duas pontas medem quantidades diferentes, pelo que a diferença entre elas não tem significado."},color:"Cor da seta",size:{ariaLabel:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},swap:"Inverter sentido",remove:"Remover seta"},shapeToolbar:{label:"Opções da forma",color:"Cor da forma",border:{ariaLabel:"Contorno",none:"Nenhum",thin:"Fino (2px)",medium:"Médio (8px)",thick:"Espesso (16px)"},remove:"Remover forma",resize:{"top-left":"Redimensionar a partir do canto superior esquerdo","top-right":"Redimensionar a partir do canto superior direito","bottom-right":"Redimensionar a partir do canto inferior direito","bottom-left":"Redimensionar a partir do canto inferior esquerdo"}},arrowToolbar:{label:"Opções da seta",color:"Cor da seta",thickness:{ariaLabel:"Espessura",thin:"Fina",medium:"Média",thick:"Espessa"},startArrowhead:"Início da seta",endArrowhead:"Fim da seta",arrowhead:{lineArrow:"Ponta de seta",none:"Nenhuma"},lineStyle:{ariaLabel:"Estilo da linha",solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"},sticker:"Efeito autocolante",remove:"Remover seta",moveEndpoint:{start:"Mover o início da seta",end:"Mover o fim da seta"}},textToolbar:{label:"Opções do texto",background:"Cor de fundo",color:"Cor do texto",font:{ariaLabel:"Tipo de letra",modern:"Moderno",fresh:"Fresco",timeless:"Intemporal",technical:"Técnico",fineliner:"Caneta fina"},fontSize:{ariaLabel:"Tamanho da letra",small:"Pequeno",medium:"Médio",large:"Grande",extraLarge:"Muito grande",huge:"Enorme"},align:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},remove:"Remover texto",resize:{left:"Redimensionar a partir da esquerda",right:"Redimensionar a partir da direita"}},text:{editLabel:"Editar texto",placeholder:"Escreva algo"},baseMenu:{pinNumber:"Fixar número",unpinNumber:"Desafixar número",annotate:"Anotar",removeAnnotation:"Remover anotação",highlight:"Realçar",highlightWithLabel:e=>`Realçar ${e.label}`,removeHighlight:"Remover realce",differenceArrow:"Seta de diferença",addSticker:"Adicionar autocolante",removeSticker:"Remover autocolante"},textMenu:{title:"Anotar",placeholder:"Adicionar comentário",addButton:"Adicionar"},highlights:{menuTitle:"Realçar",labels:{bar:"Barra",barGroup:"Grupo",barStack:"Pilha",barSeries:"Série",line:"Linha",linePoint:"Ponto",lineSeries:"Série",scatterPoint:"Ponto",scatterSeries:"Série",pieSlice:"Fatia",pointOrBar:"Ponto / barra",lineOrSeries:"Linha / série"}},stickerMenu:{title:"Adicionar autocolante"},delete:"Eliminar",arrow:{thickness:{label:"Espessura",thin:"Fina",medium:"Média",thick:"Grossa"},arrowhead:{startPoint:"Ponto inicial",endPoint:"Ponto final",lineArrow:"Seta de linha",none:"Nenhuma"},lineStyle:{label:"Estilo de linha",solid:"Sólida",dotted:"Pontilhada"},stickerEffect:"Efeito de autocolante",toolbarAriaLabel:"Barra de ferramentas de seta livre",editorAriaLabel:"Editor de seta"},differenceArrow:{type:{proportion:"Proporção",difference:({absoluteDifference:e})=>`Diferença (${e})`,increase:({absoluteDifference:e})=>`Aumento (${e})`,decrease:({absoluteDifference:e})=>`Diminuição (${e})`,percentageChange:({percentageChange:e})=>`Variação percentual (${e})`,percentIncrease:({percentageChange:e})=>`Aumento percentual (${e})`,percentDecrease:({percentageChange:e})=>`Diminuição percentual (${e})`},size:{label:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},flipArrow:"Inverter seta",color:"Cor",toolbarAriaLabel:"Barra de ferramentas de seta de diferença",editorAriaLabel:"Editor de seta de diferença"},shape:{color:"Cor",border:{label:"Contorno",none:"Nenhum",thin:({value:e})=>`Fino (${e})`,medium:({value:e})=>`Médio (${e})`,thick:({value:e})=>`Grosso (${e})`}}}},hd={common:cd,editor:dd,graph:ud},pd={"en-GB":id,"en-US":ld,ar:nd,"pt-PT":hd},md=[pd,l.dictionaries],Kt=({children:e,...t})=>(0,n.jsx)(l.IntlProvider,{dictionaries:md,...t,children:(0,n.jsx)(gd,{children:e})}),gd=({children:e})=>(0,n.jsx)(_t.DirectionProvider,{direction:l.useTextDirection(),children:e}),vd="data-variant",$o=kr.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[vd]:e.variant}:{}}}}}),xd=Tr.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{showTitle:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.showTitle)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:r}=t;return r.depth!==1||r.parentOffset!==0?!1:r.index(0)===1}}}}),Xt=()=>[ji.Text,$e.UndoRedo,Si.Heading.configure({levels:[1,2,3]}),fi.Bold,yi.Italic,Ti.Underline,wi.TextAlign.configure({types:["heading","paragraph"]}),Ci.Link.configure({openOnClick:!1,autolink:!0}),Re.TextStyle,Re.Color,bi.HardBreak],fd=({titlePlaceholder:e,subtitlePlaceholder:t,showTitle:r,showSubtitle:o})=>[Sd({showTitle:r,showSubtitle:o}),$o,...Xt(),Re.FontFamily,xd.configure({showTitle:r}),$e.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:a,editor:i})=>{if(r&&a===0)return e;const s=r?i.state.doc.firstChild?.nodeSize??-1:0;return o&&a===s?t:""}})],bd=({placeholder:e})=>[Me.Document,$o,...Xt(),Re.FontFamily,$e.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Sd=({showTitle:e,showSubtitle:t})=>e&&t?Me.Document.extend({content:"block{2,}"}):Me.Document;var yd="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",Cd="d0bl00";var jd="d0bl03",wd="d0bl04",Td=.01,Ct=l.CANVAS_COLOR_KEYS.map(e=>l.vars[e]),kd=Object.fromEntries(l.CANVAS_COLOR_KEYS.map(e=>[l.vars[e],e])),Ad=e=>Ct.some(t=>t.toLowerCase()===e.toLowerCase()),Pd=({color:e,onChange:t,open:r,onOpenChange:o,children:a,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:p=!1})=>{const h=l.useI18n(),{ColorSwatches:m,Slider:g}=O(),x=Ed(),f=p?[Or,...Ct]:Ct,b=S=>{t(S),o(!1)};return(0,n.jsxs)(H.Popover.Root,{open:r,onOpenChange:o,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(te.Toolbar.Button,{}),"aria-label":i??h("graph.toolbar.color.label"),className:Cd,onMouseDown:S=>S.preventDefault(),children:a??(0,n.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{sideOffset:6,align:"start",className:jd,children:(0,n.jsxs)(H.Popover.Popup,{className:wd,onMouseDown:S=>S.preventDefault(),...s,children:[(0,n.jsx)(m,{title:h("graph.colorDropdown.colors"),colors:f,value:e,onChange:b}),x.length>0&&(0,n.jsx)(m,{title:h("graph.colorDropdown.chartColors"),colors:x,value:e,onChange:b}),(0,n.jsx)(Id,{value:e,onChange:t,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,n.jsxs)("div",{className:"_14ty2ng0",children:[(0,n.jsx)("div",{className:"_14ty2ng1",children:h("graph.colorDropdown.opacity")}),(0,n.jsx)(g,{value:c,onChange:d,min:0,max:1,step:Td,showValue:!1,ariaLabel:h("graph.colorDropdown.opacity")})]})]})})})})]})},Ld=(e,t)=>{if(l.isHex(e))return e;const r=kd[e];return r===void 0?e:t[r]},Id=({value:e,onChange:t,popupAttributes:r})=>{const{CustomColor:o}=O(),{themeValues:a}=l.useThemeContext();return(0,n.jsx)(o,{value:e===null?null:Ld(e,a),onChange:t,popupAttributes:r})},Ed=()=>{const e=l.useSceneSelector(t=>t.scales.color);return(0,v.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const r of e.domain){const o=e.map(r);typeof o=="string"&&t.add(o)}return[...t]},[e])},Md="l9kff0",Rd="l9kff1",Od="l9kff2",_d="xn24px0",Nd="xn24px1",Dd="xn24px2",Fd=({children:e,popupAttributes:t})=>(0,n.jsx)(W.Menu.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(W.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:_d,children:(0,n.jsx)(W.Menu.Popup,{className:Nd,onMouseDown:r=>r.preventDefault(),...t,children:e})})})}),Gd=({children:e,selected:t=!1,disabled:r=!1,onClick:o})=>(0,n.jsx)(W.Menu.Item,{className:Dd,"data-selected":t,disabled:r,onClick:o,children:e}),Bd=({className:e,...t})=>(0,n.jsx)(q.Tooltip.Provider,{children:(0,n.jsx)(te.Toolbar.Root,{...t,className:(0,U.default)(Md,e)})}),zd=({className:e,...t})=>(0,n.jsx)(te.Toolbar.Group,{...t,className:(0,U.default)(Rd,e)}),Hd=({className:e,...t})=>(0,n.jsx)(te.Toolbar.Separator,{...t,className:(0,U.default)(Od,e)}),Vd=({children:e})=>{const t=l.resolvePortalContainer();return t===null?null:(0,Ot.createPortal)((0,n.jsx)(l.PortalThemeProvider,{children:e}),t)},z={Portal:Vd,Root:Bd,Group:zd,Separator:Hd,Button:te.Toolbar.Button,ColorPicker:Pd,MenuPopup:Fd,MenuItem:Gd},$d="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",Wd=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Ud="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",qd="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",jt=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:Wd},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:$d},{id:"technical",label:"Technical",preview:"00",fontFamily:Ud},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:qd}],Kd=e=>e?jt.find(t=>t.fontFamily===e)??null:null,Wo="_70l3rt0",Uo="_70l3rt1",qo="_70l3rt3",Ko="_70l3rt4",Xo="_70l3rt5",Xd=({editor:e,currentFontFamily:t,open:r,onOpenChange:o})=>{const a=l.useI18n(),i=Kd(t)??jt[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,n.jsxs)(W.Menu.Root,{open:r,onOpenChange:o,children:[(0,n.jsxs)(W.Menu.Trigger,{render:(0,n.jsx)(te.Toolbar.Button,{}),"aria-label":a("graph.toolbar.font.ariaLabel"),className:Wo,onMouseDown:c=>c.preventDefault(),children:[(0,n.jsx)("span",{className:Uo,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,n.jsx)(ie,{size:"sm"})]}),(0,n.jsx)(W.Menu.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(W.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:qo,children:(0,n.jsx)(W.Menu.Popup,{className:Ko,onMouseDown:c=>c.preventDefault(),children:jt.map(c=>(0,n.jsx)(W.Menu.Item,{className:Xo,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,n.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Zo={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:l.vars.fontTextEditorBody},_n=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:l.vars.fontTextEditorH6},Zo,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:l.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:l.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:l.vars.fontTextEditorH1}],Zd=({editor:e,activeStyle:t,open:r,onOpenChange:o})=>{const a=l.useI18n(),i=_n.find(s=>s.id===t)??Zo;return(0,n.jsxs)(W.Menu.Root,{open:r,onOpenChange:o,children:[(0,n.jsxs)(W.Menu.Trigger,{render:(0,n.jsx)(te.Toolbar.Button,{}),"aria-label":a("graph.toolbar.heading.ariaLabel"),className:Wo,onMouseDown:s=>s.preventDefault(),children:[(0,n.jsx)("span",{className:Uo,children:a(i.translationKey)}),(0,n.jsx)(ie,{size:"sm"})]}),(0,n.jsx)(W.Menu.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(W.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:qo,children:(0,n.jsx)(W.Menu.Popup,{className:Ko,onMouseDown:s=>s.preventDefault(),children:_n.map(s=>(0,n.jsx)(W.Menu.Item,{className:Xo,"data-selected":s.id===i.id,onClick:()=>Yd(e,s.id),children:(0,n.jsx)(Jd,{font:s.previewFont,children:a(s.translationKey)})},s.id))})})})})]})},Yd=(e,t)=>{switch(t){case"caption":e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return;case"text":e.chain().focus().setNode("paragraph",{variant:null}).run();return;case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},Jd=({font:e,children:t})=>(0,n.jsx)("span",{style:{font:e,margin:0},children:t}),Qd=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:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,n.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),eu=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:"M18 6 6 18"}),(0,n.jsx)("path",{d:"m6 6 12 12"})]})}),tu=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),nu=e=>{const{$from:t}=e.state.selection,r=t.parent.textContent,o=t.parentOffset,a=t.start();let i=o;for(;i>0&&Nn(r[i-1]);)i-=1;let s=o;for(;s<r.length&&Nn(r[s]);)s+=1;return{from:a+i,to:a+s}},Nn=e=>e!==void 0&&/\S/.test(e),ru="fop13s0",ou="fop13s1",au="fop13s2",iu="fop13s3",Dn="fop13s4",su=({editor:e,currentUrl:t,active:r,open:o,onOpenChange:a})=>{const i=l.useI18n(),[s,c]=(0,v.useState)(""),d=(0,v.useRef)(null);(0,v.useEffect)(()=>{o&&c(t??"")},[o,t]);const p=()=>{lu(e,s),a(!1)},h=()=>{c(""),a(!1)},m=x=>{c(x.target.value)},g=x=>{x.key==="Enter"&&(x.preventDefault(),p())};return(0,n.jsxs)(H.Popover.Root,{open:o,onOpenChange:a,children:[(0,n.jsx)(H.Popover.Trigger,{render:(0,n.jsx)(te.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":r,className:ru,onMouseDown:x=>x.preventDefault(),children:(0,n.jsx)(Qd,{})}),(0,n.jsx)(H.Popover.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(l.PortalThemeProvider,{children:(0,n.jsx)(H.Popover.Positioner,{sideOffset:6,align:"end",className:ou,children:(0,n.jsxs)(H.Popover.Popup,{className:au,initialFocus:d,onMouseDown:x=>x.preventDefault(),children:[(0,n.jsx)("input",{ref:d,type:"url",value:s,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:iu,onMouseDown:x=>x.stopPropagation(),onChange:m,onKeyDown:g}),(0,n.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:Dn,onClick:h,children:(0,n.jsx)(eu,{})}),(0,n.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:Dn,onClick:p,children:(0,n.jsx)(Xr,{})})]})})})})]})},lu=(e,t)=>{const r=t.trim(),{selection:o}=e.state;if(!r){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!o.empty){e.chain().focus().setLink({href:r}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:r}).run();return}const a=nu(e);e.chain().focus().setTextSelection(a).setLink({href:r}).run()},Yo=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:"M21 5H3"}),(0,n.jsx)("path",{d:"M17 12H7"}),(0,n.jsx)("path",{d:"M19 19H5"})]})}),Jo=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:"M21 5H3"}),(0,n.jsx)("path",{d:"M21 12H9"}),(0,n.jsx)("path",{d:"M21 19H7"})]})}),Qo=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:"M21 5H3"}),(0,n.jsx)("path",{d:"M15 12H3"}),(0,n.jsx)("path",{d:"M17 19H3"})]})}),cu="_1d66w570",du="_1d66w571",ae=({label:e,active:t,onToggle:r,children:o})=>{const a=i=>i.preventDefault();return(0,n.jsxs)(q.Tooltip.Root,{children:[(0,n.jsx)(q.Tooltip.Trigger,{render:(0,n.jsx)(ki.Toggle,{render:(0,n.jsx)(te.Toolbar.Button,{}),pressed:t,onPressedChange:()=>r()}),"aria-label":e,className:cu,onMouseDown:a,children:o}),(0,n.jsx)(q.Tooltip.Portal,{container:l.resolvePortalContainer(),className:ee,children:(0,n.jsx)(Nt,{children:(0,n.jsx)(q.Tooltip.Positioner,{sideOffset:6,className:du,children:(0,n.jsx)(q.Tooltip.Popup,{className:Hr,children:e})})})})]})},uu=({editor:e,activeAlignment:t="left"})=>{const r=l.useI18n();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ae,{label:r("graph.toolbar.textAlign.left"),active:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,n.jsx)(Qo,{})}),(0,n.jsx)(ae,{label:r("graph.toolbar.textAlign.center"),active:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,n.jsx)(Yo,{})}),(0,n.jsx)(ae,{label:r("graph.toolbar.textAlign.right"),active:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,n.jsx)(Jo,{})})]})},hu="_1u34vl40",pu=({editor:e})=>({bold:e?.isActive("bold")??!1,italic:e?.isActive("italic")??!1,underlined:e?.isActive("underline")??!1,linked:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:mu(e),textAlign:gu(e)}),mu=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",gu=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",vu=8,xu=8,fu=({editor:e})=>{const t=l.useI18n(),[r,o]=(0,v.useState)(!1),[a,i]=(0,v.useState)(null),s=a!==null,c=x=>f=>{i(f?x:null)},{refs:d,floatingStyles:p}=(0,se.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,se.offset)(vu),(0,se.flip)(),(0,se.shift)({padding:xu})],whileElementsMounted:se.autoUpdate}),h=(0,v.useRef)(null),m=(0,We.useEditorState)({editor:e,selector:pu}),g=(0,v.useCallback)(x=>{h.current=x,d.setFloating(x)},[d]);return(0,v.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,v.useEffect)(()=>{if(!e)return;const x=()=>o(!0),f=({event:b})=>{const{relatedTarget:S,currentTarget:C}=b,A=S instanceof Node&&h.current?.contains(S),T=S instanceof Node&&C instanceof Node&&C.contains(S);!A&&!T&&o(!1)};return e.on("focus",x),e.on("blur",f),()=>{e.off("focus",x),e.off("blur",f)}},[e]),!e||!r&&!s?null:(0,n.jsx)(z.Portal,{children:(0,n.jsxs)(z.Root,{ref:g,className:hu,style:p,children:[(0,n.jsxs)(z.Group,{children:[(0,n.jsx)(z.ColorPicker,{color:m?.color??null,onChange:x=>e.chain().setColor(x).run(),open:a==="color",onOpenChange:c("color")}),(0,n.jsx)(Xd,{editor:e,currentFontFamily:m?.fontFamily??null,open:a==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,n.jsx)(z.Separator,{}),(0,n.jsx)(z.Group,{children:(0,n.jsx)(Zd,{editor:e,activeStyle:m?.fontSize??"text",open:a==="fontSize",onOpenChange:c("fontSize")})}),(0,n.jsx)(z.Separator,{}),(0,n.jsxs)(z.Group,{children:[(0,n.jsx)(ae,{label:t("graph.toolbar.formatting.bold"),active:m?.bold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,n.jsx)("strong",{children:"B"})}),(0,n.jsx)(ae,{label:t("graph.toolbar.formatting.italic"),active:m?.italic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,n.jsx)("em",{children:"I"})}),(0,n.jsx)(ae,{label:t("graph.toolbar.formatting.underline"),active:m?.underlined??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,n.jsx)("u",{children:"U"})})]}),(0,n.jsx)(z.Separator,{}),(0,n.jsx)(z.Group,{children:(0,n.jsx)(uu,{editor:e,activeAlignment:m?.textAlign})}),(0,n.jsx)(z.Separator,{}),(0,n.jsx)(z.Group,{children:(0,n.jsx)(su,{editor:e,currentUrl:m?.linkUrl??null,active:m?.linked??!1,open:a==="link",onOpenChange:c("link")})})]})})},bu="_1uy50v30",ea=({editor:e,ariaLabel:t})=>(0,n.jsxs)("div",{className:bu,children:[(0,n.jsx)(fu,{editor:e}),(0,n.jsx)(We.EditorContent,{editor:e,"aria-label":t})]}),Su=200,Zt=({content:e,extensions:t,editable:r,onUpdate:o,updateDebounceMs:a=Su})=>{const i=(0,v.useRef)(Fn(e)),s=(0,v.useRef)(i.current),c=l.useDebouncedCallback(p=>{s.current=p,o?.(p)},a),d=(0,We.useEditor)({extensions:t,content:i.current,editable:r,immediatelyRender:!1,onUpdate:({editor:p})=>{const h=p.getJSON();if(dt(s.current,h))return c.cancel();c.run(h)}});return(0,v.useEffect)(()=>{d?.setEditable(r)},[d,r]),(0,v.useEffect)(()=>{if(!d)return;const p=Fn(e);dt(s.current,p)||(s.current=p,!dt(d.getJSON(),p)&&(c.cancel(),yu(d,p)))},[d,e,c]),(0,v.useEffect)(()=>()=>c.flush(),[c]),d},Fn=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,yu=(e,t)=>{const{from:r,to:o}=e.state.selection;e.commands.setContent(t,{emitUpdate:!1});const a=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(r,a),to:Math.min(o,a)})},dt=(e,t)=>JSON.stringify(Ge(e))===JSON.stringify(Ge(t)),Ge=e=>Array.isArray(e)?e.map(Ge):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Ge(r)]).filter(([,t])=>!Cu(t)).sort(([t],[r])=>String(t).localeCompare(String(r)))),Cu=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,ju=({caption:e,captionStyle:t})=>{const{dispatch:r}=l.useGraphCommands(),o=Zt({content:e,extensions:(0,v.useMemo)(()=>bd({placeholder:"Add caption"}),[]),editable:!0,onUpdate:a=>{const i=tu(a)?null:a;r(new u.SetContentCaptionCommand({caption:i}))}});return(0,n.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(t),children:(0,n.jsx)(ea,{editor:o,ariaLabel:"Chart caption"})})},wu=e=>[Me.Document,kr.Paragraph,...Xt(),ku,$e.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Tu=({annotation:e})=>{const t=l.useI18n(),{dispatch:r}=l.useGraphCommands(),o=l.useEditorStore(),a=(0,v.useMemo)(()=>wu(t("graph.annotations.text.placeholder")),[t]),i=Zt({content:e.content,extensions:a,editable:!0,onUpdate:s=>{r(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,v.useEffect)(()=>{const{setCaretEditor:s}=o.getState();return s(i),()=>s(null)},[i,o]),(0,v.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,n.jsx)(We.EditorContent,{"aria-label":t("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},Gn=e=>{const t=l.resolveRichTextFontFamily(e);return t===void 0?{}:{style:`font-family: ${t}`}},ku=Tr.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>Gn(e.fontFamily)},font:{default:null,renderHTML:e=>Gn(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${l.vars.textScale})`}:{}}}}]}}),Au=3,Pu=({title:e,showTitle:t,subtitle:r,showSubtitle:o})=>{const a=[];return t&&a.push({type:"heading",attrs:{level:Au},content:Iu(e)}),o&&a.push(...Eu(r)),{type:"doc",content:a}},Lu=e=>{const[t,...r]=e.content??[];return{title:Mu(t?.content??[]),subtitle:Ru(r)}},Yt=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(Yt)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Iu=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Eu=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(Bn):[Bn(e)],Bn=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Mu=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(Yt)}},Ru=e=>{const t=e.filter(o=>(o.content??[]).length>0);if(t.length===0)return null;const[r]=t;if(r&&t.length===1&&r.type==="paragraph"){const o=r.content??[],[a]=o;if(a&&o.length===1&&a.type==="text"&&(!a.marks||a.marks.length===0))return a.text??null}return{type:"doc",content:t.map(Yt)}},Ou="uwf6lt0",_u={fontFamily:"var(--uwf6lt1)",fontSize:"var(--uwf6lt2)",fontWeight:"var(--uwf6lt3)",fontStyle:"var(--uwf6lt4)",letterSpacing:"var(--uwf6lt5)",lineHeight:"var(--uwf6lt6)",textColor:"var(--uwf6lt7)",textTransform:"var(--uwf6lt8)",textDecoration:"var(--uwf6lt9)",textShadow:"var(--uwf6lta)",textOutline:"var(--uwf6ltb)"},Nu={fontFamily:"var(--uwf6ltc)",fontSize:"var(--uwf6ltd)",fontWeight:"var(--uwf6lte)",fontStyle:"var(--uwf6ltf)",letterSpacing:"var(--uwf6ltg)",lineHeight:"var(--uwf6lth)",textColor:"var(--uwf6lti)",textTransform:"var(--uwf6ltj)",textDecoration:"var(--uwf6ltk)",textShadow:"var(--uwf6ltl)",textOutline:"var(--uwf6ltm)"},Du=({title:e,showTitle:t,showSubtitle:r,subtitle:o,headingStyle:a,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,v.useMemo)(()=>fd({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",showTitle:t,showSubtitle:r}),[t,r]),d=Zt({content:(0,v.useMemo)(()=>Pu({title:e,showTitle:t,subtitle:o,showSubtitle:r}),[e,t,o,r]),extensions:c,editable:!0,onUpdate:p=>{const h=Lu(p);t&&s(new u.SetContentTitleCommand({title:h.title})),r&&s(new u.SetContentSubtitleCommand({subtitle:h.subtitle}))}});return(0,n.jsx)("div",{className:Ou,"data-testid":"title-editor",style:{...l.assignTextStyleVars(_u,a),...l.assignTextStyleVars(Nu,i)},children:(0,n.jsx)(ea,{editor:d,ariaLabel:"Chart title and subtitle"})})},Fu={Title:Du,Caption:ju,TextAnnotation:Tu},Gu="_10igzta0",Bu=({rect:e,zIndex:t,container:r,boxRef:o,children:a,...i})=>r===null?null:(0,Ot.createPortal)((0,n.jsx)("div",{...i,ref:o,className:Gu,style:{transform:`translate(${e.left}px, ${e.top}px)`,width:e.width,height:e.height,zIndex:t},children:a}),r),ta=(e,t)=>{const{offsetWidth:r}=e;return r<=0||t<=0?1:t/r},na=e=>ta(e,e.getBoundingClientRect().width),zn=(e,t)=>{const{offsetWidth:r,offsetHeight:o}=e;return r<=0||o<=0?t:{width:r,height:o}},me=e=>e.offset+e.strokeWidth,Hn="http://www.w3.org/2000/svg",Vn=new WeakMap,zu=(e,t)=>{const r=Hu(e);r.setAttribute("d",t);const{x:o,y:a,width:i,height:s}=r.getBBox();return{x:o,y:a,width:i,height:s}},Hu=e=>{const t=Vn.get(e);if(t?.isConnected)return t;const r=e.createElementNS(Hn,"svg");r.setAttribute("aria-hidden","true"),r.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";const o=e.createElementNS(Hn,"path");return r.append(o),e.body.append(r),Vn.set(e,o),o},Vu=(e,t)=>{const{panelRect:r,look:o,readGridLineWidth:a,measurePathBox:i}=t,s=me(o);switch(e.kind){case"observations":return ut([...e.parts,...e.vertex===null?[]:[e.vertex]].flatMap(c=>$u(c,i)).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})),s);case"guide":return ut(e.shapes.map(c=>c.kind==="box"?c.rect:l.growRect(Uu(c),a(c.axis)/2)),s);case"graph":return ut([{x:0,y:0,...e.frameSize}],-o.offset);default:return e}},$u=(e,t)=>e.kind==="boxes"?e.boxes:Wu(e.shapes,t),Wu=(e,t)=>{const r=[],o=new Map;for(const a of e){if(a.kind==="dots"){r.push(...a.centers.map(c=>l.growRect({...c,width:0,height:0},a.size/2)));continue}if(a.pathData==="")continue;const i=a.kind==="stroke"?a.width/2:0;if(!a.pathData.trimStart().startsWith("M")){r.push(l.growRect(t(a.pathData),i));continue}const s=o.get(i)??[];s.push(a.pathData),o.set(i,s)}for(const[a,i]of o)r.push(l.growRect(t(i.join("")),a));return r},Uu=e=>{switch(e.kind){case"line":return{x:Math.min(e.from.x,e.to.x),y:Math.min(e.from.y,e.to.y),width:Math.abs(e.to.x-e.from.x),height:Math.abs(e.to.y-e.from.y)};case"ring":return{x:e.center.x-e.radius,y:e.center.y-e.radius,width:e.radius*2,height:e.radius*2}}},ut=(e,t)=>{const r=e.filter(({width:o,height:a})=>o>0||a>0);return r.length===0?null:l.growRect((0,u.getBoundingRect)(r),t)};var qu=(e,{coordSystem:t,panelRect:r})=>{if(e.kind!=="observations")return null;const o=e.vertex===null?e.parts:[...e.parts,e.vertex],a=o.reduce((s,c)=>Math.max(s,c.rows.length),0),i=a===1&&e.vertex===null;return a===0||i||a>1e3?null:o.flatMap(s=>Ku(s,t,r).map(c=>({...c,x:c.x+r.x,y:c.y+r.y})))},Ku=(e,t,r)=>(0,u.measureObservationsBoxes)({layer:{...e.layer,data:e.layer.data.take(e.rows)},coordSystem:t,panelSize:r,radialExtent:"outerEnd"}),Xu=.5,Zu={top:e=>-e.y,right:e=>e.x+e.width,bottom:e=>e.y+e.height,left:e=>-e.x},Yu=(e,t,r)=>e===null||!Ju(e)?{top:wt(t),right:Tt(t),bottom:wt(t),left:Tt(t)}:{top:we(e,t,"top",r),right:we(e,t,"right",r),bottom:we(e,t,"bottom",r),left:we(e,t,"left",r)},we=(e,t,r,o)=>{const a=Zu[r],i=r==="left"||r==="right",s=f=>i?f.y:f.x,c=f=>i?f.y+f.height:f.x+f.width;let d=-1/0;for(const f of e)d=Math.max(d,a(f));const p=d-Math.max(o,Xu);let h=1/0,m=-1/0;for(const f of e)a(f)<p||(h=Math.min(h,s(f)),m=Math.max(m,c(f)));const g=i?Tt(t):wt(t),x={from:(0,re.clamp)(h-o,g.from,g.to),to:(0,re.clamp)(m+o,g.from,g.to)};return x.from<x.to?x:g},Ju=e=>{const[t]=e;return t!==void 0&&e.some(r=>!l.areRectsEqual(r,t))},wt=e=>({from:e.x,to:e.x+e.width}),Tt=e=>({from:e.y,to:e.y+e.height}),Qu=(e,{frameElement:t,panelRect:r,look:o})=>{const a=l.useEditorStore(),i=l.useStyleReaderTree(),s=l.useSceneSelector(m=>m.coordSystem),c=(0,v.useRef)(new Map),d=e?.target??null,p=e?.outline??null;(0,v.useLayoutEffect)(()=>{if(d===null||p===null)return;const m=c.current,g=new Map,f=Vu(p,{panelRect:r,look:o,readGridLineWidth:C=>l.readGridLineStyle(i,C).strokeWidth,measurePathBox:C=>{const A=m.get(C)??zu(t.ownerDocument,C);return g.set(C,A),A}});if(c.current=g,f===null){a.getState().setSelectedOutline(null);return}const b=Yu(qu(p,{coordSystem:s,panelRect:r}),f,me(o)),S=na(t);a.getState().setSelectedOutline({target:d,frame:f,frameSpans:b,frameScale:S})},[a,i,s,d,p,t,r,o]);const h=e!==null;(0,v.useLayoutEffect)(()=>h?()=>a.getState().setSelectedOutline(null):void 0,[a,h])},Jt="var(--_1qfw3e00)",eh="_1qfw3e01",th="_1qfw3e02",$n=({pathData:e,animateTransitions:t,source:r,...o})=>t?(0,n.jsx)(nh,{pathData:e,source:r,...o}):(0,n.jsx)("path",{d:e,...o}),nh=({pathData:e,source:t,...r})=>{const o=l.useSvgPathMorph(e,l.DEFAULT_SPRING_TRANSITION,t);return(0,n.jsx)(gi.motion.path,{d:o,...r})},rh="var(--dppmab0)",oh="data-edit-outline-stroke",ra=e=>({[oh]:"",style:(0,Q.assignInlineVars)({[rh]:`${e}px`})}),oa=(e,t)=>{const{config:r,guides:o}=t;switch(e.kind){case"legend":{const{position:a}=r.legend,i=a==="none";return{hidden:i,hide:new u.SetLegendPositionCommand({position:"none"}),show:new u.SetLegendPositionCommand({position:i?"auto":a})}}case"axis":{const{axis:a}=e,i=a==="ySecondary"?o.axes.find(s=>s.scaledAesthetic==="ySecondary")?.visible:r.axes[a].visible;return i===void 0?null:{hidden:!i,hide:new u.SetAxisVisibilityCommand({axis:a,visible:!1,keepSecondaryAxis:!0}),show:new u.SetAxisVisibilityCommand({axis:a,visible:!0,keepSecondaryAxis:!0})}}case"grid":{const{axis:a}=e;if(a==="both")return null;const{visible:i}=r.axes[a].grid,s=i===!1;return{hidden:s,hide:new u.SetGridVisibilityCommand({axis:a,visible:!1}),show:new u.SetGridVisibilityCommand({axis:a,visible:s?!0:i})}}case"observations":case"graph":return null;default:return e}},ge=()=>{const e=Jc(),{store:t}=l.useGraphContext();return(0,v.useCallback)(r=>e(r)||oa(r,t.getState().scene)!==null,[e,t])};var Wn=(e,t)=>{if(e.kind==="observations"&&t.kind==="observations"){if(e.layerId!==t.layerId||e.scope!==t.scope)return!1;const r=e.parts[0]?.rows[0];return r!==void 0&&(t.parts[0]?.rows.includes(r)??!1)}return e.kind==="guide"&&t.kind==="guide"?(0,u.areEditTargetsEqual)(e.target,t.target):e.kind==="graph"&&t.kind==="graph"},ah=(e,t)=>{const r=Math.max(e.width,8),o=Math.max(e.height,8),a=Math.max(0,e.x+e.width/2-r/2),i=Math.max(0,e.y+e.height/2-o/2),s=Math.min(t.width,e.x+e.width/2+r/2),c=Math.min(t.height,e.y+e.height/2+o/2);return{x:a,y:i,width:Math.max(0,s-a),height:Math.max(0,c-i)}},ih=[],sh=e=>{const{layers:t,parsingLocale:r}=l.useSceneSelector((0,J.useShallow)(g=>({layers:g.layers,parsingLocale:g.config.parsingLocale}))),o=l.useEditorState(g=>g.editTargetUnderPointer),a=o?.kind==="observations"?o.observations:null,i=a===null?void 0:(0,u.findLayerById)(t,a.layerId),s=a?.target.scope??null,c=a===null||i===void 0?null:(0,u.readRowScopeKey)(i,a.target.scope,a.observationIndex),d=(0,v.useMemo)(()=>i===void 0||s===null||c===null?null:lh(t,i,s,c),[t,i,s,c]),p=(0,v.useMemo)(()=>d!==null&&e!==null&&Wn(d,e),[d,e]),h=ge(),m=a!==null&&i!==void 0&&ch(a,i,r,h)?a.observationIndex:null;return(0,v.useMemo)(()=>{switch(o?.kind){case"observations":{const g=d?.parts[0];if(d===null||g===void 0)return null;const x=m===null?null:{layer:g.layer,rows:[m]};return p?x===null?null:{...d,parts:ih,vertex:x}:{...d,vertex:x}}case"axis":case"legend":case"grid":{const g={kind:"guide",key:(0,u.readEditTargetKey)(o.target),target:o.target};return e!==null&&Wn(g,e)?null:g}default:return null}},[o,d,p,m,e])},lh=(e,t,r,o)=>{const a=[{layer:t,rows:(0,u.readRowsAtScopeKey)(t,r,o)}];for(const i of(0,u.findCompanionLayers)(t,e)){const s=(0,u.readCompanionRowsAtScopeKey)(i,t,r,o);s.length>0&&a.push({layer:i,rows:s})}return{kind:"observations",key:JSON.stringify([t.id,r,o]),layerId:t.id,scope:r,parts:a,vertex:null}},ch=({observationIndex:e,target:t,onObservation:r},o,a,i)=>{if(!r||t.scope!=="group")return!1;const s=(0,u.buildObservationsTarget)({layer:o,observationIndex:e,scope:"observation",parsingLocale:a});return s!==null&&i(s)},dh=({frameElement:e,target:t,coordType:r,legendDisplays:o})=>{const a=e.getBoundingClientRect(),i=[...e.querySelectorAll(uh(t))],s=c=>{const d=c.getBoundingClientRect();return{x:d.left-a.left,y:d.top-a.top,width:d.width,height:d.height}};switch(t.kind){case"axis":{const c=i.map(s);return r==="polar"||c.length===0?ht(c):ht([(0,u.getBoundingRect)(c)])}case"legend":return ht([...hh(i.filter(c=>!ph(c)))].flatMap(([c,d])=>o[c]==="direct"?d.map(s):[(0,u.getBoundingRect)(d.map(s))]));case"grid":return i.flatMap(c=>{const d=l.readStampedEditTargetInStack([c],e);if(d?.kind!=="grid"||d.target.axis==="both")return[];const{axis:p}=d.target;return t.axis==="both"||p===t.axis?[mh(c,s(c),p)]:[]})}},uh=e=>{const t=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}="${e.kind}"]`;return e.kind!=="axis"?t:`${t}[${l.EDIT_TARGET_AXIS_ATTRIBUTE}="${e.axis}"]`},hh=e=>{const t=new Map;for(const r of e){const o=l.readLegendItemAddress(r);o!==null&&t.set(o.legendIndex,[...t.get(o.legendIndex)??[],r])}return t},ph=e=>e.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR)!==null,ht=e=>e.map(t=>({kind:"box",rect:t})),mh=(e,{x:t,y:r,width:o,height:a},i)=>e.querySelector("circle")!==null?{kind:"ring",axis:i,center:{x:t+o/2,y:r+a/2},radius:o/2}:o<1||a<1?o<a?{kind:"line",axis:i,from:{x:t+o/2,y:r},to:{x:t+o/2,y:r+a}}:{kind:"line",axis:i,from:{x:t,y:r+a/2},to:{x:t+o,y:r+a/2}}:gh(e.querySelector("line"))?{kind:"line",axis:i,from:{x:t,y:r},to:{x:t+o,y:r+a}}:{kind:"line",axis:i,from:{x:t,y:r+a},to:{x:t+o,y:r}},gh=e=>{const t=r=>Number(e?.getAttribute(r)??0);return(t("x2")-t("x1"))*(t("y2")-t("y1"))>=0},vh=[],xh=(e,{frameElement:t,frameSize:r,panelRect:o,animateTransitions:a})=>{const i=l.useSceneSelector(b=>b.coordSystem),s=l.useGeomRendererResolver(),c=l.useGeomReaderTree(),d=bh(e.kind==="guide"?e.target:null,{frameElement:t,frameSize:r}),p=fh(t,r),h=(0,v.useMemo)(()=>({coordSystem:i,panelRect:o,resolveRenderer:s,geomReaders:c}),[i,o,s,c]),m=e.kind==="observations"?e.parts:null,g=e.kind==="observations"?e.vertex:null,x=(0,v.useMemo)(()=>m?.map(b=>Un(b,h,a))??vh,[m,h,a]),f=(0,v.useMemo)(()=>g===null?null:Un(g,h,!1),[g,h]);return(0,v.useMemo)(()=>{switch(e.kind){case"observations":return{kind:"observations",parts:x,vertex:f};case"guide":return{kind:"guide",target:e.target,shapes:d};case"graph":return{kind:"graph",frameSize:p}}},[e,x,f,d,p])},fh=(e,t)=>{const[r,o]=(0,v.useState)(()=>zn(e,t));return(0,v.useLayoutEffect)(()=>{o(a=>{const i=zn(e,{width:t.width,height:t.height});return a.width===i.width&&a.height===i.height?a:i})},[e,t.width,t.height]),r},Un=({layer:e,rows:t},{coordSystem:r,panelRect:o,resolveRenderer:a,geomReaders:i},s)=>{const c={...e,data:e.data.take(t)},d=a(e.geom,r.type);return d?.getEditOutlineShapes===void 0?{kind:"boxes",layer:e,rows:t,boxes:(0,u.measureObservationsBoxes)({layer:c,coordSystem:r,panelSize:o}).map(p=>ah(p,o))}:{kind:"declared",layer:e,rows:t,shapes:d.getEditOutlineShapes({layer:c,sourceLayer:e,coordSystem:r,panelRect:o,styleReaders:i(e),animateTransitions:s,symbols:d.symbols})}},bh=(e,{frameElement:t,frameSize:r})=>{const o=l.useSceneSelector(h=>h.coordSystem.type),a=l.useSceneSelector((0,J.useShallow)(h=>h.guides.legends.drawn.map(m=>m.display))),i=l.useSceneSelector(h=>e===null?null:h),[s,c]=(0,v.useState)([]),d=l.useLatestRef(e),p=(0,v.useRef)(!1);return(0,v.useLayoutEffect)(()=>{const h=d.current;if(h===null)return;const m=()=>{const g=dh({frameElement:t,target:h,coordType:o,legendDisplays:a}),x=na(t);c(g.map(f=>Sh(f,1/x)))};if(p.current){const g=requestAnimationFrame(m);return()=>cancelAnimationFrame(g)}p.current=!0,m()},[t,d,o,a,i,r.width,r.height]),s},Sh=(e,t)=>{switch(e.kind){case"box":{const{x:r,y:o,width:a,height:i}=e.rect;return{kind:"box",rect:{x:r*t,y:o*t,width:a*t,height:i*t}}}case"line":return{...e,from:{x:e.from.x*t,y:e.from.y*t},to:{x:e.to.x*t,y:e.to.y*t}};case"ring":return{...e,center:{x:e.center.x*t,y:e.center.y*t},radius:e.radius*t}}},yh=()=>{const e=l.useGraphSelection()[0]??null,{layers:t,parsingLocale:r}=l.useSceneSelector((0,J.useShallow)(o=>({layers:o.layers,parsingLocale:o.config.parsingLocale})));return(0,v.useMemo)(()=>e===null?null:Ch(e,t,r),[e,t,r])},Ch=(e,t,r)=>{switch(e.kind){case"observations":{const o=jh(e,t,r);return o===null?null:{outlined:o,target:e}}case"legend":case"axis":case"grid":return{outlined:{kind:"guide",key:(0,u.readEditTargetKey)(e),target:e},target:e};case"graph":return{outlined:{kind:"graph",key:"graph"},target:e};default:return null}},jh=(e,t,r)=>{const o=(0,u.findLayerById)(t,e.layerId);if(o===void 0)return null;const a=(0,u.resolveObservationsTarget)({layer:o,target:e,parsingLocale:r});if(a.length===0)return null;const i=[{layer:o,rows:a}];for(const s of(0,u.findCompanionLayers)(o,t)){const c=(0,u.resolveObservationsTarget)({layer:s,host:o,target:e,parsingLocale:r});c.length>0&&i.push({layer:s,rows:c})}return{kind:"observations",key:(0,u.readEditTargetKey)(e),layerId:e.layerId,scope:e.scope,parts:i,vertex:null}},wh=["x","y"],Th=(0,v.memo)(function({frameElement:t,frameSize:r,panelRect:o,animateTransitions:a}){const i=l.useResolvedStyle(u.resolveEditOutlineStyle,l.useStyleReaderTree()),s=yh(),c=sh(s?.outlined??null),{selectObservationsOnPress:d,selectGraphOnPress:p,selectGuidesOnPress:h}=l.MODE_RULES[l.useGraphMode()],m=d||p||h;if(s===null&&(c===null||!m))return null;const g={frameElement:t,frameSize:r,panelRect:o,animateTransitions:a};return!m&&s!==null?(0,n.jsx)(pt,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,paints:!1,...g}):(0,n.jsxs)("svg",{className:eh,width:r.width,height:r.height,"aria-hidden":!0,"data-testid":"edit-outline",children:[c!==null&&(0,n.jsx)(pt,{part:"hover",target:c,look:i.hover,paints:!0,...g},c.key),s!==null&&(0,n.jsx)(pt,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,paints:!0,...g},s.outlined.key)]})}),pt=({part:e,target:t,editTarget:r,look:o,frameSize:a,panelRect:i,frameElement:s,animateTransitions:c,paints:d})=>{const p=(0,v.useId)(),h=`${p}-shapes`,m=`${p}-hole`,g=xh(t,{frameElement:s,frameSize:a,panelRect:i,animateTransitions:c});return Qu(r===void 0?null:{target:r,outline:g},{frameElement:s,panelRect:i,look:o}),d?(0,n.jsxs)("g",{"data-edit-outline":e,"data-testid":`edit-outline-${e}`,children:[(0,n.jsxs)("defs",{children:[(0,n.jsx)("g",{id:h,className:th,children:(0,n.jsx)(Eh,{outline:g,look:o,panelRect:i})}),(0,n.jsxs)("mask",{id:m,maskUnits:"userSpaceOnUse",x:"-100%",y:"-100%",width:"300%",height:"300%",children:[(0,n.jsx)("rect",{x:"-100%",y:"-100%",width:"300%",height:"300%",fill:"white"}),(0,n.jsx)("use",{href:`#${h}`,style:kh(o.offset)})]})]}),(0,n.jsxs)("g",{mask:`url(#${m})`,"data-testid":`edit-outline-${e}-ring`,children:[(0,n.jsx)("use",{href:`#${h}`,style:Ah(o)}),(0,n.jsx)("use",{href:`#${h}`,style:Ph(o)})]}),t.kind==="observations"&&(0,n.jsx)(Dh,{target:t,look:o,panelRect:i})]}):null},kh=e=>({fill:"black",stroke:"black",strokeLinecap:"round",...(0,Q.assignInlineVars)({[Jt]:`${2*e}px`})}),Ah=e=>({fill:"none",stroke:e.backingColor??l.vars.graphBackground,strokeLinecap:"round",opacity:e.backingAlpha,...(0,Q.assignInlineVars)({[Jt]:`${2*me(e)}px`})}),Ph=e=>{const t=(0,u.toStrokeDasharray)(e.dashArray,e.strokeWidth);return{fill:"none",stroke:e.stroke,strokeDasharray:t,strokeLinecap:t===void 0?"round":"butt",opacity:e.strokeAlpha,...(0,Q.assignInlineVars)({[Jt]:`${2*me(e)}px`})}},Lh=({dashArray:e,strokeWidth:t})=>{if((0,u.toStrokeDasharray)(e,t)===void 0)return;const r=(e.length%2===0?1:2)*e.reduce((o,a)=>o+a*t,0);return r>0?r:void 0},aa=(e,t,r=1)=>{if(!(t===void 0||e<=0))return r*Math.max(1,Math.round(2*Math.PI*e/t))*t},Ih=(e,t,r)=>{const o=r.offset+me(r);return l.buildRoundedRectPath(l.growRect({x:0,y:0,...e},-o),Math.max(0,t-o))},Eh=({outline:e,look:t,panelRect:r})=>{const o=l.useStyleReaderTree().graph().get("cornerRadius"),{cornerRadius:a}=t,i=Lh(t);switch(e.kind){case"observations":return(0,n.jsxs)("g",{transform:`translate(${r.x} ${r.y})`,children:[e.parts.map(s=>(0,n.jsx)(qn,{part:s,borderRadius:a,dashPeriod:i},s.layer.id)),e.vertex!==null&&(0,n.jsx)(qn,{part:e.vertex,borderRadius:a,dashPeriod:i},`vertex-${e.vertex.rows.join()}`)]});case"guide":return(0,n.jsx)(Oh,{target:e.target,shapes:e.shapes,borderRadius:a,dashPeriod:i});case"graph":return(0,n.jsx)("path",{d:Ih(e.frameSize,o,t)})}},qn=(0,v.memo)(function({part:t,borderRadius:r,dashPeriod:o}){return t.kind==="boxes"?(0,n.jsx)(Rh,{boxes:t.boxes,borderRadius:r}):(0,n.jsx)(Mh,{shapes:t.shapes,layer:t.layer,dashPeriod:o})}),Mh=({shapes:e,layer:t,dashPeriod:r})=>e.map((o,a)=>{const i=o.kind==="dots"||o.key===void 0?String(a):`${o.kind}:${o.key}`;switch(o.kind){case"region":return o.pathData===""?null:(0,n.jsx)($n,{pathData:o.pathData,fillRule:o.fillRule,animateTransitions:o.animateTransitions??!1,source:t,"data-geom":t.geom},i);case"stroke":return o.pathData===""?null:(0,n.jsx)($n,{pathData:o.pathData,animateTransitions:o.animateTransitions??!1,source:t,"data-geom":t.geom,...ra(o.width)},i);case"dots":return o.centers.length===0?null:(0,n.jsx)("path",{d:l.buildCirclesPath(o.centers,o.size/2),pathLength:aa(o.size/2,r,o.centers.length),"data-geom":t.geom},i)}}),Rh=({boxes:e,borderRadius:t})=>{const r=e.map(o=>l.buildRoundedRectPath(o,t)).join("");return r===""?null:(0,n.jsx)("path",{d:r,"data-testid":"edit-outline-boxes"})},Oh=({target:e,shapes:t,borderRadius:r,dashPeriod:o})=>{const a=l.useStyleReaderTree();if(e.kind==="grid")return wh.map(s=>{const c=ra(l.readGridLineStyle(a,s).strokeWidth),d=t.map(h=>_h(h,s)).join(""),p=t.filter(h=>h.kind==="ring"&&h.axis===s);return(0,n.jsxs)(v.Fragment,{children:[d!==""&&(0,n.jsx)("path",{d,...c}),p.map((h,m)=>(0,n.jsx)("path",{d:Nh(h),pathLength:aa(h.radius,o),...c},m))]},s)});const i=t.map(s=>s.kind==="box"?l.buildRoundedRectPath(s.rect,r):"").join("");return i===""?null:(0,n.jsx)("path",{d:i})},_h=(e,t)=>e.kind==="line"&&e.axis===t?`M${e.from.x},${e.from.y}L${e.to.x},${e.to.y}`:"",Nh=({center:e,radius:t})=>{const r=`${e.x},${e.y-t}`;return`M${r}A${t},${t} 0 0 1 ${`${e.x},${e.y+t}`}A${t},${t} 0 0 1 ${r}`},Dh=({target:e,look:t,panelRect:r})=>{const o=l.useSceneSelector(s=>s.coordSystem),a=e.parts[0];if(e.scope!=="xValue"||a===void 0||a.layer.highlight?.strategy!=="overlayAnchor")return null;const i=Fh(a);return i===null?null:(0,n.jsx)("svg",{x:r.x,y:r.y,width:r.width,height:r.height,overflow:"visible",children:(0,n.jsx)("line",{...l.readCrosshairLine(o,i,r),stroke:t.stroke,strokeOpacity:t.strokeAlpha,strokeWidth:t.strokeWidth,strokeDasharray:"4 3",strokeLinecap:"round","data-testid":"edit-outline-band-guide"})})},Fh=({layer:e,rows:t})=>{for(const r of t){const o=e.data.getAt(r),a=o===null?null:(0,u.getXBand)(o),i=o===null?null:(0,u.getYBand)(o);if(a!==null&&i!==null)return{x:a,y:i}}return null},Gh="kwvn4c0",Bh="kwvn4c1",zh=(e,t)=>({contextElement:e,getBoundingClientRect:()=>{const r=e.getBoundingClientRect(),o=ta(e,r.width);return new DOMRect(r.left+t.x*o,r.top+t.y*o,t.width*o,t.height*o)}}),Hh=({side:e,boundary:t,spans:r,anchor:o,rightToLeft:a})=>{if(!$h(e))return 0;const i=r[e];if(e==="left"||e==="right")return Kn(i.from-t.y,o.height,t.height);const s=a?t.x+t.width-i.to:i.from-t.x;return Kn(s,o.width,t.width)},Vh=()=>{const[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{t(!0)},[]),e},$h=e=>l.SIDE_KEYS.some(t=>t===e),Kn=(e,t,r)=>r===0?0:e*t/r,Wh={x:8,y:8},Uh={side:"flip",align:"shift",fallbackAxisSide:"end"},qh=({frameElement:e,boundary:t,spans:r,clearance:o=Wh,onEscape:a,children:i})=>{const s=qe(),c=Vh(),[d,p]=(0,v.useState)(null),h=(0,v.useRef)(null),m=(0,v.useCallback)(k=>{h.current=k,p(k)},[]),g=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>()=>{d?.contains(document.activeElement)&&e.focus({preventScroll:!0})},[d,e]);const{x,y:f,width:b,height:S}=t,C=(0,v.useMemo)(()=>({box:{x,y:f,width:b,height:S},spans:r}),[x,f,b,S,r]),A=(0,v.useMemo)(()=>zh(e,C.box),[e,C]),T=(k,w)=>{k||(w.cancel(),w.reason==="escape-key"&&a())};return(0,n.jsx)(H.Popover.Root,{open:c,modal:!1,onOpenChange:T,children:(0,n.jsx)(H.Popover.Portal,{container:s,className:ee,children:(0,n.jsx)(Nt,{children:(0,n.jsx)(H.Popover.Positioner,{ref:g,anchor:A,side:"right",align:"start",sideOffset:({side:k})=>k==="top"||k==="bottom"?o.y:o.x,alignOffset:({side:k,anchor:w})=>Hh({side:k,boundary:C.box,spans:C.spans,anchor:w,rightToLeft:Kh(g.current)}),collisionAvoidance:Uh,sticky:!0,className:Gh,...$i,children:(0,n.jsx)(H.Popover.Popup,{ref:m,className:Bh,initialFocus:h,finalFocus:!1,"data-testid":"anchored-popover",children:i})})})})})},Kh=e=>e!==null&&getComputedStyle(e).direction==="rtl",Qt=(e,t)=>(0,v.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:r,numberFormat:o}=e.config,a=t??r,i=e.guides.colorGroups.map(s=>{const c=(0,u.createValueFormatter)({valueFormat:s.valueFormat,locale:a,numberFormat:o}),d=s.value instanceof Date?s.value.getTime():s.value;return{value:d,option:{value:String(d),label:s.label??c(s.value)}}});return{options:i.map(({option:s})=>s),findValue:s=>i.find(c=>c.option.value===s)?.value}},[e,t]),Xh=({scene:e,layer:t,observation:r,groupOptions:o,locale:a,t:i})=>{const s=kt(e,t,r,o);return{observation:i(Qh(e,t)),xValue:i("editor.overlayMenu.allOf",{name:ia(e,t,r,a)}),group:s===null?i("editor.overlayMenu.all"):i("editor.overlayMenu.allOf",{name:s})}},Zh=({scene:e,layer:t,observation:r,groupOptions:o,locale:a,t:i},s)=>{const c=(0,u.getGroupVariables)(t.data,t.mapping),d=ia(e,t,r,a);switch(s){case"observation":{const p=c.length===0?null:kt(e,t,r,o),h=Yh(p,d,i);return{whole:h,value:h}}case"xValue":return Xn((0,u.findAxisGuide)(e.guides,"x")?.label??null,d,i);case"group":{const p=kt(e,t,r,o)??i("editor.overlayMenu.all");return Xn(Jh(e,c),p,i)}default:return s}},Yh=(e,t,r)=>e===null?t:t===""?e:r("editor.overlayMenu.groupAtBand",{group:e,band:t}),Xn=(e,t,r)=>({whole:e===null||e===""?t:r("editor.overlayMenu.titledValue",{title:e,value:t}),value:t}),Jh=(e,t)=>{const[r,...o]=t;return r===void 0||o.length>0?null:e.guides.variableLabels[r]??null},Qh=(e,t)=>{switch(t.geom){case"bar":return e.coordSystem.type==="polar"&&e.coordSystem.bandAxis===null?"editor.overlayMenu.thisSlice":"editor.overlayMenu.thisBar";case"point":return(0,u.readVariableName)(t.mapping.size)===null?"editor.overlayMenu.thisPoint":"editor.overlayMenu.thisBubble";default:return"editor.overlayMenu.thisPoint"}},ia=(e,t,r,o)=>{const a=(0,u.findAxisGuide)(e.guides,"x");return(0,u.createValueFormatter)({valueFormat:a===null?{type:"text"}:(0,u.resolveLayerAxisValueFormat)(a,t.id),locale:o,numberFormat:e.config.numberFormat})((0,u.createXValueReader)(t.data,t.mapping)(r),r)},kt=(e,t,r,o)=>{const a=(0,u.getGroupVariables)(t.data,t.mapping);return a.length===0?e0(t,r)??t0(e,t):a.map(i=>n0(r[i]??null,o)).join(", ")},e0=(e,t)=>{const r=(0,u.readColorPart)(e,t);return r===void 0?void 0:e.styles.parts[r]?.label},t0=(e,t)=>{const r=(0,u.readVariableName)(t.mapping.y),o=r===null?void 0:e.guides.variableLabels[r];return o===void 0||o===""?null:o},n0=(e,t)=>{const r=String(e instanceof Date?e.getTime():e);return t.options.find(o=>o.value===r)?.label??r},r0={observation:_o,xValue:No,group:Do},o0=()=>{const{selectionStore:e}=l.useGraphContext(),t=l.useEditorStore(),r=l.useI18n(),o=l.useFormattingLocale(),a=l.useSceneSelector(S=>S),i=Qt(a,o),s=l.useEditorState(S=>S.pressedObservation),c=ge(),d=(0,v.useMemo)(()=>a0({scene:a,pressed:s,groupOptions:i,locale:o,t:r,hasOverlayMenu:c}),[a,s,i,o,r,c]);if(d===null)return null;const{layer:p,levels:h,names:m}=d,{observationIndex:g,selectedFor:x}=d.pressed,f=h.map(S=>{const C=r0[S];return{value:S,label:m[S],icon:(0,n.jsx)(C,{})}}),b=S=>{const C=h.find(k=>k===S),{parsingLocale:A}=a.config,T=C===void 0?null:(0,u.buildObservationsTarget)({layer:p,observationIndex:g,scope:C,parsingLocale:A});T!==null&&(t.getState().setPressedObservation({...d.pressed,selectedFor:T}),e.getState().setSelection([T]))};return(0,n.jsx)(Dt,{value:x.scope,options:f,onChange:b,ariaLabel:r("editor.overlayMenu.selection")})},a0=({scene:e,pressed:t,groupOptions:r,locale:o,t:a,hasOverlayMenu:i})=>{const s=t===null?null:l.findPressedObservation(t,e.layers,e.config.parsingLocale);if(t===null||s===null)return null;const{layer:c,observation:d}=s,{observationIndex:p,selectedFor:h}=t,{parsingLocale:m}=e.config,g=(0,u.readReachableLevels)({layer:c,observationIndex:p,parsingLocale:m,scales:e.scales}).filter(x=>{const f=(0,u.buildObservationsTarget)({layer:c,observationIndex:p,scope:x,parsingLocale:m});return f!==null&&i(f)});return g.length<2||!g.includes(h.scope)?null:{pressed:t,layer:c,levels:g,names:Xh({scene:e,layer:c,observation:d,groupOptions:r,locale:o,t:a})}},i0=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:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),s0=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:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,n.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,n.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,n.jsx)("path",{d:"m2 2 20 20"})]})}),l0="_11vjgg60",c0=({target:e})=>{const t=l.useI18n(),r=l.useGraphCommands(),o=l.useSceneSelector(x=>x),[a,i]=(0,v.useState)(null),s=oa(e,o);if(s===null)return null;const{hidden:c,hide:d,show:p}=s,h=()=>{if(c){r.dispatch(a??p);return}i(p),r.dispatch(d)},m=t(c?"editor.overlayMenu.show":"editor.overlayMenu.hide"),g=c?s0:i0;return(0,n.jsx)(pe,{label:m,children:(0,n.jsx)("button",{type:"button",className:l0,onClick:h,children:(0,n.jsx)(g,{title:""})})})},d0="_1j45ehx0",u0="_1j45ehx1",h0="_1j45ehx2",p0="_1j45ehx3",m0=(e,t)=>{switch(e.kind){case"observations":return g0(e.scope,t);case"legend":case"axis":case"grid":return v0(e.kind,t);case"graph":return t("editor.overlayMenu.chart");default:return e}},g0=(e,t)=>{switch(e){case"observation":return t("editor.overlayMenu.observation");case"group":return t("editor.overlayMenu.group");case"xValue":return t("editor.overlayMenu.band");default:return e}},v0=(e,t)=>{switch(e){case"axis":return t("editor.overlayMenu.axis");case"legend":return t("editor.overlayMenu.legend");case"grid":return t("editor.overlayMenu.gridLines");default:return e}},x0=({target:e})=>{const t=l.useI18n(),r=l.useFormattingLocale(),o=l.useSceneSelector(s=>s),a=Qt(o,r),i=(0,v.useMemo)(()=>b0({target:e,scene:o,groupOptions:a,locale:r,t}),[e,o,a,r,t]);return(0,n.jsx)(f0,{title:i})},f0=({title:e})=>{const t=(0,v.useRef)(null),r=(0,v.useRef)(null),[o,a]=(0,v.useState)(!1),i=(0,v.useCallback)(()=>{const d=t.current,p=r.current;d===null||p===null||a(p.offsetWidth>d.clientWidth)},[]);(0,v.useLayoutEffect)(i,[i,e.whole]);const{setElement:s}=l.useResizeObserver({onResize:i}),c=(0,v.useCallback)(d=>{t.current=d,s(d)},[s]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H.Popover.Title,{ref:c,className:h0,"data-testid":"overlay-menu-title",children:o?e.value:e.whole}),(0,n.jsx)("span",{ref:r,className:p0,"aria-hidden":!0,children:e.whole})]})},b0=({target:e,scene:t,groupOptions:r,locale:o,t:a})=>{const i=m0(e,a),s={whole:i,value:i};if(e.kind!=="observations")return s;const c=(0,u.findLayerById)(t.layers,e.layerId);if(c===void 0)return s;const[d]=(0,u.resolveObservationsTarget)({layer:c,target:e,parsingLocale:t.config.parsingLocale}),p=d===void 0?null:c.data.getAt(d);return p===null?s:Zh({scene:t,layer:c,observation:p,groupOptions:r,locale:o,t:a},e.scope)},S0=({frameElement:e})=>{const{selectionStore:t}=l.useGraphContext(),r=y0(l.useEditorState(c=>c.selectedOutline)),o=Yc(r?.target??null),a=ge();if(r===null||!a(r.target))return null;const i=()=>{t.getState().clearSelection()},s=(0,u.readEditTargetKey)(r.target);return(0,n.jsxs)(qh,{frameElement:e,boundary:r.frame,spans:r.frameSpans,onEscape:i,children:[(0,n.jsxs)(xt,{className:d0,children:[(0,n.jsxs)("div",{className:u0,children:[(0,n.jsx)(x0,{target:r.target}),(0,n.jsx)(c0,{target:r.target},s)]}),r.target.kind==="observations"&&(0,n.jsx)(o0,{})]}),(0,n.jsx)(v.Fragment,{children:o},s)]})},y0=e=>{const t=l.useGraphSelection(),[r,o]=(0,v.useState)(e),a=r!==null&&(0,u.areEditTargetsEqual)(t[0]??null,r.target),i=e??(a?r:null);return i!==r&&o(i),i},C0=({frameRect:e})=>{const{targetBoundaryStore:t}=l.useGraphContext(),r=l.useEditorState(s=>s.selectedOutline),{left:o,top:a}=e,i=(0,v.useMemo)(()=>{if(r===null)return null;const{frame:s,frameSpans:c,frameScale:d}=r;return{frame:s,client:{x:o+s.x*d,y:a+s.y*d,width:s.width*d,height:s.height*d},frameSpans:c,clientSpans:{top:Te(c.top,o,d),right:Te(c.right,a,d),bottom:Te(c.bottom,o,d),left:Te(c.left,a,d)}}},[r,o,a]);return(0,v.useLayoutEffect)(()=>{t.getState().setBoundary(i)},[t,i]),(0,v.useLayoutEffect)(()=>()=>t.getState().setBoundary(null),[t]),null},Te=(e,t,r)=>({from:t+e.from*r,to:t+e.to*r}),en="l8tsqe0",sa=["start","end"],la=({anchor:e,point:t,delta:r})=>{const o={x:Zn(t.x,r.x),y:Zn(1-t.y,r.y)};return{anchor:{...e,x:e.x+o.x,y:e.y+o.y},point:{x:t.x+o.x,y:t.y-o.y}}},tn=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),ca=(e,t)=>e.x===t.x&&e.y===t.y,j0=(e,t)=>{const r=(0,u.projectAnchorToPanel)(e,t);return{x:t.x+r.x,y:t.y+r.y}},w0=(e,t,r)=>{const o=(0,u.projectAnchorToPanel)(e,r),a=(0,u.projectAnchorToPanel)(t,r);return{x:Math.min(o.x,a.x),y:Math.min(o.y,a.y),width:Math.abs(a.x-o.x),height:Math.abs(a.y-o.y)}},Zn=(e,t)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,re.clamp)(t,Math.min(-e,0),Math.max(1-e,0)),T0=({panelRect:e})=>{const t=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),r=l.useResolvedAnnotations(e).arrows,o=l.useStyleReaderTree();if(t===null)return null;const a=r.find(c=>c.id===t.annotationId);if(a===void 0)return null;const i=(0,u.resolveArrowAnnotationStyle)(o,a.id),s=(0,u.computeArrow)({arrow:tn(a,t),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:en,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":t.annotationId,children:(0,n.jsx)(l.ArrowAnnotation,{computed:s,style:i,addressable:!1})})},ve=()=>{const e=l.useGraphSelection();return At(e)},At=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},k0=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 19-7-7 7-7"}),(0,n.jsx)("path",{d:"M19 12H5"})]})}),da=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:"M5 12h14"}),(0,n.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),A0=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:"M7 17 17 7"}),(0,n.jsx)("path",{d:"M7 7h10v10"})]})}),ua=e=>(0,n.jsx)(l.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"})]})}),Ze=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"})]})}),P0="var(--pvjfpx0)",L0="var(--pvjfpx1)",I0="pvjfpx2",E0="pvjfpx3",M0="pvjfpx4",R0="pvjfpx6 pvjfpx5",O0="pvjfpx7 pvjfpx6 pvjfpx5",_0="pvjfpx8 pvjfpx5",ce=8,N0=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o})=>{const a=t.y+e.y,i=a+e.height,s=a-8-36,c=i+8,d=(0,re.clamp)(s>=ce?s:c,ce,o-ce-36),p=ce;return{top:d,left:p,available:Math.max(0,r-ce*2),centre:t.x+e.x+e.width/2-p}},D0=({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o,label:a,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=N0({anchorBox:e,panelRect:t,frameWidth:r,frameHeight:o});return(0,n.jsx)("div",{className:I0,style:{top:d.top,left:d.left,width:d.available},children:(0,n.jsx)(z.Root,{"aria-label":a,className:E0,"data-testid":i,...Ue(c),style:(0,Q.assignInlineVars)({[P0]:`${d.centre}px`,[L0]:`${d.available}px`}),children:s})})},F0=({label:e,trigger:t,open:r,onOpenChange:o,disabled:a=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,n.jsxs)(W.Menu.Root,{open:r,modal:!1,onOpenChange:o,children:[(0,n.jsxs)(W.Menu.Trigger,{render:(0,n.jsx)(z.Button,{}),"aria-label":e,className:_0,disabled:a,onMouseDown:c=>c.preventDefault(),children:[t,(0,n.jsx)(ie,{size:"sm"})]}),(0,n.jsx)(z.MenuPopup,{popupAttributes:Ue(s),children:i})]})},G0=e=>{const{chartId:t}=l.useGraphContext();return(0,n.jsx)(z.ColorPicker,{...e,popupAttributes:Ue(t)})},B0=({color:e,opacity:t})=>(0,n.jsx)("span",{className:M0,style:{background:e,opacity:t}}),z0=({label:e,onClick:t,children:r})=>(0,n.jsx)(z.Button,{"aria-label":e,className:R0,onClick:t,children:r}),H0=({label:e,pressed:t,onClick:r,children:o})=>(0,n.jsx)(z.Button,{"aria-label":e,"aria-pressed":t,className:O0,onClick:r,children:o}),_={Root:D0,Dropdown:F0,MenuItem:z.MenuItem,ColorPicker:G0,Swatch:B0,IconButton:z0,ToggleButton:H0,Button:z.Button,Separator:z.Separator},V0={kind:"chrome-popup"},Ye=()=>{const{commands:e}=l.useGraphContext(),t=l.useEditorStore(),[r,o]=(0,v.useState)(null);(0,v.useEffect)(()=>()=>e.commit(),[e]),(0,v.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:s}=t.getState();return r===null?s("chrome-popup"):i(V0),()=>s("chrome-popup")},[t,r]);const a=()=>{o(null),e.commit()};return{bind:i=>({open:r===i,onOpenChange:s=>s?o(i):a()}),close:a}},$0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19 8 16"}),(0,n.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,n.jsx)("path",{d:"M16 8 19 5"})]})}),W0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M5 19h0"}),(0,n.jsx)("path",{d:"M8.5 15.5h0"}),(0,n.jsx)("path",{d:"M12 12h0"}),(0,n.jsx)("path",{d:"M15.5 8.5h0"}),(0,n.jsx)("path",{d:"M19 5h0"})]})}),U0=e=>(0,n.jsx)(l.Icon,{...e,children:(0,n.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),q0=[{value:u.ARROW_STROKE_WIDTHS_PX.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:u.ARROW_STROKE_WIDTHS_PX.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:u.ARROW_STROKE_WIDTHS_PX.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],Yn=[{value:"lineArrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:da},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Jn=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:U0},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:$0},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:W0}],K0=(e,t)=>e.find(r=>r.value===t)??e[0];var X0=({arrow:e,arrowBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(j=>j.spec.styles.overrides),p=l.useSceneSelector(j=>(0,u.readStyleCoord)(j.spec)),h=Ye(),m=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),g=K0(Jn,(0,u.toDashPreset)(m.dashArray)),x=m.outline.strokeWidth>0||m.outline.shadow!=="none",f=(0,v.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),b=(0,v.useMemo)(()=>({...f,part:"outline"}),[f]),S=(j,y)=>{const R=(0,u.findStyleRule)(d,{select:f},p)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:f,declarations:{...R,...j}}}),y)},C=j=>{const y=(0,u.findStyleRule)(d,{select:b},p)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:b,declarations:{...y,...j}}}))},A=j=>{S(j),h.close()},T=j=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:j})),h.close()},k=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},w=j=>S({stroke:j},{transient:!0}),L=j=>A({strokeWidth:j}),E=j=>T({startArrowheadStyle:j}),I=j=>A({dashArray:u.DASH_PRESETS.arrow[j]}),G=j=>T({endArrowheadStyle:j}),N=()=>C(x?{strokeWidth:0,shadow:"none"}:u.ARROW_STICKER_DECLARATIONS);return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:m.stroke,label:s("graph.annotations.arrowToolbar.color"),onChange:w,...h.bind("color"),children:(0,n.jsx)(_.Swatch,{color:m.stroke})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,n.jsx)(ua,{size:"sm",title:""}),...h.bind("thickness"),children:(0,n.jsx)(ke,{options:q0,current:m.strokeWidth,onPick:L})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,n.jsx)(k0,{size:"sm",title:""}),...h.bind("startArrowhead"),children:(0,n.jsx)(ke,{options:Yn,current:e.startArrowheadStyle,onPick:E})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:g?.Icon!==void 0&&(0,n.jsx)(g.Icon,{size:"sm",title:""}),...h.bind("lineStyle"),children:(0,n.jsx)(ke,{options:Jn,current:(0,u.toDashPreset)(m.dashArray),onPick:I})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,n.jsx)(da,{size:"sm",title:""}),...h.bind("endArrowhead"),children:(0,n.jsx)(ke,{options:Yn,current:e.endArrowheadStyle,onPick:G})}),(0,n.jsx)(_.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),pressed:x,onClick:N,children:(0,n.jsx)(A0,{size:"sm",title:""})}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:k,children:(0,n.jsx)(Ze,{size:"sm",title:""})})]})},ke=({options:e,current:t,onPick:r})=>{const o=l.useI18n(),a=i=>()=>r(i);return(0,n.jsx)(n.Fragment,{children:e.map(i=>(0,n.jsxs)(_.MenuItem,{selected:i.value===t,onClick:a(i.value),children:[(0,n.jsx)("span",{children:o(i.key)}),i.Icon!==void 0&&(0,n.jsx)("span",{className:"_112xh5c0",children:(0,n.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},Z0="_1me29t10",K=(e,t)=>t>0?e/t:0,Je=(e,t,r)=>({x:K(t.x-e.x,r.width),y:K(t.y-e.y,r.height)}),Y0=e=>e.x!==0||e.y!==0,ha=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var J0=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,xe=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 o={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,o))return;const a=this.resolvePreview(o);a!==null&&(r.claimInteraction(a),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 J0(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)}},Be=(e,t,r)=>{const o=e.arrows.find(i=>i.id===t);if(o===void 0)return null;const a=o[r];return a.anchorType==="panel"?a:null},pa=(e,t)=>e==="start"?{start:t}:{end:t},Q0=class extends xe{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:t,endpoint:r}=this.params;return l.readDraggedArrowEndpointFor(l.readStanding(e,"arrow-endpoint-drag"),t,r)}resolvePreview(e){const{annotationId:t,endpoint:r,press:o,readInputs:a}=this.params,{annotations:i,arrow:s,panelRect:c}=a(),d=Be(i,t,r);return d===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:r,...la({anchor:d,point:s[r],delta:Je(o,e,c)})}}commit({anchor:e}){const{annotationId:t,endpoint:r,dispatch:o,readInputs:a}=this.params,i=Be(a().annotations,t,r);i===null||ca(i,e)||o(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:pa(r,e)}))}},ep=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef({annotations:l.useSceneSelector(c=>c.spec.annotations),arrow:t,panelRect:r}),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>s.current?.finish(!1),[]),(0,v.useCallback)(c=>({onPointerDown:d=>{if(d.button===0&&s.current===null){try{d.currentTarget.setPointerCapture(d.pointerId)}catch{return}d.currentTarget.focus({preventScroll:!0}),d.preventDefault(),s.current=new Q0({handle:d.currentTarget,pointerId:d.pointerId,annotationId:e,endpoint:c,press:{x:d.clientX,y:d.clientY},readInputs:()=>i.current,editorStore:a,dispatch:o.dispatch,onSettled:()=>{s.current=null}}),s.current.start()}}}),[e,i,a,o])},tp=[" ","Enter"],Qn=4,np=({annotationId:e,arrow:t,panelRect:r})=>{const{commands:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useSceneSelector(d=>d.spec.annotations),s=l.useLatestRef(i),c=l.useLatestRef(o.dispatch);return(0,v.useEffect)(()=>()=>{for(const d of sa)er({editorStore:a,annotationId:e,endpoint:d,annotations:s.current,dispatch:c.current})},[a,e,s,c]),(0,v.useCallback)(d=>({onKeyDown:p=>{if(p.altKey||p.ctrlKey||p.metaKey||p.shiftKey)return;const h=a.getState(),m=l.readDraggedArrowEndpointFor(l.readStanding(h,"arrow-endpoint-drag"),e,d);if(tp.includes(p.key)){if(p.preventDefault(),p.repeat)return;if(m!==null){er({editorStore:a,annotationId:e,endpoint:d,annotations:i,dispatch:o.dispatch});return}const x=Be(i,e,d);if(x===null)return;h.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,anchor:x,point:t[d]});return}if(m===null)return;const g=rp(p.key,r);g!==null&&(p.preventDefault(),h.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:d,...la({anchor:m.anchor,point:m.point,delta:g})}))}}),[e,i,t,r,a,o])},er=({editorStore:e,annotationId:t,endpoint:r,annotations:o,dispatch:a})=>{const i=e.getState(),s=l.readDraggedArrowEndpointFor(l.readStanding(i,"arrow-endpoint-drag"),t,r);if(s===null)return;i.releaseInteraction("arrow-endpoint-drag");const c=Be(o,t,r);c===null||ca(c,s.anchor)||a(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:pa(r,s.anchor)}))},rp=(e,t)=>{const r=K(Qn,t.width),o=K(Qn,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},op=e=>{const t=ve(),r=sp(t),o=lp(e.panelRect,t),a=cp(t);if(r===null||o===null)return null;const i=a.dragged===null?o:tn(o,a.dragged);return(0,n.jsx)(ap,{arrow:r,committed:o,painted:i,settled:a.dragged===null&&!a.moving,moving:a.moving,...e})},ap=({arrow:e,committed:t,painted:r,settled:o,moving:a,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),p=ep({annotationId:e.id,arrow:t,panelRect:i}),h=np({annotationId:e.id,arrow:t,panelRect:i});return(0,n.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[o&&(0,n.jsx)(X0,{arrow:e,arrowBox:w0(t.start,t.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!a&&sa.filter(m=>e[m].anchorType==="panel").map(m=>(0,n.jsx)(ip,{endpoint:m,point:j0(r[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:p(m),keyboardHandlers:h(m)},m))]})},ip=({endpoint:e,point:t,label:r,dragHandlers:o,keyboardHandlers:a})=>(0,n.jsx)("div",{"aria-label":r,className:Z0,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...o,...a}),sp=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.arrows);return e===null?null:t.find(r=>r.id===e)??null},lp=(e,t)=>{const r=l.useResolvedAnnotations(e).arrows;return t===null?null:r.find(o=>o.id===t)??null},cp=e=>l.useEditorState((0,J.useShallow)(t=>{if(e===null)return{dragged:null,moving:!1};const r=l.readStanding(t,"arrow-endpoint-drag");return{dragged:r?.annotationId===e?r:null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null}})),dp=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"})]})}),up="q7gcrz0",hp="q7gcrz1",pp="q7gcrz2";var mp=["absoluteDifference","relativeDifference","proportion"],tr=["absoluteDifference","relativeDifference"],gp=["relativeDifference","proportion"],vp={absoluteDifference:"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference",relativeDifference:"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},xp=e=>{const{formattingLocale:t}=l.useGraphContext(),r=l.useSceneSelector(a=>a.config.parsingLocale),o=t??r;return(0,v.useMemo)(()=>{const a=(0,u.areEndpointsComparable)(e.start,e.end);return mp.filter(i=>a||!tr.includes(i)||i===e.label).map(i=>({kind:i,key:vp[i],preview:(0,u.formatDifferenceLabel)({locale:o,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),pickable:a||!tr.includes(i),suspect:gp.includes(i)&&e.start.measurementValue===0}))},[e,o])},nr=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],fp=({arrow:e,color:t,labelBox:r,panelRect:o,frameWidth:a,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),p=l.useSceneSelector(y=>y.spec.styles.overrides),h=l.useSceneSelector(y=>(0,u.readStyleCoord)(y.spec)),m=Ye(),g=xp(e),x=(0,u.resolveDifferenceArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),f=(0,v.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),b=(0,v.useMemo)(()=>({...f,part:"label"}),[f]),S=g.find(y=>y.kind===e.label),C=g.some(y=>y.pickable&&y.kind!==e.label),A=nr.find(y=>u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[y.id].arrow.strokeWidth===x.strokeWidth),T=(y,R)=>{d.dispatch(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:y}),R)},k=y=>({...(0,u.findStyleRule)(p,{select:f},h)?.declarations,...y}),w=y=>({...(0,u.findStyleRule)(p,{select:b},h)?.declarations,...y}),L=y=>{T(y),m.close()},E=()=>{d.dispatch(new u.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},I=y=>d.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:f,declarations:k({stroke:y})}}),{transient:!0}),G=()=>T({start:e.end.anchor,end:e.start.anchor}),N=y=>()=>L({label:y}),j=y=>()=>{const R=u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[y];d.dispatch(new u.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:k(R.arrow),label:w(R.label)})),m.close()};return(0,n.jsxs)(_.Root,{anchorBox:r,panelRect:o,frameWidth:a,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,n.jsx)(_.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,n.jsx)(bp,{option:S}),disabled:!C,...m.bind("labelKind"),children:g.map(y=>(0,n.jsxs)(_.MenuItem,{selected:y.kind===e.label,disabled:!y.pickable,onClick:N(y.kind),children:[(0,n.jsx)("span",{children:c(y.key)}),(y.suspect||!y.pickable)&&(0,n.jsx)("span",{"aria-label":c(y.pickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,n.jsx)("span",{className:pp,children:y.preview})]},y.kind))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.ColorPicker,{color:t,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:I,...m.bind("color"),children:(0,n.jsx)(_.Swatch,{color:t})}),(0,n.jsx)(_.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:A===void 0?"":c(A.key),...m.bind("size"),children:nr.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.id===A?.id,onClick:j(y.id),children:c(y.key)},y.id))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:G,children:(0,n.jsx)(dp,{size:"sm",title:""})}),(0,n.jsx)(_.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:E,children:(0,n.jsx)(Ze,{size:"sm",title:""})})]})},bp=({option:e})=>{const t=l.useI18n();return e===void 0?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:hp,children:t(e.key)}),(0,n.jsxs)("span",{className:up,children:["(",e.preview,")"]})]})},Sp="var(--ydgo3h0)";var yp="ydgo3h1",Cp="ydgo3h2",jp="ydgo3h3",wp=({clientPoint:e,panelOrigin:t,panelRect:r,engine:o,layers:a,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const p=Tp({x:e.x-t.x,y:e.y-t.y},r),{primary:h}=o.query((0,u.toPanelCursor)(p,r));if(h===null)return null;const m=a.find(x=>x.id===h.layerId);if(m===void 0)return null;const g=(0,u.resolveObservationPoint)({resolver:s,layer:m,observation:h.observation,observationIndex:(0,u.readObservationIndex)(h),coordSystem:i,align:d});return g===null||(0,u.areAnchorsEqual)(g.anchor,c)?null:g},Tp=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),ma=e=>e==="start"?"end":"start",ga=({dispatch:e,arrow:t,endpoint:r,anchor:o})=>{(0,u.areAnchorsEqual)(o,t[r].anchor)||e(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[r]:o}}))},kp=class extends xe{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}isDragConfirmed(){return!0}readOwn(e){const{endpoint:t,readInputs:r}=this.params;return l.readDraggedDifferenceArrowEndpointFor(l.readStanding(e,"difference-arrow-endpoint-drag"),r().arrow.id,t)}resolvePreview(e){const{endpoint:t,readInputs:r,engine:o,anchorResolver:a}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:p}=r(),h=wp({clientPoint:e,panelOrigin:s,panelRect:c,engine:o,layers:d,coordSystem:p,resolver:a,fixedAnchor:i[ma(t)].anchor,align:i[t].anchor.align});return h===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:h}}commit({point:e,endpoint:t}){const{dispatch:r,readInputs:o}=this.params;ga({dispatch:r,arrow:o().arrow,endpoint:t,anchor:e.anchor})}},Ap=({arrow:e,panelOrigin:t,panelRect:r})=>{const{commands:o,anchorResolver:a}=l.useGraphContext(),{engine:i}=l.useHoverContext(),s=l.useEditorStore(),c=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:r,...l.useSceneSelector((0,J.useShallow)(p=>({layers:p.layers,coordSystem:p.coordSystem})))}),d=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>d.current?.finish(!1),[]),(0,v.useCallback)(p=>({onPointerDown:h=>{if(h.button===0&&d.current===null){try{h.currentTarget.setPointerCapture(h.pointerId)}catch{return}h.currentTarget.focus({preventScroll:!0}),h.preventDefault(),d.current=new kp({handle:h.currentTarget,pointerId:h.pointerId,press:{x:h.clientX,y:h.clientY},endpoint:p,readInputs:()=>c.current,editorStore:s,engine:i,anchorResolver:a,dispatch:o.dispatch,onSettled:()=>{d.current=null}}),d.current.start()}}}),[c,s,i,a,o])},Pp=[" ","Enter"],Lp=({arrow:e})=>{const{commands:t,anchorResolver:r}=l.useGraphContext(),o=l.useEditorStore(),{layers:a,coordSystem:i,mainAxis:s}=l.useSceneSelector((0,J.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:(0,u.readMainAxis)(d.coordSystem)}))),c=e.id;return(0,v.useEffect)(()=>()=>{const d=o.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[o,c]),(0,v.useCallback)(d=>({onKeyDown:p=>{if(p.altKey||p.ctrlKey||p.metaKey||p.shiftKey)return;const h=o.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(h,"difference-arrow-endpoint-drag"),e.id,d);if(Pp.includes(p.key)){if(p.preventDefault(),p.repeat)return;if(m===null)return h.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});h.releaseInteraction("difference-arrow-endpoint-drag"),ga({dispatch:t.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const g=Ip(p.key,s);if(g===null)return;p.preventDefault();const x=Ep({arrow:e,endpoint:d,from:m.point.anchor,move:g,layers:a,coordSystem:i,resolver:r});x!==null&&h.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:x})}}),[e,o,t,r,a,i,s])},Ip=(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}},Ep=({arrow:e,endpoint:t,from:r,move:o,layers:a,coordSystem:i,resolver:s})=>{const c=a.find(h=>h.id===r.layerId);if(c===void 0)return null;const d=s.createLayerMeasurement(c);if(d===null)return null;const{align:p}=e[t].anchor;return(0,u.stepDifferenceArrowEndpoint)({layer:c,from:r,partner:e[ma(t)].anchor,axis:o.axis,step:o.step,getObservationPoint:(h,m)=>(0,u.resolveObservationPoint)({resolver:s,layer:c,observation:h,observationIndex:m,coordSystem:i,align:p,measurement:d})})?.point??null},Mp=e=>{const t=ve();return t===null?null:(0,n.jsx)(Rp,{annotationId:t,...e})},Rp=({annotationId:e,...t})=>{const r=l.useDifferenceArrowGeometries(),o=(0,v.useMemo)(()=>r.find(a=>a.id===e),[r,e]);return o===void 0?null:(0,n.jsx)(Op,{committedArrow:o.committedArrow,color:o.color,labelCornerRadius:o.style.label.cornerRadius,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,start:o.start,end:o.end,dragging:o.dragging,...t})},Op=({committedArrow:e,color:t,labelCornerRadius:r,committedLabelBox:o,labelBox:a,start:i,end:s,panelRect:c,panelOrigin:d,frameRect:p,frameElement:h,dragging:m})=>{const g=Ap({arrow:e,panelOrigin:d,panelRect:c}),x=Lp({arrow:e}),f=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,n.jsxs)("div",{"data-testid":"difference-arrow-selection",style:(0,Q.assignInlineVars)({[Sp]:f}),children:[!m&&(0,n.jsx)(fp,{arrow:e,color:t,labelBox:o,panelRect:c,frameWidth:p.width,frameHeight:p.height,frameElement:h}),(0,n.jsx)("div",{"aria-hidden":"true",className:jp,"data-testid":"difference-arrow-selection-label",style:{left:c.x+a.x-2,top:c.y+a.y-2,width:a.width+4,height:a.height+4,borderRadius:l.toBorderRadiusCss(r,2)}}),(0,n.jsx)(rr,{endpoint:"start",point:i,panelRect:c,dragHandlers:g("start"),keyboardHandlers:x("start")}),(0,n.jsx)(rr,{endpoint:"end",point:s,panelRect:c,dragHandlers:g("end"),keyboardHandlers:x("end")})]})},rr=({endpoint:e,point:t,panelRect:r,dragHandlers:o,keyboardHandlers:a})=>(0,n.jsx)("div",{className:yp,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,role:"button",style:{left:r.x+t.x,top:r.y+t.y},tabIndex:0,...o,...a,children:(0,n.jsx)("span",{"aria-hidden":"true",className:Cp})}),Pt=({start:e,extent:t,moveStartEdge:r,delta:o,minExtent:a})=>{if(!Number.isFinite(o))return{start:e,extent:t};const i=e+t,s=Math.min(a,t);if(r){const p=Math.min(0,e),h=Math.min(Math.max(1,e),i-s),m=(0,re.clamp)(e+o,p,h);return{start:m,extent:i-m}}const c=Math.max(Math.min(0,i),e+s),d=Math.max(1,i);return{start:e,extent:(0,re.clamp)(i+o,c,d)-e}},_p=["top-left","top-right","bottom-right","bottom-left"];var va=({width:e,height:t})=>({x:K(16,e),y:K(16,t)}),Np=(e,t)=>({x:ba(t)?e.x:e.x+e.width,y:Sa(t)?e.y:e.y+e.height}),nn=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),xa=({region:e,corner:t,delta:r,minSize:o})=>{const a=Pt({start:e.x,extent:e.width,moveStartEdge:ba(t),delta:r.x,minExtent:o.x}),i=Pt({start:e.y,extent:e.height,moveStartEdge:Sa(t),delta:r.y,minExtent:o.y});return{anchorType:"panel",x:a.start,y:i.start,width:a.extent,height:i.extent}},fa=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ba=e=>e==="top-left"||e==="bottom-left",Sa=e=>e==="top-left"||e==="top-right",ya=(e,t,r,o)=>{const a=e.textAnnotations.find(i=>i.id===t);return a===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(a,r),o)},Dp="var(--_1ee8fau0)";var Fp={hovered:"_1ee8fau2 _1ee8fau1",selected:"_1ee8fau3 _1ee8fau1"},Gp={hovered:"_1ee8fau5 _1ee8fau4",selected:"_1ee8fau6 _1ee8fau4"},Bp=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),r=l.useMeasuredBoxes(),o=l.useStyleReaderTree(),a=ve(),i=l.useEditorState(b=>l.readStanding(b,"move-drag")),s=l.useEditorState(b=>l.readStanding(b,"shape-resize-drag")),c=l.useEditorState(b=>l.readStanding(b,"arrow-endpoint-drag")),d=l.useEditorState(b=>l.readStanding(b,"text-resize-drag")),p=l.useEditorState(l.readAnnotationUnderPointer),h=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:r,readers:o}),[e.width,e.height,r,o]),m=or(t,a,h),g=or(t,p===a?null:p,h),x=b=>{if(s?.annotationId===b.id){const S=t.shapes.find(C=>C.id===b.id);return S===void 0?b.geometry:l.measureShapeRegion(nn(s.region),o.annotation.shape(S.id).get("strokeWidth"),h.panel)}if(c?.annotationId===b.id){const S=t.arrows.find(C=>C.id===b.id);return S===void 0?b.geometry:l.measureArrowEnds(tn(S,c),h.panel)??b.geometry}return d?.annotationId===b.id?ya(t,b.id,d,h)??b.geometry:b.geometry},f=b=>{if(i?.annotationId!==b)return e;const S=ha(i.translation,e);return{x:e.x+S.x,y:e.y+S.y}};return(0,n.jsxs)(n.Fragment,{children:[g!==null&&(0,n.jsx)(ar,{annotationId:g.id,geometry:x(g),state:"hovered",origin:f(g.id)}),m!==null&&(0,n.jsx)(ar,{annotationId:m.id,geometry:x(m),state:"selected",origin:f(m.id)})]})},or=(e,t,r)=>{if(t===null)return null;const o=l.resolveAnnotationChromeGeometry(e,t,r);return o===null?null:{id:t,geometry:o}},ar=({annotationId:e,geometry:t,state:r,origin:o})=>{const a=l.useStyleReaderTree().editOutline.selected().resolve().stroke,i=(0,Q.assignInlineVars)({[Dp]:a});return t.shape==="segment"?(0,n.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:i,children:[(0,n.jsx)(ir,{point:t.start,state:r,origin:o}),(0,n.jsx)(ir,{point:t.end,state:r,origin:o})]}):(0,n.jsx)("div",{"aria-hidden":"true",className:Fp[r],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":r,style:{...i,left:o.x+t.rect.x-2,top:o.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}})},ir=({point:e,state:t,origin:r})=>(0,n.jsx)("span",{className:Gp[t],style:{left:r.x+e.x,top:r.y+e.y}}),zp=({panelRect:e})=>{const t=l.useEditorState(a=>l.readStanding(a,"move-drag")),r=l.useResolvedAnnotations(e);if(t===null)return null;const o=ha(t.translation,e);return(0,n.jsx)("svg",{"aria-hidden":"true",className:en,width:e.width,height:e.height,style:{left:e.x+o.x,top:e.y+o.y},"data-testid":"annotation-preview","data-annotation-id":t.annotationId,children:$p(r,t.annotationId,e)})},Hp=({annotation:e,panel:t})=>{const r=l.useMeasuredBoxRef(e.id);return(0,n.jsx)(l.TextAnnotation,{annotation:e,panel:t,style:l.useStyleReaderTree().annotation.text(e.id).resolve(),blockRef:r})},Ae=(e,t,r)=>{const o=e.find(a=>a.id===t);return o===void 0?null:r(o)},Vp={text:(e,t,r)=>Ae(e.textAnnotations,t,o=>(0,n.jsx)(Hp,{annotation:o,panel:r})),shape:(e,t,r)=>Ae(e.shapes,t,o=>(0,n.jsx)(Up,{shape:o,panelSize:r})),image:(e,t,r)=>Ae(e.images,t,o=>(0,n.jsx)(qp,{image:o,panelSize:r})),arrow:(e,t,r)=>Ae(e.arrows,t,o=>(0,n.jsx)(Wp,{arrow:o,panelSize:r}))},$p=(e,t,r)=>{for(const o of Object.values(Vp)){const a=o(e,t,r);if(a!==null)return a}return null},Wp=({arrow:e,panelSize:t})=>{const r=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),o=(0,u.computeArrow)({arrow:e,style:r,panelWidth:t.width,panelHeight:t.height});return o===null?null:(0,n.jsx)(l.ArrowAnnotation,{computed:o,style:r,addressable:!1})},Up=({shape:e,panelSize:t})=>(0,n.jsx)(l.ShapeAnnotation,{shape:e,style:l.useStyleReaderTree().annotation.shape(e.id).resolve(),panel:t}),qp=({image:e,panelSize:t})=>(0,n.jsx)(l.ImageAnnotation,{image:e,panel:t,style:l.useStyleReaderTree().annotation.image(e.id).resolve()}),Kp=({panelRect:e})=>{const t=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),r=l.useResolvedAnnotations(e).shapes,o=l.useStyleReaderTree();if(t===null)return null;const a=r.find(i=>i.id===t.annotationId);return a===void 0?null:(0,n.jsx)("svg",{"aria-hidden":"true",className:en,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)(l.ShapeAnnotation,{shape:{...a,region:nn(t.region)},style:o.annotation.shape(a.id).resolve(),panel:e})})},Xp="var(--o49ib40)",Zp={sm:"o49ib41",md:"o49ib42"},Yp={horizontal:"o49ib43",diagonalDown:"o49ib44",diagonalUp:"o49ib45"},Ca=({point:e,label:t,pull:r,size:o,attributes:a,dragHandlers:i,keyboardHandlers:s})=>{const c=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,n.jsx)("div",{"aria-label":t,className:Yp[r],role:"button",style:{left:e.x,top:e.y,...(0,Q.assignInlineVars)({[Xp]:c})},tabIndex:0,...a,...i,...s,children:(0,n.jsx)("span",{"aria-hidden":"true",className:Zp[o]})})},Lt=[{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"}],Jp=e=>[...Lt].reverse().find(t=>t.width<=e)??Lt[0],Qp=({shape:e,shapeBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(T=>T.spec.styles.overrides),p=l.useSceneSelector(T=>(0,u.readStyleCoord)(T.spec)),h=Ye(),m=l.useStyleReaderTree().annotation.shape(e.id).resolve(),g=Jp(m.strokeWidth),x=(0,v.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),f=(T,k)=>{const w=(0,u.findStyleRule)(d,{select:x},p)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...w,...T}}}),k)},b=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},S=T=>f({fill:T},{transient:!0}),C=T=>f({fillAlpha:T},{transient:!0}),A=T=>()=>{f({strokeWidth:T}),h.close()};return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:(0,u.toPaintColor)(m.fill),label:s("graph.annotations.shapeToolbar.color"),onChange:S,opacity:m.fillAlpha,onOpacityChange:C,...h.bind("color"),children:(0,n.jsx)(_.Swatch,{color:(0,u.toPaintColor)(m.fill),opacity:m.fillAlpha})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,n.jsx)(ua,{size:"sm",title:""}),...h.bind("border"),children:Lt.map(T=>(0,n.jsx)(_.MenuItem,{selected:T.width===g?.width,onClick:A(T.width),children:s(T.key)},T.width))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:b,children:(0,n.jsx)(Ze,{size:"sm",title:""})})]})},ja=e=>{const t=l.useLatestRef(e),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>r.current?.finish(!1),[]),(0,v.useCallback)(o=>({onPointerDown:a=>{if(a.button!==0||r.current!==null)return;try{a.currentTarget.setPointerCapture(a.pointerId)}catch{return}a.currentTarget.focus({preventScroll:!0}),a.preventDefault();const i=t.current(o,{handle:a.currentTarget,pointerId:a.pointerId,press:{x:a.clientX,y:a.clientY},onSettled:()=>{r.current=null}});r.current=i,i.start()}}),[t])},ze=(e,t)=>{const r=e.shapes.find(o=>o.id===t);return r===void 0||r.region.anchorType!=="panel"?null:r.region},e1=class extends xe{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return l.readResizedShapeFor(l.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,corner:r,press:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=ze(i,t);return c===null?null:{kind:"shape-resize-drag",annotationId:t,region:xa({region:c,corner:r,delta:Je(o,e,s),minSize:va(s)})}}commit({region:e}){const{annotationId:t,dispatch:r,readInputs:o}=this.params,a=ze(o().annotations,t);a===null||fa(a,e)||r(new u.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},t1=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return ja((i,s)=>new e1({...s,annotationId:e,corner:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},n1=[" ","Enter"],wa=e=>{const t=l.useEditorStore(),r=l.useLatestRef(e);return(0,v.useEffect)(()=>()=>sr(t,r.current),[t,r]),(0,v.useCallback)(o=>({onKeyDown:a=>{if(a.altKey||a.ctrlKey||a.metaKey||a.shiftKey)return;const i=t.getState(),s=r.current.readHeld();if(n1.includes(a.key)){if(a.preventDefault(),a.repeat)return;if(s!==null){sr(t,r.current);return}const d=r.current.claim(o);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=r.current.step(s,o,a.key);c!==null&&(a.preventDefault(),i.claimInteraction(c))}}),[t,r])},sr=(e,t)=>{const r=t.readHeld();r!==null&&(e.getState().releaseInteraction(r.kind),t.commit(r))},lr=4,r1=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useSceneSelector(i=>i.spec.annotations);return wa({readHeld:()=>l.readResizedShapeFor(l.readStanding(o.getState(),"shape-resize-drag"),e),claim:()=>{const i=ze(a,e);return i===null?null:{kind:"shape-resize-drag",annotationId:e,region:i}},step:(i,s,c)=>{const d=o1(c,t);return d===null?null:{kind:"shape-resize-drag",annotationId:e,region:xa({region:i.region,corner:s,delta:d,minSize:va(t)})}},commit:({region:i})=>{const s=ze(a,e);s===null||fa(s,i)||r.dispatch(new u.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:i}}))}})},o1=(e,t)=>{const r=K(lr,t.width),o=K(lr,t.height);switch(e){case"ArrowLeft":return{x:-r,y:0};case"ArrowRight":return{x:r,y:0};case"ArrowUp":return{x:0,y:-o};case"ArrowDown":return{x:0,y:o};default:return null}},a1={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},i1=e=>{const t=ve(),r=l1(t),o=c1(t);if(r===null)return null;const a=o.resizedRegion??(r.region.anchorType==="panel"?r.region:null);return a===null?null:(0,n.jsx)(s1,{shape:r,region:a,settled:o.resizedRegion===null&&!o.moving,moving:o.moving,...e})},s1=({shape:e,region:t,settled:r,moving:o,panelRect:a,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=t1({annotationId:e.id,panelRect:a}),p=r1({annotationId:e.id,panelRect:a}),h=l.useStyleReaderTree().annotation.shape(e.id).resolve(),{rect:m}=l.measureShapeRegion(nn(t),h.strokeWidth,a);return(0,n.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(Qp,{shape:e,shapeBox:m,panelRect:a,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!o&&_p.map(g=>{const x=Np(m,g);return(0,n.jsx)(Ca,{point:{x:a.x+x.x,y:a.y+x.y},label:c(`graph.annotations.shapeToolbar.resize.${g}`),pull:a1[g],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":g},dragHandlers:d(g),keyboardHandlers:p(g)},g)})]})},l1=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.shapes);return e===null?null:t.find(r=>r.id===e)??null},c1=e=>l.useEditorState((0,J.useShallow)(t=>e===null?{resizedRegion:null,moving:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(t,"shape-resize-drag"),e)?.region??null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),d1=({textColor:e,...t})=>(0,n.jsxs)(l.Icon,{...t,children:[(0,n.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,n.jsx)("path",{d:"M6 4h12"}),(0,n.jsx)("path",{d:"M12 4v12"})]}),(0,n.jsx)("path",{d:"M5 20h14",stroke:e??"currentColor",strokeWidth:3,strokeLinecap:"round"})]});var He="textStyle",Ta=new Set(["paragraph","heading"]),u1=e=>{const t=ka(e),r=x1(e);return{color:Pe(t.map(o=>f1(mt(o)?.color))),font:Pe(t.map(o=>v1(mt(o)))),fontSize:Pe(t.map(o=>b1(mt(o)?.fontSize))),alignment:Pe(r.map(o=>S1(o.attrs?.textAlign)))}},h1=(e,t)=>rn(e,r=>r.type==="text"?g1(r,t):r),p1=e=>ka(e).length>0,m1=(e,t)=>rn(e,r=>Ta.has(r.type??"")?{...r,attrs:{...r.attrs,textAlign:t}}:r),rn=(e,t)=>t(e.content===void 0?e:{...e,content:e.content.map(r=>rn(r,t))}),g1=(e,t)=>{const r=e.marks??[],o=r.find(i=>i.type===He),a={type:He,attrs:{...o?.attrs,...t}};return{...e,marks:o===void 0?[...r,a]:r.map(i=>i===o?a:i)}},mt=e=>e.marks?.find(t=>t.type===He)?.attrs,v1=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),ka=e=>on(e,t=>t.type==="text"),x1=e=>on(e,t=>Ta.has(t.type??"")),on=(e,t)=>[...t(e)?[e]:[],...(e.content??[]).flatMap(r=>on(r,t))],Pe=e=>{const[t,...r]=e;return t===void 0?null:r.every(o=>o===t)?t:null},f1=e=>typeof e=="string"&&e.length>0?e:void 0,b1=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,S1=e=>e==="left"||e==="center"||e==="right"?e:void 0;var Aa=[{id:"modern",key:"graph.annotations.textToolbar.font.modern"},{id:"fresh",key:"graph.annotations.textToolbar.font.fresh"},{id:"timeless",key:"graph.annotations.textToolbar.font.timeless"},{id:"technical",key:"graph.annotations.textToolbar.font.technical"},{id:"fineliner",key:"graph.annotations.textToolbar.font.fineliner"}].map(({id:e,key:t})=>({id:e,key:t,fontFamily:l.RICH_TEXT_FONT_FAMILIES[e]??e})),y1=e=>Aa.find(t=>t.id===(e??"modern"))??null;var Pa=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:15,key:"graph.annotations.textToolbar.fontSize.medium"},{size:18,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:30,key:"graph.annotations.textToolbar.fontSize.huge"}],C1=e=>Pa.find(t=>t.size===(e??15))??null,j1=e=>`${e}px`,w1=[{alignment:"left",Icon:Qo},{alignment:"center",Icon:Yo},{alignment:"right",Icon:Jo}],T1=({annotation:e,textBox:t,panelRect:r,frameWidth:o,frameHeight:a,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(y=>y.spec.styles.overrides),p=l.useSceneSelector(y=>(0,u.readStyleCoord)(y.spec)),h=l.useEditorStore(),m=Ye(),g=l.useStyleReaderTree().annotation.text(e.id).resolve(),x=u1(e.content),f=y1(x.font),b=C1(x.fontSize),S=x.color??g.textColor,C=(0,v.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),A=(y,R)=>{const D=(0,u.findStyleRule)(d,{select:C},p)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:C,declarations:{...D,...y}}}),R)},T=(y,R)=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:y}),R)},k=()=>h.getState().caret?.editor?.getJSON()??e.content,w=(y,R)=>{const D=k(),$=h.getState().caret?.editor??null;if($!==null&&!p1(D)){$.chain().focus().setMark(He,y).run();return}T({content:h1(D,y)},R)},L=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},E=y=>A(k1(y),{transient:!0}),I=y=>w({color:y},{transient:!0}),G=y=>()=>{w({font:y}),m.close()},N=y=>()=>{w({fontSize:y}),m.close()},j=y=>T({content:m1(k(),y)});return(0,n.jsxs)(_.Root,{anchorBox:t,panelRect:r,frameWidth:o,frameHeight:a,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,n.jsx)(_.ColorPicker,{color:(0,u.toPaintColor)(g.fill),label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:E,...m.bind("background"),children:(0,n.jsx)(_.Swatch,{color:g.fill==="transparent"?yd:(0,u.toPaintColor)(g.fill)})}),(0,n.jsx)(_.ColorPicker,{color:S,label:s("graph.annotations.textToolbar.color"),onChange:I,...m.bind("color"),children:(0,n.jsx)(d1,{size:"sm",textColor:S,title:""})}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,n.jsx)("span",{style:{fontFamily:f?.fontFamily},children:"Aa"}),...m.bind("font"),children:Aa.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.id===f?.id,onClick:G(y.id),children:(0,n.jsx)("span",{style:{fontFamily:y.fontFamily},children:s(y.key)})},y.id))}),(0,n.jsx)(_.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:b===null?"":s(b.key),...m.bind("fontSize"),children:Pa.map(y=>(0,n.jsx)(_.MenuItem,{selected:y.size===b?.size,onClick:N(y.size),children:(0,n.jsx)("span",{style:{fontSize:j1(y.size)},children:s(y.key)})},y.size))}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(A1,{current:x.alignment??"center",onPick:j}),(0,n.jsx)(_.Separator,{}),(0,n.jsx)(_.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:L,children:(0,n.jsx)(Ze,{size:"sm",title:""})})]})},k1=e=>e==="transparent"?{fill:Or}:{fill:e,fillAlpha:Ad(e)?u.TEXT_ANNOTATION_FADE_ALPHA:1},A1=({current:e,onPick:t})=>{const r=l.useI18n(),o=a=>()=>t(a);return(0,n.jsx)(n.Fragment,{children:w1.map(a=>(0,n.jsx)(_.ToggleButton,{label:r(`graph.annotations.textToolbar.align.${a.alignment}`),pressed:a.alignment===e,onClick:o(a.alignment),children:(0,n.jsx)(a.Icon,{size:"sm",title:""})},a.alignment))})},P1=["left","right"];var La=({width:e})=>K(60,e),L1=(e,t)=>({x:t==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),Ia=({at:e,width:t,align:r,edge:o,delta:a,minWidth:i,panelWidth:s})=>{if(a===0)return{at:e,width:t,shift:0};const c=(0,u.alignUnitFractions)(r).x,d=I1(e.offset,s),p=Pt({start:e.x+d-c*t,extent:t,moveStartEdge:o==="left",delta:a,minExtent:i}),h=p.start+c*p.extent-d;return{at:{...e,x:h},width:p.extent,shift:h-e.x}},Ea=(e,t)=>e.at.x===t.at.x&&e.width===t.width,I1=(e,t)=>e?.x===void 0?0:e.unit==="px"?K(e.x,t):e.x,Ve=(e,t)=>{const r=e.textAnnotations.find(o=>o.id===t);return r===void 0||r.at.anchorType!=="panel"?null:{at:r.at,width:r.width,align:r.align}},E1=class extends xe{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return l.readResizedTextFor(l.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,edge:r,press:o,readInputs:a}=this.params,{annotations:i,panelRect:s}=a(),c=Ve(i,t);if(c===null)return null;const d=Je(o,e,s).x;return{kind:"text-resize-drag",annotationId:t,delta:d,...Ia({...c,edge:r,delta:d,minWidth:La(s),panelWidth:s.width})}}commit(e){const{annotationId:t,dispatch:r,readInputs:o}=this.params,a=Ve(o().annotations,t);a===null||Ea(a,e)||r(new u.UpdateAnnotationCommand({kind:"text",id:t,patch:{at:e.at,width:e.width}}))}},M1=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useLatestRef({annotations:l.useSceneSelector(i=>i.spec.annotations),panelRect:t});return ja((i,s)=>new E1({...s,annotationId:e,edge:i,readInputs:()=>a.current,editorStore:o,dispatch:r.dispatch}))},R1=4,O1=({annotationId:e,panelRect:t})=>{const{commands:r}=l.useGraphContext(),o=l.useEditorStore(),a=l.useSceneSelector(s=>s.spec.annotations),i=(s,c)=>{const d=Ve(a,e);return d===null?null:{kind:"text-resize-drag",annotationId:e,delta:c,...Ia({...d,edge:s,delta:c,minWidth:La(t),panelWidth:t.width})}};return wa({readHeld:()=>l.readResizedTextFor(l.readStanding(o.getState(),"text-resize-drag"),e),claim:s=>i(s,0),step:(s,c,d)=>{const p=_1(d,t);return p===null?null:i(c,s.delta+p)},commit:s=>{const c=Ve(a,e);c===null||Ea(c,s)||r.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:s.at,width:s.width}}))}})},_1=(e,t)=>{const r=K(R1,t.width);switch(e){case"ArrowLeft":return-r;case"ArrowRight":return r;default:return null}},N1=e=>{const t=ve(),r=F1(t),o=G1(t),a=l.useEditorState(s=>s.caret?.annotationId===t),i=B1(e.panelRect,t,o.resized);return r===null||i===null?null:(0,n.jsx)(D1,{annotation:r,textBox:i,settled:o.resized===null&&!o.moving,moving:o.moving,resizable:r.at.anchorType==="panel",hasCaret:a,...e})},D1=({annotation:e,textBox:t,settled:r,moving:o,resizable:a,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const p=l.useI18n(),h=M1({annotationId:e.id,panelRect:s}),m=O1({annotationId:e.id,panelRect:s});return(0,n.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[r&&(0,n.jsx)(T1,{annotation:e,textBox:t,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),a&&!o&&!i&&P1.map(g=>{const x=L1(t,g);return(0,n.jsx)(Ca,{point:{x:s.x+x.x,y:s.y+x.y},label:p(`graph.annotations.textToolbar.resize.${g}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":g},dragHandlers:h(g),keyboardHandlers:m(g)},g)})]})},F1=e=>{const t=l.useSceneSelector(r=>r.spec.annotations.textAnnotations);return e===null?null:t.find(r=>r.id===e)??null},G1=e=>l.useEditorState((0,J.useShallow)(t=>e===null?{resized:null,moving:!1}:{resized:l.readResizedTextFor(l.readStanding(t,"text-resize-drag"),e),moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),B1=(e,t,r)=>{const o=l.useResolvedAnnotations(e),a=l.useMeasuredBoxes(),i=l.useStyleReaderTree(),s=(0,v.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:a,readers:i}),[e.width,e.height,a,i]);return t===null?null:ya(o,t,r,s)?.rect??null},z1=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"})]})}),H1="var(--_1tyillx0)",V1="var(--_1tyillx1)",$1={rest:.5,hovered:.75,open:1};var W1="_1tyillx2",U1={rest:"_1tyillx3",hovered:"_1tyillx4",open:"_1tyillx5"},q1="_1tyillx6",K1={closed:"_1tyillx7",open:"_1tyillx8"},X1=({interaction:e,panelRect:t})=>{const r=l.useEditorStore(),o=l.useStyleReaderTree().editOutline.selected().resolve().stroke,a=e.kind==="trigger"?e.anchor:null,i=Z1(e),s=(0,v.useMemo)(()=>{if(a===null)return null;const c=(0,u.projectAnchorToPanel)(a.position,t);return{center:c,radius:19*$1[i],target:{kind:"observation",cursor:(0,u.toPanelCursor)(c,t)}}},[a,t,i]);return(0,v.useEffect)(()=>{r.getState().setMenuTrigger(s)},[r,s]),(0,v.useEffect)(()=>()=>r.getState().setMenuTrigger(null),[r]),a===null||s===null?null:(0,n.jsx)("div",{"aria-hidden":"true","data-testid":"observation-menu-trigger","data-state":i,className:(0,U.default)(W1,U1[i]),style:{left:t.x+s.center.x,top:t.y+s.center.y,...(0,Q.assignInlineVars)({[H1]:a.color,[V1]:o})},children:(0,n.jsx)("span",{className:(0,U.default)(q1,K1[i==="open"?"open":"closed"]),children:(0,n.jsx)(z1,{size:"lg"})})})},Z1=e=>e.kind==="trigger"&&e.isOpen?"open":e.kind==="trigger"&&e.engaged?"hovered":"rest",Y1='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',J1=(e,t)=>{const{chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,v.useEffect)(()=>{if(t===null)return;const a=i=>{if(i.key!=="Tab"||i.defaultPrevented||!ue(i.target,e,r)||Fr(i.target)||o.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(Y1)];if(s.length===0)return;i.preventDefault();const c=s.findIndex(d=>d===document.activeElement);s[c===-1?i.shiftKey?s.length-1:0:(c+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,t,r,o])},Q1=(e,t)=>typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[],Ma=(e,t,r)=>l.readStampedEditTargetInStack(Q1(e,t),r),em=e=>{const{selectionStore:t,commands:r,chartId:o}=l.useGraphContext(),a=l.useEditorStore(),i=l.useLatestRef(l.useSceneSelector(h=>h.spec.annotations.textAnnotations)),{showAnnotations:s}=l.MODE_RULES[l.useGraphMode()],c=(0,v.useCallback)(h=>{const{selection:m}=t.getState(),g=s?At(m):null;g!==null&&(h.preventDefault(),r.dispatch(new u.RemoveAnnotationCommand({id:g})),e.focus({preventScroll:!0}))},[e,r,t,s]),d=(0,v.useCallback)(h=>{if(Ie(h.target,o))return;const m=s?At(t.getState().selection):null;m!==null&&i.current.some(g=>g.id===m)&&(h.preventDefault(),a.getState().setCaret(m))},[a,t,i,o,s]),p=(0,v.useCallback)(h=>{const m=a.getState(),g=m.standingInteraction?.kind;if(g!==void 0){g!=="chrome-popup"&&m.releaseInteraction(g);return}if(m.caret!==null){m.setCaret(null),e.focus({preventScroll:!0});return}return Ie(h.target,o)?e.focus({preventScroll:!0}):t.getState().clearSelection()},[a,t,e,o]);(0,v.useEffect)(()=>{const h=m=>{if(!ue(m.target,e,o)||Fr(m.target))return;const g=an(m.target),x=a.getState().caret!==null&&!Ie(m.target,o);if(!(g&&!x))switch(m.key){case"Escape":return p(m);case"Enter":return g?void 0:d(m);case"Delete":case"Backspace":return g?void 0:c(m);default:return}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,c,d,p,o,a])},an=e=>e instanceof HTMLElement&&(e.isContentEditable||e.closest('[contenteditable="true"]')!==null||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),tm=e=>{const{selectionStore:t,chartId:r}=l.useGraphContext(),o=l.useEditorStore();(0,v.useEffect)(()=>{let a=null;const i=d=>{if(an(d.target))return;const{caret:p}=o.getState(),h=p===null?null:Ma(d.clientX,d.clientY,e);h?.kind==="annotation"&&h.target.id===p?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:p,clearSelection:h}=t.getState();p.length!==0&&(ue(d.target,e,r)||h())},c=d=>{t.getState().selection.length!==0&&ue(d.target,e,r)&&d.relatedTarget===null&&(a!==null&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{a=null,document.hasFocus()&&(ue(document.activeElement,e,r)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{a!==null&&cancelAnimationFrame(a),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[o,t,e,r])},nm=(e,t)=>{switch(e.kind){case"legend":{const r=t.legends[e.part.legendIndex],o=r?.items[e.part.itemIndex];if(r===void 0||o===void 0)return null;const a=rm(r,o.layerId,t.layers);return a===null?null:(0,u.buildObservationsTargetAtValue)({layer:a.layer,scope:"group",variable:a.variable,value:o.value,parsingLocale:t.parsingLocale})}case"axis":{const r=e.part;if(r===null||e.target.axis!=="x")return null;const o=t.formattedAxes.find(i=>i.scaledAesthetic==="x");if(o===void 0||o.bandwidth===void 0)return null;const a=o.ticks[r.tickIndex];return a===void 0?null:im(t.layers,a.value,t.parsingLocale)}case"annotation":case"grid":return null}},rm=(e,t,r)=>{const o=t===void 0?r:r.filter(a=>a.id===t);for(const a of e.aesthetics){const i=om(o,a);if(i!==null)return i}return null},om=(e,t)=>{for(const r of e){const o=(0,u.readVariableName)(r.mapping[t]);if(o!==null&&am(r,o))return{layer:r,variable:o}}return null},am=(e,t)=>e.data.hasVariable(t)&&e.data.getType(t)==="categorical",im=(e,t,r)=>{let o=null;for(const a of e){if(!a.interactive)continue;const i=(0,u.readScopeXVariable)(a.mapping);if(i===null)continue;const s=(0,u.buildObservationsTargetAtValue)({layer:a,scope:"xValue",variable:i,value:t,parsingLocale:r});if(s!==null){if(o!==null)return null;o=s}}return o},sm=({hover:e,layers:t,scales:r,parsingLocale:o})=>{const{primary:a,intersection:i}=e;if(a===null)return null;const s=(0,u.findLayerById)(t,a.layerId);if(s===void 0)return null;const c=(0,u.readObservationIndex)(a),d=i?.intersects!==!1,p=(0,u.readBroadestObservationsScope)(s),h=d||!(0,u.hasMainAxisBand)(r)?[p]:["xValue",p];for(const m of h){const g=(0,u.buildObservationsTarget)({layer:s,observationIndex:c,scope:m,parsingLocale:o});if(g!==null)return{layerId:s.id,observationIndex:c,onObservation:d,target:g}}return null},lm=(e,t,r)=>{if(!e.onObservation||e.target.scope!=="group")return null;const o=(0,u.findLayerById)(t,e.layerId);return o===void 0?null:(0,u.buildObservationsTarget)({layer:o,observationIndex:e.observationIndex,scope:"observation",parsingLocale:r})},Ra=(e,t)=>{const{target:r,clientX:o,clientY:a}=e,{frameElement:i,captureRect:s,menuTrigger:c,panelOrigin:d,resolvesObservations:p,scene:h}=t,m=c!==null&&(0,u.isPointWithinEditMenuTrigger)({x:o-d.x,y:a-d.y},c);if(!(r instanceof Element&&i.contains(r)))return{targetAtPoint:l.resolveEditTargetAtPoint({overMenuTrigger:m,stamped:cr(!1,!1,e,t),observations:null}),hover:null};const g=s!==null&&r===s,x=g&&p?cm(s):null,f=x===null?null:um(e,x,t),b=f===null?null:sm({hover:f,layers:h.layers,scales:h.scales,parsingLocale:h.config.parsingLocale}),S=b!==null&&t.hasOverlayMenu(b.target)?b:null,C=l.resolveEditTargetAtPoint({overMenuTrigger:m,stamped:cr(g,S!==null,e,t),observations:S});return{targetAtPoint:C,hover:C?.kind==="observations"?f:null}},cm=e=>{const t=e.getBoundingClientRect();return t.width>0&&t.height>0?t:null},cr=(e,t,r,{showAnnotations:o,selectGuidesOnPress:a,frameElement:i,scene:s,hasOverlayMenu:c})=>{if(!o&&s.coordSystem.type==="cartesian"&&e&&t)return null;const d=e||o?Ma(r.clientX,r.clientY,i):dm(r.target,i);return d===null?null:(d.kind==="annotation"?o:a&&c(d.target))?d:null},dm=(e,t)=>e instanceof Element?l.readStampedEditTargetInStack([e],t):null,um=(e,t,r)=>{const o=(0,u.toPanelCursor)({x:e.clientX-t.left,y:e.clientY-t.top},t);return r.engine.query(o,{tolerance:r.tolerance,viewport:t,includeAttached:!0})},hm=class extends xe{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return l.readMovedAnnotationFor(l.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,press:r,readInputs:o}=this.params,{annotations:a,panelRect:i}=o(),s=(0,u.findAnnotation)(a,t);if(s===null)return null;const c=(0,u.clampAnnotationTranslation)(s,Je(r,e,i));return c===null?null:{kind:"move-drag",annotationId:t,translation:c}}commit({translation:e}){const{annotationId:t,dispatch:r}=this.params;Y0(e)&&r(new u.MoveAnnotationCommand({id:t,translation:e}))}},pm=(e,{canSelectGraph:t,withinFrame:r,caretAnnotationId:o})=>{switch(e?.kind){case"annotation":return e.target.id===o?{kind:"keep-caret"}:{kind:"select-annotation",target:e.target};case"axis":case"legend":case"grid":return{kind:"select-guide",target:e.target};case"observations":return mm(e.observations);case"menu-trigger":case void 0:break}return t&&r?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},mm=({target:e,observationIndex:t,onObservation:r})=>e.scope==="xValue"?{kind:"select-band",target:e}:{kind:"select-observations",target:e,observationIndex:r?t:null},gm=(e,t,r,o,a)=>{const{commands:i,selectionStore:s,store:c}=l.useGraphContext(),d=l.useEditorStore(),p=l.useSceneSelector(S=>S.spec.annotations),{selectGraphOnPress:h}=l.MODE_RULES[l.useGraphMode()],m=l.useLatestRef(h),g=l.useLatestRef({annotations:p,panelRect:r}),x=l.useLatestRef(t),f=l.useLatestRef(a),b=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>b.current?.finish(!1),[]),(0,v.useEffect)(()=>s.subscribe(({selection:S})=>{const C=d.getState().pressedObservation,[A,...T]=S,k=A!==void 0&&T.length===0&&C!==null&&(0,u.areEditTargetsEqual)(A,C.selectedFor);C!==null&&!k&&d.getState().setPressedObservation(null)}),[d,s]),(0,v.useEffect)(()=>{const S=L=>Ra({target:L.target,clientX:L.clientX,clientY:L.clientY},o()).targetAtPoint,C=L=>{if(!(L.target instanceof Element))return!1;const E=L.target.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR);return E!==null&&e.contains(E)&&l.readStampedEditTargetInStack([L.target],e)===null},A=(L,E)=>{if(b.current!==null||!l.canMoveAnnotationOnCanvas(g.current.annotations,E.id))return;try{e.setPointerCapture(L.pointerId)}catch{return}L.preventDefault();const I=new hm({handle:e,pointerId:L.pointerId,annotationId:E.id,press:{x:L.clientX,y:L.clientY},readInputs:()=>g.current,editorStore:d,dispatch:i.dispatch,onSettled:()=>{b.current=null}});b.current=I,I.start()},T=(L,E)=>{const I=s.getState(),{layers:G,config:N}=c.getState().scene,j=E.kind==="select-observations"&&E.observationIndex!==null?l.readPressedObservation(E.observationIndex,G,E.target,N.parsingLocale):null;switch(d.getState().setPressedObservation(j),E.kind){case"select-annotation":I.setSelection([E.target]),A(L,E.target);return;case"select-observations":case"select-band":case"select-guide":case"select-graph":I.setSelection([E.target]);return;case"clear":I.clearSelection();return;default:throw new u.InternalError({message:`No press outcome for: ${JSON.stringify(E)}`})}},k=L=>{if(L.button!==0||vt(L.target)||Gr(L,x.current,d.getState().menuTrigger)||C(L)||l.isOnLiveGeomMark(L.target,e))return;const E=pm(S(L),{canSelectGraph:m.current&&!an(L.target)&&o().hasOverlayMenu({kind:"graph"}),withinFrame:L.target instanceof Node&&e.contains(L.target),caretAnnotationId:d.getState().caret?.annotationId??null});E.kind!=="keep-caret"&&(d.getState().setCaret(null),T(L,E))},w=L=>{if(vt(L.target)||C(L)||l.isOnLiveGeomMark(L.target,e))return;const E=S(L),{layers:I,guides:G,config:N}=c.getState().scene,{hasOverlayMenu:j}=o(),y=s.getState(),R=d.getState();switch(E?.kind){case"observations":{const{observations:D}=E,$=lm(D,I,N.parsingLocale);if($===null||!j($))return;const{observationIndex:nt}=D;R.setPressedObservation({observationIndex:nt,predicate:$.predicate,selectedFor:$}),y.setSelection([$]);return}case"axis":case"legend":{const D=nm(E,{layers:I,legends:G.legends.drawn,formattedAxes:f.current,parsingLocale:N.parsingLocale});if(D===null||!j(D))return;y.setSelection([D]);return}case"annotation":{const{target:D}=E;if(!g.current.annotations.textAnnotations.some($=>$.id===D.id))return;y.setSelection([D]),R.setCaret(D.id);return}case"grid":case"menu-trigger":case void 0:return}};return document.addEventListener("pointerdown",k),document.addEventListener("dblclick",w),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("dblclick",w)}},[e,d,s,c,i,g,x,f,m,o])},vm=(e,t)=>{const r=l.useEditorStore(),{store:o}=l.useGraphContext(),{engine:a,overlayRef:i}=l.useHoverContext(),s=l.useLatestRef(t),{showAnnotations:c,selectObservationsOnPress:d,selectGuidesOnPress:p,hoverTolerance:h}=l.MODE_RULES[l.useGraphMode()],m=l.useIsIntroWaitingForView(),g=ge(),x=d&&!m;return(0,v.useCallback)(()=>({frameElement:e,captureRect:i.current,panelOrigin:s.current,menuTrigger:r.getState().menuTrigger,selectGuidesOnPress:p,showAnnotations:c,resolvesObservations:x,engine:a,tolerance:h??void 0,scene:o.getState().scene,hasOverlayMenu:g}),[g,e,i,s,r,p,c,x,a,h,o])},xm=()=>{const{showMenuTriggerOnHover:e,layers:t,coordSystem:r,parsingLocale:o,anchorResolver:a,geom:i,hasOverlayMenu:s}=Oa(),c=l.useHoverState(d=>e?d.hover.primary:null);return(0,v.useMemo)(()=>{if(c===null)return null;const d=t.find(h=>h.id===c.layerId);if(d===void 0)return null;const p=(0,u.buildObservationsTarget)({layer:d,observationIndex:(0,u.readObservationIndex)(c),scope:"observation",parsingLocale:o});return p===null||!s(p)?null:_a({layer:d,observation:c.observation,target:p,coordSystem:r,anchorResolver:a,geom:i})},[c,t,r,o,a,i,s])},fm=()=>{const{showMenuTriggerOnHover:e,layers:t,coordSystem:r,parsingLocale:o,anchorResolver:a,geom:i,hasOverlayMenu:s}=Oa(),[c]=l.useGraphSelection(),d=c?.kind==="observations"&&c.scope==="observation"?c:null;return(0,v.useMemo)(()=>{if(!e||d===null||!s(d))return null;const p=t.find(g=>g.id===d.layerId);if(p===void 0)return null;const[h]=(0,u.resolveObservationsTarget)({layer:p,target:d,parsingLocale:o}),m=h===void 0?void 0:p.data.getAt(h);return m==null?null:_a({layer:p,observation:m,target:d,coordSystem:r,anchorResolver:a,geom:i})},[e,d,s,t,o,r,a,i])},Oa=()=>{const{showMenuTriggerOnHover:e}=l.MODE_RULES[l.useGraphMode()],t=l.useSceneSelector((0,J.useShallow)(i=>({layers:i.layers,coordSystem:i.coordSystem,parsingLocale:i.config.parsingLocale}))),{anchorResolver:r}=l.useGraphContext(),o=l.useGeomReaderTree(),a=ge();return{showMenuTriggerOnHover:e,...t,anchorResolver:r,geom:o,hasOverlayMenu:a}},_a=({layer:e,observation:t,target:r,coordSystem:o,anchorResolver:a,geom:i})=>{const s=a.resolve(e.geom,t,{coordSystem:o,position:e.position,purpose:"pin"});return s===null?null:{position:s,color:(0,u.readGeomColor)({geom:i},e,t)??u.DEFAULT_GEOM_COLOR,target:r}},bm={kind:"idle"},Na=()=>{const e=l.useEditorState(a=>a.standingInteraction),t=l.useEditorState(a=>a.editTargetUnderPointer?.kind==="menu-trigger"),r=fm(),o=xm();return(0,v.useMemo)(()=>e!==null?e:r!==null?{kind:"trigger",anchor:r,engaged:t,isOpen:!0}:o===null?bm:{kind:"trigger",anchor:o,engaged:t,isOpen:!1},[e,r,o,t])},Sm=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,ym=(e,t,r)=>{const o=l.useEditorStore(),{selectionStore:a}=l.useGraphContext(),{store:i,engine:s}=l.useHoverContext(),c=l.useLatestRef(e),d=l.useLatestRef(t),p=l.useLatestRef(r);(0,v.useEffect)(()=>{const h=S=>Gr(S,d.current,o.getState().menuTrigger),m=S=>{if(h(S)||a.getState().selection.length>0)return;const C=p.current,A=d.current,T={x:S.clientX-A.x,y:S.clientY-A.y},k=Sm(T,C)?s.query((0,u.toPanelCursor)(T,C)):u.RESTING_HOVER_STATE;i.getState().setHoverState(k)};let g=!1;const x=()=>{const S=c.current;g=S.kind==="trigger"&&S.isOpen},f=()=>{const S=o.getState().menuTrigger?.target.cursor;S!==void 0&&i.getState().setHoverState(s.query(S))},b=S=>{if(vt(S.target))return;const C=h(S),A=c.current;if(C&&!g&&A.kind==="trigger"){a.getState().setSelection([A.anchor.target]);return}if(C&&g){a.getState().clearSelection(),f();return}g&&a.getState().selection.length===0&&m(S)};return document.addEventListener("pointerdown",x,!0),document.addEventListener("click",b),()=>{document.removeEventListener("pointerdown",x,!0),document.removeEventListener("click",b)}},[o,a,c,i,s,d,p])},Cm=(e,t,r)=>{const o=l.useEditorStore(),{store:a}=l.useGraphContext(),{store:i}=l.useHoverContext(),s=l.useLatestRef(t),{selectObservationsOnPress:c}=l.MODE_RULES[l.useGraphMode()];(0,v.useEffect)(()=>(i.getState().setEditorOwnsQuery(c),()=>i.getState().setEditorOwnsQuery(!1)),[i,c]),(0,v.useEffect)(()=>{let d=null,p=null,h=!1;const m=k=>{if(!c)return;const w=i.getState();w.suspendsHover||k===null&&w.hover.primary===null||w.setHoverState(k??u.RESTING_HOVER_STATE)},g=()=>{if(d=null,p===null)return;const k=o.getState();if(Le(k.standingInteraction)){const E=k.menuTrigger!==null&&(0,u.isPointWithinEditMenuTrigger)({x:p.clientX-s.current.x,y:p.clientY-s.current.y},k.menuTrigger),I=k.editTargetUnderPointer;E?k.setEditTargetUnderPointer({kind:"menu-trigger"}):I?.kind==="menu-trigger"&&k.setEditTargetUnderPointer(null);return}if(h&&(h=!1,p={...p,target:jm(p)}),l.isOnLiveGeomMark(p.target,e)){k.setEditTargetUnderPointer(null);return}const{targetAtPoint:w,hover:L}=Ra(p,r());k.setEditTargetUnderPointer(w),m(L)},x=()=>{d===null&&(d=requestAnimationFrame(g))},f=()=>{p!==null&&(h=!0,x())},b=()=>{o.getState().setEditTargetUnderPointer(null),m(null)},S=k=>{p={target:k.target,clientX:k.clientX,clientY:k.clientY},h=!1,x()},C=()=>{p=null,d!==null&&(cancelAnimationFrame(d),d=null),b()},A=o.subscribe((k,w)=>{Le(w.standingInteraction)&&!Le(k.standingInteraction)&&f()}),T=a.subscribe((k,w)=>{k.scene!==w.scene&&(Le(o.getState().standingInteraction)||f())});return e.addEventListener("pointermove",S),e.addEventListener("pointerleave",C),()=>{d!==null&&cancelAnimationFrame(d),A(),T(),e.removeEventListener("pointermove",S),e.removeEventListener("pointerleave",C),b()}},[e,o,a,i,s,c,r])},jm=e=>typeof document.elementFromPoint=="function"?document.elementFromPoint(e.clientX,e.clientY):e.target,Le=e=>{if(e===null)return!1;switch(e.kind){case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":case"text-resize-drag":return!0;case"chrome-popup":return!1}},dr="editor",ur=[],wm=(e,t,r,o,a)=>{const i=Na(),{store:s}=l.useHoverContext(),c=l.useGraphSelection().length>0,{freezeHoverWhileSelected:d}=l.MODE_RULES[l.useGraphMode()],p=l.useEditorState(x=>x.menuTrigger),h=(0,v.useMemo)(()=>p===null?ur:[(0,u.buildEditMenuTriggerRegion)(p)],[p]),m=vm(e,t);Cm(e,t,m),gm(e,t,r,m,a),ym(i,t,r),tm(e),em(e),J1(e,o),(0,v.useEffect)(()=>(s.getState().publishPointerRegions(dr,h),()=>s.getState().publishPointerRegions(dr,ur)),[s,h]);const g=c&&d;(0,v.useEffect)(()=>(s.getState().setSuspendsHover(g),()=>s.getState().setSuspendsHover(!1)),[s,g]),(0,v.useEffect)(()=>{if(!c||!d)return;const x=s.getState();x.setHoverState(u.RESTING_HOVER_STATE),x.setTooltipAnchor(null)},[s,c,d])},Tm=({frameElement:e,panelRect:t,formattedAxes:r,animateTransitions:o})=>{const{measureRef:a,screenRect:i}=l.useElementScreenRect(),{selectionStore:s}=l.useGraphContext(),c=l.useEditorStore(),d=l.useEditorState(m=>m.caret?.annotationId??null),p=l.useGraphMode(),h=(0,v.useRef)(p);return(0,v.useEffect)(()=>(a(e),()=>a(null)),[a,e]),(0,v.useEffect)(()=>()=>{const m=c.getState();m.setCaret(null),m.setPressedObservation(null),s.getState().clearSelection()},[c,s]),(0,v.useEffect)(()=>{if(h.current===p)return;h.current=p;const m=c.getState();m.setCaret(null),m.setEditTargetUnderPointer(null),s.getState().clearSelection()},[p,c,s]),i===null?null:(0,n.jsxs)(Ui,{children:[d!==null&&(0,n.jsx)(km,{annotationId:d,panelRect:t}),(0,n.jsx)(Am,{frameElement:e,frameRect:i,panelRect:t,formattedAxes:r,animateTransitions:o})]})},km=({annotationId:e,panelRect:t})=>{const r=l.useEditorStore(),{textAnnotations:o}=l.useResolvedAnnotations(t);return(0,v.useEffect)(()=>{o.some(({id:a})=>a===e)||r.getState().setCaret(null)},[e,o,r]),null},Am=({frameElement:e,frameRect:t,panelRect:r,formattedAxes:o,animateTransitions:a})=>{const i=(0,v.useMemo)(()=>({x:t.left+r.x,y:t.top+r.y}),[t.left,t.top,r.x,r.y]),[s,c]=(0,v.useState)(null);return wm(e,i,r,s,o),(0,n.jsx)(Pm,{frameElement:e,frameRect:t,panelOrigin:i,panelRect:r,boxRef:c,animateTransitions:a})},Pm=({frameElement:e,frameRect:t,panelOrigin:r,panelRect:o,boxRef:a,animateTransitions:i})=>{const s=qe(),c=Na(),{showAnnotations:d}=l.MODE_RULES[l.useGraphMode()];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Th,{frameElement:e,frameSize:(0,v.useMemo)(()=>({width:t.width,height:t.height}),[t.width,t.height]),panelRect:o,animateTransitions:i}),(0,n.jsx)(C0,{frameRect:t}),(0,n.jsx)(Bu,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:s,"data-testid":"editor-overlay",boxRef:a,children:(0,n.jsxs)(l.PortalThemeProvider,{children:[d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Mp,{panelRect:o,panelOrigin:r,frameRect:t,frameElement:e}),(0,n.jsx)(i1,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(op,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(N1,{panelRect:o,frameRect:t,frameElement:e}),(0,n.jsx)(zp,{panelRect:o}),(0,n.jsx)(Kp,{panelRect:o}),(0,n.jsx)(T0,{panelRect:o}),(0,n.jsx)(Bp,{panelRect:o})]}),(0,n.jsx)(X1,{interaction:c,panelRect:o}),(0,n.jsx)(S0,{frameElement:e})]})})]})},Lm={},Im=({slots:e,mode:t,palettePresets:r=Lm,editMenus:o,...a})=>{const i=l.useChartI18nProps(l.useFormattingLocale()),s=(0,v.useMemo)(()=>({EditorSurface:Tm,...e}),[e]);return(0,n.jsx)(Kt,{...i,children:(0,n.jsx)(Zc,{editMenus:o,children:(0,n.jsx)(l.EditorProvider,{children:(0,n.jsx)(ql,{value:r,children:(0,n.jsx)(l.InlineEditorsProvider,{editors:Fu,children:(0,n.jsx)(l.GraphRendererBody,{slots:s,mode:t,...a})})})})})})},Em="_12lhx9e0",Da=({children:e})=>(0,n.jsx)("div",{className:Em,children:e}),Mm="_139ohwv0",V=({children:e})=>(0,n.jsx)("div",{className:Mm,children:e}),Fa=(0,v.createContext)(null),Rm=Fa.Provider,Ga=()=>{const e=(0,v.useContext)(Fa);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},Om="_1jlczkt0",Ba="data-graphy-editor-panel",_m={List:V,Grid:Da};function Nm(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var Dm=()=>()=>{},Fm=e=>{const t=(0,v.useSyncExternalStore)(e?.subscribe??Dm,()=>e?.getScene()?.config.parsingLocale);return e?.formattingLocale??t},Gm=e=>{const t=(0,v.useContext)(l.GraphContext),r=l.useChartI18nProps(Fm(l.useGraphHandle(e.handle))),o=l.useHasThemeContext();let a=(0,n.jsx)(Bm,{...e});return!o&&t&&(a=(0,n.jsx)(l.ThemeProvider,{colorScheme:t.colorScheme,children:a})),(0,n.jsx)(Kt,{...r,children:a})},sn={Root:Gm,Controls:_m},Bm=({handle:e,children:t,controls:r,defaultExpandedSection:o=void 0,className:a})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,p]=(0,v.useState)(()=>o?[o]:[]),h=(0,v.useMemo)(()=>({expandSection:m=>p([m]),collapseAllSections:()=>p([])}),[]);return(0,n.jsx)(Ke.Provider,{value:i,children:(0,n.jsx)(to,{controls:r,children:(0,n.jsx)(Rm,{value:h,children:(0,n.jsx)(de.Accordion.Root,{[Ba]:"",className:(0,U.default)(Om,a,{[s]:!Nm(a)}),style:c,value:d,onValueChange:m=>p(m),children:t})})})})},zm=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"})})}),ln="_40zvwv0",cn="_40zvwv1",Hm="_40zvwv2",za="_40zvwv3",Vm="_40zvwv4 _40zvwv3";var $m="_40zvwv6";var Wm="_40zvwv8",B=({title:e,layout:t="fixed",preview:r,accessory:o,onOpenChange:a,children:i})=>t==="collapsible"?(0,n.jsx)(qm,{title:e,preview:r,accessory:o,onOpenChange:a,children:i}):t==="inline"&&r===void 0?(0,n.jsx)(Um,{title:e,accessory:o,children:i}):(0,n.jsxs)("div",{className:ln,children:[(0,n.jsxs)("div",{className:cn,children:[(0,n.jsx)("span",{className:za,children:e}),r!==void 0&&(0,n.jsx)("span",{className:"_40zvwv5",children:r}),o!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:o})]}),(0,n.jsx)("div",{children:i})]}),Um=({title:e,accessory:t,children:r})=>{const o=(0,v.useId)(),a=(0,v.useId)();return(0,n.jsx)("div",{className:ln,children:(0,n.jsxs)("div",{className:cn,children:[(0,n.jsx)("label",{id:o,htmlFor:a,className:Vm,children:e}),(0,n.jsx)("span",{className:$m,children:(0,n.jsx)(Ir,{labelId:o,controlId:a,children:r})}),t!==void 0&&(0,n.jsx)("span",{className:"_40zvwv7",children:t})]})})},qm=({title:e,preview:t,accessory:r,onOpenChange:o,children:a})=>{const i=l.useI18n();return(0,n.jsxs)(de.Accordion.Item,{value:e,className:ln,onOpenChange:o,children:[(0,n.jsxs)(de.Accordion.Header,{className:cn,render:(0,n.jsx)("div",{}),children:[(0,n.jsx)(de.Accordion.Trigger,{className:Hm,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,n.jsx)("span",{className:za,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:Wm,children:(0,n.jsx)(zm,{size:"sm"})})]}),(0,n.jsx)(de.Accordion.Panel,{children:(0,n.jsx)("div",{children:a})})]})},Ha=({title:e,checked:t,onToggle:r,disabled:o,preview:a,children:i})=>{const{expandSection:s,collapseAllSections:c}=Ga(),{Switch:d}=O(),p=m=>{r(m),m?s(e):c()},h=m=>{m&&!t&&o!==!0&&r(!0)};return(0,n.jsx)(B,{title:e,layout:"collapsible",preview:a,onOpenChange:h,accessory:(0,n.jsx)(d,{checked:t,onChange:p,disabled:o,ariaLabel:e}),children:i})},Km={horizontal:["bottom","top"],vertical:["left","right"]},Xm={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},Zm={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},It=({axis:e,title:t,layout:r="collapsible",preview:o})=>{const a=F(),i=l.useHandleScene(a),s=l.useI18n(),{NumberField:c,Switch:d,TextField:p,ToggleGroup:h}=O();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",g=i.config.axes[e],x=i.scales[e],f=x?.spec,b=f?.scaleType==="continuous"?f:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const S=f?.scaleType==="continuous"||f?.scaleType==="datetime",C=b!==void 0&&(0,u.isZeroAnchoredAxis)(i,e),A=b?.transform==="log",T=b?.domainMax??null,k=Ym(b),w=(M,X)=>M.map(be=>({value:be,label:X(be)})),L=i.guides.axes.find(M=>M.scaledAesthetic===e),E=L?.position,I=i.guides.axes.filter(M=>M.scaledAesthetic===e||e==="y"&&M.scaledAesthetic==="ySecondary"),G=I.some(M=>M.visible),N=I.some(M=>M.visible||M.showGrid),j=g.label??L?.label??"",y=Km[E==="bottom"||E==="top"||E===void 0&&e==="x"?"horizontal":"vertical"],R=e==="y"?(0,u.readComboLineLayerId)(i.spec):null,D=R===null?void 0:(0,u.findLayerById)(i.spec.layers,R),$=i.guides.legends.drawn.some(M=>y.some(X=>X===M.position)),nt=y.map(M=>({value:M,label:s(Xm[M])})),Qa=w(["auto","edges"],M=>s(M==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),ei=w(["linear","log"],M=>s(M==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),ti=w(["auto","zero","custom"],M=>s(M==="zero"?"editor.axesPanel.startFrom.zero":M==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),ni=w(["auto","custom"],M=>s(M==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),ri=w(["single","double"],M=>s(M==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),oi=M=>{a.commands.dispatch(new u.SetAxisVisibilityCommand({axis:e,visible:M}))},ai=M=>{a.commands.dispatch(new u.SetAxisLabelCommand({axis:e,label:M}),{transient:!0})},ii=M=>{a.commands.dispatch(new u.SetAxisTicksVisibilityCommand({axis:e,visible:M}))},si=M=>{a.commands.dispatch(new u.SetAxisTickModeCommand({axis:e,tickMode:M==="edges"?"edges":"auto"}))},li=M=>{a.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:e,transform:M==="log"?"log":"linear"}))},hn=M=>{a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,...M}),{transient:!0})},ci=M=>{M!==null&&hn({domainMin:M})},di=M=>{M!==null&&hn({domainMax:M})},ui=M=>{const X=M==="auto"?null:M==="zero"?0:hr(x?.domain,"start");a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMin:X}))},hi=M=>{const X=M==="custom"?hr(x?.domain,"end"):null;a.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMax:X}))},pi=M=>{D!==void 0&&a.commands.dispatch(new u.SetLayerYScaleTypeCommand({layerId:D.id,yScaleType:M==="double"?"secondary":"primary"}))},mi=M=>{const X=y.find(be=>be===M);X&&a.commands.dispatch(new u.SetAxisPositionCommand({axis:e,position:X}))};return(0,n.jsx)(B,{title:t??s(Zm[e]),layout:r,preview:o,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:s("editor.axesPanel.controls.visible"),children:(0,n.jsx)(d,{checked:g.visible,onChange:oi})}),D!==void 0&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,n.jsx)(h,{value:D.yScaleType==="secondary"?"double":"single",options:ri,onChange:pi})}),m==="linear"&&(0,n.jsxs)(n.Fragment,{children:[L?.visible&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.title"),children:(0,n.jsx)(p,{value:j,placeholder:s("editor.axesPanel.controls.titlePlaceholder"),onChange:ai,onCommit:a.commands.commit})}),G&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.ticks"),children:(0,n.jsx)(d,{checked:g.ticks.visible,onChange:ii})})]}),S&&N&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.labels"),children:(0,n.jsx)(h,{value:g.ticks.mode,options:Qa,onChange:si})}),b&&m==="linear"&&L?.visible&&!$&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.position"),children:(0,n.jsx)(h,{value:E??g.position,options:nt,onChange:mi})}),b&&!C&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.scale"),children:(0,n.jsx)(h,{value:A?"log":"linear",options:ei,onChange:li})}),b&&!A&&(0,n.jsxs)(n.Fragment,{children:[!C&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{label:s("editor.axesPanel.controls.startFrom"),children:(0,n.jsx)(h,{value:k,options:ti,onChange:ui})}),k!=="auto"&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:b.domainMin??null,onChange:ci,onCommit:a.commands.commit})})]}),(0,n.jsx)(P,{label:s("editor.axesPanel.controls.endAt"),children:(0,n.jsx)(h,{value:T===null?"auto":"custom",options:ni,onChange:hi})}),T!==null&&(0,n.jsx)(P,{label:s("editor.axesPanel.controls.value"),children:(0,n.jsx)(c,{value:T,onChange:di,onCommit:a.commands.commit})})]})]})})},Ym=e=>{const t=e?.domainMin??null;return t===null?"auto":t===0?"zero":"custom"},hr=(e,t)=>{const r=t==="start"?e?.[0]:e?.[e.length-1];return typeof r=="number"?r:0},dn=({value:e,onChange:t})=>{const r=F(),o=l.useI18n(),{TextField:a}=O(),i=e!==null&&typeof e!="string",s=c=>t(c===""?null:c);return(0,n.jsx)(P,{label:o("editor.elementsPanel.contentValue"),children:(0,n.jsx)(a,{value:typeof e=="string"?e:"",onChange:s,onCommit:r.commands.commit,disabled:i})})},Va=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"caption",visible:h}))},p=h=>{o.commands.dispatch(new u.SetContentCaptionCommand({caption:h}),{transient:!0})};return(0,n.jsx)(B,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showCaption,onChange:d})}),(0,n.jsx)(dn,{value:c.caption,onChange:p})]})})},pr=/^[a-z][a-z\d+.-]*:/i,Jm={},$a=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=p=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"source",visible:p}))};return(0,n.jsx)(B,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showSource,onChange:d})}),(0,n.jsx)(Qm,{source:c.source??Jm})]})})},Qm=({source:e})=>{const t=F(),r=l.useI18n(),{TextField:o}=O(),a=d=>{const p=(d.label??"")!==""||(d.url??"")!=="";t.commands.dispatch(new u.SetContentSourceCommand({source:p?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!pr.test(d)&&a({...e,url:`https://${d}`}),t.commands.commit()},s=d=>a({...e,url:d}),c=d=>a({...e,label:d});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{label:r("editor.elementsPanel.sourceSection.url"),children:(0,n.jsx)(o,{value:e.url??"",onChange:s,onCommit:i,hasError:pr.test(e.url??"")&&!(0,u.isSafeUrl)(e.url)})}),(0,n.jsx)(P,{label:r("editor.elementsPanel.sourceSection.name"),children:(0,n.jsx)(o,{value:e.label??"",onChange:c,onCommit:t.commands.commit})})]})},Wa=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"subtitle",visible:h}))},p=h=>{o.commands.dispatch(new u.SetContentSubtitleCommand({subtitle:h}),{transient:!0})};return(0,n.jsx)(B,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showSubtitle,onChange:d})}),(0,n.jsx)(dn,{value:c.subtitle,onChange:p})]})})},fe=e=>{const{colorScheme:t}=l.useThemeContext(),r=(0,v.useMemo)(()=>(0,u.createStyleResolver)({colorScheme:t}),[t]);return(0,v.useMemo)(()=>e===null?null:r.readers(e),[e,r])},un=(e,t,r)=>{const o=fe(e);return(0,v.useMemo)(()=>{if(o===null||e===null||t===null)return null;const a=(0,u.findLayerById)(e.layers,t);return a===void 0?null:o.geom[r](a)},[o,e,t,r])},Et=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],eg=Et.length/2,tg={select:{target:"graph"}},Ua=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{RadioGrid:s}=O(),c=fe(a);if(!a||!c)return null;const d=c.graph().get("textScale"),p=g=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${g}`}),h=Et.map(g=>({value:`${g}`,label:p(g)})),m=g=>{const x=Et.find(b=>`${b}`===g);if(x===void 0)return;const f=(0,u.findStyleRule)(a.spec.styles.overrides,tg,(0,u.readStyleCoord)(a.spec))?.declarations??{};o.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...f,textScale:x}}}))};return(0,n.jsx)(B,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:r??p(d),children:(0,n.jsx)(s,{value:`${d}`,options:h,columns:eg,onChange:m,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},qa=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s}=O();if(!a)return null;const c=a.config.content,d=h=>{o.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"title",visible:h}))},p=h=>{o.commands.dispatch(new u.SetContentTitleCommand({title:h}),{transient:!0})};return(0,n.jsx)(B,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.elementsPanel.contentVisible"),children:(0,n.jsx)(s,{checked:c.showTitle,onChange:d})}),(0,n.jsx)(dn,{value:c.title,onChange:p})]})})},ng=({children:e,...t})=>(0,n.jsx)(sn.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(qa,{}),(0,n.jsx)(Wa,{}),(0,n.jsx)(Va,{}),(0,n.jsx)($a,{}),(0,n.jsx)(Ua,{})]})}),rg=({children:e,...t})=>(0,n.jsx)(sn.Root,{...t,children:e??(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(It,{axis:"x"}),(0,n.jsx)(It,{axis:"y"})]})}),Qe=e=>`${e}px`,Ka=e=>`${Math.round(e*100)}%`,og=e=>`${e}°`,ag=24,ig={select:{target:"graph"}},mr=["dim","desaturate"],sg=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=O(),d=fe(a);if(!a||!d)return null;const p=d.graph().get("cornerRadius"),h=(0,u.readHighlightDimStyle)(a.spec),m=mr.map(f=>({value:f,label:i(f==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.gray")})),g=f=>{const b=(0,u.findStyleRule)(a.spec.styles.overrides,ig,(0,u.readStyleCoord)(a.spec))?.declarations??{};o.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...b,cornerRadius:f}}}),{transient:!0})},x=f=>{const b=mr.find(S=>S===f);b&&o.commands.dispatch(new u.SetHighlightDimStyleCommand({dimStyle:b}))};return(0,n.jsx)(B,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,n.jsx)(s,{value:p,min:0,max:ag,step:1,formatValue:Qe,onChange:g,onCommit:o.commands.commit})}),(0,n.jsx)(P,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,n.jsx)(c,{value:h,options:m,onChange:x})})]})})},lg={none:0,md:3.5,full:6.5},cg=({cornerRadius:e,...t})=>(0,n.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,n.jsx)("rect",{x:2.5,y:2.5,width:13,height:13,rx:lg[e],stroke:"currentColor",strokeWidth:1.5})}),dg=.05,gr=["none","md","full"],Xa={base:["baseStart","baseEnd"],tip:["tipStart","tipEnd"]},ug=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,ToggleGroup:c}=O(),d=a?(0,u.findLayerByGeom)(a.spec.layers,"bar"):void 0,p=un(a,d?.id??null,"bar");if(!a||!d||a.coordSystem.type==="polar"&&a.coordSystem.bandAxis===null)return null;const h=b=>{o.commands.dispatch(new u.SetBarWidthCommand({layerId:d.id,width:b}),{transient:!0})},m=p?.get("cornerRadius")??u.DEFAULT_BAR_CORNER_RADII,g=(b,S)=>{const C=gr.find(k=>k===S);if(!C)return;const[A,T]=Xa[b];o.commands.dispatch(new u.SetBarCornerRadiusCommand({layerId:d.id,corners:{...m,[A]:C,[T]:C}}))},x=gr.map(b=>({value:b,label:i(`editor.graphPanel.barSection.radiusOptions.${b}`),icon:(0,n.jsx)(cg,{cornerRadius:b})})),f=(0,u.resolveBarBandFraction)(d.params,a.coordSystem.type);return(0,n.jsx)(B,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.graphPanel.barSection.thickness"),children:(0,n.jsx)(s,{value:f,min:u.MIN_BAR_WIDTH_FRACTION,max:u.MAX_BAR_WIDTH_FRACTION,step:dg,formatValue:Ka,onChange:h,onCommit:o.commands.commit})}),(0,n.jsx)(P,{label:i("editor.graphPanel.barSection.tipRadius"),children:(0,n.jsx)(c,{value:vr(m,"tip"),options:x,onChange:b=>g("tip",b)})}),(0,n.jsx)(P,{label:i("editor.graphPanel.barSection.baseRadius"),children:(0,n.jsx)(c,{value:vr(m,"base"),options:x,onChange:b=>g("base",b)})})]})})},vr=(e,t)=>{const[r,o]=Xa[t],a=e[r];return typeof a!="string"||a!==e[o]?"":a==="none"||a==="full"?a:"md"},et=({children:e})=>{const t=(0,v.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"})]})})]})},tt="qdaoth0",hg=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,n.jsx)(et,{children:(0,n.jsx)("path",{className:tt,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"})]}),pg=e=>(0,n.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,n.jsxs)(et,{children:[(0,n.jsx)("path",{className:tt,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"})]})}),mg=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(et,{children:(0,n.jsx)("path",{className:tt,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"})]}),gg=e=>(0,n.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,n.jsx)(et,{children:(0,n.jsx)("path",{className:tt,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"})]}),vg={x:.5,y:.5},xg=.2,fg={x:.375,y:.25,width:.25,height:.5},bg={zOrder:"background"},Sg={x:.4,y:.6},yg={x:.6,y:.4},Cg="relativeDifference",jg=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Button:s}=O();if(!a)return null;const c=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"text",annotation:{...u.TEXT_ANNOTATION_DEFAULTS,content:wg(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...vg},width:xg}}))},d=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"arrow",annotation:{...u.ARROW_DEFAULTS,start:{anchorType:"panel",...Sg},end:{anchorType:"panel",...yg}}}))},p=()=>{o.commands.dispatch(new u.AddAnnotationCommand({kind:"shape",annotation:{...u.SHAPE_DEFAULTS,...bg,region:{anchorType:"panel",...fg}}}))},h=()=>{const g=(0,u.inferDefaultDifferenceArrowEndpoints)(a);g!==null&&o.commands.dispatch(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...g,label:Cg}}))},m=a.coordSystem.type==="cartesian";return(0,n.jsx)(B,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:r,children:(0,n.jsxs)(Da,{children:[(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(gg,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(hg,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(pg,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:p}),m&&(0,n.jsx)(s,{variant:"tile",icon:(0,n.jsx)(mg,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:h})]})})},wg=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),Tg=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{ToggleGroup:s}=O();if(!a)return null;const c=(0,u.readGraphType)(a.spec);if(c===null||!(0,u.isComboGraphType)(c))return null;const d=u.COMBO_TYPES.map(h=>({value:h,label:i(`editor.graphPanel.comboSection.types.${h}`)})),p=h=>{const m=u.COMBO_TYPES.find(g=>g===h);m&&o.commands.dispatch(new u.SetGraphTypeCommand({coordType:"cartesian",comboType:m}))};return(0,n.jsx)(B,{title:e??i("editor.graphPanel.comboSection.title"),layout:t,preview:r??i(`editor.graphPanel.comboSection.types.${c.comboType}`),children:(0,n.jsx)(s,{value:c.comboType,options:d,onChange:p,ariaLabel:i("editor.graphPanel.comboSection.title")})})},kg=.1,Ag=20,Pg=({title:e,preview:t})=>{const r=F(),o=l.useHandleScene(r),a=l.useI18n(),{NumberField:i,TextField:s}=O();if(!o||o.coordSystem.type==="polar")return null;const c=(0,u.findGoalLineLayer)(o.spec.layers),d=e??a("editor.annotationsPanel.goalSection.title"),p=(0,u.readConstantValue)(c?.mapping.y),h=typeof p=="number"?p:null,m=f=>{const b=new u.ToggleGoalLineCommand({showGoalLine:f,value:Lg(o),...c!==void 0&&{layerId:c.id}});r.commands.dispatch(b)},g=f=>{if(c===void 0)return;const b=new u.SetRuleLabelCommand({layerId:c.id,label:f===""?null:f});r.commands.dispatch(b,{transient:!0})},x=f=>{if(c===void 0||f===null)return;const b=new u.SetRuleValueCommand({layerId:c.id,value:f});r.commands.dispatch(b,{transient:!0})};return(0,n.jsx)(Ha,{title:d,preview:t,checked:c!==void 0,onToggle:m,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:a("editor.annotationsPanel.goalSection.labelControl"),children:(0,n.jsx)(s,{value:c?.params.label??"",placeholder:a("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:g,onCommit:r.commands.commit,ariaLabel:a("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,n.jsx)(P,{label:a("editor.annotationsPanel.goalSection.valueControl"),children:(0,n.jsx)(i,{value:h,placeholder:a("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:x,onCommit:r.commands.commit,ariaLabel:a("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},Lg=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const r=Math.max(...t),o=r-Math.min(...t),a=o>0?o:Math.abs(r);if(a===0)return 0;const i=Math.min(Ag,Math.max(0,1-Math.floor(Math.log10(a))));return Number((r+a*kg).toFixed(i))},Ig=({layerId:e,title:t,layout:r="collapsible",preview:o})=>{const a=F(),i=l.useHandleScene(a),s=l.useI18n(),{Switch:c}=O();if(!i)return null;const d=e===void 0?i.layers[0]:(0,u.findLayerById)(i.layers,e);if(!d)return null;const{showDataLabels:p,format:h,showStackTotals:m,showCategoryLabels:g}=d.dataLabels,x=oo(d,i.coordSystem.type,{hasCapability:a.canPlaceDataLabels,hasPercentageFormat:a.canFormatDataLabelsAsPercentages});if(!x.supportsDataLabels)return null;const f=A=>{const T=new u.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:A});a.commands.dispatch(T)},b=A=>{const T=new u.SetDataLabelsFormatCommand({layerId:d.id,format:A?"percentage":"absolute"});a.commands.dispatch(T)},S=A=>{const T=new u.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:A});a.commands.dispatch(T)},C=A=>{const T=new u.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:A});a.commands.dispatch(T)};return(0,n.jsx)(B,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:r,preview:o,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,n.jsx)(c,{checked:p,onChange:f})}),x.supportsPercentages&&(0,n.jsx)(P,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,n.jsx)(c,{checked:h==="percentage",onChange:b})}),x.supportsStackTotals&&(0,n.jsx)(P,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,n.jsx)(c,{checked:m,onChange:S})}),x.supportsCategoryLabels&&(0,n.jsx)(P,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,n.jsx)(c,{checked:g,onChange:C})})]})})},Eg=3,Mg=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{RadioGrid:s}=O(),c=(0,v.useMemo)(()=>he.map(({name:m,icon:g,summary:x})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,n.jsx)(g,{size:"md"}),disabled:!so(x,a?.spec)})),[i,a]);if(!a)return null;const d=(0,u.readGraphType)(a.spec),p=Oe(d),h=m=>{const g=he.find(x=>x.name===m);g&&o.commands.dispatch(new u.SetGraphTypeCommand(lo(g.summary,d)))};return(0,n.jsx)(B,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:r??(p===null?void 0:i(`editor.graphTypes.${p.name}`)),children:(0,n.jsx)(s,{value:p?.name??"",options:c,columns:Eg,onChange:h,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},Rg=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=O(),p=fe(a),h=a!==null&&p!==null?yo(a,p):null;if(h===null)return null;const m=h.axes.filter(C=>C.supportsGrid);if(m.length===0)return null;const g=h.axes.some(C=>C.showGrid),x=De.map(C=>({value:C,label:i(`editor.graphPanel.gridSection.lineStyles.${C}`)})),f=C=>A=>{o.commands.dispatch(new u.SetGridVisibilityCommand({axis:C,visible:A}))},b=C=>{const A=De.find(T=>T===C);A!==void 0&&o.commands.dispatch(Co(A))},S=C=>{o.commands.dispatch(jo(C),{transient:!0})};return(0,n.jsx)(B,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[m.map(C=>(0,n.jsx)(P,{label:i(Og(C)),children:(0,n.jsx)(c,{checked:C.showGrid,onChange:f(C.scaledAesthetic)})},C.scaledAesthetic)),h.stylable&&g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,n.jsx)(d,{value:h.lineStyle,options:x,onChange:b})}),(0,n.jsx)(P,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,n.jsx)(s,{value:h.strokeWidth,min:0,max:8,step:.5,formatValue:Qe,onChange:S,onCommit:o.commands.commit})})]})]})})},Og=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaledAesthetic==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",_g="total",Za=["total","average","current"],Ng=["total"],xr=["previous","first"],fr=["auto","small","medium","large"],Dg=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Switch:s,ToggleGroup:c}=O();if(!a)return null;const d=a.config.headline,p=d.show!=="none",h=a.coordSystem,m=h.type==="polar",g=h.type==="polar"&&h.innerRadius>0,x=a.layers.some(N=>N.summary.grandTotal!==void 0);if(m&&!x)return null;const f=m?Ng:Za,b=a.guides.headline,S=b?.kind==="perGroup"&&b.items.some(N=>N.comparison!==null),C=f.map(N=>({value:N,label:i(`editor.graphPanel.headlineNumberSection.metrics.${N}`)})),A=xr.map(N=>({value:N,label:i(`editor.graphPanel.headlineNumberSection.comparison.${N}`)})),T=fr.map(N=>({value:N,label:i(N==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${N}`)})),k=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],w=N=>{o.commands.dispatch(new u.SetHeadlineShowCommand({show:N?_g:"none"}))},L=N=>{const j=f.find(y=>y===N);j&&o.commands.dispatch(new u.SetHeadlineShowCommand({show:j}))},E=N=>{const j=xr.find(y=>y===N);j&&o.commands.dispatch(new u.SetHeadlineCompareWithCommand({compareWith:j}))},I=N=>{const j=fr.find(y=>y===N);j&&o.commands.dispatch(new u.SetHeadlineSizeCommand({size:j}))},G=N=>{o.commands.dispatch(new u.SetHeadlinePositionCommand({position:N==="center"?"center":"above"}))};return(0,n.jsx)(B,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:r??Fg(i,d.show),children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,n.jsx)(s,{checked:p,onChange:w})}),p&&(0,n.jsxs)(n.Fragment,{children:[C.length>1&&(0,n.jsx)(P,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,n.jsx)(c,{value:d.show,options:C,onChange:L})}),S&&(0,n.jsx)(P,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,n.jsx)(c,{value:(0,u.resolveComparisonBasis)(d.compareWith),options:A,onChange:E})}),(0,n.jsx)(P,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,n.jsx)(c,{value:d.size,options:T,onChange:I})}),g&&(0,n.jsx)(P,{label:i("editor.axesPanel.controls.position"),children:(0,n.jsx)(c,{value:d.position,options:k,onChange:G})})]})]})})},Fg=(e,t)=>{const r=Za.find(o=>o===t);return r&&e(`editor.graphPanel.headlineNumberSection.metrics.${r}`)};var gt=["top","bottom","left","right","none"],br=["auto","start","center","end"],Gg={row:{start:"left",end:"right"},column:{start:"top",end:"bottom"}},Sr=["auto","pill","direct"],Bg=({positions:e,title:t,layout:r="collapsible",preview:o})=>{const a=F(),i=l.useHandleScene(a),s=l.useI18n(),{ToggleGroup:c}=O(),d=l.useTextDirection();if(!i)return null;const p=i.config.legend.position,h=e??gt,m=i.guides.legends.drawn[0],g=(0,u.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),x=i.guides.headline?.kind==="perGroup",f=i.guides.colorGroups.length>0;if(p==="auto"&&m===void 0&&!g&&(x||!f))return null;const b=m?.position??"none",S=p==="auto"?b:p,C=gt.filter(R=>R===S||h.includes(R)).map(R=>({value:R,label:s(`editor.graphPanel.legendSection.${R}`)})),A=R=>{const D=gt.find($=>$===R);D&&a.commands.dispatch(new u.SetLegendPositionCommand({position:D}))},T=R=>{const D=br.find($=>$===R);D&&a.commands.dispatch(new u.SetLegendAlignCommand({align:D}))},k=R=>{const D=Sr.find($=>$===R);D&&a.commands.dispatch(new u.SetLegendDisplayCommand({display:D}))},w=m?.position==="left"||m?.position==="right"?"column":"row",L=w==="row"?"ltr":d,E=R=>s(R==="start"||R==="end"?`editor.graphPanel.legendSection.${Gg[w][R]}`:`editor.graphPanel.legendSection.align.${R}`),I=br.map(R=>({value:R,label:E(R)})),G=Sr.map(R=>({value:R,label:s(`editor.graphPanel.legendSection.display.${R}`)})),N=t??s("editor.graphPanel.legendSection.title"),j=C.find(R=>R.value===S)?.label,y=m!==void 0;return(0,n.jsx)(B,{title:N,layout:r,preview:o??j,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,n.jsx)(c,{value:S,options:C,onChange:A})}),y&&(0,n.jsx)(P,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,n.jsx)(_t.DirectionProvider,{direction:L,children:(0,n.jsx)("div",{dir:L,className:"_1v6dqrh0",children:(0,n.jsx)(c,{value:i.config.legend.align,options:I,onChange:T})})})}),g&&(0,n.jsx)(P,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,n.jsx)(c,{value:i.config.legend.display,options:G,onChange:k})})]})})},zg=1,Hg=20,Vg=.5,Ya=({layerId:e})=>{const t=F(),r=l.useHandleScene(t),{Slider:o}=O(),a=un(r,e,"point");if(!r)return null;const i=(0,u.findLayerById)(r.layers,e)?.data?.findFirst(d=>(a?.get("size",d)??0)>0)??void 0,s=a?.get("size",i)??u.DEFAULT_POINT_SIZE_PX,c=d=>{const p=new u.SetPointSizeCommand({layerId:e,size:d});t.commands.dispatch(p,{transient:!0})};return(0,n.jsx)(o,{value:s,min:zg,max:Hg,step:Vg,formatValue:Qe,onChange:c,onCommit:t.commands.commit})},Ja=({layerId:e})=>{const t=F(),r=l.useHandleScene(t),o=un(r,e,"point");return r?(0,n.jsx)(zt,{symbol:o?.get("symbol")??"circle",coordType:r.coordSystem.type,onChange:a=>{t.commands.dispatch(new u.SetPointSymbolCommand({layerId:e,symbol:a}))}}):null},$g=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:p}=O(),h=fe(a),m=(0,u.findLayerByGeom)(a?.spec.layers??[],"line","area"),g=a&&h&&m?Bt(a,h,m.id):null;if(!a||!g)return null;const x=g.missingValueOptions.map(w=>({value:w,label:ao(i,w)})),f=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto"),disabled:g.hasUnderlyingStrokeWidth},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],b=w=>{o.commands.dispatch(new u.ToggleLinePointsCommand({layerId:g.layerId,showPoints:w}))},S=w=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,showFill:w,drawnFillAlpha:g.drawnFillAlpha}))},C=w=>{o.commands.dispatch(new u.SetLineCurveCommand({layerId:g.layerId,curve:w?"smooth":"linear"}))},A=w=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:w==="custom"?g.strokeWidth:null}))},T=w=>{o.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:w}),{transient:!0})},k=w=>{const L=bt.find(E=>E===w);L&&o.commands.dispatch(new u.SetLineMissingValuesCommand({layerId:g.layerId,missingValues:L}))};return(0,n.jsx)(B,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,n.jsx)(d,{checked:g.showPoints,onChange:b})}),g.pointLayerId&&(0,n.jsx)(P,{label:i("editor.graphPanel.pointSize.label"),children:(0,n.jsx)(Ya,{layerId:g.pointLayerId})}),g.showPoints&&g.pointLayerId!==null&&(0,n.jsx)(Ja,{layerId:g.pointLayerId}),g.showFill!==null&&(0,n.jsx)(P,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,n.jsx)(d,{checked:g.showFill,onChange:S})}),g.smooth!==null&&(0,n.jsx)(P,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,n.jsx)(d,{checked:g.smooth,onChange:C})}),(0,n.jsx)(P,{label:i("editor.graphPanel.lineThickness.label"),children:(0,n.jsx)(p,{value:g.widthMode,options:f,onChange:A})}),g.widthMode==="custom"&&(0,n.jsx)(P,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:g.strokeWidth,min:1,max:10,step:.1,formatValue:Qe,onChange:T,onCommit:o.commands.commit})}),g.missingValues!==null&&(0,n.jsx)(P,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,n.jsx)(s,{value:g.missingValues,options:x,onChange:k})})]})})},Mt="\0none",Wg=["x","y","color","size","label"],Ug={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},qg=({title:e,layout:t="collapsible"})=>{const r=F(),o=l.useHandleScene(r),a=l.useI18n(),{Select:i}=O(),s=a("editor.graphPanel.mappingSection.none"),c=o?.spec,d=(0,v.useMemo)(()=>c===void 0?[]:(0,u.readMappableAesthetics)(c,Wg).map(({aesthetic:p,variables:h,required:m})=>{const g=(0,u.readMappedVariable)(c.mapping,p);return{aesthetic:p,label:a(Ug[p]),value:g??(m?null:Mt),options:Kg(h,g,m?null:s),chooseColumn:x=>{r.commands.dispatch(new u.SetMappingCommand({aesthetic:p,variable:x===Mt?null:x}))}}}),[c,a,s,r]);return o?(0,n.jsx)(B,{title:e??a("editor.graphPanel.mappingSection.title"),layout:t,children:(0,n.jsx)(V,{children:d.map(({aesthetic:p,label:h,value:m,options:g,chooseColumn:x})=>(0,n.jsx)(P,{label:h,children:(0,n.jsx)(i,{value:m,options:g,placeholder:s,onChange:x})},p))})}):null},Kg=(e,t,r)=>{const o=t!==null&&!e.includes(t)?[t,...e]:e;return[...r===null?[]:[{value:Mt,label:r}],...o.map(a=>({value:a,label:a}))]},Xg="k",Zg=2,Yg=0,Jg=5,Rt=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],Qg=["auto","none"],e2=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=O();if(!a)return null;const{abbreviation:d,decimals:p}=a.config.numberFormat,h=t2(d)!==void 0,m=p!=="auto",g=T=>T.map(k=>({value:k,label:i(`editor.graphPanel.numberFormat.options.${k}`)})),x=Rt.map(({value:T,labelKey:k})=>({value:T,label:i(`common.abbreviations.${k}`)})),f=T=>{o.commands.dispatch(new u.SetNumberFormatAbbreviationCommand({abbreviation:T}))},b=T=>{const k=Qg.find(w=>w===T);f(k??Xg)},S=T=>{const k=Rt.find(w=>w.value===T);k&&f(k.value)},C=T=>{o.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:T==="custom"?Zg:"auto"}))},A=T=>{T!==null&&o.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:T}),{transient:!0})};return(0,n.jsx)(B,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,n.jsx)(c,{value:h?"custom":d,options:g(["auto","none","custom"]),onChange:b})}),h&&(0,n.jsx)(P,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(c,{value:d,options:x,onChange:S})}),(0,n.jsx)(P,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,n.jsx)(c,{value:m?"custom":"auto",options:g(["auto","custom"]),onChange:C})}),m&&(0,n.jsx)(P,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(s,{value:p,min:Yg,max:Jg,onChange:A,onCommit:o.commands.commit})})]})})},t2=e=>Rt.find(t=>t.value===e),n2=({title:e,layout:t="collapsible",preview:r})=>{const o=l.useHandleScene(F()),a=l.useI18n();if(!o)return null;const i=r2(o.spec.layers);return i?(0,n.jsx)(B,{title:e??a("editor.graphPanel.pointSize.label"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:a("editor.graphPanel.numberFormat.valueLabel"),children:(0,n.jsx)(Ya,{layerId:i.id})}),(0,n.jsx)(Ja,{layerId:i.id})]})}):null},r2=e=>{const t=(0,u.filterLayersByGeoms)(e,"line","area");return(0,u.filterLayersByGeoms)(e,"point").find(r=>!(0,u.isCompanionLayer)(r,t))},o2=.9,a2=360,i2=.05,s2=15,l2=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Slider:s}=O();if(!a||a.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=a.spec.coords.params,p=m=>{o.commands.dispatch(new u.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},h=m=>{o.commands.dispatch(new u.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,n.jsx)(B,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:r,children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,n.jsx)(s,{value:c,min:0,max:o2,step:i2,formatValue:Ka,onChange:p,onCommit:o.commands.commit})}),(0,n.jsx)(P,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,n.jsx)(s,{value:d,min:0,max:a2-1,step:s2,formatValue:og,onChange:h,onCommit:o.commands.commit})})]})})},c2=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"})]}),yr=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"})]}),Cr=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],d2="linear",u2=({title:e,layout:t="collapsible",preview:r})=>{const o=F(),a=l.useHandleScene(o),i=l.useI18n(),{Select:s,Switch:c}=O(),{options:d,findValue:p}=Qt(a,o.formattingLocale);if(!a||a.coordSystem.type==="polar")return null;const h=(0,u.findTrendLineLayer)(a.spec.layers),m=(0,u.findAverageLineLayer)(a.spec.layers),g=h?.stat.type==="smooth"?h.stat.method:d2,x=h2(m),f=Cr.map(k=>({value:k,label:i(`editor.annotationsPanel.trendType.options.${k}`)})),b=(k,w={})=>{const L=h??m,E=new u.SetStatLineCommand({line:k,...w,...L!==void 0&&{layerId:L.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});o.commands.dispatch(E)},S=k=>b(k?"trend":"none",{method:g}),C=k=>b(k?"average":"none",{group:x??p(d[0]?.value??"")}),A=k=>{const w=Cr.find(L=>L===k);w!==void 0&&b("trend",{method:w})},T=k=>{const w=k===null?void 0:p(k);w!==void 0&&b("average",{group:w})};return(0,n.jsx)(B,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:r??(0,n.jsx)(yr,{size:"lg"}),children:(0,n.jsxs)(V,{children:[(0,n.jsx)(P,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,n.jsx)(yr,{size:"lg"}),children:(0,n.jsx)(c,{checked:h!==void 0,onChange:S})}),h!==void 0&&(0,n.jsx)(P,{label:i("editor.annotationsPanel.trendType.label"),children:(0,n.jsx)(s,{value:g,options:f,onChange:A,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,n.jsx)(P,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,n.jsx)(c2,{size:"lg"}),children:(0,n.jsx)(c,{checked:m!==void 0,onChange:C})}),m!==void 0&&d.length>0&&(0,n.jsx)(P,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,n.jsx)(s,{value:x===void 0?null:String(x),options:d,onChange:T,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},h2=e=>{const t=e?.transforms.find(r=>r.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=sg;exports.AxesPanel=rg;exports.AxisEditMenu=Ft;exports.AxisSection=It;exports.BarEditMenu=Gt;exports.BarSection=ug;exports.Button=Er;exports.CalloutsSection=jg;exports.CaptionSection=Va;exports.ChartEditMenu=Vt;exports.ColorRow=Y;exports.ColorSwatches=Nr;exports.ComboSection=Tg;exports.ControlRegistryProvider=to;exports.ControlTooltip=pe;exports.CustomColor=zr;exports.EditableGraphRenderer=Im;exports.EditorIntlProvider=Kt;exports.EditorPanel=sn;exports.ElementsPanel=ng;exports.FileInput=$r;exports.GoalSection=Pg;exports.GraphOptionsSection=Ig;exports.GraphTypeSection=Mg;exports.GridEditMenu=$t;exports.GridSection=Rg;exports.HeadlineSection=Dg;exports.LegendEditMenu=wo;exports.LegendSection=Bg;exports.LineEditMenu=Fe;exports.LineSection=$g;exports.MappingSection=qg;exports.NumberField=qr;exports.NumberFormatSection=e2;exports.PANEL_ROOT_ATTRIBUTE=Ba;exports.PaletteRow=fo;exports.PointEditMenu=Ut;exports.PointSection=n2;exports.PolarSection=l2;exports.RadioGrid=Kr;exports.Row=P;exports.Section=B;exports.Select=Zr;exports.Separator=Fo;exports.Slider=Yr;exports.SourceSection=$a;exports.SubtitleSection=Wa;exports.Switch=Jr;exports.TextField=Qr;exports.TextSizeSection=Ua;exports.TitleSection=qa;exports.ToggleGroup=Dt;exports.ToggledSection=Ha;exports.TrendsAndAveragesSection=u2;exports.useAnnotateAnchor=Pr;exports.useControls=O;exports.usePanelExpansion=Ga;exports.usePanelGraph=F;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./editable.css');const l=require("./history-chords-DN7mzxHh.cjs");let u=require("@graphysdk/viz-engine"),f=require("react"),r=require("react/jsx-runtime"),ns=require("motion/react"),ae=require("zustand/react/shallow"),de=require("@vanilla-extract/dynamic"),le=require("clsx");le=l.__toESM(le,1);let fe=require("lodash-es"),Le=require("@floating-ui/react-dom"),mn=require("react-dom"),ne=require("@base-ui/react/tooltip"),K=require("@base-ui/react/popover"),Xn=require("react-colorful"),Yn=require("@base-ui/react/number-field"),ba=require("@base-ui/react/radio"),Sa=require("@base-ui/react/radio-group"),se=require("@base-ui/react/select"),Pe=require("@base-ui/react/slider"),Zn=require("@base-ui/react/switch"),rs=require("@base-ui/react/input"),gn=require("@base-ui/react/direction-provider"),ya=require("@tiptap/core"),as=require("@tiptap/extension-bold"),ot=require("@tiptap/extension-document"),os=require("@tiptap/extension-hard-break"),is=require("@tiptap/extension-heading"),ss=require("@tiptap/extension-italic"),ls=require("@tiptap/extension-link"),cs=require("@tiptap/extension-text"),ds=require("@tiptap/extension-text-align"),it=require("@tiptap/extension-text-style"),us=require("@tiptap/extension-underline"),bt=require("@tiptap/extensions"),Ca=require("@tiptap/extension-paragraph"),St=require("@tiptap/react"),pe=require("@base-ui/react/toolbar"),J=require("@base-ui/react/menu"),hs=require("@base-ui/react/toggle"),Re=require("@base-ui/react/accordion"),ps=require("@base-ui/react/separator");var wa=(e,t)=>{if(e.scope!=="observation")return null;const n=(0,u.findLayerById)(t.layers,e.layerId);if(n===void 0)return null;const[a]=(0,u.resolveObservationsTarget)({layer:n,target:e,parsingLocale:t.config.parsingLocale}),o=a===void 0?void 0:n.data.getAt(a);if(o==null)return null;const i=(0,u.createObservationAnchorBuilder)(n)(o);return i===null?null:{layer:n,observation:o,at:i}},ja=e=>{const t=l.useSceneSelector((0,ae.useShallow)(n=>({layers:n.layers,config:n.config})));return(0,f.useMemo)(()=>wa(e,t),[e,t])},ms=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,r.jsx)("path",{d:"M4 3v12M4 6h12M4 10h10M4 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),gs=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,r.jsx)("path",{d:"M14 3v12M2 6h12M4 10h10M6 14h8",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),vs=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,r.jsx)("path",{d:"M2 14 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),fs=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,r.jsx)("path",{d:"M2 14C2.5 7 6.1 5.5 16 4",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),xs=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,r.jsx)("path",{d:"M2 8h14M2 8v3M16 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),bs=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...e,children:(0,r.jsx)("path",{d:"M2 8h14M3 8v3M7.3 8v3M11.6 8v3M15 8v3",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round"})}),De=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})})}),Ta=(0,f.createContext)(null),ka=({labelId:e,controlId:t,children:n})=>{const a=(0,f.useMemo)(()=>{let o=null;return{labelId:e,controlId:t,claimControlId:i=>(o??=i,o===i)}},[e,t]);return(0,r.jsx)(Ta.Provider,{value:a,children:n})},me=({id:e,ariaLabel:t,ariaLabelledBy:n},a=!0)=>{const o=(0,f.useContext)(Ta),i=(0,f.useId)(),[s]=(0,f.useState)(()=>a?o?.claimControlId(i)??!1:!1),c=e??(s?o?.controlId:void 0),d=n??(t===void 0?o?.labelId:void 0);return{...c!==void 0&&{id:c},...t!==void 0&&{"aria-label":t},...d!==void 0&&{"aria-labelledby":d}}},ue="_18ja6qr0",vn=({children:e})=>{const{themeValues:t}=l.useThemeContext();return(0,r.jsx)(l.PortalThemeProvider,{style:(0,f.useMemo)(()=>(0,de.assignInlineVars)({[l.vars.fontFamily]:t.fontFamily,[l.vars.textScale]:t.textScale}),[t]),children:e})};var Aa="srewh00",Ss="srewh01",ys={pointer:null,focus:null,last:"pointer"},La=(0,f.createContext)({hovered:!1,dismissed:!1,reachedTooltipId:null,reach:()=>{},release:()=>{},dismiss:()=>{}}),Wt=({className:e,children:t})=>{const[n,a]=(0,f.useState)(!1),[o,i]=(0,f.useState)(!1),[s,c]=(0,f.useState)(ys),d=(0,f.useCallback)((x,b)=>{i(!1),c(y=>({...y,[b]:x,last:b}))},[]),h=(0,f.useCallback)((x,b)=>{c(y=>y[b]===x?{...y,[b]:null}:y)},[]),p=(0,f.useCallback)(()=>i(!0),[]),m=Cs(s),g=(0,f.useMemo)(()=>({hovered:n,dismissed:o,reachedTooltipId:m,reach:d,release:h,dismiss:p}),[n,o,m,d,h,p]),v=x=>{x.pointerType!=="touch"&&(a(!0),i(!1))};return(0,r.jsx)("div",{className:e,onPointerEnter:v,onPointerLeave:()=>a(!1),children:(0,r.jsx)(La.Provider,{value:g,children:t})})},xe=({label:e,checked:t=!1,side:n,delay:a,nameTrigger:o=!0,children:i})=>{const{hovered:s,dismissed:c,reachedTooltipId:d,reach:h,release:p,dismiss:m}=(0,f.useContext)(La),g=(0,f.useId)(),[v,x]=(0,f.useState)(!1),b=s?!c&&(d===g||t&&d===null):v;(0,f.useEffect)(()=>()=>{p(g,"pointer"),p(g,"focus")},[g,p]);const y=(k,w)=>{w.reason==="escape-key"&&(m(),w.allowPropagation()),x(k)};return(0,r.jsxs)(ne.Tooltip.Root,{open:b,onOpenChange:y,disableHoverablePopup:!0,children:[(0,r.jsx)(ne.Tooltip.Trigger,{render:i,delay:a,...o?{"aria-label":e}:{},onPointerEnter:k=>k.pointerType!=="touch"&&h(g,"pointer"),onPointerLeave:()=>p(g,"pointer"),onFocus:()=>h(g,"focus"),onBlur:()=>p(g,"focus")}),(0,r.jsx)(ne.Tooltip.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(vn,{children:(0,r.jsx)(ne.Tooltip.Positioner,{side:n,sideOffset:6,className:Ss,children:(0,r.jsx)(ne.Tooltip.Popup,{className:Aa,children:e})})})})]})},Cs=({pointer:e,focus:t,last:n})=>n==="focus"?t??e:e??t,ws="woi4bh0",js="woi4bh1";var Ts={default:"woi4bh6 woi4bh5",tile:"woi4bh7 woi4bh5",icon:"woi4bh8 woi4bh5"},Pa=({label:e,icon:t,onClick:n,variant:a="default",expanded:o,disabled:i,side:s,delay:c,tooltip:d,onPointerEnter:h,onPointerLeave:p,ariaLabel:m,ariaLabelledBy:g,id:v})=>{const x=me({id:v,ariaLabel:m,ariaLabelledBy:g}),b=a==="tile",y=(0,r.jsxs)("button",{type:"button",className:Ts[a],disabled:i,"aria-expanded":o,onClick:n,onPointerEnter:h,onPointerLeave:p,...x,children:[t!==void 0&&(0,r.jsx)("span",{className:(0,le.default)("woi4bh0",a==="icon"&&"woi4bh4"),children:t}),e!==void 0&&(0,r.jsx)("span",{className:b?"woi4bh3":"woi4bh1",children:e}),o!==void 0&&a==="default"&&(0,r.jsx)("span",{className:"woi4bh2","aria-hidden":"true",children:(0,r.jsx)(De,{size:"sm"})})]});return d!==void 0?(0,r.jsx)(xe,{label:d,side:s,delay:c,nameTrigger:!1,children:y}):a==="icon"&&m!==void 0&&(s!==void 0||c!==void 0)?(0,r.jsx)(xe,{label:m,side:s,delay:c,children:y}):y},ks={accent:"var(--graphy-editor-accent, var(--graphy-editor-default-accent))",surface:"var(--graphy-editor-surface, var(--graphy-editor-default-surface))",text:"var(--graphy-editor-text, var(--graphy-editor-default-text))",textSecondary:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 70%)",textDisabled:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",sunken:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 5%)",raised:"color-mix(in srgb, var(--graphy-editor-surface, var(--graphy-editor-default-surface)), var(--graphy-editor-text, var(--graphy-editor-default-text)) 7%)",border:"var(--graphy-editor-border, color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 12%))",fontFamily:"var(--graphy-editor-font-family, var(--graphy-font-family))",borderStrong:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 50%)",focus:"color-mix(in srgb, transparent, var(--graphy-editor-text, var(--graphy-editor-default-text)) 55.00000000000001%)",focusWidth:"2px",shadow:"var(--graphy-editor-default-shadow)"},As="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",Ia="_14ty2ng0",Jn="_14ty2ng1",Ls="_14ty2ng2",Ps="_14ty2ng3",Ea="_14ty2ng4",Is="_14ty2ng5",Es="_14ty2ng6",Ma="transparent",Ra=e=>e==="transparent"?{background:As,border:`1px solid ${l.vars.border100}`}:{background:e,border:`1px solid ${ks.border}`},Oa=({title:e,colors:t,value:n,onChange:a,trailing:o,clearable:i=!1,disabled:s,id:c,ariaLabel:d,ariaLabelledBy:h})=>{const p=l.useI18n(),m=me({id:c,ariaLabel:d,ariaLabelledBy:h},!1),g=o!==void 0||i,v=x=>(0,r.jsx)("button",{type:"button","aria-label":x==="transparent"?p("graph.colorDropdown.transparent"):x,className:Ps,"data-active":_a(x,n),disabled:s,onMouseDown:b=>b.preventDefault(),onClick:()=>a(x),children:(0,r.jsx)("span",{className:Ea,style:Ra(x)})},x);return(0,r.jsxs)("div",{className:Ia,children:[e!==void 0&&(0,r.jsx)("div",{className:"_14ty2ng1",children:e}),(0,r.jsxs)("div",{className:Ls,...m,children:[t.map(v),g&&(0,r.jsxs)("span",{className:"_14ty2ng5",children:[(0,r.jsx)("span",{className:"_14ty2ng6","aria-hidden":"true"}),o,i&&v("transparent")]})]})]})},_a=(e,t)=>t!==null&&e.toLowerCase()===t.toLowerCase(),Ms="data-graphy-chart-chrome",Rs="data-graphy-chart-menu",Os={[Rs]:""},yt=e=>({[Ms]:e}),Oe=(e,t)=>e instanceof Element&&e.closest(`[data-graphy-chart-chrome="${CSS.escape(t)}"]`)!==null,st=e=>e instanceof Element&&e.closest("[data-graphy-chart-menu]")!==null,Ut=e=>e instanceof Element&&e.closest("[data-graphy-chart-chrome]")!==null,we=(e,t,n)=>e instanceof Node&&(t.contains(e)||Oe(e,n)),_s="cml7ha0",Na=(0,f.createContext)(null),Ns=({children:e})=>{const{chartId:t}=l.useGraphContext(),[n]=(0,f.useState)(l.resolvePortalContainer),[a,o]=(0,f.useState)(null);return n===null?null:(0,r.jsxs)(r.Fragment,{children:[(0,mn.createPortal)((0,r.jsx)("div",{ref:o,className:_s,...yt(t)}),n),(0,r.jsx)(Na.Provider,{value:a,children:e})]})},Ct=()=>(0,f.useContext)(Na),Ds="_178jeit0",Fs="_178jeit1 _14ty2ng3",Bs="_178jeit2 _14ty2ng4",Gs="_178jeit3",zs="_178jeit4",Hs="_178jeit5",Vs="_178jeit6",$s="_178jeit7",Ws={side:"flip",align:"shift",fallbackAxisSide:"end"},Da=({value:e,onChange:t,onCommit:n,popupAttributes:a,variant:o="default"})=>{const i=l.useI18n(),s=Ct(),[c,d]=(0,f.useState)(!1),h=g=>{d(g),g||n?.()},p=e!==null&&l.isValidCssColor(e)?e:"#000000",m=l.isHex(p)?p.toUpperCase():"#000000";return(0,r.jsxs)(K.Popover.Root,{open:c,onOpenChange:h,children:[o==="chip"?(0,r.jsx)(K.Popover.Trigger,{className:Fs,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:(0,r.jsx)("span",{className:Bs})}):(0,r.jsxs)("div",{className:Ia,children:[(0,r.jsx)("div",{className:Jn,children:i("graph.colorDropdown.custom")}),(0,r.jsxs)(K.Popover.Trigger,{className:Gs,onMouseDown:g=>g.preventDefault(),"aria-label":i("graph.colorDropdown.pickCustom"),children:[(0,r.jsx)("span",{className:Ea,style:Ra(p)}),(0,r.jsx)("span",{className:zs,children:m})]})]}),(0,r.jsx)(K.Popover.Portal,{container:s??l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(K.Popover.Positioner,{side:"right",align:"start",sideOffset:18,collisionAvoidance:Ws,collisionPadding:12,disableAnchorTracking:o==="chip",className:Ds,children:(0,r.jsxs)(K.Popover.Popup,{className:Hs,onMouseDown:g=>g.preventDefault(),...a,children:[(0,r.jsx)("div",{className:Jn,children:i("graph.colorDropdown.pickColor")}),(0,r.jsx)(Xn.HexColorPicker,{color:m,onChange:t,className:Vs}),(0,r.jsx)(Xn.HexColorInput,{color:m,onChange:t,prefixed:!0,className:$s,onMouseDown:g=>g.stopPropagation()})]})})})})]})},Qn=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M12 3v12"}),(0,r.jsx)("path",{d:"m17 8-5-5-5 5"}),(0,r.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"})]})}),Us="a1l6m80 woi4bh6 woi4bh5",qs="a1l6m81 _14ty2ng3",Ks="a1l6m82",Fa=({label:e,accept:t,onFile:n,disabled:a,id:o,variant:i="default"})=>{const s=(0,f.useId)(),c=o??s,d=i==="chip",h=(0,r.jsx)("input",{id:c,type:"file",accept:t,disabled:a,"aria-label":d?e:void 0,className:Ks,onChange:p=>{const m=p.target.files?.[0];p.target.value="",m!==void 0&&n(m)}});return d?(0,r.jsx)(xe,{label:e,children:(0,r.jsxs)("label",{htmlFor:c,className:qs,children:[(0,r.jsx)(Qn,{size:"xs"}),h]})}):(0,r.jsxs)("label",{htmlFor:c,className:Us,children:[(0,r.jsx)("span",{className:ws,children:(0,r.jsx)(Qn,{})}),(0,r.jsx)("span",{className:js,children:e}),h]})},wt=(0,f.createContext)(null),V=()=>{const e=(0,f.useContext)(wt);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},Ba=({children:e,onKeyDown:t,...n})=>{const a=(0,f.useContext)(wt),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,r.jsx)("div",{onKeyDown:o,...n,children:e})},Ga="keyboard",jt=e=>{const t=(0,f.useRef)(!1),n=(0,f.useRef)(!1),a=()=>{t.current=!1,n.current&&(n.current=!1,e?.())};return{commitAfterChange:()=>{if(t.current){n.current=!0;return}e?.()},commitUnlessHeldKey:o=>{if(o){n.current=!0;return}e?.()},gestureHandlers:{onKeyDown:()=>{t.current=!0},onKeyUp:a,onBlur:o=>{o.relatedTarget instanceof Node&&o.currentTarget.contains(o.relatedTarget)||a()}}}},Xs="eh8dvc0",Ys="eh8dvc1 uz3g760",Zs="eh8dvc2 uz3g761";var za=({value:e,onChange:t,onCommit:n,min:a,max:o,step:i,placeholder:s,prefix:c,suffix:d,disabled:h,hasError:p,ariaLabel:m,ariaLabelledBy:g,id:v})=>{const x=me({id:v,ariaLabel:m,ariaLabelledBy:g}),{commitUnlessHeldKey:b,gestureHandlers:y}=jt(n);return(0,r.jsx)(Yn.NumberField.Root,{className:Xs,value:e,onValueChange:k=>t(k),onValueCommitted:(k,w)=>{b(w.reason===Ga)},min:a,max:o,step:i,disabled:h,children:(0,r.jsxs)(Ba,{className:Ys,"data-error":p===!0,"data-disabled":h===!0?"":void 0,children:[c!==void 0&&(0,r.jsx)("span",{className:"eh8dvc3",children:c}),(0,r.jsx)(Yn.NumberField.Input,{className:Zs,placeholder:s,...y,"aria-invalid":p===!0?!0:void 0,...x}),d!==void 0&&(0,r.jsx)("span",{className:"eh8dvc3",children:d})]})})},Js="_1b7s5f0",Se={1:"_1b7s5f1",2:"_1b7s5f2",3:"_1b7s5f3",4:"_1b7s5f4",5:"_1b7s5f5",6:"_1b7s5f6"},Qs="_1b7s5f7";var el=6,Ha=({options:e,value:t,onChange:n,onCommit:a,columns:o,itemLayout:i="tile",disabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const p=me({id:h,ariaLabel:c,ariaLabelledBy:d}),m=i==="tile",g=i==="swatch",v=i==="icon",x=i==="track",b=i==="chip",{commitAfterChange:y,gestureHandlers:k}=jt(a);return(0,r.jsx)(Sa.RadioGroup,{className:(0,le.default)(Js,tl(o??e.length),v&&"_1b7s5f9",x&&"_1b7s5fb",b&&"_1b7s5fd"),value:t,onValueChange:w=>{n(w),y()},...k,disabled:s,...p,children:e.map(w=>{const j=(0,r.jsxs)(ba.Radio.Root,{value:w.value,disabled:w.disabled,className:(0,le.default)(Qs,g&&"_1b7s5f8",v&&"_1b7s5fa",x&&"_1b7s5fc",b&&"_1b7s5fe"),style:{gridRow:w.gridRow,gridColumn:w.gridColumn},"aria-label":m?void 0:w.label,children:[w.icon,m&&(0,r.jsx)("span",{className:"_1b7s5ff",children:w.label})]},w.value);if(!g&&!v&&!b)return j;const P=(v||b)&&w.value===t;return(0,r.jsx)(xe,{label:w.label,checked:P,children:j},w.value)})})},tl=e=>{switch(Math.min(Math.max(Math.round(e),1),el)){case 1:return Se[1];case 2:return Se[2];case 3:return Se[3];case 4:return Se[4];case 5:return Se[5];default:return Se[6]}},Va=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M20 6 9 17l-5-5"})})}),nl="_1g5x15w0 uz3g760",rl="_1g5x15w1",al="_1g5x15w2",er="_1g5x15w3",ol="_1g5x15w4",il="_1g5x15w5",sl="_1g5x15w6",ll="_1g5x15w7";var $a=({options:e,value:t,onChange:n,placeholder:a,disabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=me({id:d,ariaLabel:s,ariaLabelledBy:c}),p=Ct();return(0,r.jsxs)(se.Select.Root,{value:t,onValueChange:m=>m!==null&&n(m),disabled:o,items:e.map(m=>({value:m.value,label:m.label})),children:[(0,r.jsxs)(se.Select.Trigger,{className:nl,"data-error":i===!0,...h,children:[(0,r.jsx)(se.Select.Value,{className:rl,children:m=>cl(e,m,a)}),(0,r.jsx)(se.Select.Icon,{className:er,children:(0,r.jsx)(De,{size:"sm"})})]}),(0,r.jsx)(se.Select.Portal,{container:p??l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(se.Select.Positioner,{className:ol,sideOffset:4,alignItemWithTrigger:!1,children:(0,r.jsx)(se.Select.Popup,{className:il,children:e.map(m=>(0,r.jsxs)(se.Select.Item,{value:m.value,disabled:m.disabled,className:sl,children:[m.icon,(0,r.jsxs)("span",{className:ll,children:[(0,r.jsx)(se.Select.ItemText,{children:m.label}),m.description!==void 0&&(0,r.jsx)("span",{className:"_1g5x15w8",children:m.description})]}),(0,r.jsx)(se.Select.ItemIndicator,{className:er,children:(0,r.jsx)(Va,{size:"sm"})})]},m.value))})})})})]})},cl=(e,t,n)=>t===null?(0,r.jsx)("span",{className:al,children:n}):dl(e,t),dl=(e,t)=>e.find(n=>n.value===t)?.label??t,ul="vod76w0",hl="vod76w1",pl="vod76w2",ml="vod76w3",gl="vod76w4",vl="vod76w5";var Wa=({value:e,onChange:t,onCommit:n,min:a,max:o,step:i,suffix:s,formatValue:c,showValue:d=!0,disabled:h,ariaLabel:p,ariaLabelledBy:m})=>{const g=me({ariaLabel:p,ariaLabelledBy:m},!1),v=fl(e,s,c),{commitUnlessHeldKey:x,gestureHandlers:b}=jt(n);return(0,r.jsxs)("div",{className:ul,children:[(0,r.jsx)(Pe.Slider.Root,{className:hl,value:e,onValueChange:y=>t(y),onValueCommitted:(y,k)=>{x(k.reason===Ga)},min:a,max:o,step:i,disabled:h,children:(0,r.jsx)(Pe.Slider.Control,{className:pl,children:(0,r.jsxs)(Pe.Slider.Track,{className:ml,children:[(0,r.jsx)(Pe.Slider.Indicator,{className:gl}),(0,r.jsx)(Pe.Slider.Thumb,{className:vl,...b,...g})]})})}),d&&(0,r.jsx)("span",{className:"vod76w6",children:v})]})},fl=(e,t,n)=>n!==void 0?n(e):`${e}${t??""}`,xl="_1hyrlw60",bl="_1hyrlw61",Ua=({checked:e,onChange:t,disabled:n,ariaLabel:a,ariaLabelledBy:o,id:i})=>{const s=me({id:i,ariaLabel:a,ariaLabelledBy:o});return(0,r.jsx)(Zn.Switch.Root,{checked:e,onCheckedChange:c=>t(c),disabled:n,className:xl,...s,children:(0,r.jsx)(Zn.Switch.Thumb,{className:bl})})},Sl="uz3g761",yl="tpcnun0 uz3g760",qa=({value:e,onChange:t,onCommit:n,placeholder:a,disabled:o,hasError:i,ariaLabel:s,ariaLabelledBy:c,id:d})=>{const h=me({id:d,ariaLabel:s,ariaLabelledBy:c});return(0,r.jsx)(Ba,{className:yl,"data-error":i===!0,children:(0,r.jsx)(rs.Input,{className:Sl,value:e,onValueChange:p=>t(p),onBlur:n,placeholder:a,disabled:o,"aria-invalid":i===!0?!0:void 0,...h})})},Cl="cnu9yl0",wl="cnu9yl1";var fn=({options:e,value:t,onChange:n,onCommit:a,itemLayout:o="inline",hasEqualWidths:i=!1,disabled:s,ariaLabel:c,ariaLabelledBy:d,id:h})=>{const p=me({id:h,ariaLabel:c,ariaLabelledBy:d}),m=o==="stacked",{commitAfterChange:g,gestureHandlers:v}=jt(a);return(0,r.jsx)(Sa.RadioGroup,{className:Cl,value:t,onValueChange:x=>{n(x),g()},...v,disabled:s,...p,children:e.map(x=>{const b=jl(x,m),y=(0,r.jsxs)(ba.Radio.Root,{value:x.value,disabled:x.disabled,className:(0,le.default)(wl,m&&"cnu9yl3",i&&"cnu9yl2"),"aria-label":b,children:[x.icon,Ka(x,m)&&(0,r.jsx)("span",{className:"cnu9yl4",children:x.label})]},x.value);return b===void 0?y:(0,r.jsx)(xe,{label:b,checked:x.value===t,children:y},x.value)})})},Ka=(e,t)=>e.icon===void 0||t,jl=(e,t)=>{if(!Ka(e,t))return e.label},Tl={ToggleGroup:fn,Switch:Ua,Slider:Wa,RadioGrid:Ha,Button:Pa,TextField:qa,NumberField:za,Select:$a,ColorSwatches:Oa,CustomColor:Da,FileInput:Fa},qt=(0,f.createContext)(Tl),Xa=({controls:e,children:t})=>{const n=(0,f.useContext)(qt),a=(0,f.useMemo)(()=>({ToggleGroup:e?.ToggleGroup??n.ToggleGroup,Switch:e?.Switch??n.Switch,Slider:e?.Slider??n.Slider,RadioGrid:e?.RadioGrid??n.RadioGrid,Button:e?.Button??n.Button,TextField:e?.TextField??n.TextField,NumberField:e?.NumberField??n.NumberField,Select:e?.Select??n.Select,ColorSwatches:e?.ColorSwatches??n.ColorSwatches,CustomColor:e?.CustomColor??n.CustomColor,FileInput:e?.FileInput??n.FileInput}),[n,e?.ToggleGroup,e?.Switch,e?.Slider,e?.RadioGrid,e?.Button,e?.TextField,e?.NumberField,e?.Select,e?.ColorSwatches,e?.CustomColor,e?.FileInput]);return(0,r.jsx)(qt.Provider,{value:a,children:t})},D=()=>(0,f.useContext)(qt),tr={stack:"pr583x0",grid:"pr583x1"},nr="pr583x2",kl={plain:"pr583x4 pr583x3",withIcon:"pr583x5 pr583x3"},I=({label:e,layout:t="grid",icon:n,children:a})=>{const o=(0,f.useId)(),i=(0,f.useId)();return e===void 0?(0,r.jsx)(Wt,{className:tr[t],children:(0,r.jsx)("div",{className:nr,children:a})}):(0,r.jsxs)(Wt,{className:tr[t],children:[(0,r.jsxs)("label",{id:o,htmlFor:i,className:kl[n===void 0?"plain":"withIcon"],children:[n!==void 0&&(0,r.jsx)("span",{"aria-hidden":"true",children:n}),e]}),(0,r.jsx)("div",{className:nr,children:(0,r.jsx)(ka,{labelId:o,controlId:i,children:a})})]})},xn=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,r.jsx)(Al,{graph:t,axis:e.axis})};xn.hasRows=(e,{scene:t})=>t.coordSystem.type!=="polar";var Al=({graph:e,axis:t})=>{const n=l.useHandleScene(e),a=l.useI18n(),{NumberField:o,TextField:i,ToggleGroup:s}=D(),c=n?.guides.axes.find(T=>T.scaledAesthetic===t);if((0,f.useEffect)(()=>()=>e.commands.commit(),[e.commands]),n===null||c?.geometry!=="linear")return null;const d=!c.visible,h=c.visible||c.showGrid,p=n.scales[t]?.spec.scaleType,m=p==="continuous"||p==="datetime",g=n.guides.legends.drawn.some(T=>T.position==="left"||T.position==="right"),v=t!=="x"&&p==="continuous"&&(c.position==="left"||c.position==="right")&&!g,x=t==="x"?void 0:n.scales[t]?.spec,b=x?.scaleType==="continuous"?x:void 0,y=b!==void 0&&(c.position==="left"||c.position==="right")&&!(0,u.isZeroAnchoredAxis)(n,t),k=b?.transform==="log"?"log":"linear",w=y&&b.transform!=="log",j=b?.domainMin??null,P=b!==void 0&&(c.position==="left"||c.position==="right")&&b.transform!=="log",A=b?.domainMax??null,E=n.config.axes[t]?.label??c.label??"",O=T=>{const R=t==="ySecondary"?{axis:t,label:T}:{axis:t,label:T};e.commands.dispatch(new u.SetAxisLabelCommand(R),{transient:!0})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I,{label:a("editor.axesPanel.controls.title"),children:(0,r.jsx)(i,{value:E,placeholder:a("editor.axesPanel.controls.titlePlaceholder"),onChange:O,onCommit:e.commands.commit,disabled:d})}),m&&(0,r.jsx)(I,{label:a("editor.axesPanel.controls.labels"),children:(0,r.jsx)(s,{value:c.tickMode,disabled:!h,options:[{value:"auto",label:a("editor.axesPanel.labelMode.auto"),icon:(0,r.jsx)(bs,{})},{value:"edges",label:a("editor.axesPanel.labelMode.edges"),icon:(0,r.jsx)(xs,{})}],onChange:T=>{const R=T==="edges"?"edges":"auto";e.commands.dispatch(new u.SetAxisTickModeCommand({axis:t,tickMode:R,keepSecondaryAxis:!0}))}})}),v&&(0,r.jsx)(I,{label:a("editor.axesPanel.controls.position"),children:(0,r.jsx)(s,{value:c.position,disabled:d,options:[{value:"left",label:a("editor.axesPanel.position.left"),icon:(0,r.jsx)(ms,{})},{value:"right",label:a("editor.axesPanel.position.right"),icon:(0,r.jsx)(gs,{})}],onChange:T=>{if(T!=="left"&&T!=="right")return;const R=t==="y"?T:T==="left"?"right":"left";e.commands.dispatch(new u.SetAxisPositionCommand({axis:"y",position:R}))}})}),y&&(0,r.jsx)(I,{label:a("editor.axesPanel.controls.scale"),children:(0,r.jsx)(s,{value:k,options:[{value:"linear",label:a("editor.axesPanel.scale.auto"),icon:(0,r.jsx)(vs,{})},{value:"log",label:a("editor.axesPanel.scale.log"),icon:(0,r.jsx)(fs,{})}],onChange:T=>{e.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:t,transform:T==="log"?"log":"linear"}))}})}),w&&(0,r.jsx)(I,{label:a("editor.axesPanel.controls.startFrom"),children:(0,r.jsx)(o,{value:j,placeholder:a("editor.axesPanel.startFrom.auto"),onChange:T=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMin:T}),{transient:!0})},onCommit:e.commands.commit})}),P&&(0,r.jsx)(I,{label:a("editor.axesPanel.controls.endAt"),children:(0,r.jsx)(o,{value:A,placeholder:a("editor.axesPanel.endAt.auto"),onChange:T=>{e.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:t,domainMax:T}),{transient:!0})},onCommit:e.commands.commit})})]})},Ll={narrow:3,regular:6,wide:11},Pl=({barWidth:e,...t})=>{const n=Ll[e];return(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("rect",{x:(18-n)/2,y:3,width:n,height:12,fill:"currentColor"})})},Il=6,ce=({target:e})=>{const{commands:t,findGeom:n}=l.useGraphContext(),a=l.useI18n(),o=l.useStyleReaderTree(),i=l.useSceneSelector(p=>p),s=Za(e,i,n);(0,f.useEffect)(()=>()=>t.commit(),[t]);const c=(0,f.useMemo)(()=>(0,u.readObservationsColor)({readers:o,layers:i.layers,target:e,parsingLocale:i.config.parsingLocale}),[o,i.config.parsingLocale,i.layers,e]);if(s===null)return null;const d=(p,m)=>{const g=s[0]?.part;t.dispatch(new u.SetObservationsColorCommand({target:e,color:p,...g===void 0?{}:{part:g}}),m?{transient:!0}:void 0)},h=s[0]?.property==="stroke"?a("editor.overlayMenu.lineColor"):a("editor.overlayMenu.fillColor");return(0,r.jsx)(Ya,{label:h,palette:(0,u.readColorChoices)(i.scales.color),selectedColor:c,paint:d,commit:()=>t.commit()})},Ya=({label:e,palette:t,selectedColor:n,paint:a,commit:o})=>{const{ColorSwatches:i,CustomColor:s}=D();return(0,r.jsx)(I,{label:e,layout:"stack",children:(0,r.jsx)(i,{colors:El(t.slice(0,Il),n),value:n,onChange:c=>a(c,!1),trailing:(0,r.jsx)(s,{variant:"chip",value:n,onChange:c=>a(c,!0),onCommit:o})})})};ce.hasRows=(e,{scene:t,findGeom:n})=>Za(e,t,n)!==null;var Za=(e,t,n)=>{if((0,u.findLayerById)(t.layers,e.layerId)===void 0)return null;const a=(0,u.readObservationsColorPart)({layers:t.layers,target:e});return(0,u.readObservationsColorRoute)(t.spec,e,n,a)},El=(e,t)=>t===null||e.some(n=>_a(n,t))?e:[...e,t],Rt=[{name:"narrow",width:.4},{name:"regular",width:.7},{name:"wide",width:.95}],bn=({target:e})=>{const t=l.useSceneSelector(g=>g),n=l.useGraphCommands(),a=l.useI18n(),{ToggleGroup:o}=D(),i=(0,u.findLayerById)(t.spec.layers,e.layerId),s=(0,u.isLayerSpecOf)(i,"bar")?i:null,c=t.coordSystem.type==="polar"&&t.coordSystem.bandAxis===null,d=g=>{const v=Rt.find(({name:x})=>x===g);v!==void 0&&n.dispatch(new u.SetBarWidthCommand({layerId:e.layerId,width:v.width}))},h=Rt.map(({name:g})=>({value:g,label:a(`editor.graphPanel.barSection.widths.${g}`),icon:(0,r.jsx)(Pl,{barWidth:g})})),p=s===null?null:(0,u.resolveBarBandFraction)(s.params,t.coordSystem.type),m=Rt.find(({width:g})=>g===p)?.name??"";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ce,{target:e}),s!==null&&!c?(0,r.jsx)(I,{label:a("editor.graphPanel.barSection.thickness"),children:(0,r.jsx)(o,{value:m,options:h,onChange:d})}):null]})};bn.hasRows=ce.hasRows;var Ml={smooth:"M2 13C6 13 7 5 10 5s4 6 6 6",linear:"M2 13l5-8 4 6 5-4"},Rl=({curve:e,...t})=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("path",{d:Ml[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),Ol={gap:"M2 12l4-5M12 10l4-4",connect:"M2 12l4-5M6 7l6 3M12 10l4-4",zero:"M2 12l4-5v7h6V10l4-4"},_l=({missingValues:e,...t})=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("path",{d:Ol[e],stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})}),rr={supportsDataLabels:!1,supportsPercentages:!1,supportsStackTotals:!1,supportsCategoryLabels:!1},Ja=(e,t,n)=>{if(!n.hasCapability(e.geom,t)||Nl(e))return rr;const{showDataLabels:a}=e.dataLabels,o=e.geom==="bar",i=t==="polar";return{supportsDataLabels:!0,supportsPercentages:a&&n.hasPercentageFormat(e,t),supportsStackTotals:o&&!i&&e.position==="stack",supportsCategoryLabels:o&&i&&e.position==="fill"&&a}},Nl=e=>{const t=(0,u.readVariableName)(e.mapping.color);return e.geom==="tile"&&t!==null&&e.data.getType(t)==="categorical"},Qa=(e,t)=>{switch(t){case"gap":return e("editor.graphPanel.treatEmptyValues.leaveGap.label");case"zero":return e("editor.graphPanel.treatEmptyValues.fillZero.label");case"connect":return e("editor.graphPanel.treatEmptyValues.connectGaps.label");default:return t}};var Kt=["gap","zero","connect"],Sn=(e,t,n)=>{const a=(0,u.findLayerById)(e.spec.layers,n);if(!(0,u.isLayerSpecOf)(a,"line","area"))return null;const o=e.coordSystem.type==="polar",i=(0,u.buildLayerStyleAddress)(a.geom,a.id),s=(0,u.readStyleCoord)(e.spec),c=e.spec.styles.overrides,d=(0,u.combineKindStyleDeclarations)(c,i,s),h=(0,u.combineKindStyleDeclarations)((0,u.readStyleRulesBeneath)(c,i,s),i,s),p=typeof d?.strokeWidth=="number"?d.strokeWidth:null,m=Dl(a,e.spec.layers),g=o?[]:Bl(a),v=g.length>1,x=a.geom==="line"&&!o,b=x?zl(e,t,a):0;return{layerId:a.id,showPoints:m!==void 0&&Fl(e,t,m.id),pointLayerId:m?.id??null,showFill:x?b>0:null,drawnFillAlpha:b,smooth:o?null:a.params.curve==="smooth",widthMode:p===null?"auto":"custom",hasUnderlyingStrokeWidth:h?.strokeWidth!==void 0,strokeWidth:p??Gl(e,t,a)??u.DEFAULT_STROKE_WIDTH_PX,missingValues:v?a.params.missingValues:null,missingValueOptions:v?g:[]}},Dl=(e,t)=>(0,u.filterLayersByGeoms)(t,"point").find(n=>(0,u.isCompanionLayer)(n,[e])),Fl=(e,t,n)=>{const a=(0,u.findLayerById)(e.layers,n);if(a?.geom!=="point")return!1;const o=t.geom.point(a);return a.data.findFirst(i=>o.get("size",i)>0)!==null},Bl=e=>{const t=["gap","zero"];return e.position!=="stack"&&e.position!=="fill"&&t.push("connect"),e.geom==="area"?t.filter(n=>n!=="gap"):t},Gl=(e,t,n)=>{const a=(0,u.findLayerById)(e.layers,n.id);if(a?.geom==="line")return t.geom.line(a).get("strokeWidth");if(a?.geom==="area")return t.geom.area(a).get("strokeWidth")},zl=(e,t,n)=>{const a=(0,u.findLayerById)(e.layers,n.id);return a?.geom==="line"?t.geom.line(a).get("fillAlpha")??0:0},Hl=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M0 11 5.5 5.5 10.5 9 16 4v12H0z"}),(0,r.jsx)("path",{fill:"currentColor",fillOpacity:"0.3",d:"M0 11 5.5 5.5 10.5 9 16 4V0H0z"})]}),Vl=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,r.jsx)("rect",{width:"3.2",height:"3.5",y:"12.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"2.3",y:"9.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4.5",x:"4.267",y:"11.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"3.3",x:"4.267",y:"7.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"2.5",x:"8.533",y:"13.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"1.8",x:"8.533",y:"11",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4",x:"12.8",y:"12",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"2.8",x:"12.8",y:"8.5",rx:".533"})]}),(0,r.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,r.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,r.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),eo=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:".993",children:[(0,r.jsxs)("g",{fillOpacity:"0.3",strokeOpacity:"0.3",children:[(0,r.jsx)("path",{fill:"none",d:"M1.4 12.2 6 6.4l4.2 1.2 4.4-4.2"}),(0,r.jsx)("circle",{cx:"1.4",cy:"12.2",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"6",cy:"6.4",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"10.2",cy:"7.6",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"14.6",cy:"3.4",r:".9",stroke:"none"})]}),(0,r.jsxs)("g",{fillOpacity:"0.8",strokeOpacity:"0.8",children:[(0,r.jsx)("path",{fill:"none",d:"M1.4 5.6 6 11.4l4.2-1.2 4.4 1.2"}),(0,r.jsx)("circle",{cx:"1.4",cy:"5.6",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"6",cy:"11.4",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"10.2",cy:"10.2",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"14.6",cy:"11.4",r:".9",stroke:"none"})]})]})}),$l=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M10.394 12.734 5.63 7.652 0 13.822V16h16V8.741z"}),(0,r.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"})]}),Wl=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,r.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]})}),Ul=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,r.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,r.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"})]})}),ql=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{transform:"rotate(90 8 8)",children:[(0,r.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,r.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"})]})}),Kl=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Xl=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.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,r.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"})]}),Yl=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.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,r.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"})]}),Zl=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsxs)("g",{fill:"currentColor",fillOpacity:"0.3",children:[(0,r.jsx)("rect",{width:"3.2",height:"6.5",y:"9.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"8.5",x:"4.267",y:"7.5",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"5",x:"8.533",y:"11",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"7.5",x:"12.8",y:"8.5",rx:".533"})]}),(0,r.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"0.8",strokeWidth:".993",children:[(0,r.jsx)("path",{fill:"none",d:"M1.6 6.2 5.867 3.6l4.266 3.8 4.267-3"}),(0,r.jsx)("circle",{cx:"1.6",cy:"6.2",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"5.867",cy:"3.6",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"10.133",cy:"7.4",r:".9",stroke:"none"}),(0,r.jsx)("circle",{cx:"14.4",cy:"4.4",r:".9",stroke:"none"})]})]}),Jl=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"5",transform:"rotate(-90 8 8)",children:[(0,r.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.3"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.6",strokeDasharray:"25 100"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"5.5",pathLength:"100",strokeOpacity:"0.8",strokeDasharray:"25 100",strokeDashoffset:"-25"})]})}),Ql=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"currentColor",children:[(0,r.jsx)("rect",{width:"4.267",height:"4.267",y:"0.533",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"0.533",fillOpacity:"0.55",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"0.533",fillOpacity:"0.2",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",y:"5.867",fillOpacity:"0.55",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"5.867",fillOpacity:"0.9",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"5.867",fillOpacity:"0.45",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",y:"11.2",fillOpacity:"0.2",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",x:"5.867",y:"11.2",fillOpacity:"0.45",rx:".533"}),(0,r.jsx)("rect",{width:"4.267",height:"4.267",x:"11.733",y:"11.2",fillOpacity:"0.75",rx:".533"})]})}),ec=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("rect",{width:"16",height:"16",fill:"currentColor",fillOpacity:"0.3",rx:"8"}),(0,r.jsx)("path",{fill:"currentColor",fillOpacity:"0.6",d:"m7.999 16 .412-.01A8 8 0 0 0 8 0z"}),(0,r.jsx)("path",{fill:"currentColor",fillOpacity:"0.8",d:"M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"})]}),tc=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",children:[(0,r.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",strokeOpacity:"0.3",strokeWidth:".8"}),(0,r.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",strokeOpacity:"0.8",strokeWidth:"1.2"})]})}),nc=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("polygon",{points:"8,0.5 15.13,5.68 12.41,14.07 3.59,14.07 0.87,5.68",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeOpacity:"0.3",strokeWidth:".8"}),(0,r.jsx)("polygon",{points:"8,2.5 14.66,5.84 10.06,10.83 4.47,12.85 3.72,6.61",fill:"currentColor",fillOpacity:"0.6"})]}),rc=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",transform:"rotate(-90 8 8)",children:[(0,r.jsxs)("g",{strokeOpacity:"0.2",children:[(0,r.jsx)("circle",{cx:"8",cy:"8",r:"6.6"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"4.4"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"2.2"})]}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"6.6",pathLength:"100",strokeDasharray:"72 100",strokeOpacity:"0.8"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"4.4",pathLength:"100",strokeDasharray:"52 100",strokeOpacity:"0.6"}),(0,r.jsx)("circle",{cx:"8",cy:"8",r:"2.2",pathLength:"100",strokeDasharray:"34 100",strokeOpacity:"0.45"})]})}),ac=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsx)("path",{fill:"currentColor",fillOpacity:"0.75",d:"M8.4 7.31 8.4 1.01A7 7 0 0 1 13.85 4.16ZM8.8 8 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8ZM8.4 8.69 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59ZM7.6 8.69 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74ZM7.2 8 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31ZM7.6 7.31 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52Z"})}),oc=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"currentColor",children:[(0,r.jsx)("path",{fillOpacity:"0.35",d:"M8.4 3.82 8.4 1.01A7 7 0 0 1 13.85 4.16L11.42 5.56A4.2 4.2 0 0 0 8.4 3.82ZM11.46 6.47 13.64 5.2A6.3 6.3 0 0 1 13.64 10.8L11.46 9.53A3.78 3.78 0 0 0 11.46 6.47ZM10.69 10.01 12.64 11.14A5.6 5.6 0 0 1 8.4 13.59L8.4 11.34A3.36 3.36 0 0 0 10.69 10.01ZM7.6 10.85 7.6 12.78A4.8 4.8 0 0 1 4.06 10.74L5.73 9.77A2.88 2.88 0 0 0 7.6 10.85ZM5.7 8.87 4.27 9.69A4.1 4.1 0 0 1 4.27 6.31L5.7 7.13A2.46 2.46 0 0 0 5.7 8.87ZM6.41 6.62 5.19 5.92A3.5 3.5 0 0 1 7.6 4.52L7.6 5.94A2.1 2.1 0 0 0 6.41 6.62Z"}),(0,r.jsx)("path",{fillOpacity:"0.9",d:"M8.4 7.31 8.4 3.82A4.2 4.2 0 0 1 11.42 5.56ZM8.8 8 11.46 6.47A3.78 3.78 0 0 1 11.46 9.53ZM8.4 8.69 10.69 10.01A3.36 3.36 0 0 1 8.4 11.34ZM7.6 8.69 7.6 10.85A2.88 2.88 0 0 1 5.73 9.77ZM7.2 8 5.7 8.87A2.46 2.46 0 0 1 5.7 7.13ZM7.6 7.31 6.41 6.62A2.1 2.1 0 0 1 7.6 5.94Z"})]})}),ic=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 16 16",...e,children:(0,r.jsxs)("g",{fill:"currentColor",fillOpacity:"0.8",children:[(0,r.jsx)("circle",{cx:"1.028",cy:"13.897",r:"1.028"}),(0,r.jsx)("circle",{cx:"2.57",cy:"8.243",r:"1.028"}),(0,r.jsx)("circle",{cx:"5.653",cy:"12.355",r:"1.028"}),(0,r.jsx)("circle",{cx:"8.223",cy:"8.243",r:"1.028"}),(0,r.jsx)("circle",{cx:"9.252",cy:"3.618",r:"1.028"}),(0,r.jsx)("circle",{cx:"12.849",cy:"7.215",r:"1.028"}),(0,r.jsx)("circle",{cx:"14.905",cy:"1.561",r:"1.028"})]})}),sc=.55,lc=.15,_e=[{name:"column",icon:Kl,summary:{coordType:"cartesian",geom:"bar",position:"dodge"}},{name:"columnStacked",icon:Yl,summary:{coordType:"cartesian",geom:"bar",position:"stack"}},{name:"columnStackedFill",icon:Xl,summary:{coordType:"cartesian",geom:"bar",position:"fill"}},{name:"bar",icon:Wl,summary:{coordType:"flip",geom:"bar",position:"dodge"}},{name:"barStacked",icon:ql,summary:{coordType:"flip",geom:"bar",position:"stack"}},{name:"barStackedFill",icon:Ul,summary:{coordType:"flip",geom:"bar",position:"fill"}},{name:"line",icon:eo,summary:{coordType:"cartesian",geom:"line",position:"identity"}},{name:"areaStacked",icon:$l,summary:{coordType:"cartesian",geom:"area",position:"stack"}},{name:"combo",icon:Zl,summary:{coordType:"cartesian",comboType:"groupedBars"}},{name:"scatter",icon:ic,summary:{coordType:"cartesian",geom:"point",position:"identity"}},{name:"pie",icon:ec,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:0}},{name:"donut",icon:Jl,summary:{coordType:"polar",geom:"bar",position:"fill",theta:"y",innerRadius:sc}},{name:"radialBar",icon:rc,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"y",innerRadius:lc}},{name:"rose",icon:ac,summary:{coordType:"polar",geom:"bar",position:"dodge",theta:"x",innerRadius:0}},{name:"roseStacked",icon:oc,summary:{coordType:"polar",geom:"bar",position:"stack",theta:"x",innerRadius:0}},{name:"radar",icon:tc,summary:{coordType:"polar",geom:"line",position:"identity",theta:"x",innerRadius:0}},{name:"radarFilled",icon:nc,summary:{coordType:"polar",geom:"area",position:"identity",theta:"x",innerRadius:0}},{name:"heatmap",icon:Ql,summary:{coordType:"cartesian",geom:"tile",position:"identity"}}],cc=.05,to=(e,t)=>(0,u.isComboGraphType)(e)?(0,u.canBecomeCombo)(t):e.geom==="tile"?(0,u.canBecomeHeatmap)(t):!0,lt=e=>e===null?null:_e.find(t=>dc(t.summary,e))??null,no=(e,t)=>t===null||(0,u.isComboGraphType)(e)?e:e.position==="dodge"&&ro(t)?{...e,position:"identity"}:e.coordType!=="polar"||!ct(e.innerRadius)||t.coordType!=="polar"||!ct(t.innerRadius)?e:{...e,innerRadius:t.innerRadius},ro=e=>!(0,u.isComboGraphType)(e)&&e.geom==="bar"&&e.position==="identity",dc=(e,t)=>{if((0,u.isComboGraphType)(e)||(0,u.isComboGraphType)(t))return(0,u.isComboGraphType)(e)&&(0,u.isComboGraphType)(t);const n=e.position===t.position||e.position==="dodge"&&ro(t);return e.coordType!==t.coordType||e.geom!==t.geom||!n?!1:e.coordType!=="polar"||t.coordType!=="polar"?!0:e.theta===t.theta&&ct(e.innerRadius)===ct(t.innerRadius)},ct=e=>e>=cc;var uc="_1a90obs1",hc=[{summary:{coordType:"cartesian",geom:"area",position:"fill"},icon:Hl},{summary:{coordType:"cartesian",comboType:"stackedBars"},icon:Vl},{summary:{coordType:"cartesian",comboType:"lines"},icon:eo}],pc=[["column","column"],["bar","bar"],["line","line"],["area","areaStacked"],["combo","combo"],["scatter","scatter"],["pie","pie"],["donut","donut"],["heatmap","heatmap"]],mc=4,gc={dodge:"grouped",identity:"grouped",stack:"stacked",fill:"filled"},vc={groupedBars:"grouped",stackedBars:"stacked",lines:"lines"},fc=()=>{const e=l.useSceneSelector(E=>E.spec),t=l.useSceneSelector(({layers:E})=>E.some(O=>(0,u.hasMultipleGroups)(O.data,O.mapping))),n=l.useGraphCommands(),a=l.useI18n(),{Button:o,RadioGrid:i}=D(),[s,c]=(0,f.useState)(!1),d=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!s)return;const E=({target:O,detail:T})=>{T>0&&bc(O)&&d.current?.contains(O)&&c(!1)};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[s]);const h=(0,u.readGraphType)(e);if(h===null)return null;const p=Sc(h),m=dt(h),g=lt(h),v=p??g,x=a(v===null?"editor.overlayMenu.customChartType":`editor.graphTypes.${v.name}`),b=(p===void 0?g:or(p,m))?.icon,y=p!==void 0&&p.arrangements.length>1,k=y&&(t||p.name==="combo"),w=()=>c(!s),j=({summary:E})=>{n.dispatch(new u.SetGraphTypeCommand(no(E,h)),{transient:!0})},P=E=>{const O=ar.find(T=>T.name===E);O!==void 0&&j(or(O,y?m:null))},A=ar.map(({name:E,arrangements:[O]})=>({value:E,label:a(`editor.graphTypes.${E}`),icon:(0,r.jsx)(O.icon,{size:"md"}),disabled:!to(O.summary,e)}));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I,{label:a("editor.overlayMenu.chartType"),children:b===void 0?(0,r.jsx)(o,{label:x,expanded:s,onClick:w}):(0,r.jsx)(o,{variant:"icon",icon:(0,r.jsx)(b,{size:"sm"}),ariaLabel:x,expanded:s,onClick:w})}),s&&(0,r.jsx)(I,{layout:"stack",children:(0,r.jsx)("div",{ref:d,className:"_1a90obs0",children:(0,r.jsx)(i,{options:A,value:p?.name??"",onChange:P,onCommit:n.commit,columns:mc,itemLayout:"swatch",ariaLabel:a("editor.overlayMenu.chartType")})})}),k&&(0,r.jsx)(xc,{type:p,arrangement:m,onPick:j,onCommit:n.commit})]})},ao=(e,t)=>(0,u.isComboGraphType)(e)||(0,u.isComboGraphType)(t)?(0,u.isComboGraphType)(e)&&(0,u.isComboGraphType)(t):e.coordType==="polar"?lt(e)===lt(t):e.coordType===t.coordType&&e.geom===t.geom,oo=pc.flatMap(([e,t])=>{const n=_e.find(a=>a.name===t);return n===void 0?[]:[{name:e,arrangements:[n,...[..._e,...hc].filter(a=>a!==n&&ao(n.summary,a.summary))]}]}),ar=oo.filter(({name:e})=>e!=="combo"),xc=({type:e,arrangement:t,onPick:n,onCommit:a})=>{const o=l.useI18n(),{ToggleGroup:i}=D(),s=e.arrangements.map(({summary:d,icon:h})=>{const p=dt(d);return{value:p,label:o(`editor.overlayMenu.arrangements.${p}`),icon:(0,r.jsx)(h,{size:"sm"})}}),c=d=>{const h=e.arrangements.find(({summary:p})=>dt(p)===d);h!==void 0&&n(h)};return(0,r.jsx)(I,{label:o("editor.overlayMenu.arrange"),children:(0,r.jsx)("div",{className:uc,children:(0,r.jsx)(i,{options:s,value:t,onChange:c,onCommit:a})})})},bc=e=>e instanceof Element&&e.closest('[role="radio"]:not([aria-disabled="true"])')!==null,dt=e=>(0,u.isComboGraphType)(e)?vc[e.comboType]:gc[e.position],or=(e,t)=>e.arrangements.find(({summary:n})=>dt(n)===t)??e.arrangements[0],Sc=e=>oo.find(({arrangements:[t]})=>ao(t.summary,e)),yc=()=>{const e=l.useSceneSelector(c=>c.scales.color),t=l.useGraphCommands(),n=l.useI18n(),[a,o]=(0,f.useState)(null);(0,f.useEffect)(()=>()=>t.commit(),[t]);const i=(0,u.readColorChoices)(e),s=(0,u.readColormapColor)(e,a===null?i:[a,...i]);return(s===null?[{label:n("editor.overlayMenu.lowColor"),color:(0,u.readDivergingColor)(e,"low"),buildRange:c=>(0,u.buildDivergingRange)(e,"low",c)},{label:n("editor.overlayMenu.highColor"),color:(0,u.readDivergingColor)(e,"high"),buildRange:c=>(0,u.buildDivergingRange)(e,"high",c)}]:[{label:n("editor.overlayMenu.fillColor"),color:s,buildRange:c=>(0,u.buildColormapRange)(e,c)}]).map(({label:c,color:d,buildRange:h})=>{if(d===null)return null;const p=(m,g)=>{const v=h(m);v!==null&&(o(m),t.dispatch(new u.SetScaleRangeCommand({scaledAesthetic:"color",range:v}),g?{transient:!0}:void 0))};return(0,r.jsx)(Ya,{label:c,palette:i,selectedColor:d,paint:p,commit:()=>t.commit()},c)})},io=({lineStyle:e,...t})=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 18 18",...t,children:[e==="solid"&&(0,r.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:2}),e==="dashed"&&(0,r.jsx)("path",{d:"M1 9h4m2 0h4m2 0h4",stroke:"currentColor",strokeWidth:2}),e==="dotted"&&(0,r.jsxs)("g",{fill:"currentColor",children:[(0,r.jsx)("circle",{cx:2.4,cy:9,r:1.4}),(0,r.jsx)("circle",{cx:9,cy:9,r:1.4}),(0,r.jsx)("circle",{cx:15.6,cy:9,r:1.4})]})]}),so=({lineWidth:e,...t})=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("path",{d:"M2 9h14",stroke:"currentColor",strokeWidth:e})}),Cc={small:2,medium:3.8,large:5.6},wc=({pointSize:e,...t})=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("circle",{cx:9,cy:9,r:Cc[e],fill:"currentColor"})});var jc=({symbol:e,...t})=>{const n=(0,u.buildPointSymbolInBox)(e,12,12),a=18/2;return(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("path",{d:n.path,fill:"currentColor",transform:`translate(${a+n.offsetX} ${a+n.offsetY})`})})},Tc="_1yjsaqt0",kc="_1yjsaqt1",Ac="_1yjsaqt2",Lc="_1yjsaqt3";var $f=512*1024,Pc=e=>new Promise(t=>{if(e.size>524288){t({rejection:"oversized"});return}if(!e.type.startsWith("image/")){t({rejection:"undecodable"});return}const n=new FileReader;n.onerror=()=>t({rejection:"undecodable"}),n.onload=()=>{const a=n.result;if(typeof a!="string"||!a.startsWith("data:image/")){t({rejection:"undecodable"});return}const o=new Image;o.onload=()=>t({image:a}),o.onerror=()=>t({rejection:"undecodable"}),o.src=a},n.readAsDataURL(e)}),ir=["solid","dashed","dotted"],Ot=[{name:"thin",widthPx:2},{name:"medium",widthPx:3},{name:"thick",widthPx:5}],_t=[{name:"small",sizePx:6},{name:"medium",sizePx:8},{name:"large",sizePx:10}],Ic=["circle","square","diamond","triangle","cross","star"],lo=({widthPx:e,onChange:t})=>{const n=l.useI18n(),{ToggleGroup:a}=D(),o=i=>{const s=Ot.find(({name:c})=>c===i);s!==void 0&&t(s.widthPx)};return(0,r.jsx)(I,{label:n("editor.graphPanel.lineThickness.label"),children:(0,r.jsx)(a,{value:Ot.find(i=>i.widthPx===e)?.name??"",options:Ot.map(({name:i,widthPx:s})=>({value:i,label:n(`editor.graphPanel.gridSection.lineWidths.${i}`),icon:(0,r.jsx)(so,{lineWidth:s})})),onChange:o})})},co=({lineStyle:e,onChange:t})=>{const n=l.useI18n(),{ToggleGroup:a}=D(),o=i=>{const s=ir.find(c=>c===i);s!==void 0&&t(s)};return(0,r.jsx)(I,{label:n("editor.fineTunePanel.lineStyleSection.title"),children:(0,r.jsx)(a,{value:e??"",options:ir.map(i=>({value:i,label:n(`editor.graphPanel.gridSection.lineStyles.${i}`),icon:(0,r.jsx)(io,{lineStyle:i})})),onChange:o})})},yn=({symbol:e,coordType:t,onChange:n})=>{const a=l.useI18n(),{RadioGrid:o}=D(),[i,s]=(0,f.useState)(null),c=(0,f.useContext)(wt),d=l.useGlyphRegistry(),h=l.useGeomRendererResolver(),p=c?c.getPointSymbols(t):h("point",t)?.symbols,m=c?new Map(c.getGlyphs().map(({name:A,definition:E})=>[A,E])):d;if(p===void 0||p.length===0)return null;const g=A=>typeof A=="string"&&p.includes(A),v=A=>g(A)||(0,u.isImageSymbol)(A)||!(0,u.isGeometricSymbol)(A)&&m.has(A),x=A=>!(0,u.isGeometricSymbol)(A)||Ic.some(E=>E===A),b=[...m.keys()].filter(A=>!(0,u.isGeometricSymbol)(A)&&!g(A)),y=[...p.filter(x),...b],k=e===null?"":We(e),w=e===null||y.some(A=>We(A)===k)||!v(e)?y:[...y,e],j=A=>(0,u.isGeometricSymbol)(A)?a(`editor.graphPanel.pointSymbol.symbols.${A}`):(0,u.isImageSymbol)(A)?a("editor.graphPanel.pointSymbol.custom"):A,P=A=>{s(null);const E=w.find(O=>We(O)===A);E!==void 0&&n(E)};return(0,r.jsx)(I,{label:a("editor.graphPanel.pointSymbol.label"),layout:"stack",children:(0,r.jsxs)("div",{className:Tc,children:[(0,r.jsxs)("div",{className:kc,children:[(0,r.jsx)(o,{itemLayout:"chip",value:k,options:w.map(A=>({value:We(A),label:j(A),icon:(0,r.jsx)(Mc,{symbol:A,glyphs:m})})),onChange:P}),(0,r.jsxs)("span",{className:Is,children:[(0,r.jsx)("span",{className:Es,"aria-hidden":"true"}),(0,r.jsx)(Ec,{label:a("editor.graphPanel.pointSymbol.custom"),onChange:A=>{s(null),n(A)},onReject:s})]})]}),i!==null&&(0,r.jsx)("p",{className:"_1yjsaqt4",role:"status",children:a(`editor.graphPanel.pointSymbol.${i}`)})]})})},Cn=({sizePx:e,onChange:t})=>{const n=l.useI18n(),{ToggleGroup:a}=D(),o=i=>{const s=_t.find(({name:c})=>c===i);s!==void 0&&t(s.sizePx)};return(0,r.jsx)(I,{label:n("editor.graphPanel.pointSize.label"),children:(0,r.jsx)(a,{value:_t.find(i=>i.sizePx===e)?.name??"",options:_t.map(({name:i})=>({value:i,label:n(`editor.graphPanel.pointSize.sizes.${i}`),icon:(0,r.jsx)(wc,{pointSize:i})})),onChange:o})})},Ec=({label:e,onChange:t,onReject:n})=>{const{FileInput:a}=D(),o=i=>{Pc(i).then(s=>{"image"in s?t({image:s.image}):n(s.rejection)})};return(0,r.jsx)(a,{variant:"chip",label:e,accept:"image/*",onFile:o})},Mc=({symbol:e,glyphs:t})=>{if((0,u.isGeometricSymbol)(e))return(0,r.jsx)(jc,{symbol:e});const n=Rc(e,t);if(n!==null&&l.tintsGlyphImage(n))return(0,r.jsx)("span",{className:Lc,style:{maskImage:`url(${JSON.stringify(n)})`}});if(n!==null)return(0,r.jsx)("img",{className:Ac,src:n,alt:""});const a=18/2;return(0,r.jsx)("svg",{viewBox:`${-a} ${-a} 18 18`,width:16,height:16,"aria-hidden":"true",children:(0,r.jsx)(l.GlyphMark,{symbol:e,glyphs:t,size:12,fill:"currentColor"})})},We=e=>typeof e=="string"?e:e.image,Rc=(e,t)=>{if((0,u.isImageSymbol)(e))return e.image;const n=t.get(e);return n!==void 0&&typeof n!="function"&&"image"in n?n.image:null},uo=(0,f.createContext)({}),Oc=uo.Provider,_c=()=>(0,f.useContext)(uo),Nc="_1qh3fon0",Xt="theme",Dc=3,Ue=14,sr=9,ho=()=>{const e=l.useSceneSelector(p=>p.scales.color),t=_c(),n=l.useGraphCommands(),a=l.useI18n(),{RadioGrid:o}=D();if(Object.keys(t).length===0||e?.kind!=="visual"||e.spec.scaleType!=="discrete"||e.defaultPalette===void 0)return null;const{defaultPalette:i,spec:s}=e,c=Object.entries(t),d=[{value:Xt,label:a("editor.overlayMenu.themePalette"),icon:(0,r.jsx)(lr,{colors:i})},...c.map(([p,m])=>({value:Yt(p),label:p,icon:(0,r.jsx)(lr,{colors:m})}))],h=p=>{const m=c.find(([v])=>Yt(v)===p);if(p!==Xt&&m===void 0)return;const g=m===void 0?null:[...m[1]];n.dispatch(new u.SetScaleRangeCommand({scaledAesthetic:"color",range:g}),{transient:!0})};return(0,r.jsx)(I,{label:a("editor.overlayMenu.palette"),layout:"stack",children:(0,r.jsx)(o,{options:d,value:Fc(s.range,c),onChange:h,onCommit:n.commit,columns:4,itemLayout:"track"})})},Yt=e=>`preset:${e}`,Fc=(e,t)=>{if(e===null)return Xt;const n=t.find(([,a])=>(0,fe.isEqual)(a,e));return n===void 0?"":Yt(n[0])},lr=({colors:e})=>{const t=e.slice(0,Dc),n=Ue/2,a=Ue+(t.length-1)*sr;return(0,r.jsx)("svg",{width:a,height:Ue,viewBox:`0 0 ${a} ${Ue}`,"aria-hidden":"true",children:t.map((o,i)=>(0,r.jsx)("circle",{className:Nc,cx:n+i*sr,cy:n,r:n-.5,fill:o},i)).reverse()})},cr=["smooth","linear"],wn=()=>{const e=l.useSceneSelector(C=>C),t=l.useStyleReaderTree(),n=l.useDataLabelPlacementResolver(),a=l.useGraphCommands(),o=l.useI18n(),{Switch:i,ToggleGroup:s}=D(),c=po(e.layers,e.coordSystem.type,n),d=C=>c.filter(({support:S})=>C(S)).map(({layer:S})=>S),h=Bc(e,t),p=h.filter(C=>C.smooth!==null),m=h.filter(C=>C.missingValues!==null&&C.missingValueOptions.length>1),g=Kt.filter(C=>m.some(S=>S.missingValueOptions.includes(C))),v=Vc(p),x=$c(m),b=C=>{a.dispatch(new u.SequenceCommand({commands:h.map(S=>new u.ToggleLinePointsCommand({layerId:S.layerId,showPoints:C}))}))},y=C=>{const S=cr.find(M=>M===C);S!==void 0&&a.dispatch(new u.SequenceCommand({commands:p.map(M=>new u.SetLineCurveCommand({layerId:M.layerId,curve:S}))}))},k=C=>{const S=Kt.find(N=>N===C);if(S===void 0)return;const M=m.filter(N=>N.missingValueOptions.includes(S)).map(N=>new u.SetLineMissingValuesCommand({layerId:N.layerId,missingValues:S}));M.length!==0&&a.dispatch(new u.SequenceCommand({commands:M}))},w=h.filter(C=>C.showFill!==null),j=h.filter(C=>C.showPoints),P=Gc(e,t,h),A=w.some(C=>zc(e,C)),E=C=>{C.length>0&&a.dispatch(new u.SequenceCommand({commands:C}))},O=C=>{E(h.map(S=>new u.SetLineStyleCommand({layerId:S.layerId,strokeWidth:C})))},T=C=>{E(h.map(S=>new u.SetLineStyleCommand({layerId:S.layerId,lineStyle:C})))},R=C=>{E(w.map(S=>new u.SetLineStyleCommand({layerId:S.layerId,showFill:C,drawnFillAlpha:S.drawnFillAlpha})))},L=C=>{E(j.flatMap(({pointLayerId:S})=>S===null?[]:[new u.SetPointSizeCommand({layerId:S,size:C})]))};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(fc,{}),(0,r.jsx)(qe,{label:o("editor.graphPanel.graphOptions.dataLabels"),layers:d(C=>C.supportsDataLabels),isOn:C=>C.showDataLabels,buildCommand:(C,S)=>new u.ToggleDataLabelsCommand({layerId:C,showDataLabels:S})}),(0,r.jsx)(qe,{label:o("editor.graphPanel.graphOptions.showPercentages"),layers:d(C=>C.supportsPercentages),isOn:C=>C.format==="percentage",buildCommand:(C,S)=>new u.SetDataLabelsFormatCommand({layerId:C,format:S?"percentage":"absolute"})}),(0,r.jsx)(qe,{label:o("editor.graphPanel.graphOptions.stackTotals"),layers:d(C=>C.supportsStackTotals),isOn:C=>C.showStackTotals,buildCommand:(C,S)=>new u.ToggleStackTotalsCommand({layerId:C,showStackTotals:S})}),(0,r.jsx)(qe,{label:o("editor.graphPanel.graphOptions.categoryLabels"),layers:d(C=>C.supportsCategoryLabels),isOn:C=>C.showCategoryLabels,buildCommand:(C,S)=>new u.ToggleCategoryLabelsCommand({layerId:C,showCategoryLabels:S})}),(0,r.jsx)(I,{label:o("editor.elementsPanel.headerSection.toggleTitle"),children:(0,r.jsx)(i,{checked:e.config.content.showTitle,onChange:C=>a.dispatch(new u.ToggleContentVisibilityCommand({part:"title",visible:C}))})}),(0,r.jsx)(I,{label:o("editor.elementsPanel.headerSection.subtitle"),children:(0,r.jsx)(i,{checked:e.config.content.showSubtitle,onChange:C=>a.dispatch(new u.ToggleContentVisibilityCommand({part:"subtitle",visible:C}))})}),(0,r.jsx)(I,{label:o("editor.elementsPanel.footerSection.caption"),children:(0,r.jsx)(i,{checked:e.config.content.showCaption,onChange:C=>a.dispatch(new u.ToggleContentVisibilityCommand({part:"caption",visible:C}))})}),p.length>0&&(0,r.jsx)(I,{label:o("editor.graphPanel.graphOptions.smoothLines"),children:(0,r.jsx)(s,{value:v,options:cr.map(C=>({value:C,label:o(`editor.graphPanel.graphOptions.curves.${C}`),icon:(0,r.jsx)(Rl,{curve:C})})),onChange:y})}),g.length>1&&(0,r.jsx)(I,{label:o("editor.fineTunePanel.detailSection.missingValues"),children:(0,r.jsx)(s,{value:x,options:g.map(C=>({value:C,label:Qa(o,C),icon:(0,r.jsx)(_l,{missingValues:C})})),onChange:k})}),h.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lo,{widthPx:Nt(P.map(C=>C.strokeWidth)),onChange:O}),(0,r.jsx)(co,{lineStyle:Nt(P.map(C=>C.lineStyle)),onChange:T})]}),w.length>0&&(0,r.jsx)(I,{label:o("editor.graphPanel.graphOptions.lineFill"),children:(0,r.jsx)(i,{checked:A,onChange:R})}),h.length>0&&(0,r.jsx)(I,{label:o("editor.graphPanel.graphOptions.showPoints"),children:(0,r.jsx)(i,{checked:j.length>0,onChange:b})}),j.length>0&&(0,r.jsx)(Cn,{sizePx:Nt(Hc(e,t,j)),onChange:L}),(0,r.jsx)(ho,{}),(0,r.jsx)(yc,{})]})};wn.hasRows=(e,{scene:t,dataLabelPlacement:n})=>(0,u.readGraphType)(t.spec)!==null||po(t.layers,t.coordSystem.type,n).some(({support:a})=>a.supportsDataLabels)||t.spec.layers.some(a=>a.interactive&&(0,u.isLayerSpecOf)(a,"line","area"));var po=(e,t,n)=>e.filter(a=>a.interactive).map(a=>({layer:a,support:Ja(a,t,n)})),Bc=(e,t)=>{const n=[];for(const a of e.spec.layers){if(!a.interactive)continue;const o=Sn(e,t,a.id);o!==null&&n.push(o)}return n},Gc=(e,t,n)=>n.flatMap(a=>{const o=(0,u.findLayerById)(e.layers,a.layerId);if(o?.geom==="line"){const s=t.geom.line(o);return Array.from(o.data,c=>({strokeWidth:s.get("strokeWidth",c),lineStyle:(0,u.toDashPreset)(s.get("dashArray",c))}))}if(o?.geom!=="area")return[];const i=t.geom.area(o);return Array.from(o.data,s=>({strokeWidth:i.get("strokeWidth",s),lineStyle:(0,u.toDashPreset)(i.get("dashArray",s))}))}),zc=(e,t)=>{if(t.showFill===!0)return!0;const n=(0,u.buildLayerStyleAddress)("line",t.layerId),a=(0,u.readStyleCoord)(e.spec);return e.spec.styles.overrides.some(o=>!(0,u.isGeomStyleRule)(o)||o.when?.where===void 0?!1:(0,u.createStyleRuleMatcher)({...n,when:o.when},a)(o)&&"fillAlpha"in o.declarations&&(o.declarations.fillAlpha??0)>0)},Hc=(e,t,n)=>n.flatMap(a=>{const o=a.pointLayerId===null?void 0:(0,u.findLayerById)(e.layers,a.pointLayerId);if(o?.geom!=="point")return[];const i=t.geom.point(o);return Array.from(o.data,s=>i.get("size",s)).filter(s=>s>0)}),Nt=e=>{const[t]=e;return t!==void 0&&e.every(n=>n===t)?t:null},Vc=e=>e.every(t=>t.smooth===!0)?"smooth":e.every(t=>t.smooth!==!0)?"linear":"",$c=e=>{const[t,...n]=e,a=t?.missingValues??null;return a===null?"":n.every(o=>o.missingValues===a)?a:""},qe=({label:e,layers:t,isOn:n,buildCommand:a})=>{const o=l.useGraphCommands(),{Switch:i}=D();if(t.length===0)return null;const s=c=>{o.dispatch(new u.SequenceCommand({commands:t.map(d=>a(d.id,c))}))};return(0,r.jsx)(I,{label:e,children:(0,r.jsx)(i,{checked:t.some(c=>n(c.dataLabels)),onChange:s})})},Wc=(e,t)=>{const n=(0,u.findLayerById)(t.layers,e);if(n===void 0)return null;const a=(0,u.findLayerById)(t.spec.layers,e),o=a===void 0?null:(0,u.findHostLayer)(a,t.spec.layers),i=o!==null&&o.id!==n.id?o:n;return{geom:i.geom,coord:t.spec.coords.coordType,position:i.position}},Ke=(e,t)=>{for(const n of e){const a=t(n);if(a!==void 0)return a}return null},Uc=({geom:e,coord:t,position:n},a,o="style",i=null)=>{for(const s of a){const c=dr(ur(s.layers,e)?.[t]?.[n],o),d=c!==void 0?c:dr(ur(s.geoms,e),o);if(d===null)return null;if(d!==void 0)return d}return i},qc=e=>typeof e=="object"&&("style"in e||"annotate"in e),dr=(e,t)=>e==null?e:qc(e)?e[t]:t==="style"?e:void 0,ur=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,ut=["solid","dashed","dotted"];var mo=e=>e.scaledAesthetic==="x"||e.scaledAesthetic==="y",go=(e,t)=>{const n=e.guides.axes.filter(mo);if(n.length===0)return null;const a=t.gridLine.y().resolve();return{axes:n,stylable:e.coordSystem.type!=="polar",lineStyle:(0,u.toDashPreset)(a.dashArray),strokeWidth:a.strokeWidth}},Kc=(e,t)=>{if(e==="both")return t.axes.every(a=>!a.showGrid);const n=t.axes.find(a=>a.scaledAesthetic===e);return n===void 0||!n.showGrid},vo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,lineStyle:e}),fo=(e,t="both")=>new u.SetGridLineStyleCommand({axis:t,strokeWidth:e}),Dt=[{name:"thin",widthPx:1},{name:"medium",widthPx:2},{name:"thick",widthPx:4}],jn=({target:e})=>{const t=l.useSceneSelector(y=>y),n=l.useStyleReaderTree(),a=go(t,n),o=l.useI18n(),i=l.useGraphCommands(),{ToggleGroup:s}=D();if(a===null||!a.stylable)return null;const c=e.axis==="both"?"y":e.axis,d=n.gridLine[c]().resolve(),h=(0,u.toDashPreset)(d.dashArray),p=Kc(e.axis,a),m=ut.map(y=>({value:y,label:o(`editor.graphPanel.gridSection.lineStyles.${y}`),icon:(0,r.jsx)(io,{lineStyle:y})})),g=Dt.map(({name:y,widthPx:k})=>({value:y,label:o(`editor.graphPanel.gridSection.lineWidths.${y}`),icon:(0,r.jsx)(so,{lineWidth:k})})),v=Dt.find(({widthPx:y})=>y===d.strokeWidth)?.name??"",x=y=>{const k=ut.find(w=>w===y);k!==void 0&&i.dispatch(vo(k,e.axis))},b=y=>{const k=Dt.find(({name:w})=>w===y);k!==void 0&&i.dispatch(fo(k.widthPx,e.axis))};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I,{label:o("editor.graphPanel.gridSection.gridStyle"),children:(0,r.jsx)(s,{value:h,options:m,onChange:x,disabled:p})}),(0,r.jsx)(I,{label:o("editor.graphPanel.gridSection.gridThickness"),children:(0,r.jsx)(s,{value:v,options:g,onChange:b,disabled:p})})]})};jn.hasRows=(e,{scene:t})=>{if(t.coordSystem.type==="polar")return!1;const n=t.guides.axes.filter(mo);return n.length===0?!1:e.axis==="both"?!0:n.some(a=>a.scaledAesthetic===e.axis)};var hr=[{position:"top",align:"start",gridRow:1,gridColumn:1},{position:"top",align:"center",gridRow:1,gridColumn:2},{position:"top",align:"end",gridRow:1,gridColumn:3},{position:"right",align:"center",gridRow:2,gridColumn:3},{position:"bottom",align:"end",gridRow:3,gridColumn:3},{position:"bottom",align:"center",gridRow:3,gridColumn:2},{position:"bottom",align:"start",gridRow:3,gridColumn:1},{position:"left",align:"center",gridRow:2,gridColumn:1}],Xc={start:"Start",center:"Center",end:"End"},xo=()=>{const e=l.useSceneSelector(d=>d.guides.legends.drawn[0]),t=l.useGraphCommands(),n=l.useI18n(),{RadioGrid:a}=D(),o=e===void 0,i=o?"":Ft(e),s=hr.map(d=>{const h=Ft(d);return{value:h,label:n(`editor.overlayMenu.legendPlaces.${h}`),icon:(0,r.jsx)(l.ArrowIcon,{title:"",size:"xs",style:{transform:`rotate(${Yc(d)}deg)`}}),gridRow:d.gridRow,gridColumn:d.gridColumn}}),c=d=>{const h=hr.find(p=>Ft(p)===d);h!==void 0&&t.dispatch(new u.SetLegendPlacementCommand({position:h.position,align:h.align}),{transient:!0})};return(0,r.jsx)(I,{label:n("editor.axesPanel.controls.position"),children:(0,r.jsx)(gn.DirectionProvider,{direction:"ltr",children:(0,r.jsx)("div",{dir:"ltr",children:(0,r.jsx)(a,{options:s,value:i,onChange:c,onCommit:t.commit,columns:3,itemLayout:"icon",disabled:o})})})})},Ft=({position:e,align:t})=>e==="left"||e==="right"?e:`${e}${Xc[t]}`,Yc=({gridRow:e,gridColumn:t})=>Math.atan2(t-2,2-e)*180/Math.PI,bo=(e,t,n,a)=>{const o=yo(e,n,a)?.size;if(typeof o=="number")return o;const i=(0,u.findLayerById)(e.layers,n);return i?.geom==="point"?t.geom.point(i).get("size"):u.DEFAULT_POINT_SIZE_PX},So=(e,t,n,a)=>{const o=yo(e,n,a)?.symbol;if(o!==void 0)return o;const i=(0,u.findLayerById)(e.layers,n);return i?.geom==="point"?t.geom.point(i).get("symbol"):"circle"},yo=(e,t,n)=>n===void 0?void 0:(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("point",t),when:{where:n}},(0,u.readStyleCoord)(e.spec)),ht=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,r.jsx)(Zc,{graph:t,target:e})};ht.hasRows=(e,{scene:t})=>e.scope==="group"&&Co(t,e.layerId)!==null;var Zc=({graph:e,target:t})=>{const n=l.useHandleScene(e),a=l.useStyleReaderTree(),o=l.useI18n(),{Switch:i}=D(),s=n===null?null:Co(n,t.layerId),c=n===null||s===null?null:Sn(n,a,s.id);if(n===null||s===null||c===null)return null;const d=td(n,t),h=d===void 0?{}:{where:d},p=d===void 0||s.geom!=="line"?void 0:ed(n,c.layerId,d),m=p===void 0?c.showFill:p>0,g=d===void 0?null:Jc(n,s.geom,c.layerId,d),v=d===void 0?c.strokeWidth:g??Qc(n,a,t)??c.strokeWidth,x=c.pointLayerId===null?null:bo(n,a,c.pointLayerId,d),b=c.pointLayerId===null?null:So(n,a,c.pointLayerId,d),y=x!==null&&x>0,k=T=>{e.commands.dispatch(new u.ToggleLinePointsCommand({layerId:c.layerId,showPoints:T,...h}))},w=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,showFill:T,drawnFillAlpha:c.drawnFillAlpha,...h}))},j=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,strokeWidth:T,...h}))},P=T=>{c.pointLayerId!==null&&e.commands.dispatch(new u.SetPointSizeCommand({layerId:c.pointLayerId,size:T,...h}))},A=T=>{c.pointLayerId!==null&&e.commands.dispatch(new u.SetPointSymbolCommand({layerId:c.pointLayerId,symbol:T,...h}))},E=T=>{e.commands.dispatch(new u.SetLineStyleCommand({layerId:c.layerId,lineStyle:T,...h}))},O=(0,u.readObservationsColorRoute)(n.spec,t)?.some(T=>T.geomKind==="line"||T.geomKind==="area")===!0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ce,{target:t}),(0,r.jsx)(lo,{widthPx:v,onChange:j}),O&&(0,r.jsx)(co,{lineStyle:nd(n,a,t),onChange:E}),c.showFill!==null&&(0,r.jsx)(I,{label:o("editor.graphPanel.graphOptions.lineFill"),children:(0,r.jsx)(i,{checked:m===!0,onChange:w})}),(0,r.jsx)(I,{label:o("editor.graphPanel.graphOptions.showPoints"),children:(0,r.jsx)(i,{checked:y,onChange:k})}),y&&(0,r.jsx)(Cn,{sizePx:x,onChange:P}),y&&(0,r.jsx)(yn,{symbol:b,coordType:n.coordSystem.type,onChange:A})]})},Jc=(e,t,n,a)=>{const o=(t==="line"?(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",n),when:{where:a}},(0,u.readStyleCoord)(e.spec)):(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("area",n),when:{where:a}},(0,u.readStyleCoord)(e.spec)))?.strokeWidth;return typeof o=="number"?o:null},Qc=(e,t,n)=>{const a=(0,u.findLayerById)(e.layers,n.layerId),o=a===void 0?void 0:(0,u.findHostLayer)(a,e.layers);if(o?.geom!=="line"&&o?.geom!=="area")return null;const[i]=(0,u.resolveObservationsTarget)({layer:o,target:n,parsingLocale:e.config.parsingLocale}),s=i===void 0?void 0:o.data.getAt(i)??void 0,c=o.geom==="line"?t.geom.line(o).get("strokeWidth",s):t.geom.area(o).get("strokeWidth",s);return typeof c=="number"?c:null},ed=(e,t,n)=>{const a=(0,u.findKindStyleDeclarations)(e.spec.styles.overrides,{...(0,u.buildLayerStyleAddress)("line",t),when:{where:n}},(0,u.readStyleCoord)(e.spec))?.fillAlpha;return typeof a=="number"?a:void 0},td=(e,t)=>(0,u.readObservationsColorRoute)(e.spec,t)?.find(n=>n.geomKind==="line"||n.geomKind==="area")?.where,nd=(e,t,n)=>{const a=(0,u.findLayerById)(e.layers,n.layerId),o=a===void 0?void 0:(0,u.findHostLayer)(a,e.layers);if(o?.geom!=="line"&&o?.geom!=="area")return"solid";const[i]=(0,u.resolveObservationsTarget)({layer:o,target:n,parsingLocale:e.config.parsingLocale}),s=i===void 0?null:o.data.getAt(i);return(0,u.toDashPreset)(o.geom==="line"?t.geom.line(o).get("dashArray",s??void 0):t.geom.area(o).get("dashArray",s??void 0))},Co=(e,t)=>{const n=(0,u.findLayerById)(e.spec.layers,t);if(n===void 0)return null;const a=(0,u.findHostLayer)(n,e.spec.layers);return(0,u.isLayerSpecOf)(a,"line","area")?a:null},wo=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.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,r.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,r.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"})]}),rd="_1aafi1g0",ad="_1aafi1g1",pr=({children:e})=>(0,r.jsxs)("span",{className:rd,"aria-hidden":"true",children:[e,(0,r.jsx)("span",{className:ad})]}),Bt=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 15 14",...e,children:(0,r.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"})}),mr=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("path",{opacity:"0.12",d:"M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",fill:"currentColor",fillOpacity:"0.8"}),(0,r.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"})]}),jo=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.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,r.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,r.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"})]}),To=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.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,r.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,r.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,r.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,r.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"})]}),od=e=>{const t=[{scope:"observation",labelKey:"bar"}];if(!(0,u.hasMultipleGroups)(e.data,e.mapping))return t;const n=e.position==="stack"||e.position==="fill";return t.push({scope:"xValue",labelKey:n?"barStack":"barGroup"}),t.push({scope:"group",labelKey:"barSeries"}),t},ko=e=>{const t=[{scope:"observation",labelKey:"linePoint"}];return(0,u.hasMultipleGroups)(e.data,e.mapping)&&t.push({scope:"group",labelKey:"lineSeries"}),t},Ao=e=>{const t=[{scope:"observation",labelKey:"scatterPoint"}];return(0,u.hasMultipleGroups)(e.data,e.mapping)&&t.push({scope:"group",labelKey:"scatterSeries"}),t},id=()=>[{scope:"group",labelKey:"pieSlice"}];function sd(e,t){if(e.type==="polar"&&!ld(t))return id();switch(t.geom){case"bar":return od(t);case"line":case"area":return ko(t);case"point":return Ao(t);default:return[]}}var ld=e=>{const t=(0,u.readVariableName)(e.mapping.x);return t!==null&&t!==u.CONSTANT_VARIABLES.x},cd=(e,t,n,a)=>{const o=[],i=dd(e,t,n,a);i!==null&&o.push({id:"gte",valueLabel:i.label,predicate:{variable:i.variable,gte:i.value}});const s=ud(e,t,n,a);return s!==null&&o.push({id:"onward",categoryLabel:s.label,predicate:s.predicate}),o},Lo=(e,t)=>{const n=t.find(a=>Tn(e.predicate,a.predicate));return n===void 0?e.scope:n.id},dd=(e,t,n,a)=>{const o=(0,u.readVariableName)(e.mapping.y),i=(0,u.readVariableName)(e.mapping.x);if(o===null||i===null||i===u.CONSTANT_VARIABLES.x||!e.data.hasVariable(o)||e.data.getType(o)!=="numeric")return null;const s=Po(t,o);return s===null||!gd(e,o,s)?null:{variable:o,value:s,label:Io(e,o,s,n,a)}},ud=(e,t,n,a)=>{const o=(0,u.readVariableName)(e.mapping.x);if(o===null||o===u.CONSTANT_VARIABLES.x||!e.data.hasVariable(o)||e.data.getType(o)==="numeric")return null;const i=t[o]??null;if(i===null)return null;const s=hd(e,t);if(s===null)return null;const c=pd(e,o,s),d=c.findIndex(m=>Ne(m)===Ne(i));if(d<0||d>=c.length-1)return null;const h={variable:o,oneOf:c.slice(d)},p=s.length===0?h:{and:[h,...s]};return{label:Io(e,o,i,n,a),predicate:p}},hd=(e,t)=>{const n=[];for(const a of(0,u.getGroupVariables)(e.data,e.mapping)){const o=t[a]??null;if(o===null)return null;n.push({variable:a,eq:o})}return n},pd=(e,t,n)=>{const a=new Map;for(let o=0;o<e.data.size();o+=1){const i=e.data.getAt(o);if(i===null||!md(i,n))continue;const s=i[t]??null;if(s===null)continue;const c=i[u.POSITION_VARIABLES.x],d=typeof c=="number"?c:o,h=Ne(s),p=a.get(h);(p===void 0||d<p.position)&&a.set(h,{value:s,position:d})}return[...a.values()].sort((o,i)=>o.position-i.position).map(o=>o.value)},md=(e,t)=>t.every(n=>Ne(e[n.variable]??null)===Ne(n.eq)),gd=(e,t,n)=>{for(let a=0;a<e.data.size();a+=1){const o=e.data.getAt(a);if(o===null)continue;const i=Po(o,t);if(i!==null&&i>n)return!0}return!1},Po=(e,t)=>{const n=e[u.POSITION_VARIABLES.yRaw],a=typeof n=="number"?n:e[t];return typeof a=="number"&&Number.isFinite(a)?a:null},Io=(e,t,n,a,o)=>{const i=(0,u.createValueFormatter)({valueFormat:e.data.getValueFormat(t),locale:a,numberFormat:o})(n);return i.length>0?i:String(n)},Ne=e=>e instanceof Date?String(e.getTime()):String(e),Tn=(e,t)=>"and"in e||"and"in t?"and"in e&&"and"in t&&gr(e.and,t.and):"or"in e||"or"in t?"or"in e&&"or"in t&&gr(e.or,t.or):"not"in e||"not"in t?"not"in e&&"not"in t&&Tn(e.not,t.not):e.variable!==t.variable?!1:"eq"in e||"eq"in t?"eq"in e&&"eq"in t&&ye(e.eq,t.eq):"oneOf"in e||"oneOf"in t?"oneOf"in e&&"oneOf"in t&&vr(e.oneOf,t.oneOf):"lt"in e||"lt"in t?"lt"in e&&"lt"in t&&ye(e.lt,t.lt):"lte"in e||"lte"in t?"lte"in e&&"lte"in t&&ye(e.lte,t.lte):"gt"in e||"gt"in t?"gt"in e&&"gt"in t&&ye(e.gt,t.gt):"gte"in e||"gte"in t?"gte"in e&&"gte"in t&&ye(e.gte,t.gte):"range"in e&&"range"in t&&vr(e.range,t.range),gr=(e,t)=>e.length===t.length&&e.every((n,a)=>{const o=t[a];return o!==void 0&&Tn(n,o)}),vr=(e,t)=>e.length===t.length&&e.every((n,a)=>{const o=t[a];return o!==void 0&&ye(n,o)}),ye=(e,t)=>e instanceof Date||t instanceof Date?e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime():e===t,vd=(e,t)=>{const n=l.useSceneSelector(o=>o.spec.highlights),a=l.useSceneSelector(o=>o.config.parsingLocale);return(0,f.useMemo)(()=>(0,u.findHighlightsAtObservation)({layer:e,highlights:n,observation:t,parsingLocale:a}),[e,n,t,a])},fd={pinnedNumber:!0,comment:!0,sticker:!0,image:!1},xd=e=>(0,u.isObservationAttachmentKind)(e.kind)&&fd[e.kind],Tt=(e,t)=>(0,f.useMemo)(()=>{if(e===null)return{options:[],findValue:()=>{}};const{parsingLocale:n,numberFormat:a}=e.config,o=t??n,i=e.guides.colorGroups.map(s=>{const c=(0,u.createValueFormatter)({valueFormat:s.valueFormat,locale:o,numberFormat:a}),d=s.value instanceof Date?s.value.getTime():s.value;return{value:d,option:{value:String(d),label:s.label??c(s.value)}}});return{options:i.map(({option:s})=>s),findValue:s=>i.find(c=>c.option.value===s)?.value}},[e,t]),Eo=({scene:e,layer:t,observation:n,groupOptions:a,locale:o,t:i})=>{const s=Jt(e,t,n,a);return{observation:i(yd(e,t)),xValue:i("editor.overlayMenu.allOf",{name:Mo(e,t,n,o)}),group:s===null?i("editor.overlayMenu.all"):i("editor.overlayMenu.allOf",{name:s})}},Zt=({scene:e,layer:t,observation:n,groupOptions:a,locale:o,t:i},s)=>{const c=(0,u.getGroupVariables)(t.data,t.mapping),d=Mo(e,t,n,o);switch(s){case"observation":{const h=c.length===0?null:Jt(e,t,n,a),p=bd(h,d,i);return{whole:p,value:p}}case"xValue":return fr((0,u.findAxisGuide)(e.guides,"x")?.label??null,d,i);case"group":{const h=Jt(e,t,n,a)??i("editor.overlayMenu.all");return fr(Sd(e,c),h,i)}default:return s}},bd=(e,t,n)=>e===null?t:t===""?e:n("editor.overlayMenu.groupAtBand",{group:e,band:t}),fr=(e,t,n)=>({whole:e===null||e===""?t:n("editor.overlayMenu.titledValue",{title:e,value:t}),value:t}),Sd=(e,t)=>{const[n,...a]=t;return n===void 0||a.length>0?null:e.guides.variableLabels[n]??null},yd=(e,t)=>{switch(t.geom){case"bar":return e.coordSystem.type==="polar"&&e.coordSystem.bandAxis===null?"editor.overlayMenu.thisSlice":"editor.overlayMenu.thisBar";case"point":return(0,u.readVariableName)(t.mapping.size)===null?"editor.overlayMenu.thisPoint":"editor.overlayMenu.thisBubble";default:return"editor.overlayMenu.thisPoint"}},Mo=(e,t,n,a)=>{const o=(0,u.findAxisGuide)(e.guides,"x");return(0,u.createValueFormatter)({valueFormat:o===null?{type:"text"}:(0,u.resolveLayerAxisValueFormat)(o,t.id),locale:a,numberFormat:e.config.numberFormat})((0,u.createXValueReader)(t.data,t.mapping)(n),n)},Jt=(e,t,n,a)=>{const o=(0,u.getGroupVariables)(t.data,t.mapping);return o.length===0?Cd(t,n)??wd(e,t):o.map(i=>jd(n[i]??null,a)).join(", ")},Cd=(e,t)=>{const n=(0,u.readColorPart)(e,t);return n===void 0?void 0:e.styles.parts[n]?.label},wd=(e,t)=>{const n=(0,u.readVariableName)(t.mapping.y),a=n===null?void 0:e.guides.variableLabels[n];return a===void 0||a===""?null:a},jd=(e,t)=>{const n=String(e instanceof Date?e.getTime():e);return t.options.find(a=>a.value===n)?.label??n},Ro="vez73g0",pt="vez73g1",Oo="vez73g2",Td="vez73g3",kd="vez73g4",Ad="vez73g5";var Ld="vez73g7",Pd="vez73g8",Id="vez73g9",_o="vez73ga",No="vez73gb",Do=[Oo,Ld,Ad,kd],Ed=Do.map(e=>`.${e}`).join(", "),Md=Do.flatMap(e=>[`.${e} button`,`.${e} input`]).join(", "),Fo=e=>{const t=e.target;if(!(t instanceof HTMLElement))return;const n=e.currentTarget,a=t.closest(`.${pt}, ${Ed}`),o=t.closest(`.${pt}`)!==null;if((e.key==="ArrowRight"||e.key==="ArrowLeft")&&t instanceof HTMLButtonElement&&a!==null){const i=[...a.querySelectorAll("button")],s=i.indexOf(t);if(s<0)return;e.preventDefault();const c=getComputedStyle(a).direction==="rtl";i[(s+(e.key==="ArrowRight"?1:-1)*(c?-1:1)+i.length)%i.length]?.focus();return}if(e.key==="ArrowDown"&&o){const i=n.querySelector(Md);if(i===null)return;e.preventDefault(),i.focus();return}e.key==="ArrowUp"&&!o&&a!==null&&(e.preventDefault(),n.querySelector('[aria-expanded="true"]')?.focus())},ve={side:"top",delay:200},Bo={pinnedNumber:{phrase:"graph.annotations.baseMenu.unpinNumber",Icon:jo},comment:{phrase:"graph.annotations.baseMenu.removeAnnotation",Icon:wo},sticker:{phrase:"graph.annotations.baseMenu.removeSticker",Icon:To}},Go=new Set(["barSeries","lineSeries","scatterSeries"]),Rd=new Set(["bar","linePoint","scatterPoint","pieSlice"]),kn=e=>{const t=({target:n})=>{const a=ja(n);return a===null?null:(0,r.jsx)(_d,{anchor:a,readHighlightOptions:e})};return t.hasRows=(n,{scene:a})=>wa(n,a)!==null,t},rt=kn((e,t)=>sd(t,e)),xr=kn(ko),Od=kn(Ao),_d=({anchor:e,readHighlightOptions:t})=>{const{layer:n,observation:a,at:o}=e,i=l.useI18n(),{dispatch:s,paintPreview:c,clearPreview:d}=l.useGraphCommands(),{selectionStore:h}=l.useGraphContext(),p=(0,f.useRef)(null),m=(0,f.useRef)(d);m.current=d;const{Button:g}=D(),v=l.useSceneSelector(B=>B),x=v.spec.annotations,b=v.config.parsingLocale,y=v.config.numberFormat,k=l.useFormattingLocale(),w={scene:v,layer:n,observation:a,groupOptions:Tt(v,k),locale:k,t:i},j=Zt(w,"xValue").value,P=Zt(w,"group").value,A=Eo(w).observation,E=(0,u.findObservationAttachment)(x,o,(0,f.useMemo)(()=>(0,u.createObservationAnchorParser)(n,b),[n,b])),O=E!==null&&xd(E)?E:null,T=p.current,R=O!==null&&T?.key.startsWith("sticker:")===!0&&O.kind==="sticker"?null:O,L=R?.kind==="comment"?R.annotation.content:null,C=L===null?"":Xd(L)??void 0,[S,M]=(0,f.useState)(()=>qd(O?.kind)),N=vd(n,a),z=v.coordSystem,H=t(n,z),X=H.length===0?[]:cd(n,a,k,y),Q=(T?.choiceId===void 0?N:N.filter(B=>Lo(B,X)!==T.choiceId)).at(-1),Y=(0,f.useMemo)(()=>(0,u.inferDifferenceArrowEndpoints)({layer:n,at:o,coordSystem:z}),[n,o,z]),oe=Vd({layer:n,observation:a,highlights:N,highlightOptions:H,reaches:X,previewedChoiceId:p.current?.choiceId,scopeLabel:B=>Wd(i,B,j,P,A),scopeDescription:B=>Ud(i,B,br(i,n,H),j,P,H.some(ee=>Go.has(ee.labelKey))),atLeastLabel:B=>i("graph.annotations.highlights.atLeast",{value:B}),atLeastDescription:B=>i("graph.annotations.highlights.atLeastDescription",{noun:br(i,n,H),value:B}),onwardLabel:B=>i("graph.annotations.highlights.onward",{label:B}),onwardDescription:B=>i("graph.annotations.highlights.onwardDescription",{label:B})}),F=()=>{p.current!==null&&(p.current=null,m.current())};(0,f.useEffect)(()=>()=>F(),[]);const $=(B,ee,ge)=>{p.current?.key!==B&&(F(),p.current={key:B,choiceId:ge},c(ee)||(p.current=null))},W=B=>{F(),s(B),h.getState().clearSelection()},te=(B,ee)=>{if(p.current?.key===B){p.current=null,m.current(),s(ee),h.getState().clearSelection();return}W(ee)},Mt=(B,ee,ge)=>({onPointerEnter:()=>$(B,ee,ge),onPointerLeave:F,onClick:()=>te(B,ee)}),be=B=>{F(),M(ee=>ee===B?null:B)},Ae=B=>{if(Y===null)return;F();const ee=(0,u.areAnchorsEqual)(Y.start,o)?Y.end:Y.start,ge=new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,start:o,end:ee,label:B}});s(ge),h.getState().setSelection([{kind:"annotation",id:ge.params.annotation.id}])};return(0,r.jsxs)("div",{className:Ro,role:"toolbar","aria-label":i("graph.annotations.baseMenu.annotate"),onKeyDown:B=>{if(R!==null&&Kd(B)){W(new u.RemoveAnnotationCommand({id:R.annotation.id}));return}Fo(B)},children:[(0,r.jsxs)("div",{className:pt,children:[oe!==null&&(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i("graph.annotations.baseMenu.highlight"),icon:(0,r.jsx)(mr,{}),expanded:S==="highlight",onClick:()=>be("highlight")}),Q!==void 0&&(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i("graph.annotations.baseMenu.removeHighlight"),icon:(0,r.jsx)(pr,{children:(0,r.jsx)(mr,{})}),onClick:()=>W(new u.RemoveHighlightCommand({id:Q.id}))}),R!==null&&(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i(Bo[R.kind].phrase),icon:(0,r.jsx)(pr,{children:Nd(R.kind)}),onClick:()=>W(new u.RemoveAnnotationCommand({id:R.annotation.id}))}),R===null&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i("graph.annotations.baseMenu.pinNumber"),icon:(0,r.jsx)(jo,{}),onClick:()=>W(new u.AddAnnotationCommand({kind:"pinnedNumber",annotation:{at:o}}))}),(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i("graph.annotations.baseMenu.addNote"),icon:(0,r.jsx)(wo,{}),expanded:S==="comment",onClick:()=>be("comment")})]}),Y!==null&&(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i("graph.annotations.baseMenu.differenceArrow"),icon:(0,r.jsx)(Bt,{}),expanded:S==="difference",onClick:()=>be("difference")}),R===null&&(0,r.jsx)(g,{variant:"icon",...ve,ariaLabel:i("graph.annotations.baseMenu.addSticker"),icon:(0,r.jsx)(To,{}),expanded:S==="sticker",onClick:()=>be("sticker")})]}),S==="comment"&&C!==void 0&&(0,r.jsx)("div",{className:"vez73g7",children:(0,r.jsx)(Dd,{at:o,onRun:W,annotationId:R?.kind==="comment"?R.annotation.id:void 0,initialText:C})}),S==="sticker"&&(0,r.jsx)("div",{className:"vez73g2",children:(0,r.jsx)(Fd,{at:o,showPreview:$,dropPreview:F,keepPreview:te,annotationId:R?.kind==="sticker"?R.annotation.id:void 0})}),S==="difference"&&(0,r.jsxs)("div",{className:"vez73g5",children:[(0,r.jsx)(g,{variant:"icon",ariaLabel:i("graph.annotations.differenceArrowToolbar.labelKind.asPercent"),icon:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Bt,{size:"sm"}),(0,r.jsx)("span",{className:"vez73g6","aria-hidden":"true",children:"%"})]}),onClick:()=>Ae("relativeDifference")}),(0,r.jsx)(g,{variant:"icon",ariaLabel:i("graph.annotations.differenceArrowToolbar.labelKind.asNumber"),icon:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Bt,{size:"sm"}),(0,r.jsx)("span",{className:"vez73g6","aria-hidden":"true",children:"+n"})]}),onClick:()=>Ae("absoluteDifference")})]}),S==="highlight"&&oe!==null&&(0,r.jsx)("div",{className:"vez73g4",children:oe.available.map(B=>(0,r.jsx)(g,{label:B.label,tooltip:B.description===B.label?void 0:B.description,...ve,...Mt(Bd(B.id),zd(B,n.id),B.id)},B.id))})]})},Nd=e=>{const t=Bo[e].Icon;return(0,r.jsx)(t,{})},Dd=({at:e,onRun:t,annotationId:n,initialText:a=""})=>{const o=l.useI18n(),{Button:i,TextField:s}=D(),[c,d]=(0,f.useState)(a),h=(0,f.useRef)(null),p=c.trim();(0,f.useEffect)(()=>{h.current?.querySelector("input")?.focus()},[]);const m=()=>{if(p.length===0)return;const g=Yd(p);t(n===void 0?new u.AddAnnotationCommand({kind:"comment",annotation:{at:e,content:g}}):new u.UpdateAnnotationCommand({kind:"comment",id:n,patch:{content:g}}))};return(0,r.jsxs)("form",{ref:h,className:Pd,onSubmit:g=>{g.preventDefault(),m()},children:[(0,r.jsx)("div",{className:Id,children:(0,r.jsx)(s,{value:c,onChange:d,placeholder:o("graph.annotations.textMenu.placeholder")})}),(0,r.jsx)(i,{label:o("graph.annotations.textMenu.addButton"),onClick:m,disabled:p.length===0})]})},Fd=({at:e,showPreview:t,dropPreview:n,keepPreview:a,annotationId:o})=>(0,r.jsx)(r.Fragment,{children:Object.entries(l.STICKER_ASSETS).map(([i,s])=>{const c=Hd(e,i,o);return(0,r.jsx)("button",{type:"button",className:No,"aria-label":i,onPointerEnter:()=>t(c.key,c.command),onPointerLeave:n,onClick:()=>a(c.key,c.command),children:(0,r.jsx)("img",{className:_o,src:s.src,alt:""})},i)})}),Bd=e=>`highlight:${e}`,Gd=e=>`sticker:${e}`,zd=(e,t)=>new u.AddHighlightCommand({predicate:e.predicate,scope:e.scope,layerId:t}),Hd=(e,t,n)=>n===void 0?{key:Gd(t),command:new u.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"observation",...e},sticker:t}})}:{key:`swap:${t}`,command:new u.UpdateAnnotationCommand({kind:"sticker",id:n,patch:{sticker:t}})},Vd=({layer:e,observation:t,highlights:n,highlightOptions:a,reaches:o,previewedChoiceId:i,scopeLabel:s,scopeDescription:c,atLeastLabel:d,atLeastDescription:h,onwardLabel:p,onwardDescription:m})=>{if(e.highlight===null)return null;const g=(0,u.buildObservationPredicate)(e,t),v=new Set(n.flatMap(j=>{const P=Lo(j,o);return P===i?[]:[P]})),x=g===null?[]:a.filter(j=>!v.has(j.scope)).map(j=>{const P=s(j.labelKey);return{id:j.scope,label:P,description:c(j.labelKey),icon:j.labelKey,predicate:g,scope:j.scope}}),b=o.flatMap(j=>v.has(j.id)?[]:[$d(j,d,h,p,m)]),[y,...k]=x,w=y===void 0?b:[y,...b,...k];return w.length===0?null:{available:w}},$d=(e,t,n,a,o)=>{switch(e.id){case"gte":return{id:e.id,label:t(e.valueLabel),description:n(e.valueLabel),icon:null,predicate:e.predicate,scope:"observation"};case"onward":return{id:e.id,label:a(e.categoryLabel),description:o(e.categoryLabel),icon:null,predicate:e.predicate,scope:"observation"};default:return e}},Wd=(e,t,n,a,o)=>{const i=e(`graph.annotations.highlights.labels.${t}`);if(Rd.has(t))return o;if(t==="barGroup"||t==="barStack")return n===""?i:e("editor.overlayMenu.allOf",{name:n});if(!Go.has(t))return i;const s=e("editor.overlayMenu.all");return a===""||a===s?i:e("editor.overlayMenu.allOf",{name:a})},br=(e,t,n)=>{if(t.geom==="point"&&(0,u.readVariableName)(t.mapping.size)!==null)return e("graph.annotations.highlights.nouns.bubble");const a=n.find(o=>o.scope==="observation")??n[0];return e(a===void 0?"graph.annotations.highlights.labels.pointOrBar":`graph.annotations.highlights.labels.${a.labelKey}`)},Ud=(e,t,n,a,o,i)=>{switch(t){case"bar":case"linePoint":case"scatterPoint":case"pieSlice":return!i&&a!==""?e("graph.annotations.highlights.justValue",{label:a}):e("graph.annotations.highlights.justThis",{noun:n});case"barGroup":return a===""?e("graph.annotations.highlights.wholeGroup"):e("graph.annotations.highlights.everyIn",{noun:n,name:a});case"barStack":return a===""?e("graph.annotations.highlights.wholeStack"):e("graph.annotations.highlights.everyIn",{noun:n,name:a});case"barSeries":case"lineSeries":case"scatterSeries":return o===""||o===e("editor.overlayMenu.all")?e("graph.annotations.highlights.wholeSeries"):e("graph.annotations.highlights.everyNamed",{name:o,noun:n});default:return t}},qd=e=>e==="comment"?"comment":e==="sticker"?"sticker":null,Kd=e=>{if(e.key!=="Delete"&&e.key!=="Backspace")return!1;const t=e.target;return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?!1:(e.preventDefault(),!0)},Xd=e=>{if(e.type!=="doc"||e.content?.length!==1)return null;const t=e.content[0];if(t?.type!=="paragraph"||Sr(t)||yr(t)||t.content?.length!==1)return null;const n=t.content[0];return n?.type!=="text"||n.text===void 0||n.content!==void 0||Sr(n)||yr(n)?null:n.text},Sr=e=>e.marks!==void 0&&e.marks.length>0,yr=e=>e.attrs!==void 0&&Object.keys(e.attrs).length>0,Yd=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),An=({target:e})=>{const t=l.useGraphHandle();return t===null?null:(0,r.jsx)(Zd,{graph:t,target:e})};An.hasRows=(e,t)=>(0,u.isLayerSpecOf)((0,u.findLayerById)(t.scene.spec.layers,e.layerId),"point")?!0:ce.hasRows(e,t);var Zd=({graph:e,target:t})=>{const n=l.useHandleScene(e),a=l.useStyleReaderTree(),o=n===null?void 0:(0,u.findLayerById)(n.spec.layers,t.layerId);if(n===null||!(0,u.isLayerSpecOf)(o,"point"))return(0,r.jsx)(ce,{target:t});const i=(0,u.readObservationsColorRoute)(n.spec,t)?.find(d=>d.geomKind==="point")?.where,s=i===void 0?{}:{where:i},c=(0,u.readVariableName)((0,u.findLayerById)(n.layers,o.id)?.mapping.size)!==null;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ce,{target:t}),!c&&(0,r.jsx)(Cn,{sizePx:bo(n,a,o.id,i),onChange:d=>{e.commands.dispatch(new u.SetPointSizeCommand({layerId:o.id,size:d,...s}))}}),(0,r.jsx)(yn,{symbol:So(n,a,o.id,i),coordType:n.coordSystem.type,onChange:d=>{e.commands.dispatch(new u.SetPointSymbolCommand({layerId:o.id,symbol:d,...s}))}})]})},zo={geoms:{point:{style:An,annotate:Od},line:{style:ht,annotate:xr},area:{style:ht,annotate:xr},bar:{style:bn,annotate:rt},rule:{style:null,annotate:rt},tile:{style:ce,annotate:rt}},legend:xo,axis:xn,grid:jn,graph:wn},Ln=(0,f.createContext)([zo]),Jd=({editMenus:e,children:t})=>{const n=(0,f.useMemo)(()=>[e??{},zo],[e]);return(0,r.jsx)(Ln.Provider,{value:n,children:t})},Qd=e=>{const t=(0,f.useContext)(Ln),n=l.useSceneSelector(s=>s),{findGeom:a}=l.useGraphContext(),o=l.useDataLabelPlacementResolver(),i=Ho(l.useGraphMode());return(0,f.useMemo)(()=>e===null?null:Vo(e,t,{scene:n,dataLabelPlacement:o,findGeom:a},i),[e,t,n,o,a,i])},eu=()=>{const e=(0,f.useContext)(Ln),{store:t,findGeom:n}=l.useGraphContext(),a=l.useDataLabelPlacementResolver(),o=Ho(l.useGraphMode());return(0,f.useCallback)(i=>Vo(i,e,{scene:t.getState().scene,dataLabelPlacement:a,findGeom:n},o)!==null,[e,t,a,n,o])},Ho=e=>e===l.GRAPH_MODES.annotate?"annotate":"style",Vo=(e,t,n,a)=>{if(a==="annotate"&&e.kind!=="observations")return null;switch(e.kind){case"observations":{const o=Wc(e.layerId,n.scene),i=o===null?null:Uc(o,t,a,a==="annotate"?rt:ce);return i===null||i.hasRows?.(e,n)===!1?null:(0,r.jsx)(i,{target:e})}case"legend":{const o=Ke(t,i=>i.legend);return o===null||o.hasRows?.(e,n)===!1?null:(0,r.jsx)(o,{target:e})}case"axis":{const o=Ke(t,i=>i.axis);return o===null||o.hasRows?.(e,n)===!1?null:(0,r.jsx)(o,{target:e})}case"grid":{const o=Ke(t,i=>i.grid);return o===null||o.hasRows?.(e,n)===!1?null:(0,r.jsx)(o,{target:e})}case"graph":{const o=Ke(t,i=>i.graph);return o===null||o.hasRows?.(e,n)===!1?null:(0,r.jsx)(o,{target:e})}default:return e}},tu={save:"حفظ",cancel:"إلغاء",confirm:"تأكيد",delete:"حذف",confirmDelete:e=>`هل أنت متأكد من رغبتك في حذف ${e.item}؟`,abbreviations:{thousands:"ألف",millions:"مليون",billions:"مليار"}},nu={title:"محرر Graphy",description:"قم بتحرير المحتوى الخاص بك هنا",graphTypes:{column:"أعمدة",columnStacked:"أعمدة مكدسة",columnStackedFill:"أعمدة مكدسة 100%",bar:"شريطي",barStacked:"أشرطة مكدسة",barStackedFill:"أشرطة مكدسة 100%",line:"خطي",area:"مساحة",areaStacked:"مساحة مكدسة",pie:"دائري",donut:"حلقي",radar:"راداري",radarFilled:"راداري معبأ",scatter:"نقطي",bubble:"فقاعي",funnel:"قمعي",combo:"مركب",heatmap:"خريطة حرارية",waterfall:"شلالي",mekko:"ميكو",table:"جدول"},sizePanel:{toolbarButton:"الحجم",presetsSection:{title:"إعدادات مسبقة"},customSizeSection:{title:"حجم مخصص"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"ويب / بريد إلكتروني",linkedIn:"منشور LinkedIn",instagram:"منشور Instagram",tiktok:"TikTok / قصة Instagram",twitter:"X (Twitter)",mobile:"جوال"},inputs:{unitLabel:"بكسل"},validation:{maxSizeError:e=>`≤ ${e.max} بكسل`,minSizeError:e=>`≥ ${e.min} بكسل`}},graphPanel:{toolbarButton:"الرسم البياني",graphTypeSection:{title:"نوع الرسم البياني"},mappingSection:{title:"البيانات",x:"المحور السيني",y:"القيمة",color:"اللون",size:"الحجم",label:"التسمية",none:"بلا"},comboSection:{title:"مظهر الرسم البياني المركب",types:{groupedBars:"أعمدة مجمعة",stackedBars:"أعمدة مكدسة",lines:"خطوط فقط"}},polarSection:{title:"قطبي",innerRadius:"نصف القطر الداخلي",startAngle:"زاوية البداية"},barSection:{title:"الأعمدة",thickness:"سمك العمود",widths:{narrow:"ضيق",regular:"عادي",wide:"عريض"},baseRadius:"القاعدة",tipRadius:"الطرف",radiusOptions:{none:"مربع",md:"مستدير الحواف",full:"دائري"}},graphOptionsSection:{title:"خيارات الرسم البياني"},gridSection:{title:"الشبكة",horizontalGridLines:"خطوط أفقية",verticalGridLines:"خطوط رأسية",rings:"حلقات",spokes:"أشعة",gridStyle:"نمط الشبكة",gridThickness:"سمك الشبكة",lineStyles:{solid:"متصل",dashed:"متقطع",dotted:"منقط"},lineWidths:{thin:"رفيع",medium:"متوسط",thick:"سميك"}},graphOptions:{sortBars:"ترتيب من الأعلى ← الأدنى",showPoints:"إظهار النقاط",lineFill:"تعبئة تحت الخط",smoothLines:"خطوط ناعمة",curves:{smooth:"ناعم",linear:"مستقيم"},stackTotals:"مجاميع المكدس",dataLabels:"تسميات البيانات",showPercentages:"إظهار النسب المئوية",categoryLabels:"تسميات الفئات"},legendSection:{title:"وسيلة الإيضاح",auto:"تلقائي",top:"أعلى",bottom:"أسفل",left:"يسار",right:"يمين",none:"بدون",alignLabel:"المحاذاة",align:{auto:"تلقائي",center:"الوسط"},displayLabel:"النمط",display:{auto:"تلقائي",pill:"شارات",direct:"على الرسم"}},numberFormatSection:{title:"تنسيق الأرقام"},numberFormat:{abbreviationLabel:"الاختصار",valueLabel:"القيمة",decimalPlacesLabel:"المنازل العشرية",options:{auto:"تلقائي",custom:"مخصص",none:"بدون"}},headlineNumberSize:{sizeLabel:"الحجم",valueLabel:"القيمة",sizes:{small:"ص",medium:"م",large:"ك"}},lineThickness:{label:"سمك الخط"},pointSize:{label:"حجم النقطة",options:{auto:"تلقائي",custom:"مخصص"},sizes:{small:"صغير",medium:"متوسط",large:"كبير"}},pointSymbol:{label:"شكل النقطة",symbols:{circle:"دائرة",square:"مربع",diamond:"معين",triangle:"مثلث",cross:"صليب",star:"نجمة",wye:"واي"},custom:"شكل مخصص",oversized:"هذه الصورة كبيرة جدًا. اختر صورة أصغر من 512 كيلوبايت.",undecodable:"تعذر قراءة هذا الملف كصورة."},headlineNumberSection:{title:"الرقم الرئيسي",toggle:"مرئي",metricLabel:"المقياس",compareWithLabel:"مقارنة مع",metrics:{total:"المجموع",average:"المتوسط",current:"الأخير",conversion:"التحويل",left:"يسار"},comparison:{first:"الأول",previous:"السابق"},position:{above:"أعلى",center:"وسط"}},treatEmptyValues:{leaveGap:{label:"ترك فجوة في الرسم البياني",description:"يترك فاصلاً مرئياً في الخط حيث تكون البيانات مفقودة"},fillZero:{label:"ملء بالصفر",description:"يعرض نقاط البيانات المفقودة كصفر"},connectGaps:{label:"الاتصال عبر الفجوات",description:"يربط الخط بين النقاط المتاحة، متخطياً الفجوة"}}},axesPanel:{toolbarButton:"المحاور",mainAxisSection:{yAxis:"المحور الصادي",xAxis:"المحور السيني"},crossAxisSection:{xAxis:"المحور السيني",yAxis:"المحور الصادي"},controls:{title:"العنوان",titlePlaceholder:"إضافة عنوان",visible:"مرئي",ticks:"العلامات",labels:"التسميات",position:"الموضع",scale:"المقياس",startFrom:"البدء من",endAt:"الانتهاء عند",value:"القيمة",numberOfAxes:"عدد المحاور"},labelMode:{auto:"تلقائي",edges:"الحواف"},scale:{auto:"تلقائي",log:"لوغاريتمي"},startFrom:{auto:"تلقائي",zero:"صفر",custom:"مخصص"},endAt:{auto:"تلقائي",custom:"مخصص"},axisCount:{single:"مفرد",double:"مزدوج"},position:{left:"يسار",right:"يمين",top:"أعلى",bottom:"أسفل"}},colorPanel:{toolbarButton:"اللون",themeSection:{title:"السمة"},appearanceSection:{title:"المظهر",highlightStyle:"التمييز"},backgroundSection:{title:"الخلفية",black:"أسود",white:"أبيض",gray:"رمادي",tint:"صبغة",custom:"مخصص",none:"بدون"},borderSection:{title:"الحدود",borderColor:"لون الحدود",thickness:"السمك",cornerRadius:"نصف قطر الزاوية"},borderType:{solid:"صلب",gradient:"متدرج",gray:"رمادي",preset:"مسبق",custom:"مخصص",none:"بدون"},presetGradients:{lilac:"ليلكي",neonPink:"وردي نيون",blackberry:"توت أسود",sun:"شمس",iceland:"آيسلندا",sunset:"غروب",ultraviolet:"فوق بنفسجي",purple:"أرجواني",iceCream:"آيس كريم",mint:"نعناع",cool:"بارد",fresh:"منعش"}},designPanel:{toolbarButton:"التصميم",defaultExpanded:"لوحة الألوان"},annotatePanel:{toolbarButton:"التعليقات",callOutSection:{title:"وسائل الشرح",text:"نص",arrow:"سهم",box:"مربع",difference:"الفرق"},highlightSection:{title:"التمييز",button:"تمييز",colorLabel:"لون التمييز"}},annotationsPanel:{toolbarButton:"التعليقات",freeformSection:{title:"حر",text:"نص",arrow:"سهم",box:"مربع",difference:"فرق"},goalSection:{title:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",valueAriaLabel:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:"(اختياري)"},trendsAndAveragesSection:{title:"الاتجاهات والمتوسطات",trend:"الاتجاه",average:"المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},averageLineSeries:{label:"سلسلة خط المتوسط",placeholder:"اختر السلسلة",ariaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},highlightSection:{title:"التمييز",button:"تمييز",fadeColorLabel:"لون التلاشي"},titleAndSubtitleSection:{title:"العنوان والعنوان الفرعي",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},captionAndSourceSection:{title:"التسمية التوضيحية والمصدر",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"}},elementsPanel:{contentVisible:"مرئي",contentValue:"القيمة",toolbarButton:"العناصر",headerSection:{title:"الرأس",toggleTitle:"العنوان",subtitle:"العنوان الفرعي"},footerSection:{title:"التذييل",caption:"التسمية التوضيحية",source:"المصدر",url:"الرابط",name:"الاسم"},textSizeSection:{title:"حجم النص",scaleFormat:e=>`${e.value}x`},fontSection:{title:"الخط"},sourceSection:{title:"المصدر",url:"الرابط",name:"الاسم"}},powerUpPanel:{toolbarButton:"التحسينات",goalSection:{title:"الهدف",toggle:"الهدف",labelControl:"التسمية",labelPlaceholder:"الهدف",labelAriaLabel:"تسمية الهدف المخصصة",valueControl:"قيمة الهدف",byDate:"حسب التاريخ",xAxisValue:"قيمة المحور السيني",optional:" (اختياري)",xAxisReferenceAriaLabel:"قيمة مرجعية للمحور السيني",anyXAxisValue:"أي قيمة للمحور السيني",selectValuePlaceholder:"اختر القيمة"},trendSection:{title:"الاتجاه",toggle:"الاتجاه"},averageSection:{title:"المتوسط",toggle:"المتوسط",seriesLabel:"سلسلة خط المتوسط",seriesPlaceholder:"اختر السلسلة",seriesAriaLabel:"قائمة منسدلة للسلسلة لخط المتوسط"},trendType:{label:"نوع الاتجاه",placeholder:"نوع الاتجاه",options:{linear:"خطي",exponential:"أسي",quadratic:"تربيعي",polynomial:"متعدد الحدود",logarithmic:"لوغاريتمي",power:"قوة",loess:"لويس"}},valueInput:{percentagePlaceholder:"النسبة المئوية",numberPlaceholder:"الرقم",percentageSymbol:"٪"}},highlighting:{modeHelper:{title:"وضع التمييز",hover:"مرر",toHighlight:"للتمييز",anyElement:"أي عنصر",escToExit:"للخروج",esc:"ESC"},emptyState:"لا تتوفر خيارات تمييز",deleteAriaLabel:"حذف التمييز",highlightStyle:{tint:"صبغة",gray:"رمادي"}},fineTunePanel:{toolbarButton:"الضبط الدقيق",detailSection:{title:"التفاصيل",missingValues:"القيم المفقودة"},lineStyleSection:{title:"نمط الخط",lineCurve:"انحناء الخط",sharp:"حاد",smooth:"ناعم"}},customThemeEditor:{patternDropdownAriaLabel:"قائمة منسدلة للنمط للسلسلة",patterns:{solid:"صلب",pattern:"نمط",dotted:"منقط",dashed:"متقطع",hatched:"مظلل"},heatmapColorLabel:"اللون"},overlayMenu:{observation:"مشاهدة",group:"مجموعة",band:"نطاق",axis:"المحور",legend:"وسيلة الإيضاح",gridLines:"خطوط الشبكة",chart:"الرسم البياني",selection:"التحديد",thisBar:"هذا الشريط",thisPoint:"هذه النقطة",thisBubble:"هذه الفقاعة",thisSlice:"هذه الشريحة",allOf:e=>`كل ${e.name}`,all:"الكل",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"إخفاء",show:"إظهار",legendPlaces:{topStart:"أعلى اليسار",topCenter:"أعلى الوسط",topEnd:"أعلى اليمين",left:"اليسار",right:"اليمين",bottomStart:"أسفل اليسار",bottomCenter:"أسفل الوسط",bottomEnd:"أسفل اليمين"},fillColor:"لون التعبئة",lowColor:"لون القيم المنخفضة",highColor:"لون القيم المرتفعة",lineColor:"لون الخط",palette:"لوحة الألوان",themePalette:"السمة",chartType:"النوع",customChartType:"مخصص",arrange:"الترتيب",arrangements:{grouped:"مجمعة",stacked:"مكدسة",filled:"100%",lines:"خطوط فقط"}},accessibility:{toggleSection:e=>`تبديل قسم ${e.title}`},graphyDefaults:{themeOptions:{light:"فاتح",dark:"داكن"}}},ru={titleEditor:{titlePlaceholder:"بدون عنوان",subtitlePlaceholder:"إضافة عنوان فرعي"},toolbar:{formatting:{bold:"عريض",italic:"مائل",underline:"تحته خط",link:"رابط"},link:{ariaLabel:"إنشاء رابط",placeholder:"اكتب أو الصق رابطاً...",submit:"إرسال",urlLabel:"عنوان الرابط",apply:"تطبيق الرابط"},font:{label:"الخط",ariaLabel:"عائلة الخط"},heading:{label:"مستوى العنوان",ariaLabel:"نمط النص",text:"نص",caption:"تسمية توضيحية",heading1:"عنوان 1",heading2:"عنوان 2",heading3:"عنوان 3"},textAlign:{left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين"},color:{label:"لون النص"}},colorDropdown:{colors:"الألوان",chartColors:"ألوان الرسم البياني",custom:"مخصص",opacity:"الشفافية",transparent:"شفاف",pickCustom:"اختيار لون مخصص",pickColor:"اختيار لون"},annotations:{differenceArrowToolbar:{label:"خيارات سهم الفرق",labelKind:{ariaLabel:"التسمية",absoluteDifference:"التغير المطلق",relativeDifference:"التغير المئوي",asPercent:"الفرق كنسبة مئوية",asNumber:"الفرق كرقم",proportion:"النسبة",suspectValue:"تقسم هذه القيمة على أساس يساوي صفرًا.",incomparableEnds:"يقيس الطرفان كميتين مختلفتين، لذا لا معنى للفرق بينهما."},color:"لون السهم",size:{ariaLabel:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},swap:"عكس الاتجاه",remove:"إزالة السهم"},shapeToolbar:{label:"خيارات الشكل",color:"لون الشكل",border:{ariaLabel:"الحد",none:"بلا",thin:"رفيع (2 بكسل)",medium:"متوسط (8 بكسل)",thick:"سميك (16 بكسل)"},remove:"إزالة الشكل",resize:{"top-left":"تغيير الحجم من الزاوية العلوية اليسرى","top-right":"تغيير الحجم من الزاوية العلوية اليمنى","bottom-right":"تغيير الحجم من الزاوية السفلية اليمنى","bottom-left":"تغيير الحجم من الزاوية السفلية اليسرى"}},arrowToolbar:{label:"خيارات السهم",color:"لون السهم",thickness:{ariaLabel:"السماكة",thin:"رفيع",medium:"متوسط",thick:"سميك"},startArrowhead:"بداية السهم",endArrowhead:"نهاية السهم",arrowhead:{lineArrow:"رأس سهم",none:"بلا"},lineStyle:{ariaLabel:"نمط الخط",solid:"متصل",dashed:"متقطع",dotted:"منقّط"},sticker:"تأثير الملصق",remove:"إزالة السهم",moveEndpoint:{start:"تحريك بداية السهم",end:"تحريك نهاية السهم"}},textToolbar:{label:"خيارات النص",background:"لون الخلفية",color:"لون النص",font:{ariaLabel:"الخط",modern:"عصري",fresh:"منعش",timeless:"كلاسيكي",technical:"تقني",fineliner:"قلم رفيع",handwritten:"Permanent Marker"},fontSize:{ariaLabel:"حجم الخط",small:"صغير",medium:"متوسط",large:"كبير",extraLarge:"كبير جدًا",huge:"ضخم"},align:{left:"محاذاة إلى اليسار",center:"محاذاة إلى الوسط",right:"محاذاة إلى اليمين"},remove:"إزالة النص",resize:{left:"تغيير الحجم من اليسار",right:"تغيير الحجم من اليمين"}},text:{editLabel:"تحرير النص",placeholder:"اكتب شيئًا"},baseMenu:{pinNumber:"تثبيت الرقم",unpinNumber:"إلغاء تثبيت الرقم",annotate:"تعليق",addNote:"إضافة ملاحظة",removeAnnotation:"إزالة التعليق",highlight:"تمييز",highlightWithLabel:e=>`تمييز ${e.label}`,removeHighlight:"إزالة التمييز",differenceArrow:"إضافة سهم الفرق",addSticker:"إضافة ملصق",removeSticker:"إزالة الملصق",text:"إضافة نص",stickyNote:"إضافة ملاحظة لاصقة",arrow:"إضافة سهم",box:"إضافة مربع",arrowOneWay:"اتجاه واحد",arrowTwoWay:"اتجاهان",arrowLine:"خط"},textMenu:{title:"تعليق",placeholder:"قل ما حدث…",addButton:"إضافة"},highlights:{menuTitle:"تمييز",labels:{bar:"شريط",barGroup:"مجموعة",barStack:"مكدس",barSeries:"سلسلة",line:"خط",linePoint:"نقطة",lineSeries:"سلسلة",scatterPoint:"نقطة",scatterSeries:"سلسلة",pieSlice:"شريحة",pointOrBar:"نقطة / شريط",lineOrSeries:"خط / سلسلة"},atLeast:({value:e})=>`≥ ${e}`,atLeastDescription:({noun:e,value:t})=>`تمييز كل ${e} عند ${t} أو أكثر`,onward:({label:e})=>`${e} فصاعداً`,onwardDescription:({label:e})=>`تمييز ${e} وكل ما بعده`,justThis:({noun:e})=>`تمييز هذه ${e} فقط`,justValue:({label:e})=>`تمييز ${e} فقط`,everyNamed:({name:e,noun:t})=>`تمييز كل ${e} ${t}`,everyIn:({noun:e,name:t})=>`تمييز كل ${e} في ${t}`,wholeGroup:"تمييز المجموعة كلها",wholeStack:"تمييز المكدس كله",wholeSeries:"تمييز السلسلة كلها",nouns:{bubble:"فقاعة"}},stickerMenu:{title:"إضافة ملصق"},delete:"حذف",arrow:{thickness:{label:"السمك",thin:"رفيع",medium:"متوسط",thick:"سميك"},arrowhead:{startPoint:"نقطة البداية",endPoint:"نقطة النهاية",lineArrow:"سهم الخط",none:"بدون"},lineStyle:{label:"نمط الخط",solid:"صلب",dotted:"منقط"},stickerEffect:"تأثير الملصق",toolbarAriaLabel:"شريط أدوات السهم الحر",editorAriaLabel:"محرر السهم"},differenceArrow:{type:{proportion:"النسبة",difference:({absoluteDifference:e})=>`الفرق (${e})`,increase:({absoluteDifference:e})=>`الزيادة (${e})`,decrease:({absoluteDifference:e})=>`النقصان (${e})`,percentageChange:({percentageChange:e})=>`تغيير النسبة المئوية (${e})`,percentIncrease:({percentageChange:e})=>`زيادة النسبة المئوية (${e})`,percentDecrease:({percentageChange:e})=>`نقصان النسبة المئوية (${e})`},size:{label:"الحجم",small:"صغير",medium:"متوسط",large:"كبير"},flipArrow:"عكس السهم",color:"اللون",toolbarAriaLabel:"شريط أدوات سهم الفرق",editorAriaLabel:"محرر سهم الفرق"},shape:{color:"اللون",border:{label:"الحدود",none:"بدون",thin:({value:e})=>`رفيع (${e})`,medium:({value:e})=>`متوسط (${e})`,thick:({value:e})=>`سميك (${e})`}}}},au={common:tu,editor:nu,graph:ru},ou={save:"Save",cancel:"Cancel",confirm:"Confirm",delete:"Delete",confirmDelete:e=>`Are you sure you want to delete ${e.item}?`,abbreviations:{thousands:"k",millions:"m",billions:"b"}},iu={title:"Graphy Editor",description:"Edit your content here",graphTypes:{column:"Column",columnStacked:"Stacked column",columnStackedFill:"100% stacked column",bar:"Bar",barStacked:"Stacked bar",barStackedFill:"100% stacked bar",line:"Line",area:"Area",areaStacked:"Stacked area",pie:"Pie",donut:"Donut",radialBar:"Radial bar",rose:"Rose",roseStacked:"Stacked rose",radar:"Radar",radarFilled:"Filled radar",scatter:"Scatter",bubble:"Bubble",funnel:"Funnel",combo:"Combo",heatmap:"Heatmap",waterfall:"Waterfall",mekko:"Mekko",table:"Table"},sizePanel:{toolbarButton:"Size",presetsSection:{title:"Presets"},customSizeSection:{title:"Custom size"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"LinkedIn post",instagram:"Instagram post",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Mobile"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Graph",graphTypeSection:{title:"Graph type"},mappingSection:{title:"Data",x:"X-axis",y:"Value",color:"Colour",size:"Size",label:"Label",none:"None"},comboSection:{title:"Combo chart appearance",types:{groupedBars:"Grouped bars",stackedBars:"Stacked bars",lines:"Lines only"}},polarSection:{title:"Polar",innerRadius:"Inner radius",startAngle:"Start angle"},barSection:{title:"Bars",thickness:"Bar thickness",widths:{narrow:"Narrow",regular:"Regular",wide:"Wide"},baseRadius:"Base",tipRadius:"Tip",radiusOptions:{none:"Square",md:"Rounded",full:"Round"}},graphOptionsSection:{title:"Graph options"},gridSection:{title:"Grid",horizontalGridLines:"Horizontal lines",verticalGridLines:"Vertical lines",rings:"Rings",spokes:"Spokes",gridStyle:"Grid style",gridThickness:"Grid thickness",lineStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted"},lineWidths:{thin:"Thin",medium:"Medium",thick:"Thick"}},graphOptions:{sortBars:"Sort high → low",showPoints:"Show points",lineFill:"Fill under line",smoothLines:"Smooth lines",curves:{smooth:"Smooth",linear:"Straight"},stackTotals:"Stack totals",dataLabels:"Data labels",showPercentages:"Show percentages",categoryLabels:"Category labels"},legendSection:{title:"Legend",auto:"Auto",top:"Top",bottom:"Bottom",left:"Left",right:"Right",none:"None",alignLabel:"Alignment",align:{auto:"Auto",center:"Center"},displayLabel:"Style",display:{auto:"Auto",pill:"Pills",direct:"Direct"}},numberFormatSection:{title:"Number format"},numberFormat:{abbreviationLabel:"Abbreviation",valueLabel:"Value",decimalPlacesLabel:"Decimal places",options:{auto:"Auto",custom:"Custom",none:"None"}},headlineNumberSize:{sizeLabel:"Size",valueLabel:"Value",sizes:{small:"S",medium:"M",large:"L"}},lineThickness:{label:"Line thickness"},pointSize:{label:"Point size",options:{auto:"Auto",custom:"Custom"},sizes:{small:"Small",medium:"Medium",large:"Large"}},pointSymbol:{label:"Point shape",symbols:{circle:"Circle",square:"Square",diamond:"Diamond",triangle:"Triangle",cross:"Cross",star:"Star",wye:"Wye"},custom:"Custom shape",oversized:"This image is too large. Choose one under 512 KB.",undecodable:"This file could not be read as an image."},headlineNumberSection:{title:"Headline number",toggle:"Visible",metricLabel:"Metric",compareWithLabel:"Compare with",metrics:{total:"Total",average:"Avg.",current:"Last",conversion:"Conversion",left:"Left"},comparison:{first:"First",previous:"Previous"},position:{above:"Above",center:"Center"}},treatEmptyValues:{leaveGap:{label:"Leave gap in chart",description:"Leaves a visible break in the line where data is missing"},fillZero:{label:"Fill with zero",description:"Displays missing data points as zero"},connectGaps:{label:"Connect across gaps",description:"Joins the line between available points, skipping the gap"}}},axesPanel:{toolbarButton:"Axes",mainAxisSection:{yAxis:"Y-axis",xAxis:"X-axis"},crossAxisSection:{xAxis:"X-axis",yAxis:"Y-axis"},controls:{title:"Title",titlePlaceholder:"Add title",visible:"Visible",ticks:"Ticks",labels:"Labels",position:"Position",scale:"Scale",startFrom:"Start from",endAt:"End at",value:"Value",numberOfAxes:"Number of axes"},labelMode:{auto:"Auto",edges:"Edges"},scale:{auto:"Auto",log:"Log"},startFrom:{auto:"Auto",zero:"Zero",custom:"Custom"},endAt:{auto:"Auto",custom:"Custom"},axisCount:{single:"Single",double:"Double"},position:{left:"Left",right:"Right",top:"Top",bottom:"Bottom"}},colorPanel:{toolbarButton:"Color",themeSection:{title:"Theme"},appearanceSection:{title:"Appearance",highlightStyle:"Highlight"},backgroundSection:{title:"Background",black:"Black",white:"White",gray:"Grey",tint:"Tint",custom:"Custom",none:"None"},borderSection:{title:"Border",borderColor:"Border color",thickness:"Thickness",cornerRadius:"Corner radius"},borderType:{solid:"Solid",gradient:"Gradient",gray:"Grey",preset:"Preset",custom:"Custom",none:"None"},presetGradients:{lilac:"Lilac",neonPink:"Neon Pink",blackberry:"Blackberry",sun:"Sun",iceland:"Iceland",sunset:"Sunset",ultraviolet:"Ultraviolet",purple:"Purple",iceCream:"Ice Cream",mint:"Mint",cool:"Cool",fresh:"Fresh"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Palette"},annotatePanel:{toolbarButton:"Annotate",callOutSection:{title:"Callouts",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},highlightSection:{title:"Highlight",button:"Highlight",colorLabel:"Highlight color"}},annotationsPanel:{toolbarButton:"Annotate",freeformSection:{title:"Freeform",text:"Text",arrow:"Arrow",box:"Box",difference:"Difference"},goalSection:{title:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",valueAriaLabel:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:"(optional)"},trendsAndAveragesSection:{title:"Trends and Averages",trend:"Trend",average:"Average"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},averageLineSeries:{label:"Average line series",placeholder:"Select series",ariaLabel:"Series dropdown for average line"},highlightSection:{title:"Highlight",button:"Highlight",fadeColorLabel:"Fade color"},titleAndSubtitleSection:{title:"Title & Subtitle",toggleTitle:"Title",subtitle:"Subtitle"},captionAndSourceSection:{title:"Caption & Source",caption:"Caption",source:"Source",url:"URL",name:"Name"}},elementsPanel:{contentVisible:"Visible",contentValue:"Value",toolbarButton:"Elements",headerSection:{title:"Header",toggleTitle:"Title",subtitle:"Subtitle"},footerSection:{title:"Footer",caption:"Caption",source:"Source",url:"URL",name:"Name"},textSizeSection:{title:"Text size",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Font"},sourceSection:{title:"Source",url:"URL",name:"Name"}},powerUpPanel:{toolbarButton:"Power-ups",goalSection:{title:"Goal",toggle:"Goal",labelControl:"Label",labelPlaceholder:"Goal",labelAriaLabel:"Custom goal label",valueControl:"Goal value",byDate:"By date",xAxisValue:"X-axis value",optional:" (optional)",xAxisReferenceAriaLabel:"X-axis reference value",anyXAxisValue:"Any x-axis value",selectValuePlaceholder:"Select value"},trendSection:{title:"Trend",toggle:"Trend"},averageSection:{title:"Average",toggle:"Average",seriesLabel:"Average line series",seriesPlaceholder:"Select series",seriesAriaLabel:"Series dropdown for average line"},trendType:{label:"Trend type",placeholder:"Trend type",options:{linear:"Linear",exponential:"Exponential",quadratic:"Quadratic",polynomial:"Polynomial",logarithmic:"Logarithmic",power:"Power",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentage",numberPlaceholder:"Number",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Highlight mode",hover:"Hover",toHighlight:"to highlight",anyElement:"any element",escToExit:"to exit",esc:"ESC"},emptyState:"No highlight options available",deleteAriaLabel:"Delete highlight",highlightStyle:{tint:"Tint",gray:"Grey"}},fineTunePanel:{toolbarButton:"Fine tune",detailSection:{title:"Detail",missingValues:"Missing values"},lineStyleSection:{title:"Line style",lineCurve:"Line curve",sharp:"Sharp",smooth:"Smooth"}},customThemeEditor:{patternDropdownAriaLabel:"Pattern dropdown for series",patterns:{solid:"Solid",pattern:"Pattern",dotted:"Dotted",dashed:"Dashed",hatched:"Hatched"},heatmapColorLabel:"Color"},overlayMenu:{observation:"Observation",group:"Group",band:"Band",axis:"Axis",legend:"Legend",gridLines:"Grid lines",chart:"Chart",selection:"Selection",thisBar:"This bar",thisPoint:"This point",thisBubble:"This bubble",thisSlice:"This slice",allOf:e=>`All of ${e.name}`,all:"All",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Hide",show:"Show",legendPlaces:{topStart:"Top left",topCenter:"Top center",topEnd:"Top right",left:"Left",right:"Right",bottomStart:"Bottom left",bottomCenter:"Bottom center",bottomEnd:"Bottom right"},fillColor:"Fill color",lowColor:"Low color",highColor:"High color",lineColor:"Line color",palette:"Palette",themePalette:"Theme",chartType:"Type",customChartType:"Custom",arrange:"Arrange",arrangements:{grouped:"Grouped",stacked:"Stacked",filled:"100%",lines:"Lines only"}},accessibility:{toggleSection:e=>`Toggle ${e.title} section`},graphyDefaults:{themeOptions:{light:"Light",dark:"Dark"}}},su={titleEditor:{titlePlaceholder:"Untitled",subtitlePlaceholder:"Add a subtitle"},toolbar:{formatting:{bold:"Bold",italic:"Italic",underline:"Underline",link:"Link"},link:{ariaLabel:"Create link",placeholder:"Type or paste a link...",submit:"Submit",urlLabel:"Link URL",apply:"Apply link"},font:{label:"Font",ariaLabel:"Font family"},heading:{label:"Heading level",ariaLabel:"Text style",text:"Text",caption:"Caption",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},textAlign:{left:"Align left",center:"Align center",right:"Align right"},color:{label:"Text color"}},colorDropdown:{colors:"Colors",chartColors:"Chart colors",custom:"Custom",opacity:"Opacity",transparent:"Transparent",pickCustom:"Pick custom color",pickColor:"Pick color"},annotations:{differenceArrowToolbar:{label:"Difference arrow options",labelKind:{ariaLabel:"Label",absoluteDifference:"Absolute change",relativeDifference:"Percentage change",asPercent:"Difference as %",asNumber:"Difference as a number",proportion:"Proportion",suspectValue:"This value divides by a baseline of zero.",incomparableEnds:"The two ends measure different quantities, so a difference between them has no meaning."},color:"Arrow colour",size:{ariaLabel:"Size",small:"Small",medium:"Medium",large:"Large"},swap:"Swap direction",remove:"Remove arrow"},shapeToolbar:{label:"Shape options",color:"Shape colour",border:{ariaLabel:"Border",none:"None",thin:"Thin (2px)",medium:"Medium (8px)",thick:"Thick (16px)"},remove:"Remove shape",resize:{"top-left":"Resize from the top left","top-right":"Resize from the top right","bottom-right":"Resize from the bottom right","bottom-left":"Resize from the bottom left"}},arrowToolbar:{label:"Arrow options",color:"Arrow colour",thickness:{ariaLabel:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},startArrowhead:"Start of the arrow",endArrowhead:"End of the arrow",arrowhead:{lineArrow:"Line arrow",none:"None"},lineStyle:{ariaLabel:"Line style",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},sticker:"Sticker effect",remove:"Remove arrow",moveEndpoint:{start:"Move the start of the arrow",end:"Move the end of the arrow"}},textToolbar:{label:"Text options",background:"Background colour",color:"Text colour",font:{ariaLabel:"Font",modern:"Modern",fresh:"Fresh",timeless:"Timeless",technical:"Technical",fineliner:"Fineliner",handwritten:"Permanent Marker"},fontSize:{ariaLabel:"Font size",small:"Small",medium:"Medium",large:"Large",extraLarge:"Extra Large",huge:"Huge"},align:{left:"Align left",center:"Align centre",right:"Align right"},remove:"Remove text",resize:{left:"Resize from the left",right:"Resize from the right"}},text:{editLabel:"Edit text",placeholder:"Type something"},baseMenu:{pinNumber:"Pin number",unpinNumber:"Unpin number",annotate:"Annotate",addNote:"Add note",removeAnnotation:"Remove annotation",highlight:"Highlight",highlightWithLabel:e=>`Highlight ${e.label}`,removeHighlight:"Remove highlight",differenceArrow:"Add difference arrow",addSticker:"Add sticker",removeSticker:"Remove sticker",text:"Add text",stickyNote:"Add sticky note",arrow:"Add arrow",box:"Add box",arrowOneWay:"One way",arrowTwoWay:"Two way",arrowLine:"Line"},textMenu:{title:"Annotate",placeholder:"Say what happened…",addButton:"Add"},highlights:{menuTitle:"Highlight",labels:{bar:"bar",barGroup:"group",barStack:"stack",barSeries:"series",line:"line",linePoint:"point",lineSeries:"series",scatterPoint:"point",scatterSeries:"series",pieSlice:"slice",pointOrBar:"point / bar",lineOrSeries:"line / series"},atLeast:({value:e})=>`≥ ${e}`,atLeastDescription:({noun:e,value:t})=>`Highlight every ${e} at ${t} or more`,onward:({label:e})=>`${e} onward`,onwardDescription:({label:e})=>`Highlight ${e} and everything after`,justThis:({noun:e})=>`Highlight just this ${e}`,justValue:({label:e})=>`Highlight just ${e}`,everyNamed:({name:e,noun:t})=>`Highlight every ${e} ${t}`,everyIn:({noun:e,name:t})=>`Highlight every ${e} in ${t}`,wholeGroup:"Highlight the whole group",wholeStack:"Highlight the whole stack",wholeSeries:"Highlight the whole series",nouns:{bubble:"bubble"}},stickerMenu:{title:"Add sticker"},delete:"Delete",arrow:{thickness:{label:"Thickness",thin:"Thin",medium:"Medium",thick:"Thick"},arrowhead:{startPoint:"Start point",endPoint:"End point",lineArrow:"Line arrow",none:"None"},lineStyle:{label:"Line style",solid:"Solid",dotted:"Dotted"},stickerEffect:"Sticker effect",toolbarAriaLabel:"Free-form arrow toolbar",editorAriaLabel:"Arrow editor"},differenceArrow:{type:{proportion:"Proportion",difference:({absoluteDifference:e})=>`Difference (${e})`,increase:({absoluteDifference:e})=>`Increase (${e})`,decrease:({absoluteDifference:e})=>`Decrease (${e})`,percentageChange:({percentageChange:e})=>`Percentage change (${e})`,percentIncrease:({percentageChange:e})=>`Percent increase (${e})`,percentDecrease:({percentageChange:e})=>`Percent decrease (${e})`},size:{label:"Size",small:"Small",medium:"Medium",large:"Large"},flipArrow:"Flip arrow",color:"Color",toolbarAriaLabel:"Difference arrow toolbar",editorAriaLabel:"Difference arrow editor"},shape:{color:"Color",border:{label:"Border",none:"None",thin:({value:e})=>`Thin (${e})`,medium:({value:e})=>`Medium (${e})`,thick:({value:e})=>`Thick (${e})`}}}},lu={common:ou,editor:iu,graph:su},cu={colorPanel:{backgroundSection:{gray:"Gray"},borderType:{gray:"Gray"}},highlighting:{highlightStyle:{gray:"Gray"}}},du={editor:cu},uu={save:"Guardar",cancel:"Cancelar",confirm:"Confirmar",delete:"Eliminar",confirmDelete:e=>`Tem a certeza que deseja eliminar ${e.item}?`,abbreviations:{thousands:"mil",millions:"M",billions:"MM"}},hu={title:"Editor Graphy",description:"Edite o seu conteúdo aqui",graphTypes:{column:"Colunas",columnStacked:"Colunas sobrepostas",columnStackedFill:"100% Colunas sobrepostas",bar:"Barras",barStacked:"Barras sobrepostas",barStackedFill:"100% Barras sobrepostas",line:"Linha",area:"Área",areaStacked:"Área sobreposta",pie:"Circular",donut:"Donut",radialBar:"Barras radiais",radar:"Radar",radarFilled:"Radar preenchido",scatter:"Dispersão",bubble:"Bolhas",funnel:"Funil",combo:"Combinado",heatmap:"Mapa de Calor",waterfall:"Cascata",mekko:"Mekko",table:"Tabela"},sizePanel:{toolbarButton:"Tamanho",presetsSection:{title:"Predefinições"},customSizeSection:{title:"Tamanho personalizado"},presets:{googleSlides:"Google Slides / PowerPoint",webEmail:"Web / email",linkedIn:"Publicação LinkedIn",instagram:"Publicação Instagram",tiktok:"TikTok / Instagram story",twitter:"X (Twitter)",mobile:"Móvel"},inputs:{unitLabel:"px"},validation:{maxSizeError:e=>`≤ ${e.max}px`,minSizeError:e=>`≥ ${e.min}px`}},graphPanel:{toolbarButton:"Gráfico",graphTypeSection:{title:"Tipo de gráfico"},mappingSection:{title:"Dados",x:"Eixo X",y:"Valor",color:"Cor",size:"Tamanho",label:"Etiqueta",none:"Nenhum"},comboSection:{title:"Aspeto do gráfico combinado",types:{groupedBars:"Barras agrupadas",stackedBars:"Barras empilhadas",lines:"Apenas linhas"}},polarSection:{title:"Polar",innerRadius:"Raio interno",startAngle:"Ângulo inicial"},barSection:{title:"Barras",thickness:"Espessura da barra",widths:{narrow:"Estreita",regular:"Normal",wide:"Larga"},baseRadius:"Base",tipRadius:"Ponta",radiusOptions:{none:"Reto",md:"Arredondado",full:"Redondo"}},graphOptionsSection:{title:"Opções do gráfico"},gridSection:{title:"Grelha",horizontalGridLines:"Linhas horizontais",verticalGridLines:"Linhas verticais",rings:"Anéis",spokes:"Raios",gridStyle:"Estilo da grelha",gridThickness:"Espessura da grelha",lineStyles:{solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"},lineWidths:{thin:"Fina",medium:"Média",thick:"Espessa"}},graphOptions:{sortBars:"Ordenar maior → menor",showPoints:"Mostrar pontos",lineFill:"Preencher sob a linha",smoothLines:"Linhas suaves",curves:{smooth:"Suave",linear:"Reta"},stackTotals:"Totais sobrepostos",dataLabels:"Etiquetas de dados",showPercentages:"Mostrar percentagens",categoryLabels:"Etiquetas de categorias"},legendSection:{title:"Legenda",auto:"Automático",top:"Topo",bottom:"Fundo",left:"Esquerda",right:"Direita",none:"Nenhuma",alignLabel:"Alinhamento",align:{auto:"Automático",center:"Centro"},displayLabel:"Estilo",display:{auto:"Automático",pill:"Etiquetas",direct:"No gráfico"}},numberFormatSection:{title:"Formato numérico"},numberFormat:{abbreviationLabel:"Abreviação",valueLabel:"Valor",decimalPlacesLabel:"Casas decimais",options:{auto:"Automático",custom:"Personalizado",none:"Nenhum"}},headlineNumberSize:{sizeLabel:"Tamanho",valueLabel:"Valor",sizes:{small:"P",medium:"M",large:"G"}},lineThickness:{label:"Espessura da linha"},pointSize:{label:"Tamanho do ponto",options:{auto:"Automático",custom:"Personalizado"},sizes:{small:"Pequeno",medium:"Médio",large:"Grande"}},pointSymbol:{label:"Forma do ponto",symbols:{circle:"Círculo",square:"Quadrado",diamond:"Losango",triangle:"Triângulo",cross:"Cruz",star:"Estrela",wye:"Y"},custom:"Forma personalizada",oversized:"Esta imagem é demasiado grande. Escolha uma com menos de 512 KB.",undecodable:"Não foi possível ler este ficheiro como imagem."},headlineNumberSection:{title:"Número destaque",toggle:"Visível",metricLabel:"Métrica",compareWithLabel:"Comparar com",metrics:{total:"Total",average:"Média",current:"Último",conversion:"Conversão",left:"Esquerda"},comparison:{first:"Primeiro",previous:"Anterior"},position:{above:"Acima",center:"Centro"}},treatEmptyValues:{leaveGap:{label:"Deixar espaço no gráfico",description:"Deixa uma quebra visível na linha onde faltam dados"},fillZero:{label:"Preencher com zero",description:"Exibe pontos de dados em falta como zero"},connectGaps:{label:"Ligar através dos espaços",description:"Une a linha entre pontos disponíveis, ignorando o espaço"}}},axesPanel:{toolbarButton:"Eixos",mainAxisSection:{yAxis:"Eixo Y",xAxis:"Eixo X"},crossAxisSection:{xAxis:"Eixo X",yAxis:"Eixo Y"},controls:{title:"Título",titlePlaceholder:"Adicionar título",visible:"Visível",ticks:"Marcas",labels:"Etiquetas",position:"Posição",scale:"Escala",startFrom:"Iniciar de",endAt:"Terminar em",value:"Valor",numberOfAxes:"Número de eixos"},labelMode:{auto:"Automático",edges:"Extremos"},scale:{auto:"Automático",log:"Logarítmico"},startFrom:{auto:"Automático",zero:"Zero",custom:"Personalizado"},endAt:{auto:"Automático",custom:"Personalizado"},axisCount:{single:"Único",double:"Duplo"},position:{left:"Esquerda",right:"Direita",top:"Topo",bottom:"Fundo"}},colorPanel:{toolbarButton:"Cor",themeSection:{title:"Tema"},appearanceSection:{title:"Aparência",highlightStyle:"Destaque"},backgroundSection:{title:"Fundo",black:"Preto",white:"Branco",gray:"Cinzento",tint:"Tonalidade",custom:"Personalizado",none:"Nenhum"},borderSection:{title:"Contorno",borderColor:"Cor do contorno",thickness:"Espessura",cornerRadius:"Raio dos cantos"},borderType:{solid:"Sólido",gradient:"Gradiente",gray:"Cinzento",preset:"Predefinido",custom:"Personalizado",none:"Nenhum"},presetGradients:{lilac:"Lilás",neonPink:"Rosa Néon",blackberry:"Amora",sun:"Sol",iceland:"Islândia",sunset:"Pôr do Sol",ultraviolet:"Ultravioleta",purple:"Roxo",iceCream:"Gelado",mint:"Menta",cool:"Frio",fresh:"Fresco"}},designPanel:{toolbarButton:"Design",defaultExpanded:"Paleta"},annotatePanel:{toolbarButton:"Anotar",callOutSection:{title:"Destaques",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},highlightSection:{title:"Realce",button:"Realçar",colorLabel:"Cor do realce"}},annotationsPanel:{toolbarButton:"Anotar",freeformSection:{title:"Forma livre",text:"Texto",arrow:"Seta",box:"Caixa",difference:"Diferença"},goalSection:{title:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",valueAriaLabel:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:"(opcional)"},trendsAndAveragesSection:{title:"Tendências e Médias",trend:"Tendência",average:"Média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},averageLineSeries:{label:"Série da linha de média",placeholder:"Selecionar série",ariaLabel:"Dropdown de séries para linha de média"},highlightSection:{title:"Realce",button:"Realçar",fadeColorLabel:"Cor de esmaecimento"},titleAndSubtitleSection:{title:"Título e Subtítulo",toggleTitle:"Título",subtitle:"Subtítulo"},captionAndSourceSection:{title:"Legenda e Fonte",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"}},elementsPanel:{contentVisible:"Visível",contentValue:"Valor",toolbarButton:"Elementos",headerSection:{title:"Cabeçalho",toggleTitle:"Título",subtitle:"Subtítulo"},footerSection:{title:"Rodapé",caption:"Legenda",source:"Fonte",url:"URL",name:"Nome"},textSizeSection:{title:"Tamanho do texto",scaleFormat:e=>`${e.value}x`},fontSection:{title:"Tipo de letra"},sourceSection:{title:"Fonte",url:"URL",name:"Nome"}},powerUpPanel:{toolbarButton:"Extras",goalSection:{title:"Objetivo",toggle:"Objetivo",labelControl:"Etiqueta",labelPlaceholder:"Objetivo",labelAriaLabel:"Etiqueta de objetivo personalizada",valueControl:"Valor do objetivo",byDate:"Por data",xAxisValue:"Valor do eixo X",optional:" (opcional)",xAxisReferenceAriaLabel:"Valor de referência do eixo X",anyXAxisValue:"Qualquer valor do eixo X",selectValuePlaceholder:"Selecionar valor"},trendSection:{title:"Tendência",toggle:"Tendência"},averageSection:{title:"Média",toggle:"Média",seriesLabel:"Série da linha de média",seriesPlaceholder:"Selecionar série",seriesAriaLabel:"Dropdown de séries para linha de média"},trendType:{label:"Tipo de tendência",placeholder:"Tipo de tendência",options:{linear:"Linear",exponential:"Exponencial",quadratic:"Quadrática",polynomial:"Polinomial",logarithmic:"Logarítmica",power:"Potência",loess:"Loess"}},valueInput:{percentagePlaceholder:"Percentagem",numberPlaceholder:"Número",percentageSymbol:"%"}},highlighting:{modeHelper:{title:"Modo de realce",hover:"Passe",toHighlight:"para realçar",anyElement:"qualquer elemento",escToExit:"para sair",esc:"ESC"},emptyState:"Sem opções de realce disponíveis",deleteAriaLabel:"Eliminar realce",highlightStyle:{tint:"Tonalidade",gray:"Cinzento"}},fineTunePanel:{toolbarButton:"Ajuste fino",detailSection:{title:"Detalhe",missingValues:"Valores em falta"},lineStyleSection:{title:"Estilo de linha",lineCurve:"Curva da linha",sharp:"Angulosa",smooth:"Suave"}},customThemeEditor:{patternDropdownAriaLabel:"Dropdown de padrões para série",patterns:{solid:"Sólido",pattern:"Padrão",dotted:"Pontilhado",dashed:"Tracejado",hatched:"Hachurado"},heatmapColorLabel:"Cor"},overlayMenu:{observation:"Observação",group:"Grupo",band:"Banda",axis:"Eixo",legend:"Legenda",gridLines:"Linhas de grelha",chart:"Gráfico",selection:"Seleção",thisBar:"Esta barra",thisPoint:"Este ponto",thisBubble:"Esta bolha",thisSlice:"Esta fatia",allOf:e=>`Tudo em ${e.name}`,all:"Tudo",titledValue:e=>`${e.title}: ${e.value}`,groupAtBand:e=>`${e.group}, ${e.band}`,hide:"Ocultar",show:"Mostrar",legendPlaces:{topStart:"Topo à esquerda",topCenter:"Topo ao centro",topEnd:"Topo à direita",left:"Esquerda",right:"Direita",bottomStart:"Fundo à esquerda",bottomCenter:"Fundo ao centro",bottomEnd:"Fundo à direita"},fillColor:"Cor de preenchimento",lowColor:"Cor dos valores baixos",highColor:"Cor dos valores altos",lineColor:"Cor da linha",palette:"Paleta",themePalette:"Tema",chartType:"Tipo",customChartType:"Personalizado",arrange:"Disposição",arrangements:{grouped:"Agrupado",stacked:"Sobreposto",filled:"100%",lines:"Apenas linhas"}},accessibility:{toggleSection:e=>`Alternar secção ${e.title}`},graphyDefaults:{themeOptions:{light:"Claro",dark:"Escuro"}}},pu={titleEditor:{titlePlaceholder:"Sem título",subtitlePlaceholder:"Adicionar subtítulo"},toolbar:{formatting:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",link:"Ligação"},link:{ariaLabel:"Criar ligação",placeholder:"Escreva ou cole uma ligação...",submit:"Submeter",urlLabel:"URL da ligação",apply:"Aplicar ligação"},font:{label:"Tipo de letra",ariaLabel:"Família do tipo de letra"},heading:{label:"Nível de título",ariaLabel:"Estilo de texto",text:"Texto",caption:"Legenda",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3"},textAlign:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},color:{label:"Cor do texto"}},colorDropdown:{colors:"Cores",chartColors:"Cores do gráfico",custom:"Personalizado",opacity:"Opacidade",transparent:"Transparente",pickCustom:"Escolher cor personalizada",pickColor:"Escolher cor"},annotations:{differenceArrowToolbar:{label:"Opções da seta de diferença",labelKind:{ariaLabel:"Etiqueta",absoluteDifference:"Variação absoluta",relativeDifference:"Variação percentual",asPercent:"Diferença em %",asNumber:"Diferença como número",proportion:"Proporção",suspectValue:"Este valor divide por uma base igual a zero.",incomparableEnds:"As duas pontas medem quantidades diferentes, pelo que a diferença entre elas não tem significado."},color:"Cor da seta",size:{ariaLabel:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},swap:"Inverter sentido",remove:"Remover seta"},shapeToolbar:{label:"Opções da forma",color:"Cor da forma",border:{ariaLabel:"Contorno",none:"Nenhum",thin:"Fino (2px)",medium:"Médio (8px)",thick:"Espesso (16px)"},remove:"Remover forma",resize:{"top-left":"Redimensionar a partir do canto superior esquerdo","top-right":"Redimensionar a partir do canto superior direito","bottom-right":"Redimensionar a partir do canto inferior direito","bottom-left":"Redimensionar a partir do canto inferior esquerdo"}},arrowToolbar:{label:"Opções da seta",color:"Cor da seta",thickness:{ariaLabel:"Espessura",thin:"Fina",medium:"Média",thick:"Espessa"},startArrowhead:"Início da seta",endArrowhead:"Fim da seta",arrowhead:{lineArrow:"Ponta de seta",none:"Nenhuma"},lineStyle:{ariaLabel:"Estilo da linha",solid:"Sólida",dashed:"Tracejada",dotted:"Pontilhada"},sticker:"Efeito autocolante",remove:"Remover seta",moveEndpoint:{start:"Mover o início da seta",end:"Mover o fim da seta"}},textToolbar:{label:"Opções do texto",background:"Cor de fundo",color:"Cor do texto",font:{ariaLabel:"Tipo de letra",modern:"Moderno",fresh:"Fresco",timeless:"Intemporal",technical:"Técnico",fineliner:"Caneta fina",handwritten:"Permanent Marker"},fontSize:{ariaLabel:"Tamanho da letra",small:"Pequeno",medium:"Médio",large:"Grande",extraLarge:"Muito grande",huge:"Enorme"},align:{left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita"},remove:"Remover texto",resize:{left:"Redimensionar a partir da esquerda",right:"Redimensionar a partir da direita"}},text:{editLabel:"Editar texto",placeholder:"Escreva algo"},baseMenu:{pinNumber:"Fixar número",unpinNumber:"Desafixar número",annotate:"Anotar",addNote:"Adicionar nota",removeAnnotation:"Remover anotação",highlight:"Realçar",highlightWithLabel:e=>`Realçar ${e.label}`,removeHighlight:"Remover realce",differenceArrow:"Adicionar seta de diferença",addSticker:"Adicionar autocolante",removeSticker:"Remover autocolante",text:"Adicionar texto",stickyNote:"Adicionar nota adesiva",arrow:"Adicionar seta",box:"Adicionar caixa",arrowOneWay:"Um sentido",arrowTwoWay:"Dois sentidos",arrowLine:"Linha"},textMenu:{title:"Anotar",placeholder:"Diga o que aconteceu…",addButton:"Adicionar"},highlights:{menuTitle:"Realçar",labels:{bar:"Barra",barGroup:"Grupo",barStack:"Pilha",barSeries:"Série",line:"Linha",linePoint:"Ponto",lineSeries:"Série",scatterPoint:"Ponto",scatterSeries:"Série",pieSlice:"Fatia",pointOrBar:"Ponto / barra",lineOrSeries:"Linha / série"},atLeast:({value:e})=>`≥ ${e}`,atLeastDescription:({noun:e,value:t})=>`Realçar cada ${e} em ${t} ou mais`,onward:({label:e})=>`${e} em diante`,onwardDescription:({label:e})=>`Realçar ${e} e tudo a seguir`,justThis:({noun:e})=>`Realçar apenas esta ${e}`,justValue:({label:e})=>`Realçar apenas ${e}`,everyNamed:({name:e,noun:t})=>`Realçar cada ${e} ${t}`,everyIn:({noun:e,name:t})=>`Realçar cada ${e} em ${t}`,wholeGroup:"Realçar o grupo inteiro",wholeStack:"Realçar a pilha inteira",wholeSeries:"Realçar a série inteira",nouns:{bubble:"bolha"}},stickerMenu:{title:"Adicionar autocolante"},delete:"Eliminar",arrow:{thickness:{label:"Espessura",thin:"Fina",medium:"Média",thick:"Grossa"},arrowhead:{startPoint:"Ponto inicial",endPoint:"Ponto final",lineArrow:"Seta de linha",none:"Nenhuma"},lineStyle:{label:"Estilo de linha",solid:"Sólida",dotted:"Pontilhada"},stickerEffect:"Efeito de autocolante",toolbarAriaLabel:"Barra de ferramentas de seta livre",editorAriaLabel:"Editor de seta"},differenceArrow:{type:{proportion:"Proporção",difference:({absoluteDifference:e})=>`Diferença (${e})`,increase:({absoluteDifference:e})=>`Aumento (${e})`,decrease:({absoluteDifference:e})=>`Diminuição (${e})`,percentageChange:({percentageChange:e})=>`Variação percentual (${e})`,percentIncrease:({percentageChange:e})=>`Aumento percentual (${e})`,percentDecrease:({percentageChange:e})=>`Diminuição percentual (${e})`},size:{label:"Tamanho",small:"Pequeno",medium:"Médio",large:"Grande"},flipArrow:"Inverter seta",color:"Cor",toolbarAriaLabel:"Barra de ferramentas de seta de diferença",editorAriaLabel:"Editor de seta de diferença"},shape:{color:"Cor",border:{label:"Contorno",none:"Nenhum",thin:({value:e})=>`Fino (${e})`,medium:({value:e})=>`Médio (${e})`,thick:({value:e})=>`Grosso (${e})`}}}},mu={common:uu,editor:hu,graph:pu},gu={"en-GB":lu,"en-US":du,ar:au,"pt-PT":mu},vu=[gu,l.dictionaries],Pn=({children:e,...t})=>(0,r.jsx)(l.IntlProvider,{dictionaries:vu,...t,children:(0,r.jsx)(fu,{children:e})}),fu=({children:e})=>(0,r.jsx)(gn.DirectionProvider,{direction:l.useTextDirection(),children:e}),xu="data-variant",$o=Ca.Paragraph.extend({addAttributes(){return{variant:{default:null,parseHTML:e=>e.getAttribute("data-variant")??null,renderHTML:e=>e.variant?{[xu]:e.variant}:{}}}}}),bu=ya.Extension.create({name:"preventBackspaceAcrossTitleBoundary",addOptions(){return{showTitle:!0}},addKeyboardShortcuts(){return{Backspace:({editor:e})=>{if(!this.options.showTitle)return!1;const{selection:t}=e.state;if(!t.empty)return!1;const{$from:n}=t;return n.depth!==1||n.parentOffset!==0?!1:n.index(0)===1}}}}),In=()=>[cs.Text,bt.UndoRedo,is.Heading.configure({levels:[1,2,3]}),as.Bold,ss.Italic,us.Underline,ds.TextAlign.configure({types:["heading","paragraph"]}),ls.Link.configure({openOnClick:!1,autolink:!0}),it.TextStyle,it.Color,os.HardBreak],Su=({titlePlaceholder:e,subtitlePlaceholder:t,showTitle:n,showSubtitle:a})=>[Cu({showTitle:n,showSubtitle:a}),$o,...In(),it.FontFamily,bu.configure({showTitle:n}),bt.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:o,editor:i})=>{if(n&&o===0)return e;const s=n?i.state.doc.firstChild?.nodeSize??-1:0;return a&&o===s?t:""}})],yu=({placeholder:e})=>[ot.Document,$o,...In(),it.FontFamily,bt.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Cu=({showTitle:e,showSubtitle:t})=>e&&t?ot.Document.extend({content:"block{2,}"}):ot.Document;var wu="linear-gradient(to top right, transparent calc(50% - 1px), var(--graphy-alert) calc(50% - 1px), var(--graphy-alert) calc(50% + 1px), transparent calc(50% + 1px))",ju="d0bl00";var Tu="d0bl03",ku="d0bl04",Au=.01,Qt=l.CANVAS_COLOR_KEYS.map(e=>l.vars[e]),Lu=Object.fromEntries(l.CANVAS_COLOR_KEYS.map(e=>[l.vars[e],e])),Pu=e=>Qt.some(t=>t.toLowerCase()===e.toLowerCase()),Iu=({color:e,onChange:t,open:n,onOpenChange:a,children:o,label:i,popupAttributes:s,opacity:c,onOpacityChange:d,hasTransparentOption:h=!1})=>{const p=l.useI18n(),{ColorSwatches:m,Slider:g}=D(),v=Ru(),x=h?[Ma,...Qt]:Qt,b=y=>{t(y),a(!1)};return(0,r.jsxs)(K.Popover.Root,{open:n,onOpenChange:a,children:[(0,r.jsx)(K.Popover.Trigger,{render:(0,r.jsx)(pe.Toolbar.Button,{}),"aria-label":i??p("graph.toolbar.color.label"),className:ju,onMouseDown:y=>y.preventDefault(),children:o??(0,r.jsx)("span",{className:"d0bl01",style:{background:e??"transparent"}})}),(0,r.jsx)(K.Popover.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(K.Popover.Positioner,{sideOffset:6,align:"start",className:Tu,children:(0,r.jsxs)(K.Popover.Popup,{className:ku,onMouseDown:y=>y.preventDefault(),...s,children:[(0,r.jsx)(m,{title:p("graph.colorDropdown.colors"),colors:x,value:e,onChange:b}),v.length>0&&(0,r.jsx)(m,{title:p("graph.colorDropdown.chartColors"),colors:v,value:e,onChange:b}),(0,r.jsx)(Mu,{value:e,onChange:t,popupAttributes:s}),c!==void 0&&d!==void 0&&(0,r.jsxs)("div",{className:"_14ty2ng0",children:[(0,r.jsx)("div",{className:"_14ty2ng1",children:p("graph.colorDropdown.opacity")}),(0,r.jsx)(g,{value:c,onChange:d,min:0,max:1,step:Au,showValue:!1,ariaLabel:p("graph.colorDropdown.opacity")})]})]})})})})]})},Eu=(e,t)=>{if(l.isHex(e))return e;const n=Lu[e];return n===void 0?e:t[n]},Mu=({value:e,onChange:t,popupAttributes:n})=>{const{CustomColor:a}=D(),{themeValues:o}=l.useThemeContext();return(0,r.jsx)(a,{value:e===null?null:Eu(e,o),onChange:t,popupAttributes:n})},Ru=()=>{const e=l.useSceneSelector(t=>t.scales.color);return(0,f.useMemo)(()=>{if(!e||e.kind!=="visual")return[];const t=new Set;for(const n of e.domain){const a=e.map(n);typeof a=="string"&&t.add(a)}return[...t]},[e])},Ou="l9kff0",_u="l9kff1",Nu="l9kff2",Du="xn24px0",Fu="xn24px1",Bu="xn24px2",Gu=({children:e,popupAttributes:t})=>(0,r.jsx)(J.Menu.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(J.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:Du,children:(0,r.jsx)(J.Menu.Popup,{className:Fu,onMouseDown:n=>n.preventDefault(),...t,children:e})})})}),zu=({children:e,selected:t=!1,disabled:n=!1,onClick:a})=>(0,r.jsx)(J.Menu.Item,{className:Bu,"data-selected":t,disabled:n,onClick:a,children:e}),Hu=({className:e,...t})=>(0,r.jsx)(ne.Tooltip.Provider,{children:(0,r.jsx)(pe.Toolbar.Root,{...t,className:(0,le.default)(Ou,e)})}),Vu=({className:e,...t})=>(0,r.jsx)(pe.Toolbar.Group,{...t,className:(0,le.default)(_u,e)}),$u=({className:e,...t})=>(0,r.jsx)(pe.Toolbar.Separator,{...t,className:(0,le.default)(Nu,e)}),Wu=({children:e})=>{const t=l.resolvePortalContainer();return t===null?null:(0,mn.createPortal)((0,r.jsx)(l.PortalThemeProvider,{children:e}),t)},q={Portal:Wu,Root:Hu,Group:Vu,Separator:$u,Button:pe.Toolbar.Button,ColorPicker:Iu,MenuPopup:Gu,MenuItem:zu},Uu="'Noto Serif', Georgia, 'Times New Roman', serif, 'Apple Color Emoji', 'NotoColorEmoji'",qu=`'Aeonik', 'Aeonik Fallback', ${l.DEFAULT_FONT_FAMILY}`,Ku="'PT Mono', 'Courier New', monospace, 'Apple Color Emoji', 'NotoColorEmoji'",Xu="'Intruding Cat', cursive, 'Apple Color Emoji', 'NotoColorEmoji'",en=[{id:"modern",label:"Modern",preview:"Aa",fontFamily:l.DEFAULT_FONT_FAMILY},{id:"fresh",label:"Fresh",preview:"Aa",fontFamily:qu},{id:"timeless",label:"Timeless",preview:"Aa",fontFamily:Uu},{id:"technical",label:"Technical",preview:"00",fontFamily:Ku},{id:"fineliner",label:"Fineliner",preview:"Aa",fontFamily:Xu}],Yu=e=>e?en.find(t=>t.fontFamily===e)??null:null,Wo="_70l3rt0",Uo="_70l3rt1",qo="_70l3rt3",Ko="_70l3rt4",Xo="_70l3rt5",Zu=({editor:e,currentFontFamily:t,open:n,onOpenChange:a})=>{const o=l.useI18n(),i=Yu(t)??en[0],s=c=>{e.chain().focus().setFontFamily(c.fontFamily).run()};return(0,r.jsxs)(J.Menu.Root,{open:n,onOpenChange:a,children:[(0,r.jsxs)(J.Menu.Trigger,{render:(0,r.jsx)(pe.Toolbar.Button,{}),"aria-label":o("graph.toolbar.font.ariaLabel"),className:Wo,onMouseDown:c=>c.preventDefault(),children:[(0,r.jsx)("span",{className:Uo,style:{fontFamily:i?.fontFamily},children:i?.preview}),(0,r.jsx)(De,{size:"sm"})]}),(0,r.jsx)(J.Menu.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(J.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:qo,children:(0,r.jsx)(J.Menu.Popup,{className:Ko,onMouseDown:c=>c.preventDefault(),children:en.map(c=>(0,r.jsx)(J.Menu.Item,{className:Xo,"data-selected":c.id===i?.id,onClick:()=>s(c),children:(0,r.jsx)("span",{style:{fontFamily:c.fontFamily},children:c.label})},c.id))})})})})]})},Yo={id:"text",translationKey:"graph.toolbar.heading.text",previewFont:l.vars.fontTextEditorBody},Cr=[{id:"caption",translationKey:"graph.toolbar.heading.caption",previewFont:l.vars.fontTextEditorH6},Yo,{id:"h3",translationKey:"graph.toolbar.heading.heading3",previewFont:l.vars.fontTextEditorH3},{id:"h2",translationKey:"graph.toolbar.heading.heading2",previewFont:l.vars.fontTextEditorH2},{id:"h1",translationKey:"graph.toolbar.heading.heading1",previewFont:l.vars.fontTextEditorH1}],Ju=({editor:e,activeStyle:t,open:n,onOpenChange:a})=>{const o=l.useI18n(),i=Cr.find(s=>s.id===t)??Yo;return(0,r.jsxs)(J.Menu.Root,{open:n,onOpenChange:a,children:[(0,r.jsxs)(J.Menu.Trigger,{render:(0,r.jsx)(pe.Toolbar.Button,{}),"aria-label":o("graph.toolbar.heading.ariaLabel"),className:Wo,onMouseDown:s=>s.preventDefault(),children:[(0,r.jsx)("span",{className:Uo,children:o(i.translationKey)}),(0,r.jsx)(De,{size:"sm"})]}),(0,r.jsx)(J.Menu.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(J.Menu.Positioner,{side:"bottom",align:"start",sideOffset:6,className:qo,children:(0,r.jsx)(J.Menu.Popup,{className:Ko,onMouseDown:s=>s.preventDefault(),children:Cr.map(s=>(0,r.jsx)(J.Menu.Item,{className:Xo,"data-selected":s.id===i.id,onClick:()=>Qu(e,s.id),children:(0,r.jsx)(eh,{font:s.previewFont,children:o(s.translationKey)})},s.id))})})})})]})},Qu=(e,t)=>{switch(t){case"caption":e.chain().focus().setNode("paragraph",{variant:"caption"}).run();return;case"text":e.chain().focus().setNode("paragraph",{variant:null}).run();return;case"h1":e.chain().focus().setHeading({level:1}).run();return;case"h2":e.chain().focus().setHeading({level:2}).run();return;case"h3":e.chain().focus().setHeading({level:3}).run()}},eh=({font:e,children:t})=>(0,r.jsx)("span",{style:{font:e,margin:0},children:t}),th=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,r.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),nh=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M18 6 6 18"}),(0,r.jsx)("path",{d:"m6 6 12 12"})]})}),rh=e=>!e.content||e.content.length===0?!0:e.content.every(t=>!t.content||t.content.length===0),ah=e=>{const{$from:t}=e.state.selection,n=t.parent.textContent,a=t.parentOffset,o=t.start();let i=a;for(;i>0&&wr(n[i-1]);)i-=1;let s=a;for(;s<n.length&&wr(n[s]);)s+=1;return{from:o+i,to:o+s}},wr=e=>e!==void 0&&/\S/.test(e),oh="fop13s0",ih="fop13s1",sh="fop13s2",lh="fop13s3",jr="fop13s4",ch=({editor:e,currentUrl:t,active:n,open:a,onOpenChange:o})=>{const i=l.useI18n(),[s,c]=(0,f.useState)(""),d=(0,f.useRef)(null);(0,f.useEffect)(()=>{a&&c(t??"")},[a,t]);const h=()=>{dh(e,s),o(!1)},p=()=>{c(""),o(!1)},m=v=>{c(v.target.value)},g=v=>{v.key==="Enter"&&(v.preventDefault(),h())};return(0,r.jsxs)(K.Popover.Root,{open:a,onOpenChange:o,children:[(0,r.jsx)(K.Popover.Trigger,{render:(0,r.jsx)(pe.Toolbar.Button,{}),"aria-label":i("graph.toolbar.formatting.link"),"data-active":n,className:oh,onMouseDown:v=>v.preventDefault(),children:(0,r.jsx)(th,{})}),(0,r.jsx)(K.Popover.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(l.PortalThemeProvider,{children:(0,r.jsx)(K.Popover.Positioner,{sideOffset:6,align:"end",className:ih,children:(0,r.jsxs)(K.Popover.Popup,{className:sh,initialFocus:d,onMouseDown:v=>v.preventDefault(),children:[(0,r.jsx)("input",{ref:d,type:"url",value:s,placeholder:i("graph.toolbar.link.placeholder"),"aria-label":i("graph.toolbar.link.urlLabel"),className:lh,onMouseDown:v=>v.stopPropagation(),onChange:m,onKeyDown:g}),(0,r.jsx)("button",{type:"button","aria-label":i("common.cancel"),className:jr,onClick:p,children:(0,r.jsx)(nh,{})}),(0,r.jsx)("button",{type:"button","aria-label":i("graph.toolbar.link.apply"),className:jr,onClick:h,children:(0,r.jsx)(Va,{})})]})})})})]})},dh=(e,t)=>{const n=t.trim(),{selection:a}=e.state;if(!n){e.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!a.empty){e.chain().focus().setLink({href:n}).run();return}if(e.isActive("link")){e.chain().focus().extendMarkRange("link").setLink({href:n}).run();return}const o=ah(e);e.chain().focus().setTextSelection(o).setLink({href:n}).run()},Zo=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M21 5H3"}),(0,r.jsx)("path",{d:"M17 12H7"}),(0,r.jsx)("path",{d:"M19 19H5"})]})}),Jo=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M21 5H3"}),(0,r.jsx)("path",{d:"M21 12H9"}),(0,r.jsx)("path",{d:"M21 19H7"})]})}),Qo=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M21 5H3"}),(0,r.jsx)("path",{d:"M15 12H3"}),(0,r.jsx)("path",{d:"M17 19H3"})]})}),uh="_1d66w570",hh="_1d66w571",je=({label:e,active:t,onToggle:n,children:a})=>{const o=i=>i.preventDefault();return(0,r.jsxs)(ne.Tooltip.Root,{children:[(0,r.jsx)(ne.Tooltip.Trigger,{render:(0,r.jsx)(hs.Toggle,{render:(0,r.jsx)(pe.Toolbar.Button,{}),pressed:t,onPressedChange:()=>n()}),"aria-label":e,className:uh,onMouseDown:o,children:a}),(0,r.jsx)(ne.Tooltip.Portal,{container:l.resolvePortalContainer(),className:ue,children:(0,r.jsx)(vn,{children:(0,r.jsx)(ne.Tooltip.Positioner,{sideOffset:6,className:hh,children:(0,r.jsx)(ne.Tooltip.Popup,{className:Aa,children:e})})})})]})},ph=({editor:e,activeAlignment:t="left"})=>{const n=l.useI18n();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(je,{label:n("graph.toolbar.textAlign.left"),active:t==="left",onToggle:()=>e.chain().focus().setTextAlign("left").run(),children:(0,r.jsx)(Qo,{})}),(0,r.jsx)(je,{label:n("graph.toolbar.textAlign.center"),active:t==="center",onToggle:()=>e.chain().focus().setTextAlign("center").run(),children:(0,r.jsx)(Zo,{})}),(0,r.jsx)(je,{label:n("graph.toolbar.textAlign.right"),active:t==="right",onToggle:()=>e.chain().focus().setTextAlign("right").run(),children:(0,r.jsx)(Jo,{})})]})},mh="_1u34vl40",gh=({editor:e})=>({bold:e?.isActive("bold")??!1,italic:e?.isActive("italic")??!1,underlined:e?.isActive("underline")??!1,linked:e?.isActive("link")??!1,linkUrl:e?.getAttributes("link").href??null,color:e?.getAttributes("textStyle").color??null,fontFamily:e?.getAttributes("textStyle").fontFamily??null,fontSize:vh(e),textAlign:fh(e)}),vh=e=>e?e.isActive("heading",{level:1})?"h1":e.isActive("heading",{level:2})?"h2":e.isActive("heading",{level:3})?"h3":e.isActive("paragraph",{variant:"caption"})?"caption":"text":"text",fh=e=>e?e.isActive({textAlign:"center"})?"center":e.isActive({textAlign:"right"})?"right":"left":"left",xh=8,bh=8,Sh=({editor:e})=>{const t=l.useI18n(),[n,a]=(0,f.useState)(!1),[o,i]=(0,f.useState)(null),s=o!==null,c=v=>x=>{i(x?v:null)},{refs:d,floatingStyles:h}=(0,Le.useFloating)({placement:"top-start",strategy:"fixed",middleware:[(0,Le.offset)(xh),(0,Le.flip)(),(0,Le.shift)({padding:bh})],whileElementsMounted:Le.autoUpdate}),p=(0,f.useRef)(null),m=(0,St.useEditorState)({editor:e,selector:gh}),g=(0,f.useCallback)(v=>{p.current=v,d.setFloating(v)},[d]);return(0,f.useEffect)(()=>{e&&d.setReference(e.view.dom)},[e,d]),(0,f.useEffect)(()=>{if(!e)return;const v=()=>a(!0),x=({event:b})=>{const{relatedTarget:y,currentTarget:k}=b,w=y instanceof Node&&p.current?.contains(y),j=y instanceof Node&&k instanceof Node&&k.contains(y);!w&&!j&&a(!1)};return e.on("focus",v),e.on("blur",x),()=>{e.off("focus",v),e.off("blur",x)}},[e]),!e||!n&&!s?null:(0,r.jsx)(q.Portal,{children:(0,r.jsxs)(q.Root,{ref:g,className:mh,style:h,children:[(0,r.jsxs)(q.Group,{children:[(0,r.jsx)(q.ColorPicker,{color:m?.color??null,onChange:v=>e.chain().setColor(v).run(),open:o==="color",onOpenChange:c("color")}),(0,r.jsx)(Zu,{editor:e,currentFontFamily:m?.fontFamily??null,open:o==="fontFamily",onOpenChange:c("fontFamily")})]}),(0,r.jsx)(q.Separator,{}),(0,r.jsx)(q.Group,{children:(0,r.jsx)(Ju,{editor:e,activeStyle:m?.fontSize??"text",open:o==="fontSize",onOpenChange:c("fontSize")})}),(0,r.jsx)(q.Separator,{}),(0,r.jsxs)(q.Group,{children:[(0,r.jsx)(je,{label:t("graph.toolbar.formatting.bold"),active:m?.bold??!1,onToggle:()=>e.chain().focus().toggleBold().run(),children:(0,r.jsx)("strong",{children:"B"})}),(0,r.jsx)(je,{label:t("graph.toolbar.formatting.italic"),active:m?.italic??!1,onToggle:()=>e.chain().focus().toggleItalic().run(),children:(0,r.jsx)("em",{children:"I"})}),(0,r.jsx)(je,{label:t("graph.toolbar.formatting.underline"),active:m?.underlined??!1,onToggle:()=>e.chain().focus().toggleUnderline().run(),children:(0,r.jsx)("u",{children:"U"})})]}),(0,r.jsx)(q.Separator,{}),(0,r.jsx)(q.Group,{children:(0,r.jsx)(ph,{editor:e,activeAlignment:m?.textAlign})}),(0,r.jsx)(q.Separator,{}),(0,r.jsx)(q.Group,{children:(0,r.jsx)(ch,{editor:e,currentUrl:m?.linkUrl??null,active:m?.linked??!1,open:o==="link",onOpenChange:c("link")})})]})})},yh="_1uy50v30",ei=({editor:e,ariaLabel:t})=>(0,r.jsxs)("div",{className:yh,children:[(0,r.jsx)(Sh,{editor:e}),(0,r.jsx)(St.EditorContent,{editor:e,"aria-label":t})]}),Ch=200,En=({content:e,extensions:t,editable:n,onUpdate:a,updateDebounceMs:o=Ch})=>{const i=(0,f.useRef)(Tr(e)),s=(0,f.useRef)(i.current),c=l.useDebouncedCallback(h=>{s.current=h,a?.(h)},o),d=(0,St.useEditor)({extensions:t,content:i.current,editable:n,immediatelyRender:!1,onUpdate:({editor:h})=>{const p=h.getJSON();if(Gt(s.current,p))return c.cancel();c.run(p)}});return(0,f.useEffect)(()=>{d?.setEditable(n)},[d,n]),(0,f.useEffect)(()=>{if(!d)return;const h=Tr(e);Gt(s.current,h)||(s.current=h,!Gt(d.getJSON(),h)&&(c.cancel(),wh(d,h)))},[d,e,c]),(0,f.useEffect)(()=>()=>c.flush(),[c]),d},Tr=e=>e===null?{type:"doc",content:[]}:typeof e=="string"?{type:"doc",content:[{type:"paragraph",content:e?[{type:"text",text:e}]:[]}]}:e,wh=(e,t)=>{const{from:n,to:a}=e.state.selection;e.commands.setContent(t,{emitUpdate:!1});const o=e.state.doc.content.size;e.commands.setTextSelection({from:Math.min(n,o),to:Math.min(a,o)})},Gt=(e,t)=>JSON.stringify(mt(e))===JSON.stringify(mt(t)),mt=e=>Array.isArray(e)?e.map(mt):e===null||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,n])=>[t,mt(n)]).filter(([,t])=>!jh(t)).sort(([t],[n])=>String(t).localeCompare(String(n)))),jh=e=>e==null||typeof e=="object"&&Object.keys(e).length===0,Th=({caption:e,captionStyle:t})=>{const{dispatch:n}=l.useGraphCommands(),a=En({content:e,extensions:(0,f.useMemo)(()=>yu({placeholder:"Add caption"}),[]),editable:!0,onUpdate:o=>{const i=rh(o)?null:o;n(new u.SetContentCaptionCommand({caption:i}))}});return(0,r.jsx)("div",{"data-testid":"caption-editor",style:l.toHtmlTextCss(t),children:(0,r.jsx)(ei,{editor:a,ariaLabel:"Chart caption"})})},kh=e=>[ot.Document,Ca.Paragraph,...In(),Lh,bt.Placeholder.configure({showOnlyCurrent:!1,placeholder:({pos:t})=>t===0?e:""})],Ah=({annotation:e})=>{const t=l.useI18n(),{dispatch:n}=l.useGraphCommands(),a=l.useEditorStore(),o=(0,f.useMemo)(()=>kh(t("graph.annotations.text.placeholder")),[t]),i=En({content:e.content,extensions:o,editable:!0,onUpdate:s=>{n(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:{content:s}}))}});return(0,f.useEffect)(()=>{const{setCaretEditor:s}=a.getState();return s(i),()=>s(null)},[i,a]),(0,f.useEffect)(()=>{i?.commands.focus("end",{scrollIntoView:!1})},[i]),(0,r.jsx)(St.EditorContent,{"aria-label":t("graph.annotations.text.editLabel"),className:l.editor,editor:i,"data-testid":"text-annotation-editor"})},kr=e=>{const t=l.resolveRichTextFontFamily(e);return t===void 0?{}:{style:`font-family: ${t}`}},Lh=ya.Extension.create({name:"annotationTextStyleAttributes",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,renderHTML:e=>kr(e.fontFamily)},font:{default:null,renderHTML:e=>kr(e.font)},fontSize:{default:null,renderHTML:e=>typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)?{style:`font-size: calc(${e.fontSize}px * ${l.vars.textScale})`}:{}}}}]}}),Ph=3,Ih=({title:e,showTitle:t,subtitle:n,showSubtitle:a})=>{const o=[];return t&&o.push({type:"heading",attrs:{level:Ph},content:Mh(e)}),a&&o.push(...Rh(n)),{type:"doc",content:o}},Eh=e=>{const[t,...n]=e.content??[];return{title:Oh(t?.content??[]),subtitle:_h(n)}},Mn=e=>({type:e.type??"text",...e.content!==void 0?{content:e.content.map(Mn)}:{},...e.text!==void 0?{text:e.text}:{},...e.marks!==void 0?{marks:e.marks}:{},...e.attrs!==void 0?{attrs:e.attrs}:{}}),Mh=e=>e===null?[]:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e.type==="doc"&&e.content?e.content.flatMap(t=>t.content??[]):e.type==="text"||e.type==="hardBreak"?[e]:e.content??[],Rh=e=>e===null?[{type:"paragraph"}]:typeof e=="string"?e===""?[{type:"paragraph"}]:[{type:"paragraph",content:[{type:"text",text:e}]}]:e.type==="doc"&&e.content?e.content.length===0?[{type:"paragraph"}]:e.content.map(Ar):[Ar(e)],Ar=e=>e.type==="paragraph"?e:{type:"paragraph",content:e.content??[e]},Oh=e=>{if(e.length===0)return null;const[t]=e;return t&&e.length===1&&t.type==="text"&&(!t.marks||t.marks.length===0)?t.text??null:{type:"paragraph",content:e.map(Mn)}},_h=e=>{const t=e.filter(a=>(a.content??[]).length>0);if(t.length===0)return null;const[n]=t;if(n&&t.length===1&&n.type==="paragraph"){const a=n.content??[],[o]=a;if(o&&a.length===1&&o.type==="text"&&(!o.marks||o.marks.length===0))return o.text??null}return{type:"doc",content:t.map(Mn)}},Nh="uwf6lt0",Dh={fontFamily:"var(--uwf6lt1)",fontSize:"var(--uwf6lt2)",fontWeight:"var(--uwf6lt3)",fontStyle:"var(--uwf6lt4)",letterSpacing:"var(--uwf6lt5)",lineHeight:"var(--uwf6lt6)",textColor:"var(--uwf6lt7)",textTransform:"var(--uwf6lt8)",textDecoration:"var(--uwf6lt9)",textShadow:"var(--uwf6lta)",textOutline:"var(--uwf6ltb)"},Fh={fontFamily:"var(--uwf6ltc)",fontSize:"var(--uwf6ltd)",fontWeight:"var(--uwf6lte)",fontStyle:"var(--uwf6ltf)",letterSpacing:"var(--uwf6ltg)",lineHeight:"var(--uwf6lth)",textColor:"var(--uwf6lti)",textTransform:"var(--uwf6ltj)",textDecoration:"var(--uwf6ltk)",textShadow:"var(--uwf6ltl)",textOutline:"var(--uwf6ltm)"},Bh=({title:e,showTitle:t,showSubtitle:n,subtitle:a,headingStyle:o,subtitleStyle:i})=>{const{dispatch:s}=l.useGraphCommands(),c=(0,f.useMemo)(()=>Su({titlePlaceholder:"Untitled",subtitlePlaceholder:"Untitled",showTitle:t,showSubtitle:n}),[t,n]),d=En({content:(0,f.useMemo)(()=>Ih({title:e,showTitle:t,subtitle:a,showSubtitle:n}),[e,t,a,n]),extensions:c,editable:!0,onUpdate:h=>{const p=Eh(h);t&&s(new u.SetContentTitleCommand({title:p.title})),n&&s(new u.SetContentSubtitleCommand({subtitle:p.subtitle}))}});return(0,r.jsx)("div",{className:Nh,"data-testid":"title-editor",style:{...l.assignTextStyleVars(Dh,o),...l.assignTextStyleVars(Fh,i)},children:(0,r.jsx)(ei,{editor:d,ariaLabel:"Chart title and subtitle"})})},Gh={Title:Bh,Caption:Th,TextAnnotation:Ah},zh="_10igzta0",Hh=({rect:e,zIndex:t,container:n,boxRef:a,children:o,...i})=>n===null?null:(0,mn.createPortal)((0,r.jsx)("div",{...i,ref:a,className:zh,style:{transform:`translate(${e.left}px, ${e.top}px)`,width:e.width,height:e.height,zIndex:t},children:o}),n),Vh="kwvn4c0",$h="kwvn4c1",Rn=(e,t)=>{const{offsetWidth:n}=e;return n<=0||t<=0?1:t/n},ti=e=>Rn(e,e.getBoundingClientRect().width),tn=(e,t)=>{const{offsetWidth:n,offsetHeight:a}=e;return n<=0||a<=0?t:{width:n,height:a}},Wh=(e,t)=>({contextElement:e,getBoundingClientRect:()=>{const n=e.getBoundingClientRect(),a=Rn(e,n.width);return new DOMRect(n.left+t.x*a,n.top+t.y*a,t.width*a,t.height*a)}}),Uh=({side:e,boundary:t,spans:n,anchor:a,rightToLeft:o})=>{if(!Kh(e))return 0;const i=n[e];if(e==="left"||e==="right")return Lr(i.from-t.y,a.height,t.height);const s=o?t.x+t.width-i.to:i.from-t.x;return Lr(s,a.width,t.width)},qh=()=>{const[e,t]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{t(!0)},[]),e},Kh=e=>l.SIDE_KEYS.some(t=>t===e),Lr=(e,t,n)=>n===0?0:e*t/n,Xh={x:8,y:8},Yh={side:"flip",align:"shift",fallbackAxisSide:"end"},nn=({frameElement:e,boundary:t,spans:n,clearance:a=Xh,onEscape:o,children:i})=>{const s=Ct(),c=qh(),[d,h]=(0,f.useState)(null),p=(0,f.useRef)(null),m=(0,f.useCallback)(P=>{p.current=P,h(P)},[]),g=(0,f.useRef)(null);(0,f.useLayoutEffect)(()=>()=>{d?.contains(document.activeElement)&&e.focus({preventScroll:!0})},[d,e]);const{x:v,y:x,width:b,height:y}=t,k=(0,f.useMemo)(()=>({box:{x:v,y:x,width:b,height:y},spans:n}),[v,x,b,y,n]),w=(0,f.useMemo)(()=>Wh(e,k.box),[e,k]),j=(P,A)=>{P||(A.cancel(),A.reason==="escape-key"&&o())};return(0,r.jsx)(K.Popover.Root,{open:c,modal:!1,onOpenChange:j,children:(0,r.jsx)(K.Popover.Portal,{container:s,className:ue,children:(0,r.jsx)(vn,{children:(0,r.jsx)(K.Popover.Positioner,{ref:g,anchor:w,side:"right",align:"start",sideOffset:({side:P})=>P==="top"||P==="bottom"?a.y:a.x,alignOffset:({side:P,anchor:A})=>Uh({side:P,boundary:k.box,spans:k.spans,anchor:A,rightToLeft:Zh(g.current)}),collisionAvoidance:Yh,sticky:!0,className:Vh,...Os,children:(0,r.jsx)(K.Popover.Popup,{ref:m,className:$h,initialFocus:p,finalFocus:!1,"data-testid":"anchored-popover",children:i})})})})})},Zh=e=>e!==null&&getComputedStyle(e).direction==="rtl",ni=(e,t)=>{const{config:n,guides:a}=t;switch(e.kind){case"legend":{const{position:o}=n.legend,i=o==="none";return{hidden:i,hide:new u.SetLegendPositionCommand({position:"none"}),show:new u.SetLegendPositionCommand({position:i?"auto":o})}}case"axis":{const{axis:o}=e,i=o==="ySecondary"?a.axes.find(s=>s.scaledAesthetic==="ySecondary")?.visible:n.axes[o].visible;return i===void 0?null:{hidden:!i,hide:new u.SetAxisVisibilityCommand({axis:o,visible:!1,keepSecondaryAxis:!0}),show:new u.SetAxisVisibilityCommand({axis:o,visible:!0,keepSecondaryAxis:!0})}}case"grid":{const{axis:o}=e;if(o==="both")return null;const{visible:i}=n.axes[o].grid,s=i===!1;return{hidden:s,hide:new u.SetGridVisibilityCommand({axis:o,visible:!1}),show:new u.SetGridVisibilityCommand({axis:o,visible:s?!0:i})}}case"observations":case"graph":return null;default:return e}},ke=()=>{const e=eu(),{store:t}=l.useGraphContext();return(0,f.useCallback)(n=>e(n)||ni(n,t.getState().scene)!==null,[e,t])};var gt="textStyle",ri=new Set(["paragraph","heading"]),Jh=e=>{const t=oi(e),n=r0(e);return{color:Xe(t.map(a=>a0(zt(a)?.color))),font:Xe(t.map(a=>n0(zt(a)))),fontSize:Xe(t.map(a=>o0(zt(a)?.fontSize))),alignment:Xe(n.map(a=>i0(a.attrs?.textAlign)))}},Qh=(e,t)=>On(e,n=>n.type==="text"?t0(n,t):n),ai=e=>oi(e).length>0,e0=(e,t)=>On(e,n=>ri.has(n.type??"")?{...n,attrs:{...n.attrs,textAlign:t}}:n),On=(e,t)=>t(e.content===void 0?e:{...e,content:e.content.map(n=>On(n,t))}),t0=(e,t)=>{const n=e.marks??[],a=n.find(i=>i.type===gt),o={type:gt,attrs:{...a?.attrs,...t}};return{...e,marks:a===void 0?[...n,o]:n.map(i=>i===a?o:i)}},zt=e=>e.marks?.find(t=>t.type===gt)?.attrs,n0=e=>l.readRichTextFontId(e?.font)??l.readRichTextFontId(e?.fontFamily),oi=e=>_n(e,t=>t.type==="text"),r0=e=>_n(e,t=>ri.has(t.type??"")),_n=(e,t)=>[...t(e)?[e]:[],...(e.content??[]).flatMap(n=>_n(n,t))],Xe=e=>{const[t,...n]=e;return t===void 0?null:n.every(a=>a===t)?t:null},a0=e=>typeof e=="string"&&e.length>0?e:void 0,o0=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,i0=e=>e==="left"||e==="center"||e==="right"?e:void 0,Nn=e=>({readTopCommandId:()=>e.stack.getSnapshot().undoStack.at(-1)?.id??null,undo:()=>e.undo()}),Dn=(e,t,n,a=null)=>{const o=e.getState().caret;if(o===null)return;const i=o.editor?.getText().trim();if(i!==void 0){if(i.length>0)return}else{const c=t.textAnnotations.find(d=>d.id===o.annotationId);if(c===void 0||ai(c.content))return}const s=o.placementCommandId;s!==null&&a!==null&&a.readTopCommandId()===s&&a.undo()||n(new u.RemoveAnnotationCommand({id:o.annotationId}))},Fe=(e,t)=>e.geom==="boxplot"&&(0,u.getScaledAesthetic)(t,"outlier")!==null,s0=(e,t,n)=>{const a=[];for(let o=e.layers.length-1;o>=0;o-=1){const i=e.layers[o];i===void 0||!i.interactive||i.attachment!==null||a.push(...l0(i,e,t,n))}return a},Pr=(e,t)=>{if(t===null)return-1;const n=(0,u.readObservationIndex)(t);return e.findIndex(a=>a.target.layerId===t.layerId&&a.target.observationIndex===n)},l0=(e,t,n,a)=>{const o=[];for(let i=0;i<e.data.size();i+=1){const s=e.data.getAt(i);if(s===null||Fe(e,s))continue;const c=(0,u.buildObservationsTarget)({layer:e,observationIndex:i,scope:"observation",parsingLocale:t.config.parsingLocale});if(c===null||!a(c))continue;const d=n.resolve(e.geom,s,{coordSystem:t.coordSystem,position:e.position,purpose:"pin"});if(d===null)continue;const h=c0(s,t.coordSystem,d);o.push({x:d.x,target:c,primary:{anchored:!0,layerId:e.id,pointIndex:i,observation:s,x:h.x,y:h.y}})}return o.sort((i,s)=>i.x-s.x),o},c0=(e,t,n)=>{if(t.type!=="polar")return n;const a=e[u.POSITION_VARIABLES.x],o=e[u.POSITION_VARIABLES.y];return typeof a!="number"||typeof o!="number"||!Number.isFinite(a)||!Number.isFinite(o)?n:{x:a,y:o}},Be=()=>{const e=l.useGraphSelection();return rn(e)},rn=e=>{if(e.length!==1)return null;const[t]=e;return t?.kind==="annotation"?t.id:null},d0=e=>{const{selectionStore:t,commands:n,chartId:a,history:o,store:i,anchorResolver:s}=l.useGraphContext(),{store:c,engine:d,overlayRef:h}=l.useHoverContext(),p=ke(),m=l.useEditorStore(),g=l.useLatestRef(l.useSceneSelector(E=>E.spec.annotations.textAnnotations)),v=(0,f.useRef)(null),x=(0,f.useRef)(null),b=(0,f.useRef)(!0),y=(0,f.useRef)(new WeakSet),{showAnnotations:k,showMenuTriggerOnHover:w}=l.MODE_RULES[l.useGraphMode()],j=(0,f.useCallback)(E=>{const{selection:O}=t.getState(),T=k?rn(O):null;T!==null&&(E.preventDefault(),n.dispatch(new u.RemoveAnnotationCommand({id:T})),e.focus({preventScroll:!0}))},[e,n,t,k]),P=(0,f.useCallback)(E=>{if(Oe(E.target,a))return;const O=k?rn(t.getState().selection):null;O!==null&&g.current.some(T=>T.id===O)&&(E.preventDefault(),m.getState().setCaret(O))},[m,t,g,a,k]),A=(0,f.useCallback)(E=>{const O=m.getState(),T=O.standingInteraction?.kind;if(T!==void 0){T!=="chrome-popup"&&T!=="arrow-draw"&&T!=="box-draw"&&O.releaseInteraction(T);return}if(O.caret!==null){Dn(m,i.getState().scene.annotations,n.dispatch,Nn(o)),O.setCaret(null),e.focus({preventScroll:!0});return}return Oe(E.target,a)?e.focus({preventScroll:!0}):t.getState().clearSelection()},[m,t,e,a,i,n,o]);(0,f.useEffect)(()=>{const E=S=>{if(!we(S.target,e,a)||st(S.target))return;const M=Te(S.target),N=m.getState(),z=N.caret!==null&&!Oe(S.target,a);if(M&&!z)return;const H=()=>w&&S.target===e&&!M&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&!S.shiftKey&&N.standingInteraction===null&&t.getState().selection.length===0,X=()=>{if(!H())return;const Y=s0(i.getState().scene,s,p);if(Y.length===0)return;const oe=c.getState().hover.primary,F=S.key==="ArrowRight"||S.key==="ArrowDown"?1:-1,$=v.current===null?Pr(Y,oe):Pr(Y,v.current.primary),W=Y[$<0?F>0?0:Y.length-1:Math.min(Y.length-1,Math.max(0,$+F))];if(W!==void 0){if(x.current===null){const te=Ce(oe);te!==null&&!at(te,Ce(W.primary))&&(x.current=te)}v.current=W,S.preventDefault(),O(W)}},Q=()=>{if(!H())return;const Y=v.current;Y!==null&&(v.current=null,x.current=null,S.preventDefault(),m.getState().setPlotMenu(null),m.getState().setAnnotatePress(null),t.getState().setSelection([Y.target]))};switch(S.key){case"Escape":return A(S);case"Enter":return M||(P(S),m.getState().caret!==null)?void 0:Q();case"Delete":case"Backspace":return M?void 0:j(S);case"n":case"N":if(S.metaKey||S.ctrlKey||S.altKey||M||!w||S.target!==e||N.standingInteraction!==null)return;S.preventDefault(),t.getState().clearSelection(),m.getState().setPlotMenu({x:.5,y:.5});return;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":return X();default:return}},O=S=>{const M=h0(d,S,i.getState().scene.coordSystem,v0(d,h.current));y.current.add(M),c.getState().setHoverState(M)},T=c.subscribe(S=>{const M=v.current;if(M===null||y.current.has(S.hover))return;const N=S.hover.primary;if(N===null){if(b.current){O(M);return}v.current=null,x.current=null;return}const z=Ce(N);if(at(z,Ce(M.primary))){x.current=z;return}if(at(z,x.current)){O(M);return}v.current=null,x.current=null}),R=h.current,L=()=>{b.current=!0},C=S=>{b.current=!1,!(v.current===null||u0(S,R,c))&&(v.current=null,x.current=null,c.getState().setHoverState(u.RESTING_HOVER_STATE))};return R?.addEventListener("pointerenter",L),R?.addEventListener("pointerleave",C),document.addEventListener("keydown",E),()=>{T(),R?.removeEventListener("pointerenter",L),R?.removeEventListener("pointerleave",C),document.removeEventListener("keydown",E)}},[e,j,P,A,a,m,w,t,i,s,p,c,d,h])},Te=e=>e instanceof HTMLElement&&(e.isContentEditable||e.closest('[contenteditable="true"]')!==null||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement),u0=(e,t,n)=>{if(t===null)return!1;const a=n.getState().pointerRegions;if(a.length===0)return!1;const o=t.getBoundingClientRect();return o.width<=0||o.height<=0?!1:(0,u.findPointerRegion)({x:e.clientX-o.left,y:e.clientY-o.top},a)!==null},Ce=e=>e===null?null:{layerId:e.layerId,observationIndex:(0,u.readObservationIndex)(e)},h0=(e,t,n,a)=>{const o=p0(t.primary,n,a);if(o!==null){const i=e.query(o,{tolerance:l.ANNOTATE_ON_THE_MARK});if(at(Ce(i.primary),Ce(t.primary)))return{primary:i.primary,group:[...i.group],related:new Map(i.related),intersection:i.intersection}}return{primary:t.primary,group:[],related:new Map}},p0=(e,t,n)=>{if(!e.anchored)return null;switch(t.type){case"polar":return m0(e.x,e.y,n);case"cartesian":return g0(e);default:return t}},m0=(e,t,n)=>{const a=(0,u.polarToUnit)(e,t);return n>=1?{x:.5+a.x/(2*n),y:.5+a.y/2}:{x:.5+a.x/2,y:.5+a.y*n/2}},g0=e=>{const{observation:t,x:n,y:a}=e,o=Ye(t,u.POSITION_VARIABLES.xMin),i=Ye(t,u.POSITION_VARIABLES.xMax),s=Ye(t,u.POSITION_VARIABLES.yMin),c=Ye(t,u.POSITION_VARIABLES.yMax);return o===null||i===null||s===null||c===null?{x:n,y:a}:[o,i,s,c].every(d=>d>=0&&d<=1)?{x:(o+i)/2,y:(s+c)/2}:null},v0=(e,t)=>{const n=t?.getBoundingClientRect();return n===void 0||n.width<=0||n.height<=0?1:(e.setViewport({width:n.width,height:n.height}),n.width/n.height)},Ye=(e,t)=>{const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null},at=(e,t)=>e!==null&&t!==null&&e.layerId===t.layerId&&e.observationIndex===t.observationIndex;var f0="_1vbfegu3",Ge={fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"},x0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M5 6V4h14v2M12 4v16M9 20h6",...Ge})}),b0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M5 4h14v10l-6 6H5zM13 20v-6h6",...Ge})}),S0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M5 19L19 5M10 5h9v9",...Ge})}),y0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M4 6h16v12H4z",...Ge})}),C0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18zM8.5 14.5s1.3 2 3.5 2 3.5-2 3.5-2M9 9.5h.01M15 9.5h.01",...Ge})}),Fn={fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"},w0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M5 19L19 5M10 5h9v9",...Fn})}),j0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M6 18L18 6M6 18v-6M6 18h6M18 6h-6M18 6v6",...Fn})}),T0=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 24 24",...e,children:(0,r.jsx)("path",{d:"M5 19L19 5",...Fn})}),Ie={side:"top",delay:200},k0=.2,A0={type:"doc",content:[{type:"paragraph"}]},L0={paddingInline:12,paddingBlock:10},P0=["canvasYellow","canvasOrange","canvasPink","canvasGreen","canvasCyan","canvasBlue","canvasPurple"],I0=({frameElement:e,panelRect:t})=>{const n=l.useEditorState(a=>a.plotMenu);return n===null?null:(0,r.jsx)(E0,{frameElement:e,panelRect:t,point:n},`${n.x}:${n.y}:${n.stickerId??""}`)},E0=({frameElement:e,panelRect:t,point:n})=>{const a=l.useI18n(),o=l.useEditorStore(),{commands:i,chartId:s,history:c,selectionStore:d}=l.useGraphContext(),{Button:h}=D(),[p,m]=(0,f.useState)({kind:"choose"}),g=l.useEditorState(L=>L.standingInteraction?.kind==="box-draw"),v=l.useEditorState(L=>L.standingInteraction?.kind==="arrow-draw"),x=!g&&!v,b=()=>{Ee(o),o.getState().setPlotMenu(null)};(0,f.useEffect)(()=>()=>Ee(o),[o]),(0,f.useEffect)(()=>{if(!g&&!v)return;const L=C=>{if(C.key!=="Escape"||!we(C.target,e,s)||st(C.target))return;const S=Te(C.target),M=o.getState().caret!==null&&!Oe(C.target,s);if(S&&!M)return;const N=o.getState().standingInteraction?.kind;N!=="arrow-draw"&&N!=="box-draw"||(C.preventDefault(),o.getState().releaseInteraction(N))};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[s,g,v,o,e]);const y={x:t.x+n.x*t.width,y:t.y+n.y*t.height,width:1,height:1},k={top:{from:y.x,to:y.x+y.width},bottom:{from:y.x,to:y.x+y.width},left:{from:y.y,to:y.y+y.height},right:{from:y.y,to:y.y+y.height}},w=L=>{Ee(o),m(C=>C.kind===L?{kind:"choose"}:{kind:L})},j=L=>(...C)=>{o.getState().claimInteraction({kind:"arrow-draw",heads:L,start:n,...Ir(C[0])})},P=(...L)=>{if(o.getState().standingInteraction?.kind==="box-draw"){o.getState().releaseInteraction("box-draw");return}Ee(o),m({kind:"choose"}),o.getState().claimInteraction({kind:"box-draw",start:n,...Ir(L[0])})},A=()=>{const L=o.getState().standingInteraction?.kind;if((L==="arrow-draw"||L==="box-draw")&&!st(document.activeElement)){o.getState().releaseInteraction(L);return}b()},E=L=>{Ee(o);const C=new u.AddAnnotationCommand({kind:"text",annotation:{...u.TEXT_ANNOTATION_DEFAULTS,content:A0,at:{anchorType:"panel",x:n.x,y:n.y},width:k0}}),S=C.params.annotation.id;L===null?i.dispatch(C):i.dispatch(new u.SequenceCommand({commands:[C,new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"annotation",kind:"text",annotation:S},declarations:{fill:L,...L0}}})]})),d.getState().setSelection([{kind:"annotation",id:S}]),o.getState().setCaret(S,c.stack.getSnapshot().undoStack.at(-1)?.id??null),o.getState().setPlotMenu(null)},O=L=>{i.dispatch(new u.AddAnnotationCommand({kind:"sticker",annotation:{at:{anchorType:"panel",x:n.x,y:n.y},sticker:L}})),b()},T=()=>{n.stickerId!==void 0&&(i.dispatch(new u.RemoveAnnotationCommand({id:n.stickerId})),b())},R=L=>{n.stickerId!==void 0&&(i.dispatch(new u.UpdateAnnotationCommand({kind:"sticker",id:n.stickerId,patch:{sticker:L}})),b())};return n.stickerId!==void 0?(0,r.jsx)(nn,{frameElement:e,boundary:y,spans:k,onEscape:b,children:(0,r.jsxs)("div",{className:`${Ro} ${Td}`,role:"toolbar","aria-label":a("graph.annotations.baseMenu.annotate"),children:[(0,r.jsx)("div",{className:pt,children:(0,r.jsx)(h,{label:a("graph.annotations.baseMenu.removeSticker"),onClick:T})}),(0,r.jsx)("div",{className:Oo,children:Object.entries(l.STICKER_ASSETS).map(([L,C])=>(0,r.jsx)("button",{type:"button",className:No,"aria-label":L,onClick:()=>R(L),children:(0,r.jsx)("img",{className:_o,src:C.src,alt:""})},L))})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:f0,style:{left:y.x,top:y.y},"data-testid":"empty-plot-dot","aria-hidden":!0}),x&&(0,r.jsx)(nn,{frameElement:e,boundary:y,spans:k,onEscape:A,children:(0,r.jsxs)("div",{className:"vez73g0 _1vbfegu0",role:"toolbar","aria-label":a("graph.annotations.baseMenu.annotate"),onKeyDown:Fo,children:[(0,r.jsxs)("div",{className:"vez73g1",children:[(0,r.jsx)(h,{variant:"icon",...Ie,ariaLabel:a("graph.annotations.baseMenu.text"),icon:(0,r.jsx)(x0,{}),onClick:()=>E(null)}),(0,r.jsx)(h,{variant:"icon",...Ie,ariaLabel:a("graph.annotations.baseMenu.stickyNote"),icon:(0,r.jsx)(b0,{}),expanded:p.kind==="sticky",onClick:()=>w("sticky")}),(0,r.jsx)(h,{variant:"icon",...Ie,ariaLabel:a("graph.annotations.baseMenu.arrow"),icon:(0,r.jsx)(S0,{}),expanded:p.kind==="arrow",onClick:()=>w("arrow")}),(0,r.jsx)(h,{variant:"icon",...Ie,ariaLabel:a("graph.annotations.baseMenu.box"),icon:(0,r.jsx)(y0,{}),expanded:g,onClick:P}),(0,r.jsx)(h,{variant:"icon",...Ie,ariaLabel:a("graph.annotations.baseMenu.addSticker"),icon:(0,r.jsx)(C0,{}),expanded:p.kind==="sticker",onClick:()=>w("sticker")})]}),p.kind==="sticky"&&(0,r.jsx)("div",{className:"vez73g2",children:P0.map(L=>(0,r.jsx)("button",{type:"button",className:"vez73gb","aria-label":L,onClick:()=>E(l.vars[L]),children:(0,r.jsx)("span",{className:"_1vbfegu1",style:{background:l.vars[L]}})},L))}),p.kind==="sticker"&&(0,r.jsx)("div",{className:"vez73g2",children:Object.entries(l.STICKER_ASSETS).map(([L,C])=>(0,r.jsx)("button",{type:"button",className:"vez73gb","aria-label":L,onClick:()=>O(L),children:(0,r.jsx)("img",{className:"vez73ga",src:C.src,alt:""})},L))}),p.kind==="arrow"&&(0,r.jsxs)("div",{className:"vez73g5",children:[(0,r.jsx)("button",{type:"button",className:"_1vbfegu2","aria-label":a("graph.annotations.baseMenu.arrowOneWay"),onClick:j("end"),children:(0,r.jsx)(w0,{})}),(0,r.jsx)("button",{type:"button",className:"_1vbfegu2","aria-label":a("graph.annotations.baseMenu.arrowTwoWay"),onClick:j("both"),children:(0,r.jsx)(j0,{})}),(0,r.jsx)("button",{type:"button",className:"_1vbfegu2","aria-label":a("graph.annotations.baseMenu.arrowLine"),onClick:j("none"),children:(0,r.jsx)(T0,{})})]})]})})]})},Ee=e=>{const t=e.getState().standingInteraction?.kind;(t==="arrow-draw"||t==="box-draw")&&e.getState().releaseInteraction(t)},Ir=e=>{if(typeof e!="object"||e===null)return{};if("detail"in e&&e.detail===0)return{};if(!("clientX"in e)||!("clientY"in e))return{};const{clientX:t,clientY:n}=e;return typeof t!="number"||typeof n!="number"?{}:{pointer:{x:t,y:n}}},ze=e=>e.offset+e.strokeWidth,Er="http://www.w3.org/2000/svg",Mr=new WeakMap,M0=(e,t)=>{const n=R0(e);n.setAttribute("d",t);const{x:a,y:o,width:i,height:s}=n.getBBox();return{x:a,y:o,width:i,height:s}},R0=e=>{const t=Mr.get(e);if(t?.isConnected)return t;const n=e.createElementNS(Er,"svg");n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";const a=e.createElementNS(Er,"path");return n.append(a),e.body.append(n),Mr.set(e,a),a},O0=(e,t)=>{const{panelRect:n,look:a,readGridLineWidth:o,measurePathBox:i}=t,s=ze(a);switch(e.kind){case"observations":return Ht([...e.parts,...e.vertex===null?[]:[e.vertex]].flatMap(c=>_0(c,i)).map(c=>({...c,x:c.x+n.x,y:c.y+n.y})),s);case"guide":return Ht(e.shapes.map(c=>c.kind==="box"?c.rect:l.growRect(D0(c),o(c.axis)/2)),s);case"graph":return Ht([{x:0,y:0,...e.frameSize}],-a.offset);default:return e}},_0=(e,t)=>e.kind==="boxes"?e.boxes:N0(e.shapes,t),N0=(e,t)=>{const n=[],a=new Map;for(const o of e){if(o.kind==="dots"){n.push(...o.centers.map(c=>l.growRect({...c,width:0,height:0},o.size/2)));continue}if(o.pathData==="")continue;const i=o.kind==="stroke"?o.width/2:0;if(!o.pathData.trimStart().startsWith("M")){n.push(l.growRect(t(o.pathData),i));continue}const s=a.get(i)??[];s.push(o.pathData),a.set(i,s)}for(const[o,i]of a)n.push(l.growRect(t(i.join("")),o));return n},D0=e=>{switch(e.kind){case"line":return{x:Math.min(e.from.x,e.to.x),y:Math.min(e.from.y,e.to.y),width:Math.abs(e.to.x-e.from.x),height:Math.abs(e.to.y-e.from.y)};case"ring":return{x:e.center.x-e.radius,y:e.center.y-e.radius,width:e.radius*2,height:e.radius*2}}},Ht=(e,t)=>{const n=e.filter(({width:a,height:o})=>a>0||o>0);return n.length===0?null:l.growRect((0,u.getBoundingRect)(n),t)};var F0=(e,{coordSystem:t,panelRect:n})=>{if(e.kind!=="observations")return null;const a=e.vertex===null?e.parts:[...e.parts,e.vertex],o=a.reduce((s,c)=>Math.max(s,c.rows.length),0),i=o===1&&e.vertex===null;return o===0||i||o>1e3?null:a.flatMap(s=>B0(s,t,n).map(c=>({...c,x:c.x+n.x,y:c.y+n.y})))},B0=(e,t,n)=>(0,u.measureObservationsBoxes)({layer:{...e.layer,data:e.layer.data.take(e.rows)},coordSystem:t,panelSize:n,radialExtent:"outerEnd"}),G0=.5,z0={top:e=>-e.y,right:e=>e.x+e.width,bottom:e=>e.y+e.height,left:e=>-e.x},H0=(e,t,n)=>e===null||!V0(e)?{top:an(t),right:on(t),bottom:an(t),left:on(t)}:{top:Ze(e,t,"top",n),right:Ze(e,t,"right",n),bottom:Ze(e,t,"bottom",n),left:Ze(e,t,"left",n)},Ze=(e,t,n,a)=>{const o=z0[n],i=n==="left"||n==="right",s=x=>i?x.y:x.x,c=x=>i?x.y+x.height:x.x+x.width;let d=-1/0;for(const x of e)d=Math.max(d,o(x));const h=d-Math.max(a,G0);let p=1/0,m=-1/0;for(const x of e)o(x)<h||(p=Math.min(p,s(x)),m=Math.max(m,c(x)));const g=i?on(t):an(t),v={from:(0,fe.clamp)(p-a,g.from,g.to),to:(0,fe.clamp)(m+a,g.from,g.to)};return v.from<v.to?v:g},V0=e=>{const[t]=e;return t!==void 0&&e.some(n=>!l.areRectsEqual(n,t))},an=e=>({from:e.x,to:e.x+e.width}),on=e=>({from:e.y,to:e.y+e.height}),$0=(e,{frameElement:t,panelRect:n,look:a})=>{const o=l.useEditorStore(),i=l.useStyleReaderTree(),s=l.useSceneSelector(m=>m.coordSystem),c=(0,f.useRef)(new Map),d=e?.target??null,h=e?.outline??null;(0,f.useLayoutEffect)(()=>{if(d===null||h===null)return;const m=c.current,g=new Map,x=O0(h,{panelRect:n,look:a,readGridLineWidth:k=>l.readGridLineStyle(i,k).strokeWidth,measurePathBox:k=>{const w=m.get(k)??M0(t.ownerDocument,k);return g.set(k,w),w}});if(c.current=g,x===null){o.getState().setSelectedOutline(null);return}const b=H0(F0(h,{coordSystem:s,panelRect:n}),x,ze(a)),y=ti(t);o.getState().setSelectedOutline({target:d,frame:x,frameSpans:b,frameScale:y})},[o,i,s,d,h,t,n,a]);const p=e!==null;(0,f.useLayoutEffect)(()=>p?()=>o.getState().setSelectedOutline(null):void 0,[o,p])},Bn="var(--_1qfw3e00)",Rr="_1qfw3e01",W0="_1qfw3e02",Or=({pathData:e,animateTransitions:t,source:n,...a})=>t?(0,r.jsx)(U0,{pathData:e,source:n,...a}):(0,r.jsx)("path",{d:e,...a}),U0=({pathData:e,source:t,...n})=>{const a=l.useSvgPathMorph(e,l.DEFAULT_SPRING_TRANSITION,t);return(0,r.jsx)(ns.motion.path,{d:a,...n})},q0="var(--dppmab0)",K0="data-edit-outline-stroke",ii=e=>({[K0]:"",style:(0,de.assignInlineVars)({[q0]:`${e}px`})}),X0=()=>{const{showMenuTriggerOnHover:e,layers:t,coordSystem:n,parsingLocale:a,anchorResolver:o,geom:i,hasOverlayMenu:s}=si(),c=l.useHoverState(d=>e?d.hover.primary:null);return(0,f.useMemo)(()=>{if(c===null)return null;const d=t.find(p=>p.id===c.layerId);if(d===void 0||Fe(d,c.observation))return null;const h=(0,u.buildObservationsTarget)({layer:d,observationIndex:(0,u.readObservationIndex)(c),scope:"observation",parsingLocale:a});return h===null||!s(h)?null:li({layer:d,observation:c.observation,target:h,coordSystem:n,anchorResolver:o,geom:i,purpose:"pin"})},[c,t,n,a,o,i,s])},Y0=()=>Z0("pin"),Z0=e=>{const{showMenuTriggerOnHover:t,layers:n,coordSystem:a,parsingLocale:o,anchorResolver:i,geom:s,hasOverlayMenu:c}=si(),[d]=l.useGraphSelection(),h=d?.kind==="observations"&&d.scope==="observation"?d:null;return(0,f.useMemo)(()=>{if(!t||h===null||!c(h))return null;const p=n.find(v=>v.id===h.layerId);if(p===void 0)return null;const[m]=(0,u.resolveObservationsTarget)({layer:p,target:h,parsingLocale:o}),g=m===void 0?void 0:p.data.getAt(m);return g==null||Fe(p,g)?null:li({layer:p,observation:g,target:h,coordSystem:a,anchorResolver:i,geom:s,purpose:e})},[t,h,c,n,o,a,i,s,e])},si=()=>{const{showMenuTriggerOnHover:e}=l.MODE_RULES[l.useGraphMode()],t=l.useSceneSelector((0,ae.useShallow)(i=>({layers:i.layers,coordSystem:i.coordSystem,parsingLocale:i.config.parsingLocale}))),{anchorResolver:n}=l.useGraphContext(),a=l.useGeomReaderTree(),o=ke();return{showMenuTriggerOnHover:e,...t,anchorResolver:n,geom:a,hasOverlayMenu:o}},li=({layer:e,observation:t,target:n,coordSystem:a,anchorResolver:o,geom:i,purpose:s})=>{const c=o.resolve(e.geom,t,{coordSystem:a,position:e.position,purpose:s});return c===null?null:{position:c,color:(0,u.readGeomColor)({geom:i},e,t)??u.DEFAULT_GEOM_COLOR,target:n}},J0=()=>{const e=l.useGraphSelection()[0]??null,{layers:t,parsingLocale:n}=l.useSceneSelector((0,ae.useShallow)(a=>({layers:a.layers,parsingLocale:a.config.parsingLocale})));return(0,f.useMemo)(()=>e===null?null:Q0(e,t,n),[e,t,n])},ci=(e,t,n)=>{const a=(0,u.findLayerById)(t,e.layerId);if(a===void 0)return null;const o=(0,u.resolveObservationsTarget)({layer:a,target:e,parsingLocale:n});if(o.length===0)return null;const i=[{layer:a,rows:o}];for(const s of(0,u.findCompanionLayers)(a,t)){const c=(0,u.resolveObservationsTarget)({layer:s,host:a,target:e,parsingLocale:n});c.length>0&&i.push({layer:s,rows:c})}return{kind:"observations",key:(0,u.readEditTargetKey)(e),layerId:e.layerId,scope:e.scope,parts:i,vertex:null}},Q0=(e,t,n)=>{switch(e.kind){case"observations":{const a=ci(e,t,n);return a===null?null:{outlined:a,target:e}}case"legend":case"axis":case"grid":return{outlined:{kind:"guide",key:(0,u.readEditTargetKey)(e),target:e},target:e};case"graph":return{outlined:{kind:"graph",key:"graph"},target:e};default:return null}},ep=()=>{const e=X0(),t=l.useHoverState(c=>c.hover.intersection?.intersects===!0),n=l.useGraphSelection()[0]??null,a=l.useEditorState(c=>c.standingInteraction),o=l.useEditorState(c=>c.plotMenu),{layers:i,parsingLocale:s}=l.useSceneSelector((0,ae.useShallow)(c=>({layers:c.layers,parsingLocale:c.config.parsingLocale})));return(0,f.useMemo)(()=>!t||e===null||n!==null||a!==null||o!==null?null:ci(e.target,i,s),[t,e,n,a,o,i,s])};var _r=(e,t)=>{if(e.kind==="observations"&&t.kind==="observations"){if(e.layerId!==t.layerId||e.scope!==t.scope)return!1;const n=e.parts[0]?.rows[0];return n!==void 0&&(t.parts[0]?.rows.includes(n)??!1)}return e.kind==="guide"&&t.kind==="guide"?(0,u.areEditTargetsEqual)(e.target,t.target):e.kind==="graph"&&t.kind==="graph"},tp=(e,t)=>{const n=Math.max(e.width,8),a=Math.max(e.height,8),o=Math.max(0,e.x+e.width/2-n/2),i=Math.max(0,e.y+e.height/2-a/2),s=Math.min(t.width,e.x+e.width/2+n/2),c=Math.min(t.height,e.y+e.height/2+a/2);return{x:o,y:i,width:Math.max(0,s-o),height:Math.max(0,c-i)}},np=[],rp=e=>{const{layers:t,parsingLocale:n}=l.useSceneSelector((0,ae.useShallow)(g=>({layers:g.layers,parsingLocale:g.config.parsingLocale}))),a=l.useEditorState(g=>g.editTargetUnderPointer),o=a?.kind==="observations"?a.observations:null,i=o===null?void 0:(0,u.findLayerById)(t,o.layerId),s=o?.target.scope??null,c=o===null||i===void 0?null:(0,u.readRowScopeKey)(i,o.target.scope,o.observationIndex),d=(0,f.useMemo)(()=>i===void 0||s===null||c===null?null:ap(t,i,s,c),[t,i,s,c]),h=(0,f.useMemo)(()=>d!==null&&e!==null&&_r(d,e),[d,e]),p=ke(),m=o!==null&&i!==void 0&&op(o,i,n,p)?o.observationIndex:null;return(0,f.useMemo)(()=>{switch(a?.kind){case"observations":{const g=d?.parts[0];if(d===null||g===void 0)return null;const v=m===null?null:{layer:g.layer,rows:[m]};return h?v===null?null:{...d,parts:np,vertex:v}:{...d,vertex:v}}case"axis":case"legend":case"grid":{const g={kind:"guide",key:(0,u.readEditTargetKey)(a.target),target:a.target};return e!==null&&_r(g,e)?null:g}default:return null}},[a,d,h,m,e])},ap=(e,t,n,a)=>{const o=[{layer:t,rows:(0,u.readRowsAtScopeKey)(t,n,a)}];for(const i of(0,u.findCompanionLayers)(t,e)){const s=(0,u.readCompanionRowsAtScopeKey)(i,t,n,a);s.length>0&&o.push({layer:i,rows:s})}return{kind:"observations",key:JSON.stringify([t.id,n,a]),layerId:t.id,scope:n,parts:o,vertex:null}},op=({observationIndex:e,target:t,onObservation:n},a,o,i)=>{if(!n||t.scope!=="group")return!1;const s=(0,u.buildObservationsTarget)({layer:a,observationIndex:e,scope:"observation",parsingLocale:o});return s!==null&&i(s)},ip=({frameElement:e,target:t,coordType:n,legendDisplays:a})=>{const o=e.getBoundingClientRect(),i=[...e.querySelectorAll(sp(t))],s=c=>{const d=c.getBoundingClientRect();return{x:d.left-o.left,y:d.top-o.top,width:d.width,height:d.height}};switch(t.kind){case"axis":{const c=i.map(s);return n==="polar"||c.length===0?Vt(c):Vt([(0,u.getBoundingRect)(c)])}case"legend":return Vt([...lp(i.filter(c=>!cp(c)))].flatMap(([c,d])=>a[c]==="direct"?d.map(s):[(0,u.getBoundingRect)(d.map(s))]));case"grid":return i.flatMap(c=>{const d=l.readStampedEditTargetInStack([c],e);if(d?.kind!=="grid"||d.target.axis==="both")return[];const{axis:h}=d.target;return t.axis==="both"||h===t.axis?[dp(c,s(c),h)]:[]})}},sp=e=>{const t=`[${l.EDIT_TARGET_KIND_ATTRIBUTE}="${e.kind}"]`;return e.kind!=="axis"?t:`${t}[${l.EDIT_TARGET_AXIS_ATTRIBUTE}="${e.axis}"]`},lp=e=>{const t=new Map;for(const n of e){const a=l.readLegendItemAddress(n);a!==null&&t.set(a.legendIndex,[...t.get(a.legendIndex)??[],n])}return t},cp=e=>e.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR)!==null,Vt=e=>e.map(t=>({kind:"box",rect:t})),dp=(e,{x:t,y:n,width:a,height:o},i)=>e.querySelector("circle")!==null?{kind:"ring",axis:i,center:{x:t+a/2,y:n+o/2},radius:a/2}:a<1||o<1?a<o?{kind:"line",axis:i,from:{x:t+a/2,y:n},to:{x:t+a/2,y:n+o}}:{kind:"line",axis:i,from:{x:t,y:n+o/2},to:{x:t+a,y:n+o/2}}:up(e.querySelector("line"))?{kind:"line",axis:i,from:{x:t,y:n},to:{x:t+a,y:n+o}}:{kind:"line",axis:i,from:{x:t,y:n+o},to:{x:t+a,y:n}},up=e=>{const t=n=>Number(e?.getAttribute(n)??0);return(t("x2")-t("x1"))*(t("y2")-t("y1"))>=0},hp=[],pp=(e,{frameElement:t,frameSize:n,panelRect:a,animateTransitions:o})=>{const i=l.useSceneSelector(b=>b.coordSystem),s=l.useGeomRendererResolver(),c=l.useGeomReaderTree(),d=gp(e.kind==="guide"?e.target:null,{frameElement:t,frameSize:n}),h=mp(t,n),p=(0,f.useMemo)(()=>({coordSystem:i,panelRect:a,resolveRenderer:s,geomReaders:c}),[i,a,s,c]),m=e.kind==="observations"?e.parts:null,g=e.kind==="observations"?e.vertex:null,v=(0,f.useMemo)(()=>m?.map(b=>Nr(b,p,o))??hp,[m,p,o]),x=(0,f.useMemo)(()=>g===null?null:Nr(g,p,!1),[g,p]);return(0,f.useMemo)(()=>{switch(e.kind){case"observations":return{kind:"observations",parts:v,vertex:x};case"guide":return{kind:"guide",target:e.target,shapes:d};case"graph":return{kind:"graph",frameSize:h}}},[e,v,x,d,h])},mp=(e,t)=>{const[n,a]=(0,f.useState)(()=>tn(e,t));return(0,f.useLayoutEffect)(()=>{a(o=>{const i=tn(e,{width:t.width,height:t.height});return o.width===i.width&&o.height===i.height?o:i})},[e,t.width,t.height]),n},Nr=({layer:e,rows:t},{coordSystem:n,panelRect:a,resolveRenderer:o,geomReaders:i},s)=>{const c={...e,data:e.data.take(t)},d=o(e.geom,n.type);return d?.getEditOutlineShapes===void 0?{kind:"boxes",layer:e,rows:t,boxes:(0,u.measureObservationsBoxes)({layer:c,coordSystem:n,panelSize:a}).map(h=>tp(h,a))}:{kind:"declared",layer:e,rows:t,shapes:d.getEditOutlineShapes({layer:c,sourceLayer:e,coordSystem:n,panelRect:a,styleReaders:i(e),animateTransitions:s,symbols:d.symbols})}},gp=(e,{frameElement:t,frameSize:n})=>{const a=l.useSceneSelector(p=>p.coordSystem.type),o=l.useSceneSelector((0,ae.useShallow)(p=>p.guides.legends.drawn.map(m=>m.display))),i=l.useSceneSelector(p=>e===null?null:p),[s,c]=(0,f.useState)([]),d=l.useLatestRef(e),h=(0,f.useRef)(!1);return(0,f.useLayoutEffect)(()=>{const p=d.current;if(p===null)return;const m=()=>{const g=ip({frameElement:t,target:p,coordType:a,legendDisplays:o}),v=ti(t);c(g.map(x=>vp(x,1/v)))};if(h.current){const g=requestAnimationFrame(m);return()=>cancelAnimationFrame(g)}h.current=!0,m()},[t,d,a,o,i,n.width,n.height]),s},vp=(e,t)=>{switch(e.kind){case"box":{const{x:n,y:a,width:o,height:i}=e.rect;return{kind:"box",rect:{x:n*t,y:a*t,width:o*t,height:i*t}}}case"line":return{...e,from:{x:e.from.x*t,y:e.from.y*t},to:{x:e.to.x*t,y:e.to.y*t}};case"ring":return{...e,center:{x:e.center.x*t,y:e.center.y*t},radius:e.radius*t}}},fp=["x","y"],xp=(0,f.memo)(function({frameElement:t,frameSize:n,panelRect:a,animateTransitions:o}){const i=l.useResolvedStyle(u.resolveEditOutlineStyle,l.useStyleReaderTree()),s=J0(),c=rp(s?.outlined??null),{selectObservationsOnPress:d,selectGraphOnPress:h,selectGuidesOnPress:p}=l.MODE_RULES[l.useGraphMode()],m=ep(),g=d||h||p;if(s===null&&m===null&&(c===null||!g))return null;const v={frameElement:t,frameSize:n,panelRect:a,animateTransitions:o};if(!g){if(s!==null&&s.target.kind!=="observations")return(0,r.jsx)(Je,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,paints:!1,...v});const x=s?.target.kind==="observations"?s.outlined:m;return x===null?null:(0,r.jsx)("svg",{className:Rr,width:n.width,height:n.height,"aria-hidden":!0,"data-testid":"edit-outline",children:(0,r.jsx)(Je,{part:"selected",target:x,editTarget:s?.target.kind==="observations"?s.target:void 0,look:i.selected,paints:!0,...v},x.key)})}return(0,r.jsxs)("svg",{className:Rr,width:n.width,height:n.height,"aria-hidden":!0,"data-testid":"edit-outline",children:[c!==null&&(0,r.jsx)(Je,{part:"hover",target:c,look:i.hover,paints:!0,...v},c.key),s!==null&&(0,r.jsx)(Je,{part:"selected",target:s.outlined,editTarget:s.target,look:i.selected,paints:!0,...v},s.outlined.key)]})}),Je=({part:e,target:t,editTarget:n,look:a,frameSize:o,panelRect:i,frameElement:s,animateTransitions:c,paints:d})=>{const h=(0,f.useId)(),p=`${h}-shapes`,m=`${h}-hole`,g=pp(t,{frameElement:s,frameSize:o,panelRect:i,animateTransitions:c});return $0(n===void 0?null:{target:n,outline:g},{frameElement:s,panelRect:i,look:a}),d?(0,r.jsxs)("g",{"data-edit-outline":e,"data-testid":`edit-outline-${e}`,children:[(0,r.jsxs)("defs",{children:[(0,r.jsx)("g",{id:p,className:W0,children:(0,r.jsx)(jp,{outline:g,look:a,panelRect:i})}),(0,r.jsxs)("mask",{id:m,maskUnits:"userSpaceOnUse",x:"-100%",y:"-100%",width:"300%",height:"300%",children:[(0,r.jsx)("rect",{x:"-100%",y:"-100%",width:"300%",height:"300%",fill:"white"}),(0,r.jsx)("use",{href:`#${p}`,style:bp(a.offset)})]})]}),(0,r.jsxs)("g",{mask:`url(#${m})`,"data-testid":`edit-outline-${e}-ring`,children:[(0,r.jsx)("use",{href:`#${p}`,style:Sp(a)}),(0,r.jsx)("use",{href:`#${p}`,style:yp(a)})]}),t.kind==="observations"&&(0,r.jsx)(Ip,{target:t,look:a,panelRect:i})]}):null},bp=e=>({fill:"black",stroke:"black",strokeLinecap:"round",...(0,de.assignInlineVars)({[Bn]:`${2*e}px`})}),Sp=e=>({fill:"none",stroke:e.backingColor??l.vars.graphBackground,strokeLinecap:"round",opacity:e.backingAlpha,...(0,de.assignInlineVars)({[Bn]:`${2*ze(e)}px`})}),yp=e=>{const t=(0,u.toStrokeDasharray)(e.dashArray,e.strokeWidth);return{fill:"none",stroke:e.stroke,strokeDasharray:t,strokeLinecap:t===void 0?"round":"butt",opacity:e.strokeAlpha,...(0,de.assignInlineVars)({[Bn]:`${2*ze(e)}px`})}},Cp=({dashArray:e,strokeWidth:t})=>{if((0,u.toStrokeDasharray)(e,t)===void 0)return;const n=(e.length%2===0?1:2)*e.reduce((a,o)=>a+o*t,0);return n>0?n:void 0},di=(e,t,n=1)=>{if(!(t===void 0||e<=0))return n*Math.max(1,Math.round(2*Math.PI*e/t))*t},wp=(e,t,n)=>{const a=n.offset+ze(n);return l.buildRoundedRectPath(l.growRect({x:0,y:0,...e},-a),Math.max(0,t-a))},jp=({outline:e,look:t,panelRect:n})=>{const a=l.useStyleReaderTree().graph().get("cornerRadius"),{cornerRadius:o}=t,i=Cp(t);switch(e.kind){case"observations":return(0,r.jsxs)("g",{transform:`translate(${n.x} ${n.y})`,children:[e.parts.map(s=>(0,r.jsx)(Dr,{part:s,borderRadius:o,dashPeriod:i},s.layer.id)),e.vertex!==null&&(0,r.jsx)(Dr,{part:e.vertex,borderRadius:o,dashPeriod:i},`vertex-${e.vertex.rows.join()}`)]});case"guide":return(0,r.jsx)(Ap,{target:e.target,shapes:e.shapes,borderRadius:o,dashPeriod:i});case"graph":return(0,r.jsx)("path",{d:wp(e.frameSize,a,t)})}},Dr=(0,f.memo)(function({part:t,borderRadius:n,dashPeriod:a}){return t.kind==="boxes"?(0,r.jsx)(kp,{boxes:t.boxes,borderRadius:n}):(0,r.jsx)(Tp,{shapes:t.shapes,layer:t.layer,dashPeriod:a})}),Tp=({shapes:e,layer:t,dashPeriod:n})=>e.map((a,o)=>{const i=a.kind==="dots"||a.key===void 0?String(o):`${a.kind}:${a.key}`;switch(a.kind){case"region":return a.pathData===""?null:(0,r.jsx)(Or,{pathData:a.pathData,fillRule:a.fillRule,animateTransitions:a.animateTransitions??!1,source:t,"data-geom":t.geom},i);case"stroke":return a.pathData===""?null:(0,r.jsx)(Or,{pathData:a.pathData,animateTransitions:a.animateTransitions??!1,source:t,"data-geom":t.geom,...ii(a.width)},i);case"dots":return a.centers.length===0?null:(0,r.jsx)("path",{d:l.buildCirclesPath(a.centers,a.size/2),pathLength:di(a.size/2,n,a.centers.length),"data-geom":t.geom},i)}}),kp=({boxes:e,borderRadius:t})=>{const n=e.map(a=>l.buildRoundedRectPath(a,t)).join("");return n===""?null:(0,r.jsx)("path",{d:n,"data-testid":"edit-outline-boxes"})},Ap=({target:e,shapes:t,borderRadius:n,dashPeriod:a})=>{const o=l.useStyleReaderTree();if(e.kind==="grid")return fp.map(s=>{const c=ii(l.readGridLineStyle(o,s).strokeWidth),d=t.map(p=>Lp(p,s)).join(""),h=t.filter(p=>p.kind==="ring"&&p.axis===s);return(0,r.jsxs)(f.Fragment,{children:[d!==""&&(0,r.jsx)("path",{d,...c}),h.map((p,m)=>(0,r.jsx)("path",{d:Pp(p),pathLength:di(p.radius,a),...c},m))]},s)});const i=t.map(s=>s.kind==="box"?l.buildRoundedRectPath(s.rect,n):"").join("");return i===""?null:(0,r.jsx)("path",{d:i})},Lp=(e,t)=>e.kind==="line"&&e.axis===t?`M${e.from.x},${e.from.y}L${e.to.x},${e.to.y}`:"",Pp=({center:e,radius:t})=>{const n=`${e.x},${e.y-t}`;return`M${n}A${t},${t} 0 0 1 ${`${e.x},${e.y+t}`}A${t},${t} 0 0 1 ${n}`},Ip=({target:e,look:t,panelRect:n})=>{const a=l.useSceneSelector(s=>s.coordSystem),o=e.parts[0];if(e.scope!=="xValue"||o===void 0||o.layer.highlight?.strategy!=="overlayAnchor")return null;const i=Ep(o);return i===null?null:(0,r.jsx)("svg",{x:n.x,y:n.y,width:n.width,height:n.height,overflow:"visible",children:(0,r.jsx)("line",{...l.readCrosshairLine(a,i,n),stroke:t.stroke,strokeOpacity:t.strokeAlpha,strokeWidth:t.strokeWidth,strokeDasharray:"4 3",strokeLinecap:"round","data-testid":"edit-outline-band-guide"})})},Ep=({layer:e,rows:t})=>{for(const n of t){const a=e.data.getAt(n),o=a===null?null:(0,u.getXBand)(a),i=a===null?null:(0,u.getYBand)(a);if(o!==null&&i!==null)return{x:o,y:i}}return null},Mp=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Rp=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:"0.3",rx:".533"})]}),Op=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 16 16",...e,children:[(0,r.jsx)("rect",{width:"3.2",height:"7.704",y:"8.296",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"4.741",x:"8.533",y:"11.259",fill:"currentColor",fillOpacity:"0.3",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"11.259",x:"4.267",y:"4.741",fill:"currentColor",fillOpacity:"0.8",rx:".533"}),(0,r.jsx)("rect",{width:"3.2",height:"16",x:"12.8",fill:"currentColor",fillOpacity:".8",rx:".533"})]}),_p={observation:Mp,xValue:Rp,group:Op},Np=()=>{const{selectionStore:e}=l.useGraphContext(),t=l.useEditorStore(),n=l.useI18n(),a=l.useFormattingLocale(),o=l.useSceneSelector(y=>y),i=Tt(o,a),s=l.useEditorState(y=>y.pressedObservation),c=ke(),d=(0,f.useMemo)(()=>Dp({scene:o,pressed:s,groupOptions:i,locale:a,t:n,hasOverlayMenu:c}),[o,s,i,a,n,c]);if(d===null)return null;const{layer:h,levels:p,names:m}=d,{observationIndex:g,selectedFor:v}=d.pressed,x=p.map(y=>{const k=_p[y];return{value:y,label:m[y],icon:(0,r.jsx)(k,{})}}),b=y=>{const k=p.find(P=>P===y),{parsingLocale:w}=o.config,j=k===void 0?null:(0,u.buildObservationsTarget)({layer:h,observationIndex:g,scope:k,parsingLocale:w});j!==null&&(t.getState().setPressedObservation({...d.pressed,selectedFor:j}),e.getState().setSelection([j]))};return(0,r.jsx)(fn,{value:v.scope,options:x,onChange:b,ariaLabel:n("editor.overlayMenu.selection")})},Dp=({scene:e,pressed:t,groupOptions:n,locale:a,t:o,hasOverlayMenu:i})=>{const s=t===null?null:l.findPressedObservation(t,e.layers,e.config.parsingLocale);if(t===null||s===null)return null;const{layer:c,observation:d}=s,{observationIndex:h,selectedFor:p}=t,{parsingLocale:m}=e.config,g=(0,u.readReachableLevels)({layer:c,observationIndex:h,parsingLocale:m,scales:e.scales}).filter(v=>{const x=(0,u.buildObservationsTarget)({layer:c,observationIndex:h,scope:v,parsingLocale:m});return x!==null&&i(x)});return g.length<2||!g.includes(p.scope)?null:{pressed:t,layer:c,levels:g,names:Eo({scene:e,layer:c,observation:d,groupOptions:n,locale:a,t:o})}},Fp=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),Bp=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,r.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,r.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,r.jsx)("path",{d:"m2 2 20 20"})]})}),Gp="_11vjgg60",zp=({target:e})=>{const t=l.useI18n(),n=l.useGraphCommands(),a=l.useSceneSelector(v=>v),[o,i]=(0,f.useState)(null),s=ni(e,a);if(s===null)return null;const{hidden:c,hide:d,show:h}=s,p=()=>{if(c){n.dispatch(o??h);return}i(h),n.dispatch(d)},m=t(c?"editor.overlayMenu.show":"editor.overlayMenu.hide"),g=c?Bp:Fp;return(0,r.jsx)(xe,{label:m,children:(0,r.jsx)("button",{type:"button",className:Gp,onClick:p,children:(0,r.jsx)(g,{title:""})})})},Hp=(e,t)=>t==="polar"||e==="bar",Vp=(e,t)=>e===null||e.key!==t?null:{boundary:{x:e.x,y:e.y,width:0,height:0},spans:{top:{from:e.x,to:e.x},right:{from:e.y,to:e.y},bottom:{from:e.x,to:e.x},left:{from:e.y,to:e.y}}},$p="_1j45ehx0",Wp="_1j45ehx1",Up="_1j45ehx2",qp="_1j45ehx3",Kp=(e,t)=>{switch(e.kind){case"observations":return Xp(e.scope,t);case"legend":case"axis":case"grid":return Yp(e.kind,t);case"graph":return t("editor.overlayMenu.chart");default:return e}},Xp=(e,t)=>{switch(e){case"observation":return t("editor.overlayMenu.observation");case"group":return t("editor.overlayMenu.group");case"xValue":return t("editor.overlayMenu.band");default:return e}},Yp=(e,t)=>{switch(e){case"axis":return t("editor.overlayMenu.axis");case"legend":return t("editor.overlayMenu.legend");case"grid":return t("editor.overlayMenu.gridLines");default:return e}},Zp=({target:e})=>{const t=l.useI18n(),n=l.useFormattingLocale(),a=l.useSceneSelector(s=>s),o=Tt(a,n),i=(0,f.useMemo)(()=>Qp({target:e,scene:a,groupOptions:o,locale:n,t}),[e,a,o,n,t]);return(0,r.jsx)(Jp,{title:i})},Jp=({title:e})=>{const t=(0,f.useRef)(null),n=(0,f.useRef)(null),[a,o]=(0,f.useState)(!1),i=(0,f.useCallback)(()=>{const d=t.current,h=n.current;d===null||h===null||o(h.offsetWidth>d.clientWidth)},[]);(0,f.useLayoutEffect)(i,[i,e.whole]);const{setElement:s}=l.useResizeObserver({onResize:i}),c=(0,f.useCallback)(d=>{t.current=d,s(d)},[s]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Popover.Title,{ref:c,className:Up,"data-testid":"overlay-menu-title",children:a?e.value:e.whole}),(0,r.jsx)("span",{ref:n,className:qp,"aria-hidden":!0,children:e.whole})]})},Qp=({target:e,scene:t,groupOptions:n,locale:a,t:o})=>{const i=Kp(e,o),s={whole:i,value:i};if(e.kind!=="observations")return s;const c=(0,u.findLayerById)(t.layers,e.layerId);if(c===void 0)return s;const[d]=(0,u.resolveObservationsTarget)({layer:c,target:e,parsingLocale:t.config.parsingLocale}),h=d===void 0?null:c.data.getAt(d);return h===null?s:Zt({scene:t,layer:c,observation:h,groupOptions:n,locale:a,t:o},e.scope)},em=({frameElement:e})=>{const{selectionStore:t}=l.useGraphContext(),n=tm(l.useEditorState(p=>p.selectedOutline)),a=l.useEditorState(p=>p.annotatePress),o=l.MODE_RULES[l.useGraphMode()].showMenuTriggerOnHover,i=Qd(n?.target??null),s=ke(),c=n===null?null:(0,u.readEditTargetKey)(n.target),d=(0,f.useMemo)(()=>o&&c!==null?Vp(a,c):null,[o,a,c]);if(n===null||c===null||!s(n.target))return null;const h=()=>{t.getState().clearSelection()};return(0,r.jsxs)(nn,{frameElement:e,boundary:d?.boundary??n.frame,spans:d?.spans??n.frameSpans,onEscape:h,children:[(0,r.jsxs)(Wt,{className:$p,children:[(0,r.jsxs)("div",{className:Wp,children:[(0,r.jsx)(Zp,{target:n.target}),(0,r.jsx)(zp,{target:n.target},c)]}),n.target.kind==="observations"&&(0,r.jsx)(Np,{})]}),(0,r.jsx)(f.Fragment,{children:i},c)]})},tm=e=>{const t=l.useGraphSelection(),[n,a]=(0,f.useState)(e),o=n!==null&&(0,u.areEditTargetsEqual)(t[0]??null,n.target),i=e??(o?n:null);return i!==n&&a(i),i},nm=({frameRect:e})=>{const{targetBoundaryStore:t}=l.useGraphContext(),n=l.useEditorState(s=>s.selectedOutline),{left:a,top:o}=e,i=(0,f.useMemo)(()=>{if(n===null)return null;const{frame:s,frameSpans:c,frameScale:d}=n;return{frame:s,client:{x:a+s.x*d,y:o+s.y*d,width:s.width*d,height:s.height*d},frameSpans:c,clientSpans:{top:Qe(c.top,a,d),right:Qe(c.right,o,d),bottom:Qe(c.bottom,a,d),left:Qe(c.left,o,d)}}},[n,a,o]);return(0,f.useLayoutEffect)(()=>{t.getState().setBoundary(i)},[t,i]),(0,f.useLayoutEffect)(()=>()=>t.getState().setBoundary(null),[t]),null},Qe=(e,t,n)=>({from:t+e.from*n,to:t+e.to*n}),Gn="l8tsqe0",ui=["start","end"],hi=({anchor:e,point:t,delta:n,bounds:a=u.PANEL_FRACTION_BOUNDS})=>{const o={x:Fr(t.x,n.x,a.minX,a.maxX),y:Fr(1-t.y,n.y,a.minY,a.maxY)};return{anchor:{...e,x:e.x+o.x,y:e.y+o.y},point:{x:t.x+o.x,y:t.y-o.y}}},zn=(e,t)=>({...e,[t.endpoint]:{...e[t.endpoint],...t.point}}),pi=(e,t)=>e.x===t.x&&e.y===t.y,rm=(e,t)=>{const n=(0,u.projectAnchorToPanel)(e,t);return{x:t.x+n.x,y:t.y+n.y}},am=(e,t,n)=>{const a=(0,u.projectAnchorToPanel)(e,n),o=(0,u.projectAnchorToPanel)(t,n);return{x:Math.min(a.x,o.x),y:Math.min(a.y,o.y),width:Math.abs(o.x-a.x),height:Math.abs(o.y-a.y)}},Fr=(e,t,n,a)=>!Number.isFinite(t)||!Number.isFinite(e)?0:(0,fe.clamp)(t,Math.min(n-e,0),Math.max(a-e,0)),om=({panelRect:e})=>{const t=l.useEditorState(c=>l.readStanding(c,"arrow-endpoint-drag")),n=l.useResolvedAnnotations(e).arrows,a=l.useStyleReaderTree();if(t===null)return null;const o=n.find(c=>c.id===t.annotationId);if(o===void 0)return null;const i=(0,u.resolveArrowAnnotationStyle)(a,o.id),s=(0,u.computeArrow)({arrow:zn(o,t),style:i,panelWidth:e.width,panelHeight:e.height});return s===null?null:(0,r.jsx)("svg",{"aria-hidden":"true",className:Gn,width:e.width,height:e.height,style:{left:e.x,top:e.y},"data-testid":"arrow-endpoint-preview","data-annotation-id":t.annotationId,children:(0,r.jsx)(l.ArrowAnnotation,{computed:s,style:i,addressable:!1})})},im=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"m12 19-7-7 7-7"}),(0,r.jsx)("path",{d:"M19 12H5"})]})}),mi=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M5 12h14"}),(0,r.jsx)("path",{d:"m12 5 7 7-7 7"})]})}),sm=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M7 17 17 7"}),(0,r.jsx)("path",{d:"M7 7h10v10"})]})}),gi=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{fill:"currentColor",children:[(0,r.jsx)("rect",{x:"3",y:"5",width:"18",height:"1.5",rx:"0.75"}),(0,r.jsx)("rect",{x:"3",y:"10",width:"18",height:"3",rx:"1.5"}),(0,r.jsx)("rect",{x:"3",y:"16.5",width:"18",height:"4.5",rx:"2.25"})]})}),kt=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M4 7h16"}),(0,r.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,r.jsx)("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),(0,r.jsx)("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})}),lm="var(--pvjfpx0)",cm="var(--pvjfpx1)",dm="pvjfpx2",um="pvjfpx3",hm="pvjfpx4",pm="pvjfpx6 pvjfpx5",mm="pvjfpx7 pvjfpx6 pvjfpx5",gm="pvjfpx8 pvjfpx5",Me=8,vm=({anchorBox:e,panelRect:t,frameWidth:n,frameHeight:a})=>{const o=t.y+e.y,i=o+e.height,s=o-8-36,c=i+8,d=(0,fe.clamp)(s>=Me?s:c,Me,a-Me-36),h=Me;return{top:d,left:h,available:Math.max(0,n-Me*2),centre:t.x+e.x+e.width/2-h}},fm=({anchorBox:e,panelRect:t,frameWidth:n,frameHeight:a,label:o,testId:i,children:s})=>{const{chartId:c}=l.useGraphContext(),d=vm({anchorBox:e,panelRect:t,frameWidth:n,frameHeight:a});return(0,r.jsx)("div",{className:dm,style:{top:d.top,left:d.left,width:d.available},children:(0,r.jsx)(q.Root,{"aria-label":o,className:um,"data-testid":i,...yt(c),style:(0,de.assignInlineVars)({[lm]:`${d.centre}px`,[cm]:`${d.available}px`}),children:s})})},xm=({label:e,trigger:t,open:n,onOpenChange:a,disabled:o=!1,children:i})=>{const{chartId:s}=l.useGraphContext();return(0,r.jsxs)(J.Menu.Root,{open:n,modal:!1,onOpenChange:a,children:[(0,r.jsxs)(J.Menu.Trigger,{render:(0,r.jsx)(q.Button,{}),"aria-label":e,className:gm,disabled:o,onMouseDown:c=>c.preventDefault(),children:[t,(0,r.jsx)(De,{size:"sm"})]}),(0,r.jsx)(q.MenuPopup,{popupAttributes:yt(s),children:i})]})},bm=e=>{const{chartId:t}=l.useGraphContext();return(0,r.jsx)(q.ColorPicker,{...e,popupAttributes:yt(t)})},Sm=({color:e,opacity:t})=>(0,r.jsx)("span",{className:hm,style:{background:e,opacity:t}}),ym=({label:e,onClick:t,children:n})=>(0,r.jsx)(q.Button,{"aria-label":e,className:pm,onClick:t,children:n}),Cm=({label:e,pressed:t,onClick:n,children:a})=>(0,r.jsx)(q.Button,{"aria-label":e,"aria-pressed":t,className:mm,onClick:n,children:a}),G={Root:fm,Dropdown:xm,MenuItem:q.MenuItem,ColorPicker:bm,Swatch:Sm,IconButton:ym,ToggleButton:Cm,Button:q.Button,Separator:q.Separator},wm={kind:"chrome-popup"},At=()=>{const{commands:e}=l.useGraphContext(),t=l.useEditorStore(),[n,a]=(0,f.useState)(null);(0,f.useEffect)(()=>()=>e.commit(),[e]),(0,f.useEffect)(()=>{const{claimInteraction:i,releaseInteraction:s}=t.getState();return n===null?s("chrome-popup"):i(wm),()=>s("chrome-popup")},[t,n]);const o=()=>{a(null),e.commit()};return{bind:i=>({open:n===i,onOpenChange:s=>s?a(i):o()}),close:o}},jm=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,r.jsx)("path",{d:"M5 19 8 16"}),(0,r.jsx)("path",{d:"M10.5 13.5 13.5 10.5"}),(0,r.jsx)("path",{d:"M16 8 19 5"})]})}),Tm=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,r.jsx)("path",{d:"M5 19h0"}),(0,r.jsx)("path",{d:"M8.5 15.5h0"}),(0,r.jsx)("path",{d:"M12 12h0"}),(0,r.jsx)("path",{d:"M15.5 8.5h0"}),(0,r.jsx)("path",{d:"M19 5h0"})]})}),km=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsx)("path",{d:"M5 19 19 5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})}),Am=[{value:u.ARROW_STROKE_WIDTHS_PX.thin,key:"graph.annotations.arrowToolbar.thickness.thin"},{value:u.ARROW_STROKE_WIDTHS_PX.medium,key:"graph.annotations.arrowToolbar.thickness.medium"},{value:u.ARROW_STROKE_WIDTHS_PX.thick,key:"graph.annotations.arrowToolbar.thickness.thick"}],Br=[{value:"lineArrow",key:"graph.annotations.arrowToolbar.arrowhead.lineArrow",Icon:mi},{value:"none",key:"graph.annotations.arrowToolbar.arrowhead.none",Icon:l.MinusIcon}],Gr=[{value:"solid",key:"graph.annotations.arrowToolbar.lineStyle.solid",Icon:km},{value:"dashed",key:"graph.annotations.arrowToolbar.lineStyle.dashed",Icon:jm},{value:"dotted",key:"graph.annotations.arrowToolbar.lineStyle.dotted",Icon:Tm}],Lm=(e,t)=>e.find(n=>n.value===t)??e[0];var Pm=({arrow:e,arrowBox:t,panelRect:n,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(C=>C.spec.styles.overrides),h=l.useSceneSelector(C=>(0,u.readStyleCoord)(C.spec)),p=At(),m=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),g=Lm(Gr,(0,u.toDashPreset)(m.dashArray)),v=m.outline.strokeWidth>0||m.outline.shadow!=="none",x=(0,f.useMemo)(()=>({target:"annotation",kind:"arrow",annotation:e.id}),[e.id]),b=(0,f.useMemo)(()=>({...x,part:"outline"}),[x]),y=(C,S)=>{const M=(0,u.findStyleRule)(d,{select:x},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:{...M,...C}}}),S)},k=C=>{const S=(0,u.findStyleRule)(d,{select:b},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:b,declarations:{...S,...C}}}))},w=C=>{y(C),p.close()},j=C=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"arrow",id:e.id,patch:C})),p.close()},P=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},A=C=>y({stroke:C},{transient:!0}),E=C=>w({strokeWidth:C}),O=C=>j({startArrowheadStyle:C}),T=C=>w({dashArray:u.DASH_PRESETS.arrow[C]}),R=C=>j({endArrowheadStyle:C}),L=()=>k(v?{strokeWidth:0,shadow:"none"}:u.ARROW_STICKER_DECLARATIONS);return(0,r.jsxs)(G.Root,{anchorBox:t,panelRect:n,frameWidth:a,frameHeight:o,label:s("graph.annotations.arrowToolbar.label"),testId:"arrow-toolbar",children:[(0,r.jsx)(G.ColorPicker,{color:m.stroke,label:s("graph.annotations.arrowToolbar.color"),onChange:A,...p.bind("color"),children:(0,r.jsx)(G.Swatch,{color:m.stroke})}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.arrowToolbar.thickness.ariaLabel"),trigger:(0,r.jsx)(gi,{size:"sm",title:""}),...p.bind("thickness"),children:(0,r.jsx)(et,{options:Am,current:m.strokeWidth,onPick:E})}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.arrowToolbar.startArrowhead"),trigger:(0,r.jsx)(im,{size:"sm",title:""}),...p.bind("startArrowhead"),children:(0,r.jsx)(et,{options:Br,current:e.startArrowheadStyle,onPick:O})}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.arrowToolbar.lineStyle.ariaLabel"),trigger:g?.Icon!==void 0&&(0,r.jsx)(g.Icon,{size:"sm",title:""}),...p.bind("lineStyle"),children:(0,r.jsx)(et,{options:Gr,current:(0,u.toDashPreset)(m.dashArray),onPick:T})}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.arrowToolbar.endArrowhead"),trigger:(0,r.jsx)(mi,{size:"sm",title:""}),...p.bind("endArrowhead"),children:(0,r.jsx)(et,{options:Br,current:e.endArrowheadStyle,onPick:R})}),(0,r.jsx)(G.ToggleButton,{label:s("graph.annotations.arrowToolbar.sticker"),pressed:v,onClick:L,children:(0,r.jsx)(sm,{size:"sm",title:""})}),(0,r.jsx)(G.Separator,{}),(0,r.jsx)(G.IconButton,{label:s("graph.annotations.arrowToolbar.remove"),onClick:P,children:(0,r.jsx)(kt,{size:"sm",title:""})})]})},et=({options:e,current:t,onPick:n})=>{const a=l.useI18n(),o=i=>()=>n(i);return(0,r.jsx)(r.Fragment,{children:e.map(i=>(0,r.jsxs)(G.MenuItem,{selected:i.value===t,onClick:o(i.value),children:[(0,r.jsx)("span",{children:a(i.key)}),i.Icon!==void 0&&(0,r.jsx)("span",{className:"_112xh5c0",children:(0,r.jsx)(i.Icon,{size:"sm",title:""})})]},String(i.value)))})},Im="_1me29t10",re=(e,t)=>t>0?e/t:0,vi=(e,t)=>e.width<=0||e.height<=0||t.width<=0||t.height<=0?u.PANEL_FRACTION_BOUNDS:{minX:Math.min(0,-e.x/e.width),minY:Math.min(0,-e.y/e.height),maxX:Math.max(1,(t.width-e.x)/e.width),maxY:Math.max(1,(t.height-e.y)/e.height)},he=(e,t)=>{const n=t.getBoundingClientRect(),a=tn(t,n),o=a.width+.5>=e.x+e.width&&a.height+.5>=e.y+e.height?a:n;return vi(e,o)},Lt=(e,t,n)=>({x:re(t.x-e.x,n.width),y:re(t.y-e.y,n.height)}),Em=e=>e.x!==0||e.y!==0,fi=(e,t)=>({x:e.x*t.width,y:e.y*t.height});var Mm=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y)>=3,He=class{constructor(e){this.params=e,this.listeners=new AbortController,this.pendingEvent=null,this.scheduledFrame=null,this.hasMoved=!1,this.hasPublished=!1,this.confirmedDrag=!1,this.releasePoint=null,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.releasePoint={x:t.clientX,y:t.clientY},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 n=this.params.editorStore.getState();if(this.hasPublished&&this.readOwn(n)===null)return;const a={x:t.clientX,y:t.clientY};if(!this.hasPublished&&!this.isDragConfirmed(this.params.press,a))return;this.confirmedDrag=!0;const o=this.resolvePreview(a);o!==null&&(n.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 Mm(e,t)}settle(e){this.pendingEvent=null;const t=this.params.editorStore.getState(),n=this.readOwn(t);n!==null&&t.releaseInteraction(this.kind),e&&n!==null&&this.commit(n),e&&!this.confirmedDrag&&this.params.onClick!==void 0&&(document.activeElement===this.params.handle&&this.params.handle.blur(),this.params.onClick(this.releasePoint??this.params.press))}cancelFrame(){this.scheduledFrame!==null&&(cancelAnimationFrame(this.scheduledFrame),this.scheduledFrame=null)}},vt=(e,t,n)=>{const a=e.arrows.find(i=>i.id===t);if(a===void 0)return null;const o=a[n];return o.anchorType==="panel"?o:null},xi=(e,t)=>e==="start"?{start:t}:{end:t},Rm=class extends He{constructor(...e){super(...e),this.kind="arrow-endpoint-drag"}readOwn(e){const{annotationId:t,endpoint:n}=this.params;return l.readDraggedArrowEndpointFor(l.readStanding(e,"arrow-endpoint-drag"),t,n)}resolvePreview(e){const{annotationId:t,endpoint:n,press:a,readInputs:o}=this.params,{annotations:i,arrow:s,panelRect:c,frameElement:d}=o(),h=vt(i,t,n);return h===null?null:{kind:"arrow-endpoint-drag",annotationId:t,endpoint:n,...hi({anchor:h,point:s[n],delta:Lt(a,e,c),bounds:he(c,d)})}}commit({anchor:e}){const{annotationId:t,endpoint:n,dispatch:a,readInputs:o}=this.params,i=vt(o().annotations,t,n);i===null||pi(i,e)||a(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:xi(n,e)}))}},Om=({annotationId:e,arrow:t,panelRect:n,frameElement:a})=>{const{commands:o}=l.useGraphContext(),i=l.useEditorStore(),s=l.useLatestRef({annotations:l.useSceneSelector(d=>d.spec.annotations),arrow:t,panelRect:n,frameElement:a}),c=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>c.current?.finish(!1),[]),(0,f.useCallback)(d=>({onPointerDown:h=>{if(h.button===0&&c.current===null){try{h.currentTarget.setPointerCapture(h.pointerId)}catch{return}h.currentTarget.focus({preventScroll:!0}),h.preventDefault(),c.current=new Rm({handle:h.currentTarget,pointerId:h.pointerId,annotationId:e,endpoint:d,press:{x:h.clientX,y:h.clientY},readInputs:()=>s.current,editorStore:i,dispatch:o.dispatch,onSettled:()=>{c.current=null}}),c.current.start()}}}),[e,s,i,o])},_m=[" ","Enter"],zr=4,Nm=({annotationId:e,arrow:t,panelRect:n,frameElement:a})=>{const{commands:o}=l.useGraphContext(),i=l.useEditorStore(),s=l.useSceneSelector(h=>h.spec.annotations),c=l.useLatestRef(s),d=l.useLatestRef(o.dispatch);return(0,f.useEffect)(()=>()=>{for(const h of ui)Hr({editorStore:i,annotationId:e,endpoint:h,annotations:c.current,dispatch:d.current})},[i,e,c,d]),(0,f.useCallback)(h=>({onKeyDown:p=>{if(p.altKey||p.ctrlKey||p.metaKey||p.shiftKey)return;const m=i.getState(),g=l.readDraggedArrowEndpointFor(l.readStanding(m,"arrow-endpoint-drag"),e,h);if(_m.includes(p.key)){if(p.preventDefault(),p.repeat)return;if(g!==null){Hr({editorStore:i,annotationId:e,endpoint:h,annotations:s,dispatch:o.dispatch});return}const x=vt(s,e,h);if(x===null)return;m.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:h,anchor:x,point:t[h]});return}if(g===null)return;const v=Dm(p.key,n);v!==null&&(p.preventDefault(),m.claimInteraction({kind:"arrow-endpoint-drag",annotationId:e,endpoint:h,...hi({anchor:g.anchor,point:g.point,delta:v,bounds:he(n,a)})}))}}),[e,s,t,n,a,i,o])},Hr=({editorStore:e,annotationId:t,endpoint:n,annotations:a,dispatch:o})=>{const i=e.getState(),s=l.readDraggedArrowEndpointFor(l.readStanding(i,"arrow-endpoint-drag"),t,n);if(s===null)return;i.releaseInteraction("arrow-endpoint-drag");const c=vt(a,t,n);c===null||pi(c,s.anchor)||o(new u.UpdateAnnotationCommand({kind:"arrow",id:t,patch:xi(n,s.anchor)}))},Dm=(e,t)=>{const n=re(zr,t.width),a=re(zr,t.height);switch(e){case"ArrowLeft":return{x:-n,y:0};case"ArrowRight":return{x:n,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},Fm=e=>{const t=Be(),n=zm(t),a=Hm(e.panelRect,t),o=Vm(t);if(n===null||a===null)return null;const i=o.dragged===null?a:zn(a,o.dragged);return(0,r.jsx)(Bm,{arrow:n,committed:a,painted:i,settled:o.dragged===null&&!o.moving,moving:o.moving,...e})},Bm=({arrow:e,committed:t,painted:n,settled:a,moving:o,panelRect:i,frameRect:s,frameElement:c})=>{const d=l.useI18n(),h=Om({annotationId:e.id,arrow:t,panelRect:i,frameElement:c}),p=Nm({annotationId:e.id,arrow:t,panelRect:i,frameElement:c});return(0,r.jsxs)("div",{"data-testid":"arrow-selection","data-annotation-id":e.id,children:[a&&(0,r.jsx)(Pm,{arrow:e,arrowBox:am(t.start,t.end,i),panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),!o&&ui.filter(m=>e[m].anchorType==="panel").map(m=>(0,r.jsx)(Gm,{endpoint:m,point:rm(n[m],i),label:d(`graph.annotations.arrowToolbar.moveEndpoint.${m}`),dragHandlers:h(m),keyboardHandlers:p(m)},m))]})},Gm=({endpoint:e,point:t,label:n,dragHandlers:a,keyboardHandlers:o})=>(0,r.jsx)("div",{"aria-label":n,className:Im,"data-testid":"arrow-endpoint-handle","data-endpoint":e,role:"button",style:{left:t.x,top:t.y},tabIndex:0,...a,...o}),zm=e=>{const t=l.useSceneSelector(n=>n.spec.annotations.arrows);return e===null?null:t.find(n=>n.id===e)??null},Hm=(e,t)=>{const n=l.useResolvedAnnotations(e).arrows;return t===null?null:n.find(a=>a.id===t)??null},Vm=e=>l.useEditorState((0,ae.useShallow)(t=>{if(e===null)return{dragged:null,moving:!1};const n=l.readStanding(t,"arrow-endpoint-drag");return{dragged:n?.annotationId===e?n:null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null}})),$m=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M4 9h16m-4-4 4 4"}),(0,r.jsx)("path",{d:"M20 15H4m4 4-4-4"})]})}),Wm="q7gcrz0",Um="q7gcrz1",qm="q7gcrz2";var Km=["absoluteDifference","relativeDifference","proportion"],Vr=["absoluteDifference","relativeDifference"],Xm=["relativeDifference","proportion"],Ym={absoluteDifference:"graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference",relativeDifference:"graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",proportion:"graph.annotations.differenceArrowToolbar.labelKind.proportion"},Zm=e=>{const{formattingLocale:t}=l.useGraphContext(),n=l.useSceneSelector(o=>o.config.parsingLocale),a=t??n;return(0,f.useMemo)(()=>{const o=(0,u.areEndpointsComparable)(e.start,e.end);return Km.filter(i=>o||!Vr.includes(i)||i===e.label).map(i=>({kind:i,key:Ym[i],preview:(0,u.formatDifferenceLabel)({locale:a,kind:i,startValue:e.start.measurementValue,endValue:e.end.measurementValue,valueFormat:e.start.valueFormat}),pickable:o||!Vr.includes(i),suspect:Xm.includes(i)&&e.start.measurementValue===0}))},[e,a])},$r=[{id:"small",key:"graph.annotations.differenceArrowToolbar.size.small"},{id:"medium",key:"graph.annotations.differenceArrowToolbar.size.medium"},{id:"large",key:"graph.annotations.differenceArrowToolbar.size.large"}],Jm=({arrow:e,color:t,labelBox:n,panelRect:a,frameWidth:o,frameHeight:i,frameElement:s})=>{const c=l.useI18n(),{commands:d}=l.useGraphContext(),h=l.useSceneSelector(S=>S.spec.styles.overrides),p=l.useSceneSelector(S=>(0,u.readStyleCoord)(S.spec)),m=At(),g=Zm(e),v=(0,u.resolveDifferenceArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),x=(0,f.useMemo)(()=>({target:"annotation",kind:"differenceArrow",annotation:e.id}),[e.id]),b=(0,f.useMemo)(()=>({...x,part:"label"}),[x]),y=g.find(S=>S.kind===e.label),k=g.some(S=>S.pickable&&S.kind!==e.label),w=$r.find(S=>u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[S.id].arrow.strokeWidth===v.strokeWidth),j=(S,M)=>{d.dispatch(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:e.id,patch:S}),M)},P=S=>({...(0,u.findStyleRule)(h,{select:x},p)?.declarations,...S}),A=S=>({...(0,u.findStyleRule)(h,{select:b},p)?.declarations,...S}),E=S=>{j(S),m.close()},O=()=>{d.dispatch(new u.RemoveAnnotationCommand({id:e.id})),s.focus({preventScroll:!0})},T=S=>d.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:x,declarations:P({stroke:S})}}),{transient:!0}),R=()=>j({start:e.end.anchor,end:e.start.anchor}),L=S=>()=>E({label:S}),C=S=>()=>{const M=u.DIFFERENCE_ARROW_SIZE_DECLARATIONS[S];d.dispatch(new u.SetDifferenceArrowStyleCommand({annotationId:e.id,arrow:P(M.arrow),label:A(M.label)})),m.close()};return(0,r.jsxs)(G.Root,{anchorBox:n,panelRect:a,frameWidth:o,frameHeight:i,label:c("graph.annotations.differenceArrowToolbar.label"),testId:"difference-arrow-toolbar",children:[(0,r.jsx)(G.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),trigger:(0,r.jsx)(Qm,{option:y}),disabled:!k,...m.bind("labelKind"),children:g.map(S=>(0,r.jsxs)(G.MenuItem,{selected:S.kind===e.label,disabled:!S.pickable,onClick:L(S.kind),children:[(0,r.jsx)("span",{children:c(S.key)}),(S.suspect||!S.pickable)&&(0,r.jsx)("span",{"aria-label":c(S.pickable?"graph.annotations.differenceArrowToolbar.labelKind.suspectValue":"graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),className:"q7gcrz3",role:"img",children:"⚠"}),(0,r.jsx)("span",{className:qm,children:S.preview})]},S.kind))}),(0,r.jsx)(G.Separator,{}),(0,r.jsx)(G.ColorPicker,{color:t,label:c("graph.annotations.differenceArrowToolbar.color"),onChange:T,...m.bind("color"),children:(0,r.jsx)(G.Swatch,{color:t})}),(0,r.jsx)(G.Dropdown,{label:c("graph.annotations.differenceArrowToolbar.size.ariaLabel"),trigger:w===void 0?"":c(w.key),...m.bind("size"),children:$r.map(S=>(0,r.jsx)(G.MenuItem,{selected:S.id===w?.id,onClick:C(S.id),children:c(S.key)},S.id))}),(0,r.jsx)(G.Separator,{}),(0,r.jsx)(G.IconButton,{label:c("graph.annotations.differenceArrowToolbar.swap"),onClick:R,children:(0,r.jsx)($m,{size:"sm",title:""})}),(0,r.jsx)(G.IconButton,{label:c("graph.annotations.differenceArrowToolbar.remove"),onClick:O,children:(0,r.jsx)(kt,{size:"sm",title:""})})]})},Qm=({option:e})=>{const t=l.useI18n();return e===void 0?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:Um,children:t(e.key)}),(0,r.jsxs)("span",{className:Wm,children:["(",e.preview,")"]})]})},bi="var(--ydgo3h0)";var eg="ydgo3h1",tg="ydgo3h2",ng="ydgo3h3",rg=({clientPoint:e,panelOrigin:t,panelRect:n,engine:a,layers:o,coordSystem:i,resolver:s,fixedAnchor:c,align:d})=>{const h=ag({x:e.x-t.x,y:e.y-t.y},n),{primary:p}=a.query((0,u.toPanelCursor)(h,n));if(p===null)return null;const m=o.find(v=>v.id===p.layerId);if(m===void 0)return null;const g=(0,u.resolveObservationPoint)({resolver:s,layer:m,observation:p.observation,observationIndex:(0,u.readObservationIndex)(p),coordSystem:i,align:d});return g===null||(0,u.areAnchorsEqual)(g.anchor,c)?null:g},ag=(e,t)=>({x:Math.max(0,Math.min(e.x,t.width)),y:Math.max(0,Math.min(e.y,t.height))}),Si=e=>e==="start"?"end":"start",yi=({dispatch:e,arrow:t,endpoint:n,anchor:a})=>{(0,u.areAnchorsEqual)(a,t[n].anchor)||e(new u.UpdateAnnotationCommand({kind:"differenceArrow",id:t.id,patch:{[n]:a}}))},og=class extends He{constructor(...e){super(...e),this.kind="difference-arrow-endpoint-drag"}readOwn(e){const{endpoint:t,readInputs:n}=this.params;return l.readDraggedDifferenceArrowEndpointFor(l.readStanding(e,"difference-arrow-endpoint-drag"),n().arrow.id,t)}resolvePreview(e){const{endpoint:t,readInputs:n,engine:a,anchorResolver:o}=this.params,{arrow:i,panelOrigin:s,panelRect:c,layers:d,coordSystem:h}=n(),p=rg({clientPoint:e,panelOrigin:s,panelRect:c,engine:a,layers:d,coordSystem:h,resolver:o,fixedAnchor:i[Si(t)].anchor,align:i[t].anchor.align});return p===null?null:{kind:"difference-arrow-endpoint-drag",annotationId:i.id,endpoint:t,point:p}}commit({point:e,endpoint:t}){const{dispatch:n,readInputs:a}=this.params;yi({dispatch:n,arrow:a().arrow,endpoint:t,anchor:e.anchor})}},ig=({arrow:e,panelOrigin:t,panelRect:n,onClick:a})=>{const{commands:o,anchorResolver:i}=l.useGraphContext(),{engine:s}=l.useHoverContext(),c=l.useEditorStore(),d=l.useLatestRef({arrow:e,panelOrigin:t,panelRect:n,...l.useSceneSelector((0,ae.useShallow)(m=>({layers:m.layers,coordSystem:m.coordSystem})))}),h=l.useLatestRef(a),p=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>p.current?.finish(!1),[]),(0,f.useCallback)(m=>({onPointerDown:g=>{if(g.button===0&&p.current===null){try{g.currentTarget.setPointerCapture(g.pointerId)}catch{return}g.currentTarget.focus({preventScroll:!0}),g.preventDefault(),p.current=new og({handle:g.currentTarget,pointerId:g.pointerId,press:{x:g.clientX,y:g.clientY},endpoint:m,readInputs:()=>d.current,editorStore:c,engine:s,anchorResolver:i,dispatch:o.dispatch,onClick:v=>h.current(v),onSettled:()=>{p.current=null}}),p.current.start()}}}),[d,h,c,s,i,o])},sg=[" ","Enter"],lg=({arrow:e})=>{const{commands:t,anchorResolver:n}=l.useGraphContext(),a=l.useEditorStore(),{layers:o,coordSystem:i,mainAxis:s}=l.useSceneSelector((0,ae.useShallow)(d=>({layers:d.layers,coordSystem:d.coordSystem,mainAxis:(0,u.readMainAxis)(d.coordSystem)}))),c=e.id;return(0,f.useEffect)(()=>()=>{const d=a.getState();l.readStanding(d,"difference-arrow-endpoint-drag")?.annotationId===c&&d.releaseInteraction("difference-arrow-endpoint-drag")},[a,c]),(0,f.useCallback)(d=>({onKeyDown:h=>{if(h.altKey||h.ctrlKey||h.metaKey||h.shiftKey)return;const p=a.getState(),m=l.readDraggedDifferenceArrowEndpointFor(l.readStanding(p,"difference-arrow-endpoint-drag"),e.id,d);if(sg.includes(h.key)){if(h.preventDefault(),h.repeat)return;if(m===null)return p.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:e[d]});p.releaseInteraction("difference-arrow-endpoint-drag"),yi({dispatch:t.dispatch,arrow:e,endpoint:d,anchor:m.point.anchor});return}if(m===null)return;const g=cg(h.key,s);if(g===null)return;h.preventDefault();const v=dg({arrow:e,endpoint:d,from:m.point.anchor,move:g,layers:o,coordSystem:i,resolver:n});v!==null&&p.claimInteraction({kind:"difference-arrow-endpoint-drag",annotationId:e.id,endpoint:d,point:v})}}),[e,a,t,n,o,i,s])},cg=(e,t)=>{const n=e==="ArrowUp"||e==="ArrowDown";return!n&&!(e==="ArrowLeft"||e==="ArrowRight")?null:{axis:t==="x"===n?"cross":"main",step:e==="ArrowDown"||e==="ArrowRight"?1:-1}},dg=({arrow:e,endpoint:t,from:n,move:a,layers:o,coordSystem:i,resolver:s})=>{const c=o.find(p=>p.id===n.layerId);if(c===void 0)return null;const d=s.createLayerMeasurement(c);if(d===null)return null;const{align:h}=e[t].anchor;return(0,u.stepDifferenceArrowEndpoint)({layer:c,from:n,partner:e[Si(t)].anchor,axis:a.axis,step:a.step,getObservationPoint:(p,m)=>(0,u.resolveObservationPoint)({resolver:s,layer:c,observation:p,observationIndex:m,coordSystem:i,align:h,measurement:d})})?.point??null},ug=e=>{const t=Be(),n=l.useDifferenceArrowGeometries(),a=(0,f.useCallback)(o=>{const i=e.frameElement.querySelector('[data-testid="pointer-capture-layer"]');i!==null&&i.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,button:0,clientX:o.x,clientY:o.y,pointerId:1,pointerType:"mouse"}))},[e.frameElement]);return(0,r.jsxs)(r.Fragment,{children:[t!==null&&(0,r.jsx)(hg,{annotationId:t,...e}),n.map(o=>o.id!==t&&!o.dragging?null:(0,r.jsx)(mg,{geometry:o,shown:o.id===t||o.dragging,keyboard:o.id===t,panelRect:e.panelRect,panelOrigin:e.panelOrigin,onClick:a},o.id))]})},hg=({annotationId:e,panelOrigin:t,...n})=>{const a=l.useDifferenceArrowGeometries(),o=(0,f.useMemo)(()=>a.find(i=>i.id===e),[a,e]);return o===void 0?null:(0,r.jsx)(pg,{committedArrow:o.committedArrow,color:o.color,labelCornerRadius:o.style.label.cornerRadius,committedLabelBox:o.committedLabelBox,labelBox:o.labelBox,dragging:o.dragging,...n})},pg=({committedArrow:e,color:t,labelCornerRadius:n,committedLabelBox:a,labelBox:o,panelRect:i,frameRect:s,frameElement:c,dragging:d})=>{const h=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,r.jsxs)("div",{"data-testid":"difference-arrow-selection",style:(0,de.assignInlineVars)({[bi]:h}),children:[!d&&(0,r.jsx)(Jm,{arrow:e,color:t,labelBox:a,panelRect:i,frameWidth:s.width,frameHeight:s.height,frameElement:c}),(0,r.jsx)("div",{"aria-hidden":"true",className:ng,"data-testid":"difference-arrow-selection-label",style:{left:i.x+o.x-2,top:i.y+o.y-2,width:o.width+4,height:o.height+4,borderRadius:l.toBorderRadiusCss(n,2)}})]})},mg=({geometry:e,shown:t,keyboard:n,panelRect:a,panelOrigin:o,onClick:i})=>{const s=l.useEditorStore(),c=(0,f.useRef)(n),d=e.committedArrow.id;(0,f.useEffect)(()=>{if(c.current&&!n){const g=s.getState();l.readStanding(g,"difference-arrow-endpoint-drag")?.annotationId===d&&g.releaseInteraction("difference-arrow-endpoint-drag")}c.current=n},[n,s,d]);const h=ig({arrow:e.committedArrow,panelOrigin:o,panelRect:a,onClick:i}),p=lg({arrow:e.committedArrow}),m=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,r.jsxs)("div",{style:(0,de.assignInlineVars)({[bi]:m}),children:[(0,r.jsx)(Wr,{endpoint:"start",point:e.start,panelRect:a,shown:t,keyboard:n,dragHandlers:h("start"),keyboardHandlers:p("start")}),(0,r.jsx)(Wr,{endpoint:"end",point:e.end,panelRect:a,shown:t,keyboard:n,dragHandlers:h("end"),keyboardHandlers:p("end")})]})},Wr=({endpoint:e,point:t,panelRect:n,shown:a,keyboard:o,dragHandlers:i,keyboardHandlers:s})=>(0,r.jsx)("div",{className:eg,"data-testid":"difference-arrow-selection-handle","data-endpoint":e,"data-shown":a||void 0,role:"button",style:{left:n.x+t.x,top:n.y+t.y},tabIndex:o?0:-1,...i,...o?s:{},children:(0,r.jsx)("span",{"aria-hidden":"true",className:tg})}),sn=({start:e,extent:t,moveStartEdge:n,delta:a,minExtent:o,bounds:i})=>{if(!Number.isFinite(a))return{start:e,extent:t};const s=i?.min??0,c=i?.max??1,d=e+t,h=Math.min(o,t);if(n){const g=Math.min(s,e),v=Math.min(Math.max(c,e),d-h),x=(0,fe.clamp)(e+a,g,v);return{start:x,extent:d-x}}const p=Math.max(Math.min(s,d),e+h),m=Math.max(c,d);return{start:e,extent:(0,fe.clamp)(d+a,p,m)-e}},gg=["top-left","top-right","bottom-right","bottom-left"];var Ci=({width:e,height:t})=>({x:re(16,e),y:re(16,t)}),vg=(e,t)=>({x:Ti(t)?e.x:e.x+e.width,y:ki(t)?e.y:e.y+e.height}),Hn=e=>({x:e.x,y:1-e.y-e.height,width:e.width,height:e.height}),wi=({region:e,corner:t,delta:n,minSize:a,bounds:o})=>{const i=sn({start:e.x,extent:e.width,moveStartEdge:Ti(t),delta:n.x,minExtent:a.x,...o===void 0?{}:{bounds:{min:o.minX,max:o.maxX}}}),s=sn({start:e.y,extent:e.height,moveStartEdge:ki(t),delta:n.y,minExtent:a.y,...o===void 0?{}:{bounds:{min:o.minY,max:o.maxY}}});return{anchorType:"panel",x:i.start,y:s.start,width:i.extent,height:s.extent}},ji=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ti=e=>e==="top-left"||e==="bottom-left",ki=e=>e==="top-left"||e==="top-right",Ai=(e,t,n,a)=>{const o=e.textAnnotations.find(i=>i.id===t);return o===void 0?null:l.measureTextAnnotationBox(l.previewResizedText(o,n),a)},fg="var(--_1ee8fau0)";var xg={hovered:"_1ee8fau2 _1ee8fau1",selected:"_1ee8fau3 _1ee8fau1"},bg={hovered:"_1ee8fau5 _1ee8fau4",selected:"_1ee8fau6 _1ee8fau4"},Sg=({panelRect:e})=>{const t=l.useResolvedAnnotations(e),n=l.useMeasuredBoxes(),a=l.useStyleReaderTree(),o=Be(),i=l.useEditorState(b=>l.readStanding(b,"move-drag")),s=l.useEditorState(b=>l.readStanding(b,"shape-resize-drag")),c=l.useEditorState(b=>l.readStanding(b,"arrow-endpoint-drag")),d=l.useEditorState(b=>l.readStanding(b,"text-resize-drag")),h=l.useEditorState(l.readAnnotationUnderPointer),p=(0,f.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:n,readers:a}),[e.width,e.height,n,a]),m=Ur(t,o,p),g=Ur(t,h===o?null:h,p),v=b=>{if(s?.annotationId===b.id){const y=t.shapes.find(k=>k.id===b.id);return y===void 0?b.geometry:l.measureShapeRegion(Hn(s.region),a.annotation.shape(y.id).get("strokeWidth"),p.panel)}if(c?.annotationId===b.id){const y=t.arrows.find(k=>k.id===b.id);return y===void 0?b.geometry:l.measureArrowEnds(zn(y,c),p.panel)??b.geometry}return d?.annotationId===b.id?Ai(t,b.id,d,p)??b.geometry:b.geometry},x=b=>{if(i?.annotationId!==b)return e;const y=fi(i.translation,e);return{x:e.x+y.x,y:e.y+y.y}};return(0,r.jsxs)(r.Fragment,{children:[g!==null&&(0,r.jsx)(qr,{annotationId:g.id,geometry:v(g),state:"hovered",origin:x(g.id)}),m!==null&&(0,r.jsx)(qr,{annotationId:m.id,geometry:v(m),state:"selected",origin:x(m.id)})]})},Ur=(e,t,n)=>{if(t===null)return null;const a=l.resolveAnnotationChromeGeometry(e,t,n);return a===null?null:{id:t,geometry:a}},qr=({annotationId:e,geometry:t,state:n,origin:a})=>{const o=l.useStyleReaderTree().editOutline.selected().resolve().stroke,i=(0,de.assignInlineVars)({[fg]:o});return t.shape==="segment"?(0,r.jsxs)("div",{"aria-hidden":"true","data-testid":"annotation-chrome","data-annotation-id":e,"data-state":n,style:i,children:[(0,r.jsx)(Kr,{point:t.start,state:n,origin:a}),(0,r.jsx)(Kr,{point:t.end,state:n,origin:a})]}):(0,r.jsx)("div",{"aria-hidden":"true",className:xg[n],"data-testid":"annotation-chrome","data-annotation-id":e,"data-state":n,style:{...i,left:a.x+t.rect.x-2,top:a.y+t.rect.y-2,width:t.rect.width+4,height:t.rect.height+4}})},Kr=({point:e,state:t,origin:n})=>(0,r.jsx)("span",{className:bg[t],style:{left:n.x+e.x,top:n.y+e.y}}),yg=({panelRect:e})=>{const t=l.useEditorState(o=>l.readStanding(o,"move-drag")),n=l.useResolvedAnnotations(e);if(t===null)return null;const a=fi(t.translation,e);return(0,r.jsx)("svg",{"aria-hidden":"true",className:Gn,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:jg(n,t.annotationId,e)})},Cg=({annotation:e,panel:t})=>{const n=l.useMeasuredBoxRef(e.id);return(0,r.jsx)(l.TextAnnotation,{annotation:e,panel:t,style:l.useStyleReaderTree().annotation.text(e.id).resolve(),blockRef:n})},tt=(e,t,n)=>{const a=e.find(o=>o.id===t);return a===void 0?null:n(a)},wg={text:(e,t,n)=>tt(e.textAnnotations,t,a=>(0,r.jsx)(Cg,{annotation:a,panel:n})),shape:(e,t,n)=>tt(e.shapes,t,a=>(0,r.jsx)(kg,{shape:a,panelSize:n})),image:(e,t,n)=>tt(e.images,t,a=>(0,r.jsx)(Ag,{image:a,panelSize:n})),arrow:(e,t,n)=>tt(e.arrows,t,a=>(0,r.jsx)(Tg,{arrow:a,panelSize:n}))},jg=(e,t,n)=>{for(const a of Object.values(wg)){const o=a(e,t,n);if(o!==null)return o}return null},Tg=({arrow:e,panelSize:t})=>{const n=(0,u.resolveArrowAnnotationStyle)(l.useStyleReaderTree(),e.id),a=(0,u.computeArrow)({arrow:e,style:n,panelWidth:t.width,panelHeight:t.height});return a===null?null:(0,r.jsx)(l.ArrowAnnotation,{computed:a,style:n,addressable:!1})},kg=({shape:e,panelSize:t})=>(0,r.jsx)(l.ShapeAnnotation,{shape:e,style:l.useStyleReaderTree().annotation.shape(e.id).resolve(),panel:t}),Ag=({image:e,panelSize:t})=>(0,r.jsx)(l.ImageAnnotation,{image:e,panel:t,style:l.useStyleReaderTree().annotation.image(e.id).resolve()}),Lg="s8eewu0",Xr="s8eewu1",Pg=({frameElement:e,panelRect:t})=>{const n=l.useEditorState(h=>l.readStanding(h,"arrow-draw")),a=l.useEditorState(h=>l.readStanding(h,"box-draw")),o=n?.start??a?.start??null,[i,s]=(0,f.useState)(null);if((0,f.useEffect)(()=>{if(n===null&&a===null)return;const h=(g,v)=>{const x=e.getBoundingClientRect();s({x:Yr(g-x.left,0,x.width),y:Yr(v-x.top,0,x.height)})},p=n?.pointer??a?.pointer;p!==void 0&&h(p.x,p.y);const m=g=>{h(g.clientX,g.clientY)};return document.addEventListener("pointermove",m,!0),document.addEventListener("pointerdown",m,!0),()=>{document.removeEventListener("pointermove",m,!0),document.removeEventListener("pointerdown",m,!0),s(null)}},[n,a,e]),o===null||i===null)return null;const c=t.x+o.x*t.width,d=t.y+o.y*t.height;return(0,r.jsx)("svg",{className:Lg,children:a===null?(0,r.jsx)("line",{className:Xr,x1:c,y1:d,x2:i.x,y2:i.y}):(0,r.jsx)("rect",{className:Xr,fill:"none",x:Math.min(c,i.x),y:Math.min(d,i.y),width:Math.abs(i.x-c),height:Math.abs(i.y-d)})})},Yr=(e,t,n)=>Math.min(Math.max(e,t),n),Ig=({panelRect:e})=>{const t=l.useEditorState(i=>l.readStanding(i,"shape-resize-drag")),n=l.useResolvedAnnotations(e).shapes,a=l.useStyleReaderTree();if(t===null)return null;const o=n.find(i=>i.id===t.annotationId);return o===void 0?null:(0,r.jsx)("svg",{"aria-hidden":"true",className:Gn,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,r.jsx)(l.ShapeAnnotation,{shape:{...o,region:Hn(t.region)},style:a.annotation.shape(o.id).resolve(),panel:e})})},Eg="var(--o49ib40)",Mg={sm:"o49ib41",md:"o49ib42"},Rg={horizontal:"o49ib43",diagonalDown:"o49ib44",diagonalUp:"o49ib45"},Li=({point:e,label:t,pull:n,size:a,attributes:o,dragHandlers:i,keyboardHandlers:s})=>{const c=l.useStyleReaderTree().editOutline.selected().resolve().stroke;return(0,r.jsx)("div",{"aria-label":t,className:Rg[n],role:"button",style:{left:e.x,top:e.y,...(0,de.assignInlineVars)({[Eg]:c})},tabIndex:0,...o,...i,...s,children:(0,r.jsx)("span",{"aria-hidden":"true",className:Mg[a]})})},ln=[{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"}],Og=e=>[...ln].reverse().find(t=>t.width<=e)??ln[0],_g=({shape:e,shapeBox:t,panelRect:n,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(j=>j.spec.styles.overrides),h=l.useSceneSelector(j=>(0,u.readStyleCoord)(j.spec)),p=At(),m=l.useStyleReaderTree().annotation.shape(e.id).resolve(),g=Og(m.strokeWidth),v=(0,f.useMemo)(()=>({target:"annotation",kind:"shape",annotation:e.id}),[e.id]),x=(j,P)=>{const A=(0,u.findStyleRule)(d,{select:v},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:v,declarations:{...A,...j}}}),P)},b=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},y=j=>x({fill:j},{transient:!0}),k=j=>x({fillAlpha:j},{transient:!0}),w=j=>()=>{x({strokeWidth:j}),p.close()};return(0,r.jsxs)(G.Root,{anchorBox:t,panelRect:n,frameWidth:a,frameHeight:o,label:s("graph.annotations.shapeToolbar.label"),testId:"shape-toolbar",children:[(0,r.jsx)(G.ColorPicker,{color:(0,u.toPaintColor)(m.fill),label:s("graph.annotations.shapeToolbar.color"),onChange:y,opacity:m.fillAlpha,onOpacityChange:k,...p.bind("color"),children:(0,r.jsx)(G.Swatch,{color:(0,u.toPaintColor)(m.fill),opacity:m.fillAlpha})}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.shapeToolbar.border.ariaLabel"),trigger:(0,r.jsx)(gi,{size:"sm",title:""}),...p.bind("border"),children:ln.map(j=>(0,r.jsx)(G.MenuItem,{selected:j.width===g?.width,onClick:w(j.width),children:s(j.key)},j.width))}),(0,r.jsx)(G.Separator,{}),(0,r.jsx)(G.IconButton,{label:s("graph.annotations.shapeToolbar.remove"),onClick:b,children:(0,r.jsx)(kt,{size:"sm",title:""})})]})},Pi=e=>{const t=l.useLatestRef(e),n=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>n.current?.finish(!1),[]),(0,f.useCallback)(a=>({onPointerDown:o=>{if(o.button!==0||n.current!==null)return;try{o.currentTarget.setPointerCapture(o.pointerId)}catch{return}o.currentTarget.focus({preventScroll:!0}),o.preventDefault();const i=t.current(a,{handle:o.currentTarget,pointerId:o.pointerId,press:{x:o.clientX,y:o.clientY},onSettled:()=>{n.current=null}});n.current=i,i.start()}}),[t])},ft=(e,t)=>{const n=e.shapes.find(a=>a.id===t);return n===void 0||n.region.anchorType!=="panel"?null:n.region},Ng=class extends He{constructor(...e){super(...e),this.kind="shape-resize-drag"}readOwn(e){return l.readResizedShapeFor(l.readStanding(e,"shape-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,corner:n,press:a,readInputs:o}=this.params,{annotations:i,panelRect:s,frameElement:c}=o(),d=ft(i,t);return d===null?null:{kind:"shape-resize-drag",annotationId:t,region:wi({region:d,corner:n,delta:Lt(a,e,s),minSize:Ci(s),bounds:he(s,c)})}}commit({region:e}){const{annotationId:t,dispatch:n,readInputs:a}=this.params,o=ft(a().annotations,t);o===null||ji(o,e)||n(new u.UpdateAnnotationCommand({kind:"shape",id:t,patch:{region:e}}))}},Dg=({annotationId:e,panelRect:t,frameElement:n})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useLatestRef({annotations:l.useSceneSelector(s=>s.spec.annotations),panelRect:t,frameElement:n});return Pi((s,c)=>new Ng({...c,annotationId:e,corner:s,readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch}))},Fg=[" ","Enter"],Ii=e=>{const t=l.useEditorStore(),n=l.useLatestRef(e);return(0,f.useEffect)(()=>()=>Zr(t,n.current),[t,n]),(0,f.useCallback)(a=>({onKeyDown:o=>{if(o.altKey||o.ctrlKey||o.metaKey||o.shiftKey)return;const i=t.getState(),s=n.current.readHeld();if(Fg.includes(o.key)){if(o.preventDefault(),o.repeat)return;if(s!==null){Zr(t,n.current);return}const d=n.current.claim(a);if(d===null)return;i.claimInteraction(d);return}if(s===null)return;const c=n.current.step(s,a,o.key);c!==null&&(o.preventDefault(),i.claimInteraction(c))}}),[t,n])},Zr=(e,t)=>{const n=t.readHeld();n!==null&&(e.getState().releaseInteraction(n.kind),t.commit(n))},Jr=4,Bg=({annotationId:e,panelRect:t,frameElement:n})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useSceneSelector(s=>s.spec.annotations);return Ii({readHeld:()=>l.readResizedShapeFor(l.readStanding(o.getState(),"shape-resize-drag"),e),claim:()=>{const s=ft(i,e);return s===null?null:{kind:"shape-resize-drag",annotationId:e,region:s}},step:(s,c,d)=>{const h=Gg(d,t);return h===null?null:{kind:"shape-resize-drag",annotationId:e,region:wi({region:s.region,corner:c,delta:h,minSize:Ci(t),bounds:he(t,n)})}},commit:({region:s})=>{const c=ft(i,e);c===null||ji(c,s)||a.dispatch(new u.UpdateAnnotationCommand({kind:"shape",id:e,patch:{region:s}}))}})},Gg=(e,t)=>{const n=re(Jr,t.width),a=re(Jr,t.height);switch(e){case"ArrowLeft":return{x:-n,y:0};case"ArrowRight":return{x:n,y:0};case"ArrowUp":return{x:0,y:-a};case"ArrowDown":return{x:0,y:a};default:return null}},zg={"top-left":"diagonalDown","bottom-right":"diagonalDown","top-right":"diagonalUp","bottom-left":"diagonalUp"},Hg=e=>{const t=Be(),n=$g(t),a=Wg(t);if(n===null)return null;const o=a.resizedRegion??(n.region.anchorType==="panel"?n.region:null);return o===null?null:(0,r.jsx)(Vg,{shape:n,region:o,settled:a.resizedRegion===null&&!a.moving,moving:a.moving,...e})},Vg=({shape:e,region:t,settled:n,moving:a,panelRect:o,frameRect:i,frameElement:s})=>{const c=l.useI18n(),d=Dg({annotationId:e.id,panelRect:o,frameElement:s}),h=Bg({annotationId:e.id,panelRect:o,frameElement:s}),p=l.useStyleReaderTree().annotation.shape(e.id).resolve(),{rect:m}=l.measureShapeRegion(Hn(t),p.strokeWidth,o);return(0,r.jsxs)("div",{"data-testid":"shape-selection","data-annotation-id":e.id,children:[n&&(0,r.jsx)(_g,{shape:e,shapeBox:m,panelRect:o,frameWidth:i.width,frameHeight:i.height,frameElement:s}),!a&&gg.map(g=>{const v=vg(m,g);return(0,r.jsx)(Li,{point:{x:o.x+v.x,y:o.y+v.y},label:c(`graph.annotations.shapeToolbar.resize.${g}`),pull:zg[g],size:"md",attributes:{"data-testid":"shape-resize-handle","data-corner":g},dragHandlers:d(g),keyboardHandlers:h(g)},g)})]})},$g=e=>{const t=l.useSceneSelector(n=>n.spec.annotations.shapes);return e===null?null:t.find(n=>n.id===e)??null},Wg=e=>l.useEditorState((0,ae.useShallow)(t=>e===null?{resizedRegion:null,moving:!1}:{resizedRegion:l.readResizedShapeFor(l.readStanding(t,"shape-resize-drag"),e)?.region??null,moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),Ug=({textColor:e,...t})=>(0,r.jsxs)(l.Icon,{...t,children:[(0,r.jsxs)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:[(0,r.jsx)("path",{d:"M6 4h12"}),(0,r.jsx)("path",{d:"M12 4v12"})]}),(0,r.jsx)("path",{d:"M5 20h14",stroke:e??"currentColor",strokeWidth:3,strokeLinecap:"round"})]});var Ei=[{id:"modern",key:"graph.annotations.textToolbar.font.modern"},{id:"fresh",key:"graph.annotations.textToolbar.font.fresh"},{id:"timeless",key:"graph.annotations.textToolbar.font.timeless"},{id:"technical",key:"graph.annotations.textToolbar.font.technical"},{id:"fineliner",key:"graph.annotations.textToolbar.font.fineliner"},{id:"handwritten",key:"graph.annotations.textToolbar.font.handwritten"}].map(({id:e,key:t})=>({id:e,key:t,fontFamily:l.RICH_TEXT_FONT_FAMILIES[e]??e})),qg=e=>Ei.find(t=>t.id===(e??"modern"))??null;var Mi=[{size:12,key:"graph.annotations.textToolbar.fontSize.small"},{size:15,key:"graph.annotations.textToolbar.fontSize.medium"},{size:18,key:"graph.annotations.textToolbar.fontSize.large"},{size:24,key:"graph.annotations.textToolbar.fontSize.extraLarge"},{size:30,key:"graph.annotations.textToolbar.fontSize.huge"}],Kg=e=>Mi.find(t=>t.size===(e??15))??null,Xg=e=>`${e}px`,Yg=[{alignment:"left",Icon:Qo},{alignment:"center",Icon:Zo},{alignment:"right",Icon:Jo}],Zg=({annotation:e,textBox:t,panelRect:n,frameWidth:a,frameHeight:o,frameElement:i})=>{const s=l.useI18n(),{commands:c}=l.useGraphContext(),d=l.useSceneSelector(S=>S.spec.styles.overrides),h=l.useSceneSelector(S=>(0,u.readStyleCoord)(S.spec)),p=l.useEditorStore(),m=At(),g=l.useStyleReaderTree().annotation.text(e.id).resolve(),v=Jh(e.content),x=qg(v.font),b=Kg(v.fontSize),y=v.color??g.textColor,k=(0,f.useMemo)(()=>({target:"annotation",kind:"text",annotation:e.id}),[e.id]),w=(S,M)=>{const N=(0,u.findStyleRule)(d,{select:k},h)?.declarations??{};c.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:k,declarations:{...N,...S}}}),M)},j=(S,M)=>{c.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e.id,patch:S}),M)},P=()=>p.getState().caret?.editor?.getJSON()??e.content,A=(S,M)=>{const N=P(),z=p.getState().caret?.editor??null;if(z!==null&&!ai(N)){z.chain().focus().setMark(gt,S).run();return}j({content:Qh(N,S)},M)},E=()=>{c.dispatch(new u.RemoveAnnotationCommand({id:e.id})),i.focus({preventScroll:!0})},O=S=>w(Jg(S),{transient:!0}),T=S=>A({color:S},{transient:!0}),R=S=>()=>{A({font:S}),m.close()},L=S=>()=>{A({fontSize:S}),m.close()},C=S=>j({content:e0(P(),S)});return(0,r.jsxs)(G.Root,{anchorBox:t,panelRect:n,frameWidth:a,frameHeight:o,label:s("graph.annotations.textToolbar.label"),testId:"text-toolbar",children:[(0,r.jsx)(G.ColorPicker,{color:(0,u.toPaintColor)(g.fill),label:s("graph.annotations.textToolbar.background"),hasTransparentOption:!0,onChange:O,...m.bind("background"),children:(0,r.jsx)(G.Swatch,{color:g.fill==="transparent"?wu:(0,u.toPaintColor)(g.fill)})}),(0,r.jsx)(G.ColorPicker,{color:y,label:s("graph.annotations.textToolbar.color"),onChange:T,...m.bind("color"),children:(0,r.jsx)(Ug,{size:"sm",textColor:y,title:""})}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.textToolbar.font.ariaLabel"),trigger:(0,r.jsx)("span",{style:{fontFamily:x?.fontFamily},children:"Aa"}),...m.bind("font"),children:Ei.map(S=>(0,r.jsx)(G.MenuItem,{selected:S.id===x?.id,onClick:R(S.id),children:(0,r.jsx)("span",{style:{fontFamily:S.fontFamily},children:s(S.key)})},S.id))}),(0,r.jsx)(G.Dropdown,{label:s("graph.annotations.textToolbar.fontSize.ariaLabel"),trigger:b===null?"":s(b.key),...m.bind("fontSize"),children:Mi.map(S=>(0,r.jsx)(G.MenuItem,{selected:S.size===b?.size,onClick:L(S.size),children:(0,r.jsx)("span",{style:{fontSize:Xg(S.size)},children:s(S.key)})},S.size))}),(0,r.jsx)(G.Separator,{}),(0,r.jsx)(Qg,{current:v.alignment??"center",onPick:C}),(0,r.jsx)(G.Separator,{}),(0,r.jsx)(G.IconButton,{label:s("graph.annotations.textToolbar.remove"),onClick:E,children:(0,r.jsx)(kt,{size:"sm",title:""})})]})},Jg=e=>e==="transparent"?{fill:Ma}:{fill:e,fillAlpha:Pu(e)?u.TEXT_ANNOTATION_FADE_ALPHA:1},Qg=({current:e,onPick:t})=>{const n=l.useI18n(),a=o=>()=>t(o);return(0,r.jsx)(r.Fragment,{children:Yg.map(o=>(0,r.jsx)(G.ToggleButton,{label:n(`graph.annotations.textToolbar.align.${o.alignment}`),pressed:o.alignment===e,onClick:a(o.alignment),children:(0,r.jsx)(o.Icon,{size:"sm",title:""})},o.alignment))})},e1=["left","right"];var Ri=({width:e})=>re(60,e),t1=(e,t)=>({x:t==="left"?e.x:e.x+e.width,y:e.y+e.height/2}),Oi=({at:e,width:t,align:n,edge:a,delta:o,minWidth:i,panelWidth:s,bounds:c})=>{if(o===0)return{at:e,width:t,shift:0};const d=(0,u.alignUnitFractions)(n).x,h=n1(e.offset,s),p=sn({start:e.x+h-d*t,extent:t,moveStartEdge:a==="left",delta:o,minExtent:i,...c===void 0?{}:{bounds:{min:c.minX,max:c.maxX}}}),m=p.start+d*p.extent-h;return{at:{...e,x:m},width:p.extent,shift:m-e.x}},_i=(e,t)=>e.at.x===t.at.x&&e.width===t.width,n1=(e,t)=>e?.x===void 0?0:e.unit==="px"?re(e.x,t):e.x,xt=(e,t)=>{const n=e.textAnnotations.find(a=>a.id===t);return n===void 0||n.at.anchorType!=="panel"?null:{at:n.at,width:n.width,align:n.align}},r1=class extends He{constructor(...e){super(...e),this.kind="text-resize-drag"}readOwn(e){return l.readResizedTextFor(l.readStanding(e,"text-resize-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,edge:n,press:a,readInputs:o}=this.params,{annotations:i,panelRect:s,frameElement:c}=o(),d=xt(i,t);if(d===null)return null;const h=Lt(a,e,s).x;return{kind:"text-resize-drag",annotationId:t,delta:h,...Oi({...d,edge:n,delta:h,minWidth:Ri(s),panelWidth:s.width,bounds:he(s,c)})}}commit(e){const{annotationId:t,dispatch:n,readInputs:a}=this.params,o=xt(a().annotations,t);o===null||_i(o,e)||n(new u.UpdateAnnotationCommand({kind:"text",id:t,patch:{at:e.at,width:e.width}}))}},a1=({annotationId:e,panelRect:t,frameElement:n})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useLatestRef({annotations:l.useSceneSelector(s=>s.spec.annotations),panelRect:t,frameElement:n});return Pi((s,c)=>new r1({...c,annotationId:e,edge:s,readInputs:()=>i.current,editorStore:o,dispatch:a.dispatch}))},o1=4,i1=({annotationId:e,panelRect:t,frameElement:n})=>{const{commands:a}=l.useGraphContext(),o=l.useEditorStore(),i=l.useSceneSelector(c=>c.spec.annotations),s=(c,d)=>{const h=xt(i,e);return h===null?null:{kind:"text-resize-drag",annotationId:e,delta:d,...Oi({...h,edge:c,delta:d,minWidth:Ri(t),panelWidth:t.width,bounds:he(t,n)})}};return Ii({readHeld:()=>l.readResizedTextFor(l.readStanding(o.getState(),"text-resize-drag"),e),claim:c=>s(c,0),step:(c,d,h)=>{const p=s1(h,t);return p===null?null:s(d,c.delta+p)},commit:c=>{const d=xt(i,e);d===null||_i(d,c)||a.dispatch(new u.UpdateAnnotationCommand({kind:"text",id:e,patch:{at:c.at,width:c.width}}))}})},s1=(e,t)=>{const n=re(o1,t.width);switch(e){case"ArrowLeft":return-n;case"ArrowRight":return n;default:return null}},l1=e=>{const t=Be(),n=d1(t),a=u1(t),o=l.useEditorState(s=>s.caret?.annotationId===t),i=h1(e.panelRect,t,a.resized);return n===null||i===null?null:(0,r.jsx)(c1,{annotation:n,textBox:i,settled:a.resized===null&&!a.moving,moving:a.moving,resizable:n.at.anchorType==="panel",hasCaret:o,...e})},c1=({annotation:e,textBox:t,settled:n,moving:a,resizable:o,hasCaret:i,panelRect:s,frameRect:c,frameElement:d})=>{const h=l.useI18n(),p=a1({annotationId:e.id,panelRect:s,frameElement:d}),m=i1({annotationId:e.id,panelRect:s,frameElement:d});return(0,r.jsxs)("div",{"data-testid":"text-selection","data-annotation-id":e.id,children:[n&&(0,r.jsx)(Zg,{annotation:e,textBox:t,panelRect:s,frameWidth:c.width,frameHeight:c.height,frameElement:d}),o&&!a&&!i&&e1.map(g=>{const v=t1(t,g);return(0,r.jsx)(Li,{point:{x:s.x+v.x,y:s.y+v.y},label:h(`graph.annotations.textToolbar.resize.${g}`),pull:"horizontal",size:"sm",attributes:{"data-testid":"text-resize-handle","data-edge":g},dragHandlers:p(g),keyboardHandlers:m(g)},g)})]})},d1=e=>{const t=l.useSceneSelector(n=>n.spec.annotations.textAnnotations);return e===null?null:t.find(n=>n.id===e)??null},u1=e=>l.useEditorState((0,ae.useShallow)(t=>e===null?{resized:null,moving:!1}:{resized:l.readResizedTextFor(l.readStanding(t,"text-resize-drag"),e),moving:l.readMovedAnnotationFor(l.readStanding(t,"move-drag"),e)!==null})),h1=(e,t,n)=>{const a=l.useResolvedAnnotations(e),o=l.useMeasuredBoxes(),i=l.useStyleReaderTree(),s=(0,f.useMemo)(()=>({panel:{width:e.width,height:e.height},measuredBoxes:o,readers:i}),[e.width,e.height,o,i]);return t===null?null:Ai(a,t,n,s)?.rect??null},Vn=(e,t)=>typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[],p1=(e,t,n)=>l.readStampedEditTargetInStack(Vn(e,t),n),m1="_1rpuha50";var Qr=["pointerdown","mousedown","pointerup","mouseup","click"],Ni=e=>e instanceof Element&&e.closest("[data-menu-shield]")!==null,g1=()=>{const e=l.useEditorState(c=>c.plotMenu!==null),t=l.useEditorState(c=>x1(c.standingInteraction?.kind)),n=l.useGraphSelection()[0]?.kind==="observations",a=l.MODE_RULES[l.useGraphMode()].showMenuTriggerOnHover,{store:o}=l.useHoverContext(),i=a&&!t&&(e||n),s=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!i)return;const c=o.getState();c.setHoverState(u.RESTING_HOVER_STATE),c.setTooltipAnchor(null)},[i,o]),(0,f.useEffect)(()=>{const c=s.current;if(c===null)return;const d=h=>{if(!(h instanceof MouseEvent)||h.button!==0)return;const p=v1(h.clientX,h.clientY);p!==null&&(h.stopPropagation(),p.dispatchEvent(f1(h)))};for(const h of Qr)c.addEventListener(h,d);return()=>{for(const h of Qr)c.removeEventListener(h,d)}},[i]),i?(0,r.jsx)("div",{ref:s,className:m1,"data-menu-shield":"","data-testid":"menu-shield"}):null},v1=(e,t)=>Vn(e,t).find(n=>!Ni(n))??null,f1=e=>new MouseEvent(e.type,{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,button:e.button,buttons:e.buttons}),x1=e=>e==="arrow-draw"||e==="box-draw",b1='button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',S1=(e,t)=>{const{chartId:n}=l.useGraphContext(),a=l.useEditorStore();(0,f.useEffect)(()=>{if(t===null)return;const o=i=>{if(i.key!=="Tab"||i.defaultPrevented||!we(i.target,e,n)||st(i.target)||a.getState().standingInteraction?.kind==="chrome-popup")return;const s=[...t.querySelectorAll(b1)];if(s.length===0)return;i.preventDefault();const c=s.findIndex(d=>d===document.activeElement);s[c===-1?i.shiftKey?s.length-1:0:(c+(i.shiftKey?-1:1)+s.length)%s.length]?.focus()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,t,n,a])},y1=e=>{const{selectionStore:t,chartId:n}=l.useGraphContext(),a=l.useEditorStore();(0,f.useEffect)(()=>{let o=null;const i=d=>{if(Te(d.target))return;const{caret:h}=a.getState(),p=h===null?null:p1(d.clientX,d.clientY,e);p?.kind==="annotation"&&p.target.id===h?.annotationId||e.focus({preventScroll:!0})},s=d=>{const{selection:h,clearSelection:p}=t.getState();h.length!==0&&(we(d.target,e,n)||p())},c=d=>{t.getState().selection.length!==0&&we(d.target,e,n)&&d.relatedTarget===null&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{o=null,document.hasFocus()&&(we(document.activeElement,e,n)||t.getState().clearSelection())}))};return e.addEventListener("pointerdown",i),document.addEventListener("focusin",s),document.addEventListener("focusout",c),()=>{o!==null&&cancelAnimationFrame(o),e.removeEventListener("pointerdown",i),document.removeEventListener("focusin",s),document.removeEventListener("focusout",c)}},[a,t,e,n])},C1=(e,t)=>{switch(e.kind){case"legend":{const n=t.legends[e.part.legendIndex],a=n?.items[e.part.itemIndex];if(n===void 0||a===void 0)return null;const o=w1(n,a.layerId,t.layers);return o===null?null:(0,u.buildObservationsTargetAtValue)({layer:o.layer,scope:"group",variable:o.variable,value:a.value,parsingLocale:t.parsingLocale})}case"axis":{const n=e.part;if(n===null||e.target.axis!=="x")return null;const a=t.formattedAxes.find(i=>i.scaledAesthetic==="x");if(a===void 0||a.bandwidth===void 0)return null;const o=a.ticks[n.tickIndex];return o===void 0?null:k1(t.layers,o.value,t.parsingLocale)}case"annotation":case"grid":return null}},w1=(e,t,n)=>{const a=t===void 0?n:n.filter(o=>o.id===t);for(const o of e.aesthetics){const i=j1(a,o);if(i!==null)return i}return null},j1=(e,t)=>{for(const n of e){const a=(0,u.readVariableName)(n.mapping[t]);if(a!==null&&T1(n,a))return{layer:n,variable:a}}return null},T1=(e,t)=>e.data.hasVariable(t)&&e.data.getType(t)==="categorical",k1=(e,t,n)=>{let a=null;for(const o of e){if(!o.interactive)continue;const i=(0,u.readScopeXVariable)(o.mapping);if(i===null)continue;const s=(0,u.buildObservationsTargetAtValue)({layer:o,scope:"xValue",variable:i,value:t,parsingLocale:n});if(s!==null){if(a!==null)return null;a=s}}return a},A1=({hover:e,layers:t,scales:n,parsingLocale:a})=>{const{primary:o,intersection:i}=e;if(o===null)return null;const s=(0,u.findLayerById)(t,o.layerId);if(s===void 0)return null;const c=(0,u.readObservationIndex)(o),d=i?.intersects!==!1,h=(0,u.readBroadestObservationsScope)(s),p=d||!(0,u.hasMainAxisBand)(n)?[h]:["xValue",h];for(const m of p){const g=(0,u.buildObservationsTarget)({layer:s,observationIndex:c,scope:m,parsingLocale:a});if(g!==null)return{layerId:s.id,observationIndex:c,onObservation:d,target:g}}return null},L1=(e,t,n)=>{if(!e.onObservation||e.target.scope!=="group")return null;const a=(0,u.findLayerById)(t,e.layerId);return a===void 0?null:(0,u.buildObservationsTarget)({layer:a,observationIndex:e.observationIndex,scope:"observation",parsingLocale:n})},cn=(e,t)=>{const{target:n}=e,{frameElement:a,captureRect:o,resolvesObservations:i,scene:s}=t;if(!(n instanceof Element&&a.contains(n))){const x=ea(!1,!1,e,t);return{targetAtPoint:l.resolveEditTargetAtPoint({stamped:x.stamped,observations:null}),hover:null,elements:x.elements}}const c=o!==null&&n===o,d=c&&i?P1(o):null,h=d===null?null:I1(e,d,t),p=h===null?null:A1({hover:h,layers:s.layers,scales:s.scales,parsingLocale:s.config.parsingLocale}),m=p!==null&&t.hasOverlayMenu(p.target)?p:null,g=ea(c,m!==null,e,t),v=l.resolveEditTargetAtPoint({stamped:g.stamped,observations:m});return{targetAtPoint:v,hover:v?.kind==="observations"?h:null,elements:g.elements}},P1=e=>{const t=e.getBoundingClientRect();return t.width>0&&t.height>0?t:null},ea=(e,t,n,{showAnnotations:a,selectGuidesOnPress:o,frameElement:i,scene:s,hasOverlayMenu:c})=>{if(!a&&s.coordSystem.type==="cartesian"&&e&&t)return{stamped:null,elements:[]};const d=e||a?Vn(n.clientX,n.clientY):n.target instanceof Element?[n.target]:[],h=l.readStampedEditTargetInStack(d,i);return h===null?{stamped:null,elements:d}:{stamped:(h.kind==="annotation"?a:o&&c(h.target))?h:null,elements:d}},I1=(e,t,n)=>{const a=(0,u.toPanelCursor)({x:e.clientX-t.left,y:e.clientY-t.top},t);return n.engine.query(a,{tolerance:n.tolerance,viewport:t,includeAttached:!0})},E1=class extends He{constructor(...e){super(...e),this.kind="move-drag"}readOwn(e){return l.readMovedAnnotationFor(l.readStanding(e,"move-drag"),this.params.annotationId)}resolvePreview(e){const{annotationId:t,press:n,readInputs:a}=this.params,{annotations:o,panelRect:i,frameElement:s}=a(),c=(0,u.findAnnotation)(o,t);if(c===null)return null;const d=he(i,s),h=(0,u.clampAnnotationTranslation)(c,Lt(n,e,i),d);return h===null?null:{kind:"move-drag",annotationId:t,translation:h}}commit({translation:e}){const{annotationId:t,dispatch:n,readInputs:a}=this.params,{panelRect:o,frameElement:i}=a();Em(e)&&n(new u.MoveAnnotationCommand({id:t,translation:e,bounds:he(o,i)}))}},M1=({client:e,capture:t,engine:n,layers:a,parsingLocale:o,hasMenu:i})=>{if(t===null||t.width===0||t.height===0||e.x<t.left||e.x>t.right||e.y<t.top||e.y>t.bottom)return null;const s={x:e.x-t.left,y:e.y-t.top},{primary:c,intersection:d}=n.query((0,u.toPanelCursor)(s,t),{tolerance:l.ANNOTATE_ON_THE_MARK,viewport:{width:t.width,height:t.height}});if(c===null||d?.intersects!==!0)return null;const h=a.find(g=>g.id===c.layerId);if(h===void 0||Fe(h,c.observation)||!R1(h.spatialKind))return null;const p=(0,u.readObservationIndex)(c),m=(0,u.buildObservationsTarget)({layer:h,observationIndex:p,scope:"observation",parsingLocale:o});return m===null||!i(m)?null:{target:m,observationIndex:p}},R1=e=>{switch(e){case"noop":return!1;case"points":return!0;case"buckets":case"filledBuckets":case"spannedBuckets":case"rects":case"cells":case"renderHitTest":return!0;default:return e}},ta="data-annotation-id",O1='[data-testid="pinnedNumber"], [data-testid="comment"], [data-testid="stickers"]',na=(e,t,n)=>{if(e.target instanceof Element){const a=ra(e.target,t);if(a!==null)return a}for(const a of n){if(a===e.target)continue;const o=ra(a,t);if(o!==null)return o}return null},_1=(e,t)=>{const n=e.annotations.pinnedNumbers.find(i=>i.id===t)??e.annotations.comments.find(i=>i.id===t);if(n!==void 0)return aa(e,n.at.anchor.layerId,n.at.observationIndex);const a=e.annotations.stickers.find(i=>i.id===t),o=e.spec.annotations.stickers.find(i=>i.id===t);return a?.at.observationIndex===void 0||o?.at.anchorType!=="observation"?null:aa(e,D1(a.at)??o.at.layerId,a.at.observationIndex)},N1=(e,t)=>{const n=e.spec.annotations.stickers.find(a=>a.id===t);return n?.at.anchorType!=="panel"?null:{x:n.at.x,y:n.at.y,stickerId:n.id}},ra=(e,t)=>{if(!t.contains(e))return null;const n=e.closest(O1);if(n===null||!t.contains(n))return null;const a=e.closest(`[${ta}]`);if(a===null||!n.contains(a))return null;const o=a.getAttribute(ta);return o===null||o.length===0?null:o},D1=e=>{if(!("anchor"in e))return;const t=e.anchor;if(!(typeof t!="object"||t===null||!("layerId"in t)))return typeof t.layerId=="string"?t.layerId:void 0},aa=(e,t,n)=>{const a=t===void 0?void 0:e.layers.find(o=>o.id===t);return a===void 0?null:(0,u.buildObservationsTarget)({layer:a,observationIndex:n,scope:"observation",parsingLocale:e.config.parsingLocale})},F1={on:{edge:0,stroke:6,point:8},near:{main:0,cross:0}},B1=({client:e,capture:t,frame:n,engine:a,layers:o})=>{if(t===null||t.width===0||t.height===0||n===null||!ia(n,e))return null;const i={x:e.x-t.left,y:e.y-t.top};if(ia(t,e)){const{primary:c,intersection:d}=a.query((0,u.toPanelCursor)(i,t),{tolerance:F1,viewport:{width:t.width,height:t.height}}),h=c===null?void 0:o.find(m=>m.id===c.layerId),p=c!==null&&h!==void 0&&Fe(h,c.observation);if(c!==null&&d?.intersects!==!1&&!p)return null}const s=vi({x:t.left-n.left,y:t.top-n.top,width:t.width,height:t.height},n);return{x:oa(i.x/t.width,s.minX,s.maxX),y:oa(i.y/t.height,s.minY,s.maxY)}},oa=(e,t,n)=>Math.min(Math.max(e,t),n),ia=(e,t)=>t.x>=e.left&&t.x<=e.right&&t.y>=e.top&&t.y<=e.bottom,G1=(e,{canSelectGraph:t,withinFrame:n,caretAnnotationId:a})=>{switch(e?.kind){case"annotation":return e.target.id===a?{kind:"keep-caret"}:{kind:"select-annotation",target:e.target};case"axis":case"legend":case"grid":return{kind:"select-guide",target:e.target};case"observations":return z1(e.observations);case void 0:break}return t&&n?{kind:"select-graph",target:{kind:"graph"}}:{kind:"clear"}},z1=({target:e,observationIndex:t,onObservation:n})=>e.scope==="xValue"?{kind:"select-band",target:e}:{kind:"select-observations",target:e,observationIndex:n?t:null},H1=`[${l.CHART_LABEL_ATTRIBUTE}], [${l.EDIT_TARGET_KIND_ATTRIBUTE}="axis"], [${l.EDIT_TARGET_KIND_ATTRIBUTE}="legend"]`,V1=(e,t,n,a)=>{const{commands:o,history:i,selectionStore:s,store:c}=l.useGraphContext(),d=l.useEditorStore(),h=l.useSceneSelector(w=>w.spec.annotations),p=l.useGraphMode(),{selectGraphOnPress:m}=l.MODE_RULES[p],g=l.useLatestRef(m),v=l.useLatestRef(p===l.GRAPH_MODES.annotate),x=l.useLatestRef(p===l.GRAPH_MODES.annotate),b=l.useLatestRef({annotations:h,panelRect:t,frameElement:e}),y=l.useLatestRef(a),k=(0,f.useRef)(null);(0,f.useEffect)(()=>()=>k.current?.finish(!1),[]),(0,f.useEffect)(()=>s.subscribe(({selection:w})=>{const j=d.getState().pressedObservation,[P,...A]=w,E=P!==void 0&&A.length===0&&j!==null&&(0,u.areEditTargetsEqual)(P,j.selectedFor);j!==null&&!E&&d.getState().setPressedObservation(null)}),[d,s]),(0,f.useEffect)(()=>{const w=T=>cn({target:T.target,clientX:T.clientX,clientY:T.clientY},n()).targetAtPoint,j=T=>{if(!(T.target instanceof Element))return!1;const R=T.target.closest(l.LEGEND_OVERFLOW_CONTROL_SELECTOR);return R!==null&&e.contains(R)&&l.readStampedEditTargetInStack([T.target],e)===null},P=(T,R)=>{if(k.current!==null||!l.canMoveAnnotationOnCanvas(b.current.annotations,R.id))return;try{e.setPointerCapture(T.pointerId)}catch{return}T.preventDefault();const L=new E1({handle:e,pointerId:T.pointerId,annotationId:R.id,press:{x:T.clientX,y:T.clientY},readInputs:()=>b.current,editorStore:d,dispatch:o.dispatch,onSettled:()=>{k.current=null}});k.current=L,L.start()},A=(T,R)=>{const L=s.getState(),{layers:C,config:S,coordSystem:M}=c.getState().scene,N=R.kind==="select-observations"&&R.observationIndex!==null?l.readPressedObservation(R.observationIndex,C,R.target,S.parsingLocale):null;if(d.getState().setPressedObservation(N),v.current&&(R.kind==="select-observations"||R.kind==="select-band")){const z=(0,u.findLayerById)(C,R.target.layerId);if(z!==void 0&&Hp(z.geom,M.type)){const H=e.getBoundingClientRect(),X=Rn(e,H.width);d.getState().setAnnotatePress({key:(0,u.readEditTargetKey)(R.target),x:(T.clientX-H.left)/X,y:(T.clientY-H.top)/X})}else d.getState().setAnnotatePress(null)}switch(R.kind){case"select-annotation":L.setSelection([R.target]),P(T,R.target);return;case"select-observations":case"select-band":case"select-guide":case"select-graph":L.setSelection([R.target]);return;case"clear":L.clearSelection();return;default:throw new u.InternalError({message:`No press outcome for: ${JSON.stringify(R)}`})}},E=T=>{if(T.button!==0)return;if(Ni(T.target)){d.getState().setPlotMenu(null),s.getState().clearSelection();return}if(Ut(T.target))return;const R=d.getState().caret?.annotationId??null,L=T.target instanceof Element?T.target.closest("[data-edit-id]")?.getAttribute("data-edit-id")??null:null;!Te(T.target)&&L!==R&&Dn(d,c.getState().scene.annotations,o.dispatch,Nn(i));const C=d.getState().standingInteraction,S=F=>{d.getState().releaseInteraction(F),d.getState().setPlotMenu(null),s.getState().clearSelection()},M=he(b.current.panelRect,b.current.frameElement),N=F=>{const $=e.getBoundingClientRect();return F.x<$.left||F.x>$.right||F.y<$.top||F.y>$.bottom};if(C?.kind==="arrow-draw"){const F=n(),$=F.captureRect?.getBoundingClientRect()??null,W={x:T.clientX,y:T.clientY};if(N(W)){S("arrow-draw");return}const te=l.readArrowEnd({client:W,capture:$,bounds:M,engine:F.engine,layers:F.scene.layers,start:C.start});if(te===null)return;o.dispatch(new u.AddAnnotationCommand({kind:"arrow",annotation:{...u.ARROW_DEFAULTS,...l.arrowHeads(C.heads),start:{anchorType:"panel",x:C.start.x,y:C.start.y},end:te}})),d.getState().releaseInteraction("arrow-draw"),d.getState().setPlotMenu(null);return}if(C?.kind==="box-draw"){const F=n().captureRect?.getBoundingClientRect()??null,$={x:T.clientX,y:T.clientY};if(N($)){S("box-draw");return}const W=l.readDrawnPanelPoint($,F,M);if(W===null||F===null||l.isTinySpan(C.start,W,F))return;o.dispatch(new u.AddAnnotationCommand({kind:"shape",annotation:{...u.SHAPE_DEFAULTS,region:l.panelBox(C.start,W)}})),d.getState().releaseInteraction("box-draw"),d.getState().setPlotMenu(null);return}if(d.getState().setPlotMenu(null),j(T)||l.isOnLiveGeomMark(T.target,e))return;const z=n(),H=cn({target:T.target,clientX:T.clientX,clientY:T.clientY},z);if(x.current){const F=na(T,e,H.elements),$=F===null?null:_1(c.getState().scene,F);if($?.observationIndex!==void 0){d.getState().setCaret(null),A(T,{kind:"select-observations",target:$,observationIndex:$.observationIndex});return}const W=F===null?null:N1(c.getState().scene,F);if(W!==null){d.getState().setCaret(null),s.getState().clearSelection(),d.getState().setPlotMenu(W);return}}const X=T.target instanceof Node&&e.contains(T.target),Q=G1(H.targetAtPoint,{canSelectGraph:g.current&&!Te(T.target)&&n().hasOverlayMenu({kind:"graph"}),withinFrame:X,caretAnnotationId:d.getState().caret?.annotationId??null});if(Q.kind==="keep-caret")return;const Y=Q.kind==="select-annotation"&&c.getState().scene.spec.annotations.differenceArrows.some(F=>F.id===Q.target.id);if((Q.kind==="clear"||Y)&&v.current){const F=n();if(T.target===F.captureRect){const $=M1({client:{x:T.clientX,y:T.clientY},capture:F.captureRect?.getBoundingClientRect()??null,engine:F.engine,layers:F.scene.layers,parsingLocale:F.scene.config.parsingLocale,hasMenu:F.hasOverlayMenu});if($!==null){d.getState().setCaret(null),A(T,{kind:"select-observations",target:$.target,observationIndex:$.observationIndex});return}}}const oe=z.scene.coordSystem.type==="polar"&&Q.kind==="select-observations";if(X&&(Q.kind==="clear"||oe)&&x.current&&na(T,e,H.elements)===null&&!$1(T.target,H.elements)){const F=B1({client:{x:T.clientX,y:T.clientY},capture:z.captureRect?.getBoundingClientRect()??null,frame:e.getBoundingClientRect(),engine:z.engine,layers:z.scene.layers});if(F!==null){d.getState().setCaret(null),A(T,{kind:"clear"}),d.getState().setPlotMenu(F);return}}d.getState().setCaret(null),A(T,Q)},O=T=>{if(Ut(T.target)||j(T)||l.isOnLiveGeomMark(T.target,e))return;const R=w(T),{layers:L,guides:C,config:S}=c.getState().scene,{hasOverlayMenu:M}=n(),N=s.getState(),z=d.getState();switch(R?.kind){case"observations":{const{observations:H}=R,X=L1(H,L,S.parsingLocale);if(X===null||!M(X))return;const{observationIndex:Q}=H;z.setPressedObservation({observationIndex:Q,predicate:X.predicate,selectedFor:X}),N.setSelection([X]);return}case"axis":case"legend":{const H=C1(R,{layers:L,legends:C.legends.drawn,formattedAxes:y.current,parsingLocale:S.parsingLocale});if(H===null||!M(H))return;N.setSelection([H]);return}case"annotation":{const{target:H}=R;if(!b.current.annotations.textAnnotations.some(X=>X.id===H.id))return;N.setSelection([H]),z.setCaret(H.id);return}case"grid":case void 0:return}};return document.addEventListener("pointerdown",E),document.addEventListener("dblclick",O),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("dblclick",O)}},[e,d,s,c,o,i,b,y,g,v,x,n])},$1=(e,t)=>Te(e)||sa(e)||t.some(sa),sa=e=>e instanceof Element&&e.closest(H1)!==null,W1=e=>{const{store:t}=l.useGraphContext(),{engine:n,overlayRef:a}=l.useHoverContext(),{showAnnotations:o,selectObservationsOnPress:i,selectGuidesOnPress:s,hoverTolerance:c}=l.MODE_RULES[l.useGraphMode()],d=l.useIsIntroWaitingForView(),h=ke(),p=i&&!d;return(0,f.useCallback)(()=>({frameElement:e,captureRect:a.current,selectGuidesOnPress:s,showAnnotations:o,resolvesObservations:p,engine:n,tolerance:c??void 0,scene:t.getState().scene,hasOverlayMenu:h}),[h,e,a,s,o,p,n,c,t])},U1={kind:"idle"},q1=()=>{const e=l.useEditorState(n=>n.standingInteraction),t=Y0();return(0,f.useMemo)(()=>e!==null?e:t===null?U1:{kind:"trigger",anchor:t,isOpen:!0},[e,t])},K1=(e,t)=>e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height,X1=(e,t,n)=>{const{selectionStore:a}=l.useGraphContext(),{store:o,engine:i}=l.useHoverContext(),s=l.useLatestRef(e),c=l.useLatestRef(t),d=l.useLatestRef(n);(0,f.useEffect)(()=>{const h=v=>{if(a.getState().selection.length>0)return;const x=d.current,b=c.current,y={x:v.clientX-b.x,y:v.clientY-b.y},k=K1(y,x)?i.query((0,u.toPanelCursor)(y,x)):u.RESTING_HOVER_STATE;o.getState().setHoverState(k)};let p=!1;const m=()=>{const v=s.current;p=v.kind==="trigger"&&v.isOpen},g=v=>{Ut(v.target)||p&&a.getState().selection.length===0&&h(v)};return document.addEventListener("pointerdown",m,!0),document.addEventListener("click",g),()=>{document.removeEventListener("pointerdown",m,!0),document.removeEventListener("click",g)}},[a,s,o,i,c,d])},Y1=(e,t)=>{const n=l.useEditorStore(),{store:a}=l.useGraphContext(),{store:o}=l.useHoverContext(),{selectObservationsOnPress:i}=l.MODE_RULES[l.useGraphMode()];(0,f.useEffect)(()=>(o.getState().setEditorOwnsQuery(i),()=>o.getState().setEditorOwnsQuery(!1)),[o,i]),(0,f.useEffect)(()=>{let s=null,c=null,d=!1;const h=w=>{if(!i)return;const j=o.getState();j.suspendsHover||w===null&&j.hover.primary===null||j.setHoverState(w??u.RESTING_HOVER_STATE)},p=()=>{if(s=null,c===null)return;const w=n.getState();if(nt(w.standingInteraction))return;if(d&&(d=!1,c={...c,target:Z1(c)}),l.isOnLiveGeomMark(c.target,e)){w.setEditTargetUnderPointer(null);return}const{targetAtPoint:j,hover:P}=cn(c,t());w.setEditTargetUnderPointer(j),h(P)},m=()=>{s===null&&(s=requestAnimationFrame(p))},g=()=>{c!==null&&(d=!0,m())},v=()=>{n.getState().setEditTargetUnderPointer(null),h(null)},x=w=>{c={target:w.target,clientX:w.clientX,clientY:w.clientY},d=!1,m()},b=()=>{c=null,s!==null&&(cancelAnimationFrame(s),s=null),v()},y=n.subscribe((w,j)=>{nt(j.standingInteraction)&&!nt(w.standingInteraction)&&g()}),k=a.subscribe((w,j)=>{w.scene!==j.scene&&(nt(n.getState().standingInteraction)||g())});return e.addEventListener("pointermove",x),e.addEventListener("pointerleave",b),()=>{s!==null&&cancelAnimationFrame(s),y(),k(),e.removeEventListener("pointermove",x),e.removeEventListener("pointerleave",b),v()}},[e,n,a,o,i,t])},Z1=e=>typeof document.elementFromPoint=="function"?document.elementFromPoint(e.clientX,e.clientY):e.target,nt=e=>{if(e===null)return!1;switch(e.kind){case"move-drag":case"shape-resize-drag":case"difference-arrow-endpoint-drag":case"arrow-endpoint-drag":case"text-resize-drag":return!0;case"arrow-draw":case"box-draw":case"chrome-popup":return!1}},J1=(e,t,n,a,o)=>{const i=q1(),{store:s}=l.useHoverContext(),c=l.useGraphSelection().length>0,{freezeHoverWhileSelected:d}=l.MODE_RULES[l.useGraphMode()],h=W1(e);Y1(e,h),V1(e,n,h,o),X1(i,t,n),y1(e),d0(e),S1(e,a);const p=c&&d;(0,f.useEffect)(()=>(s.getState().setSuspendsHover(p),()=>s.getState().setSuspendsHover(!1)),[s,p]),(0,f.useEffect)(()=>{if(!c||!d)return;const m=s.getState();m.setHoverState(u.RESTING_HOVER_STATE),m.setTooltipAnchor(null)},[s,c,d])},Q1=({frameElement:e,panelRect:t,formattedAxes:n,animateTransitions:a})=>{const{measureRef:o,screenRect:i}=l.useElementScreenRect(),{selectionStore:s,commands:c,store:d,history:h}=l.useGraphContext(),p=l.useEditorStore(),m=(0,f.useRef)(()=>{});(0,f.useEffect)(()=>{m.current=()=>{Dn(p,d.getState().scene.annotations,c.dispatch,Nn(h))}},[c,p,h,d]);const g=i?.width??0,v=i?.height??0,x=(0,f.useRef)({width:g,height:v});(0,f.useEffect)(()=>{const w=x.current;x.current={width:g,height:v},!(w.width===g&&w.height===v)&&p.getState().setAnnotatePress(null)},[g,v,p]);const b=l.useEditorState(w=>w.caret?.annotationId??null),y=l.useGraphMode(),k=(0,f.useRef)(y);return(0,f.useEffect)(()=>(o(e),()=>o(null)),[o,e]),(0,f.useEffect)(()=>()=>{m.current();const w=p.getState();w.setCaret(null),w.setPressedObservation(null),w.setPlotMenu(null),s.getState().clearSelection()},[p,s]),(0,f.useEffect)(()=>{if(k.current===y)return;k.current=y,m.current();const w=p.getState();w.setCaret(null),w.setEditTargetUnderPointer(null),w.setPlotMenu(null),s.getState().clearSelection()},[y,p,s]),i===null?null:(0,r.jsxs)(Ns,{children:[b!==null&&(0,r.jsx)(ev,{annotationId:b,panelRect:t}),(0,r.jsx)(tv,{frameElement:e,frameRect:i,panelRect:t,formattedAxes:n,animateTransitions:a})]})},ev=({annotationId:e,panelRect:t})=>{const n=l.useEditorStore(),{textAnnotations:a}=l.useResolvedAnnotations(t);return(0,f.useEffect)(()=>{a.some(({id:o})=>o===e)||n.getState().setCaret(null)},[e,a,n]),null},tv=({frameElement:e,frameRect:t,panelRect:n,formattedAxes:a,animateTransitions:o})=>{const i=(0,f.useMemo)(()=>({x:t.left+n.x,y:t.top+n.y}),[t.left,t.top,n.x,n.y]),[s,c]=(0,f.useState)(null);return J1(e,i,n,s,a),(0,r.jsx)(nv,{frameElement:e,frameRect:t,panelOrigin:i,panelRect:n,boxRef:c,animateTransitions:o})},nv=({frameElement:e,frameRect:t,panelOrigin:n,panelRect:a,boxRef:o,animateTransitions:i})=>{const s=Ct(),{showAnnotations:c}=l.MODE_RULES[l.useGraphMode()];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(xp,{frameElement:e,frameSize:(0,f.useMemo)(()=>({width:t.width,height:t.height}),[t.width,t.height]),panelRect:a,animateTransitions:i}),(0,r.jsx)(nm,{frameRect:t}),(0,r.jsx)(Hh,{rect:t,zIndex:l.Z_INDEX.editorOverlay,container:s,"data-testid":"editor-overlay",boxRef:o,children:(0,r.jsxs)(l.PortalThemeProvider,{children:[c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ug,{panelRect:a,panelOrigin:n,frameRect:t,frameElement:e}),(0,r.jsx)(Hg,{panelRect:a,frameRect:t,frameElement:e}),(0,r.jsx)(Fm,{panelRect:a,frameRect:t,frameElement:e}),(0,r.jsx)(l1,{panelRect:a,frameRect:t,frameElement:e}),(0,r.jsx)(yg,{panelRect:a}),(0,r.jsx)(Pg,{frameElement:e,panelRect:a}),(0,r.jsx)(Ig,{panelRect:a}),(0,r.jsx)(om,{panelRect:a}),(0,r.jsx)(Sg,{panelRect:a})]}),(0,r.jsx)(em,{frameElement:e}),c&&(0,r.jsx)(I0,{frameElement:e,panelRect:a}),(0,r.jsx)(g1,{})]})})]})},rv={},av=({slots:e,mode:t,palettePresets:n=rv,editMenus:a,...o})=>{const i=l.useChartI18nProps(l.useFormattingLocale()),s=(0,f.useMemo)(()=>({EditorSurface:Q1,...e}),[e]);return(0,r.jsx)(Pn,{...i,children:(0,r.jsx)(Jd,{editMenus:a,children:(0,r.jsx)(l.EditorProvider,{children:(0,r.jsx)(Oc,{value:n,children:(0,r.jsx)(l.InlineEditorsProvider,{editors:Gh,children:(0,r.jsx)(l.GraphRendererBody,{slots:s,mode:t,...o})})})})})})},ov="_12lhx9e0",Di=({children:e})=>(0,r.jsx)("div",{className:ov,children:e}),iv="_139ohwv0",Z=({children:e})=>(0,r.jsx)("div",{className:iv,children:e}),Fi=(0,f.createContext)(null),sv=Fi.Provider,Bi=()=>{const e=(0,f.useContext)(Fi);if(!e)throw new Error("A section must be rendered inside <EditorPanel.Root>.");return e},lv="_1jlczkt0",Gi="data-graphy-editor-panel",cv={List:Z,Grid:Di};function dv(e){if(e===void 0)return!1;const t=e.split(/\s+/);return t.includes("_1ii3bsb0")||t.includes("_1ii3bsb1")}var uv=()=>()=>{},hv=e=>{const t=(0,f.useSyncExternalStore)(e?.subscribe??uv,()=>e?.getScene()?.config.parsingLocale);return e?.formattingLocale??t},pv=e=>{const t=(0,f.useContext)(l.GraphContext),n=l.useChartI18nProps(hv(l.useGraphHandle(e.handle))),a=l.useHasThemeContext();let o=(0,r.jsx)(mv,{...e});return!a&&t&&(o=(0,r.jsx)(l.ThemeProvider,{colorScheme:t.colorScheme,children:o})),(0,r.jsx)(Pn,{...n,children:o})},$n={Root:pv,Controls:cv},mv=({handle:e,children:t,controls:n,defaultExpandedSection:a=void 0,className:o})=>{const i=l.useGraphHandle(e),{themeClass:s,inlineVarsStyle:c}=l.useThemeContext(),[d,h]=(0,f.useState)(()=>a?[a]:[]),p=(0,f.useMemo)(()=>({expandSection:m=>h([m]),collapseAllSections:()=>h([])}),[]);return(0,r.jsx)(wt.Provider,{value:i,children:(0,r.jsx)(Xa,{controls:n,children:(0,r.jsx)(sv,{value:p,children:(0,r.jsx)(Re.Accordion.Root,{[Gi]:"",className:(0,le.default)(lv,o,{[s]:!dv(o)}),style:c,value:d,onValueChange:m=>h(m),children:t})})})})},gv="_2m7wuq0",vv=()=>(0,r.jsx)(ps.Separator,{className:gv}),fv=e=>(0,r.jsx)(l.Icon,{...e,children:(0,r.jsx)("g",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"m9 6 6 6-6 6"})})}),Wn="_40zvwv0",Un="_40zvwv1",xv="_40zvwv2",zi="_40zvwv3",bv="_40zvwv4 _40zvwv3";var Sv="_40zvwv6";var yv="_40zvwv8",U=({title:e,layout:t="fixed",preview:n,accessory:a,onOpenChange:o,children:i})=>t==="collapsible"?(0,r.jsx)(wv,{title:e,preview:n,accessory:a,onOpenChange:o,children:i}):t==="inline"&&n===void 0?(0,r.jsx)(Cv,{title:e,accessory:a,children:i}):(0,r.jsxs)("div",{className:Wn,children:[(0,r.jsxs)("div",{className:Un,children:[(0,r.jsx)("span",{className:zi,children:e}),n!==void 0&&(0,r.jsx)("span",{className:"_40zvwv5",children:n}),a!==void 0&&(0,r.jsx)("span",{className:"_40zvwv7",children:a})]}),(0,r.jsx)("div",{children:i})]}),Cv=({title:e,accessory:t,children:n})=>{const a=(0,f.useId)(),o=(0,f.useId)();return(0,r.jsx)("div",{className:Wn,children:(0,r.jsxs)("div",{className:Un,children:[(0,r.jsx)("label",{id:a,htmlFor:o,className:bv,children:e}),(0,r.jsx)("span",{className:Sv,children:(0,r.jsx)(ka,{labelId:a,controlId:o,children:n})}),t!==void 0&&(0,r.jsx)("span",{className:"_40zvwv7",children:t})]})})},wv=({title:e,preview:t,accessory:n,onOpenChange:a,children:o})=>{const i=l.useI18n();return(0,r.jsxs)(Re.Accordion.Item,{value:e,className:Wn,onOpenChange:a,children:[(0,r.jsxs)(Re.Accordion.Header,{className:Un,render:(0,r.jsx)("div",{}),children:[(0,r.jsx)(Re.Accordion.Trigger,{className:xv,"aria-label":i("editor.accessibility.toggleSection",{title:e})}),(0,r.jsx)("span",{className:zi,children:e}),t!==void 0&&(0,r.jsx)("span",{className:"_40zvwv5",children:t}),n!==void 0&&(0,r.jsx)("span",{className:"_40zvwv7",children:n}),(0,r.jsx)("span",{className:yv,children:(0,r.jsx)(fv,{size:"sm"})})]}),(0,r.jsx)(Re.Accordion.Panel,{children:(0,r.jsx)("div",{children:o})})]})},Hi=({title:e,checked:t,onToggle:n,disabled:a,preview:o,children:i})=>{const{expandSection:s,collapseAllSections:c}=Bi(),{Switch:d}=D(),h=m=>{n(m),m?s(e):c()},p=m=>{m&&!t&&a!==!0&&n(!0)};return(0,r.jsx)(U,{title:e,layout:"collapsible",preview:o,onOpenChange:p,accessory:(0,r.jsx)(d,{checked:t,onChange:h,disabled:a,ariaLabel:e}),children:i})},jv={horizontal:["bottom","top"],vertical:["left","right"]},Tv={left:"editor.axesPanel.position.left",right:"editor.axesPanel.position.right",top:"editor.axesPanel.position.top",bottom:"editor.axesPanel.position.bottom"},kv={x:"editor.axesPanel.mainAxisSection.xAxis",y:"editor.axesPanel.mainAxisSection.yAxis"},dn=({axis:e,title:t,layout:n="collapsible",preview:a})=>{const o=V(),i=l.useHandleScene(o),s=l.useI18n(),{NumberField:c,Switch:d,TextField:h,ToggleGroup:p}=D();if(!i)return null;const m=i.coordSystem.type==="polar"?i.coordSystem.axisMapping[e].geometry:"linear",g=i.config.axes[e],v=i.scales[e],x=v?.spec,b=x?.scaleType==="continuous"?x:void 0;if(m==="circular"||m==="radial"&&b===void 0)return null;const y=x?.scaleType==="continuous"||x?.scaleType==="datetime",k=b!==void 0&&(0,u.isZeroAnchoredAxis)(i,e),w=b?.transform==="log",j=b?.domainMax??null,P=Av(b),A=(_,ie)=>_.map($e=>({value:$e,label:ie($e)})),E=i.guides.axes.find(_=>_.scaledAesthetic===e),O=E?.position,T=i.guides.axes.filter(_=>_.scaledAesthetic===e||e==="y"&&_.scaledAesthetic==="ySecondary"),R=T.some(_=>_.visible),L=T.some(_=>_.visible||_.showGrid),C=g.label??E?.label??"",S=jv[O==="bottom"||O==="top"||O===void 0&&e==="x"?"horizontal":"vertical"],M=e==="y"?(0,u.readComboLineLayerId)(i.spec):null,N=M===null?void 0:(0,u.findLayerById)(i.spec.layers,M),z=i.guides.legends.drawn.some(_=>S.some(ie=>ie===_.position)),H=S.map(_=>({value:_,label:s(Tv[_])})),X=A(["auto","edges"],_=>s(_==="edges"?"editor.axesPanel.labelMode.edges":"editor.axesPanel.labelMode.auto")),Q=A(["linear","log"],_=>s(_==="log"?"editor.axesPanel.scale.log":"editor.axesPanel.scale.auto")),Y=A(["auto","zero","custom"],_=>s(_==="zero"?"editor.axesPanel.startFrom.zero":_==="custom"?"editor.axesPanel.startFrom.custom":"editor.axesPanel.startFrom.auto")),oe=A(["auto","custom"],_=>s(_==="custom"?"editor.axesPanel.endAt.custom":"editor.axesPanel.endAt.auto")),F=A(["single","double"],_=>s(_==="double"?"editor.axesPanel.axisCount.double":"editor.axesPanel.axisCount.single")),$=_=>{o.commands.dispatch(new u.SetAxisVisibilityCommand({axis:e,visible:_}))},W=_=>{o.commands.dispatch(new u.SetAxisLabelCommand({axis:e,label:_}),{transient:!0})},te=_=>{o.commands.dispatch(new u.SetAxisTicksVisibilityCommand({axis:e,visible:_}))},Mt=_=>{o.commands.dispatch(new u.SetAxisTickModeCommand({axis:e,tickMode:_==="edges"?"edges":"auto"}))},be=_=>{o.commands.dispatch(new u.SetScaleTransformCommand({scaledAesthetic:e,transform:_==="log"?"log":"linear"}))},Ae=_=>{o.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,..._}),{transient:!0})},B=_=>{_!==null&&Ae({domainMin:_})},ee=_=>{_!==null&&Ae({domainMax:_})},ge=_=>{const ie=_==="auto"?null:_==="zero"?0:la(v?.domain,"start");o.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMin:ie}))},Qi=_=>{const ie=_==="custom"?la(v?.domain,"end"):null;o.commands.dispatch(new u.SetScaleDomainCommand({scaledAesthetic:e,domainMax:ie}))},es=_=>{N!==void 0&&o.commands.dispatch(new u.SetLayerYScaleTypeCommand({layerId:N.id,yScaleType:_==="double"?"secondary":"primary"}))},ts=_=>{const ie=S.find($e=>$e===_);ie&&o.commands.dispatch(new u.SetAxisPositionCommand({axis:e,position:ie}))};return(0,r.jsx)(U,{title:t??s(kv[e]),layout:n,preview:a,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:s("editor.axesPanel.controls.visible"),children:(0,r.jsx)(d,{checked:g.visible,onChange:$})}),N!==void 0&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.numberOfAxes"),children:(0,r.jsx)(p,{value:N.yScaleType==="secondary"?"double":"single",options:F,onChange:es})}),m==="linear"&&(0,r.jsxs)(r.Fragment,{children:[E?.visible&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.title"),children:(0,r.jsx)(h,{value:C,placeholder:s("editor.axesPanel.controls.titlePlaceholder"),onChange:W,onCommit:o.commands.commit})}),R&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.ticks"),children:(0,r.jsx)(d,{checked:g.ticks.visible,onChange:te})})]}),y&&L&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.labels"),children:(0,r.jsx)(p,{value:g.ticks.mode,options:X,onChange:Mt})}),b&&m==="linear"&&E?.visible&&!z&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.position"),children:(0,r.jsx)(p,{value:O??g.position,options:H,onChange:ts})}),b&&!k&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.scale"),children:(0,r.jsx)(p,{value:w?"log":"linear",options:Q,onChange:be})}),b&&!w&&(0,r.jsxs)(r.Fragment,{children:[!k&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I,{label:s("editor.axesPanel.controls.startFrom"),children:(0,r.jsx)(p,{value:P,options:Y,onChange:ge})}),P!=="auto"&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.value"),children:(0,r.jsx)(c,{value:b.domainMin??null,onChange:B,onCommit:o.commands.commit})})]}),(0,r.jsx)(I,{label:s("editor.axesPanel.controls.endAt"),children:(0,r.jsx)(p,{value:j===null?"auto":"custom",options:oe,onChange:Qi})}),j!==null&&(0,r.jsx)(I,{label:s("editor.axesPanel.controls.value"),children:(0,r.jsx)(c,{value:j,onChange:ee,onCommit:o.commands.commit})})]})]})})},Av=e=>{const t=e?.domainMin??null;return t===null?"auto":t===0?"zero":"custom"},la=(e,t)=>{const n=t==="start"?e?.[0]:e?.[e.length-1];return typeof n=="number"?n:0},qn=({value:e,onChange:t})=>{const n=V(),a=l.useI18n(),{TextField:o}=D(),i=e!==null&&typeof e!="string",s=c=>t(c===""?null:c);return(0,r.jsx)(I,{label:a("editor.elementsPanel.contentValue"),children:(0,r.jsx)(o,{value:typeof e=="string"?e:"",onChange:s,onCommit:n.commands.commit,disabled:i})})},Vi=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=p=>{a.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"caption",visible:p}))},h=p=>{a.commands.dispatch(new u.SetContentCaptionCommand({caption:p}),{transient:!0})};return(0,r.jsx)(U,{title:e??i("editor.elementsPanel.footerSection.caption"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.elementsPanel.contentVisible"),children:(0,r.jsx)(s,{checked:c.showCaption,onChange:d})}),(0,r.jsx)(qn,{value:c.caption,onChange:h})]})})},ca=/^[a-z][a-z\d+.-]*:/i,Lv={},$i=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=h=>{a.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"source",visible:h}))};return(0,r.jsx)(U,{title:e??i("editor.elementsPanel.sourceSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.elementsPanel.contentVisible"),children:(0,r.jsx)(s,{checked:c.showSource,onChange:d})}),(0,r.jsx)(Pv,{source:c.source??Lv})]})})},Pv=({source:e})=>{const t=V(),n=l.useI18n(),{TextField:a}=D(),o=d=>{const h=(d.label??"")!==""||(d.url??"")!=="";t.commands.dispatch(new u.SetContentSourceCommand({source:h?d:null}),{transient:!0})},i=()=>{const d=e.url??"";d!==""&&!ca.test(d)&&o({...e,url:`https://${d}`}),t.commands.commit()},s=d=>o({...e,url:d}),c=d=>o({...e,label:d});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I,{label:n("editor.elementsPanel.sourceSection.url"),children:(0,r.jsx)(a,{value:e.url??"",onChange:s,onCommit:i,hasError:ca.test(e.url??"")&&!(0,u.isSafeUrl)(e.url)})}),(0,r.jsx)(I,{label:n("editor.elementsPanel.sourceSection.name"),children:(0,r.jsx)(a,{value:e.label??"",onChange:c,onCommit:t.commands.commit})})]})},Wi=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=p=>{a.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"subtitle",visible:p}))},h=p=>{a.commands.dispatch(new u.SetContentSubtitleCommand({subtitle:p}),{transient:!0})};return(0,r.jsx)(U,{title:e??i("editor.elementsPanel.headerSection.subtitle"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.elementsPanel.contentVisible"),children:(0,r.jsx)(s,{checked:c.showSubtitle,onChange:d})}),(0,r.jsx)(qn,{value:c.subtitle,onChange:h})]})})},Ve=e=>{const{colorScheme:t}=l.useThemeContext(),n=(0,f.useMemo)(()=>(0,u.createStyleResolver)({colorScheme:t}),[t]);return(0,f.useMemo)(()=>e===null?null:n.readers(e),[e,n])},Kn=(e,t,n)=>{const a=Ve(e);return(0,f.useMemo)(()=>{if(a===null||e===null||t===null)return null;const o=(0,u.findLayerById)(e.layers,t);return o===void 0?null:a.geom[n](o)},[a,e,t,n])},un=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4],Iv=un.length/2,Ev={select:{target:"graph"}},Ui=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{RadioGrid:s}=D(),c=Ve(o);if(!o||!c)return null;const d=c.graph().get("textScale"),h=g=>i("editor.elementsPanel.textSizeSection.scaleFormat",{value:`${g}`}),p=un.map(g=>({value:`${g}`,label:h(g)})),m=g=>{const v=un.find(b=>`${b}`===g);if(v===void 0)return;const x=(0,u.findStyleRule)(o.spec.styles.overrides,Ev,(0,u.readStyleCoord)(o.spec))?.declarations??{};a.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...x,textScale:v}}}))};return(0,r.jsx)(U,{title:e??i("editor.elementsPanel.textSizeSection.title"),layout:t,preview:n??h(d),children:(0,r.jsx)(s,{value:`${d}`,options:p,columns:Iv,onChange:m,ariaLabel:i("editor.elementsPanel.textSizeSection.title")})})},qi=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s}=D();if(!o)return null;const c=o.config.content,d=p=>{a.commands.dispatch(new u.ToggleContentVisibilityCommand({part:"title",visible:p}))},h=p=>{a.commands.dispatch(new u.SetContentTitleCommand({title:p}),{transient:!0})};return(0,r.jsx)(U,{title:e??i("editor.elementsPanel.headerSection.toggleTitle"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.elementsPanel.contentVisible"),children:(0,r.jsx)(s,{checked:c.showTitle,onChange:d})}),(0,r.jsx)(qn,{value:c.title,onChange:h})]})})},Mv=({children:e,...t})=>(0,r.jsx)($n.Root,{...t,children:e??(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(qi,{}),(0,r.jsx)(Wi,{}),(0,r.jsx)(Vi,{}),(0,r.jsx)($i,{}),(0,r.jsx)(Ui,{})]})}),Rv=({children:e,...t})=>(0,r.jsx)($n.Root,{...t,children:e??(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(dn,{axis:"x"}),(0,r.jsx)(dn,{axis:"y"})]})}),Pt=e=>`${e}px`,Ki=e=>`${Math.round(e*100)}%`,Ov=e=>`${e}°`,_v=24,Nv={select:{target:"graph"}},da=["dim","desaturate"],Dv=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,ToggleGroup:c}=D(),d=Ve(o);if(!o||!d)return null;const h=d.graph().get("cornerRadius"),p=(0,u.readHighlightDimStyle)(o.spec),m=da.map(x=>({value:x,label:i(x==="dim"?"editor.highlighting.highlightStyle.tint":"editor.highlighting.highlightStyle.gray")})),g=x=>{const b=(0,u.findStyleRule)(o.spec.styles.overrides,Nv,(0,u.readStyleCoord)(o.spec))?.declarations??{};a.commands.dispatch(new u.SetStyleRuleCommand({list:"overrides",rule:{select:{target:"graph"},declarations:{...b,cornerRadius:x}}}),{transient:!0})},v=x=>{const b=da.find(y=>y===x);b&&a.commands.dispatch(new u.SetHighlightDimStyleCommand({dimStyle:b}))};return(0,r.jsx)(U,{title:e??i("editor.colorPanel.appearanceSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.colorPanel.borderSection.cornerRadius"),children:(0,r.jsx)(s,{value:h,min:0,max:_v,step:1,formatValue:Pt,onChange:g,onCommit:a.commands.commit})}),(0,r.jsx)(I,{label:i("editor.colorPanel.appearanceSection.highlightStyle"),children:(0,r.jsx)(c,{value:p,options:m,onChange:v})})]})})},Fv={none:0,md:3.5,full:6.5},Bv=({cornerRadius:e,...t})=>(0,r.jsx)(l.Icon,{viewBox:"0 0 18 18",...t,children:(0,r.jsx)("rect",{x:2.5,y:2.5,width:13,height:13,rx:Fv[e],stroke:"currentColor",strokeWidth:1.5})}),Gv=.05,ua=["none","md","full"],Xi={base:["baseStart","baseEnd"],tip:["tipStart","tipEnd"]},zv=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,ToggleGroup:c}=D(),d=o?(0,u.findLayerByGeom)(o.spec.layers,"bar"):void 0,h=Kn(o,d?.id??null,"bar");if(!o||!d||o.coordSystem.type==="polar"&&o.coordSystem.bandAxis===null)return null;const p=b=>{a.commands.dispatch(new u.SetBarWidthCommand({layerId:d.id,width:b}),{transient:!0})},m=h?.get("cornerRadius")??u.DEFAULT_BAR_CORNER_RADII,g=(b,y)=>{const k=ua.find(P=>P===y);if(!k)return;const[w,j]=Xi[b];a.commands.dispatch(new u.SetBarCornerRadiusCommand({layerId:d.id,corners:{...m,[w]:k,[j]:k}}))},v=ua.map(b=>({value:b,label:i(`editor.graphPanel.barSection.radiusOptions.${b}`),icon:(0,r.jsx)(Bv,{cornerRadius:b})})),x=(0,u.resolveBarBandFraction)(d.params,o.coordSystem.type);return(0,r.jsx)(U,{title:e??i("editor.graphPanel.barSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.graphPanel.barSection.thickness"),children:(0,r.jsx)(s,{value:x,min:u.MIN_BAR_WIDTH_FRACTION,max:u.MAX_BAR_WIDTH_FRACTION,step:Gv,formatValue:Ki,onChange:p,onCommit:a.commands.commit})}),(0,r.jsx)(I,{label:i("editor.graphPanel.barSection.tipRadius"),children:(0,r.jsx)(c,{value:ha(m,"tip"),options:v,onChange:b=>g("tip",b)})}),(0,r.jsx)(I,{label:i("editor.graphPanel.barSection.baseRadius"),children:(0,r.jsx)(c,{value:ha(m,"base"),options:v,onChange:b=>g("base",b)})})]})})},ha=(e,t)=>{const[n,a]=Xi[t],o=e[n];return typeof o!="string"||o!==e[a]?"":o==="none"||o==="full"?o:"md"},It=({children:e})=>{const t=(0,f.useId)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("g",{filter:`url(#${t})`,children:e}),(0,r.jsx)("defs",{children:(0,r.jsxs)("filter",{id:t,x:"-20%",y:"-20%",width:"140%",height:"140%",children:[(0,r.jsx)("feDropShadow",{dx:"0",dy:"0",stdDeviation:"0.586",floodColor:"#0F0F18",floodOpacity:"0.12"}),(0,r.jsx)("feDropShadow",{dx:"0",dy:"1.172",stdDeviation:"0.586",floodColor:"#0E0E34",floodOpacity:"0.16"})]})})]})},Et="qdaoth0",Hv=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 31 33",...e,children:[(0,r.jsx)(It,{children:(0,r.jsx)("path",{className:Et,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,r.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"})]}),Vv=e=>(0,r.jsx)(l.Icon,{viewBox:"0 0 32 32",...e,children:(0,r.jsxs)(It,{children:[(0,r.jsx)("path",{className:Et,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,r.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"})]})}),$v=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,r.jsx)(It,{children:(0,r.jsx)("path",{className:Et,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,r.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"})]}),Wv=e=>(0,r.jsxs)(l.Icon,{viewBox:"0 0 32 33",...e,children:[(0,r.jsx)(It,{children:(0,r.jsx)("path",{className:Et,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,r.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"})]}),Uv={x:.5,y:.5},qv=.2,Kv={x:.375,y:.25,width:.25,height:.5},Xv={zOrder:"background"},Yv={x:.4,y:.6},Zv={x:.6,y:.4},Jv="relativeDifference",Qv=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Button:s}=D();if(!o)return null;const c=()=>{a.commands.dispatch(new u.AddAnnotationCommand({kind:"text",annotation:{...u.TEXT_ANNOTATION_DEFAULTS,content:ef(i("editor.annotatePanel.callOutSection.text")),at:{anchorType:"panel",...Uv},width:qv}}))},d=()=>{a.commands.dispatch(new u.AddAnnotationCommand({kind:"arrow",annotation:{...u.ARROW_DEFAULTS,start:{anchorType:"panel",...Yv},end:{anchorType:"panel",...Zv}}}))},h=()=>{a.commands.dispatch(new u.AddAnnotationCommand({kind:"shape",annotation:{...u.SHAPE_DEFAULTS,...Xv,region:{anchorType:"panel",...Kv}}}))},p=()=>{const g=(0,u.inferDefaultDifferenceArrowEndpoints)(o);g!==null&&a.commands.dispatch(new u.AddAnnotationCommand({kind:"differenceArrow",annotation:{...u.DIFFERENCE_ARROW_DEFAULTS,...g,label:Jv}}))},m=o.coordSystem.type==="cartesian";return(0,r.jsx)(U,{title:e??i("editor.annotatePanel.callOutSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Di,{children:[(0,r.jsx)(s,{variant:"tile",icon:(0,r.jsx)(Wv,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.text"),onClick:c}),(0,r.jsx)(s,{variant:"tile",icon:(0,r.jsx)(Hv,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.arrow"),onClick:d}),(0,r.jsx)(s,{variant:"tile",icon:(0,r.jsx)(Vv,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.box"),onClick:h}),m&&(0,r.jsx)(s,{variant:"tile",icon:(0,r.jsx)($v,{size:"xl"}),label:i("editor.annotatePanel.callOutSection.difference"),onClick:p})]})})},ef=e=>({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e}]}]}),tf=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{ToggleGroup:s}=D();if(!o)return null;const c=(0,u.readGraphType)(o.spec);if(c===null||!(0,u.isComboGraphType)(c))return null;const d=u.COMBO_TYPES.map(p=>({value:p,label:i(`editor.graphPanel.comboSection.types.${p}`)})),h=p=>{const m=u.COMBO_TYPES.find(g=>g===p);m&&a.commands.dispatch(new u.SetGraphTypeCommand({coordType:"cartesian",comboType:m}))};return(0,r.jsx)(U,{title:e??i("editor.graphPanel.comboSection.title"),layout:t,preview:n??i(`editor.graphPanel.comboSection.types.${c.comboType}`),children:(0,r.jsx)(s,{value:c.comboType,options:d,onChange:h,ariaLabel:i("editor.graphPanel.comboSection.title")})})},nf=.1,rf=20,af=({title:e,preview:t})=>{const n=V(),a=l.useHandleScene(n),o=l.useI18n(),{NumberField:i,TextField:s}=D();if(!a||a.coordSystem.type==="polar")return null;const c=(0,u.findGoalLineLayer)(a.spec.layers),d=e??o("editor.annotationsPanel.goalSection.title"),h=(0,u.readConstantValue)(c?.mapping.y),p=typeof h=="number"?h:null,m=x=>{const b=new u.ToggleGoalLineCommand({showGoalLine:x,value:of(a),...c!==void 0&&{layerId:c.id}});n.commands.dispatch(b)},g=x=>{if(c===void 0)return;const b=new u.SetRuleLabelCommand({layerId:c.id,label:x===""?null:x});n.commands.dispatch(b,{transient:!0})},v=x=>{if(c===void 0||x===null)return;const b=new u.SetRuleValueCommand({layerId:c.id,value:x});n.commands.dispatch(b,{transient:!0})};return(0,r.jsx)(Hi,{title:d,preview:t,checked:c!==void 0,onToggle:m,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:o("editor.annotationsPanel.goalSection.labelControl"),children:(0,r.jsx)(s,{value:c?.params.label??"",placeholder:o("editor.annotationsPanel.goalSection.labelPlaceholder"),onChange:g,onCommit:n.commands.commit,ariaLabel:o("editor.annotationsPanel.goalSection.labelAriaLabel")})}),(0,r.jsx)(I,{label:o("editor.annotationsPanel.goalSection.valueControl"),children:(0,r.jsx)(i,{value:p,placeholder:o("editor.powerUpPanel.valueInput.numberPlaceholder"),onChange:v,onCommit:n.commands.commit,ariaLabel:o("editor.annotationsPanel.goalSection.valueAriaLabel")})})]})})},of=e=>{const t=(e.scales.y?.domain??[]).filter(s=>typeof s=="number");if(t.length===0)return 0;const n=Math.max(...t),a=n-Math.min(...t),o=a>0?a:Math.abs(n);if(o===0)return 0;const i=Math.min(rf,Math.max(0,1-Math.floor(Math.log10(o))));return Number((n+o*nf).toFixed(i))},sf=({layerId:e,title:t,layout:n="collapsible",preview:a})=>{const o=V(),i=l.useHandleScene(o),s=l.useI18n(),{Switch:c}=D();if(!i)return null;const d=e===void 0?i.layers[0]:(0,u.findLayerById)(i.layers,e);if(!d)return null;const{showDataLabels:h,format:p,showStackTotals:m,showCategoryLabels:g}=d.dataLabels,v=Ja(d,i.coordSystem.type,{hasCapability:o.canPlaceDataLabels,hasPercentageFormat:o.canFormatDataLabelsAsPercentages});if(!v.supportsDataLabels)return null;const x=w=>{const j=new u.ToggleDataLabelsCommand({layerId:d.id,showDataLabels:w});o.commands.dispatch(j)},b=w=>{const j=new u.SetDataLabelsFormatCommand({layerId:d.id,format:w?"percentage":"absolute"});o.commands.dispatch(j)},y=w=>{const j=new u.ToggleStackTotalsCommand({layerId:d.id,showStackTotals:w});o.commands.dispatch(j)},k=w=>{const j=new u.ToggleCategoryLabelsCommand({layerId:d.id,showCategoryLabels:w});o.commands.dispatch(j)};return(0,r.jsx)(U,{title:t??s("editor.graphPanel.graphOptionsSection.title"),layout:n,preview:a,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:s("editor.graphPanel.graphOptions.dataLabels"),children:(0,r.jsx)(c,{checked:h,onChange:x})}),v.supportsPercentages&&(0,r.jsx)(I,{label:s("editor.graphPanel.graphOptions.showPercentages"),children:(0,r.jsx)(c,{checked:p==="percentage",onChange:b})}),v.supportsStackTotals&&(0,r.jsx)(I,{label:s("editor.graphPanel.graphOptions.stackTotals"),children:(0,r.jsx)(c,{checked:m,onChange:y})}),v.supportsCategoryLabels&&(0,r.jsx)(I,{label:s("editor.graphPanel.graphOptions.categoryLabels"),children:(0,r.jsx)(c,{checked:g,onChange:k})})]})})},lf=3,cf=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{RadioGrid:s}=D(),c=(0,f.useMemo)(()=>_e.map(({name:m,icon:g,summary:v})=>({value:m,label:i(`editor.graphTypes.${m}`),icon:(0,r.jsx)(g,{size:"md"}),disabled:!to(v,o?.spec)})),[i,o]);if(!o)return null;const d=(0,u.readGraphType)(o.spec),h=lt(d),p=m=>{const g=_e.find(v=>v.name===m);g&&a.commands.dispatch(new u.SetGraphTypeCommand(no(g.summary,d)))};return(0,r.jsx)(U,{title:e??i("editor.graphPanel.graphTypeSection.title"),layout:t,preview:n??(h===null?void 0:i(`editor.graphTypes.${h.name}`)),children:(0,r.jsx)(s,{value:h?.name??"",options:c,columns:lf,onChange:p,ariaLabel:i("editor.graphPanel.graphTypeSection.title")})})},df=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s,Switch:c,ToggleGroup:d}=D(),h=Ve(o),p=o!==null&&h!==null?go(o,h):null;if(p===null)return null;const m=p.axes.filter(k=>k.supportsGrid);if(m.length===0)return null;const g=p.axes.some(k=>k.showGrid),v=ut.map(k=>({value:k,label:i(`editor.graphPanel.gridSection.lineStyles.${k}`)})),x=k=>w=>{a.commands.dispatch(new u.SetGridVisibilityCommand({axis:k,visible:w}))},b=k=>{const w=ut.find(j=>j===k);w!==void 0&&a.commands.dispatch(vo(w))},y=k=>{a.commands.dispatch(fo(k),{transient:!0})};return(0,r.jsx)(U,{title:e??i("editor.graphPanel.gridSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[m.map(k=>(0,r.jsx)(I,{label:i(uf(k)),children:(0,r.jsx)(c,{checked:k.showGrid,onChange:x(k.scaledAesthetic)})},k.scaledAesthetic)),p.stylable&&g&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I,{label:i("editor.graphPanel.gridSection.gridStyle"),children:(0,r.jsx)(d,{value:p.lineStyle,options:v,onChange:b})}),(0,r.jsx)(I,{label:i("editor.graphPanel.gridSection.gridThickness"),children:(0,r.jsx)(s,{value:p.strokeWidth,min:0,max:8,step:.5,formatValue:Pt,onChange:y,onCommit:a.commands.commit})})]})]})})},uf=e=>e.geometry==="radial"?"editor.graphPanel.gridSection.rings":e.geometry==="circular"?"editor.graphPanel.gridSection.spokes":e.scaledAesthetic==="x"?"editor.graphPanel.gridSection.verticalGridLines":"editor.graphPanel.gridSection.horizontalGridLines",hf="total",Yi=["total","average","current"],pf=["total"],pa=["previous","first"],ma=["auto","small","medium","large"],mf=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Switch:s,ToggleGroup:c}=D();if(!o)return null;const d=o.config.headline,h=d.show!=="none",p=o.coordSystem,m=p.type==="polar",g=p.type==="polar"&&p.innerRadius>0,v=o.layers.some(L=>L.summary.grandTotal!==void 0);if(m&&!v)return null;const x=m?pf:Yi,b=o.guides.headline,y=b?.kind==="perGroup"&&b.items.some(L=>L.comparison!==null),k=x.map(L=>({value:L,label:i(`editor.graphPanel.headlineNumberSection.metrics.${L}`)})),w=pa.map(L=>({value:L,label:i(`editor.graphPanel.headlineNumberSection.comparison.${L}`)})),j=ma.map(L=>({value:L,label:i(L==="auto"?"editor.graphPanel.numberFormat.options.auto":`editor.graphPanel.headlineNumberSize.sizes.${L}`)})),P=[{value:"above",label:i("editor.graphPanel.headlineNumberSection.position.above")},{value:"center",label:i("editor.graphPanel.headlineNumberSection.position.center")}],A=L=>{a.commands.dispatch(new u.SetHeadlineShowCommand({show:L?hf:"none"}))},E=L=>{const C=x.find(S=>S===L);C&&a.commands.dispatch(new u.SetHeadlineShowCommand({show:C}))},O=L=>{const C=pa.find(S=>S===L);C&&a.commands.dispatch(new u.SetHeadlineCompareWithCommand({compareWith:C}))},T=L=>{const C=ma.find(S=>S===L);C&&a.commands.dispatch(new u.SetHeadlineSizeCommand({size:C}))},R=L=>{a.commands.dispatch(new u.SetHeadlinePositionCommand({position:L==="center"?"center":"above"}))};return(0,r.jsx)(U,{title:e??i("editor.graphPanel.headlineNumberSection.title"),layout:t,preview:n??gf(i,d.show),children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.graphPanel.headlineNumberSection.toggle"),children:(0,r.jsx)(s,{checked:h,onChange:A})}),h&&(0,r.jsxs)(r.Fragment,{children:[k.length>1&&(0,r.jsx)(I,{label:i("editor.graphPanel.headlineNumberSection.metricLabel"),layout:"stack",children:(0,r.jsx)(c,{value:d.show,options:k,onChange:E})}),y&&(0,r.jsx)(I,{label:i("editor.graphPanel.headlineNumberSection.compareWithLabel"),layout:"stack",children:(0,r.jsx)(c,{value:(0,u.resolveComparisonBasis)(d.compareWith),options:w,onChange:O})}),(0,r.jsx)(I,{label:i("editor.graphPanel.headlineNumberSize.sizeLabel"),children:(0,r.jsx)(c,{value:d.size,options:j,onChange:T})}),g&&(0,r.jsx)(I,{label:i("editor.axesPanel.controls.position"),children:(0,r.jsx)(c,{value:d.position,options:P,onChange:R})})]})]})})},gf=(e,t)=>{const n=Yi.find(a=>a===t);return n&&e(`editor.graphPanel.headlineNumberSection.metrics.${n}`)};var $t=["top","bottom","left","right","none"],ga=["auto","start","center","end"],vf={row:{start:"left",end:"right"},column:{start:"top",end:"bottom"}},va=["auto","pill","direct"],ff=({positions:e,title:t,layout:n="collapsible",preview:a})=>{const o=V(),i=l.useHandleScene(o),s=l.useI18n(),{ToggleGroup:c}=D(),d=l.useTextDirection();if(!i)return null;const h=i.config.legend.position,p=e??$t,m=i.guides.legends.drawn[0],g=(0,u.canAnchorDirectLabels)({legendPosition:i.guides.legends.position,coordSystem:i.coordSystem,layers:i.layers}),v=i.guides.headline?.kind==="perGroup",x=i.guides.colorGroups.length>0;if(h==="auto"&&m===void 0&&!g&&(v||!x))return null;const b=m?.position??"none",y=h==="auto"?b:h,k=$t.filter(M=>M===y||p.includes(M)).map(M=>({value:M,label:s(`editor.graphPanel.legendSection.${M}`)})),w=M=>{const N=$t.find(z=>z===M);N&&o.commands.dispatch(new u.SetLegendPositionCommand({position:N}))},j=M=>{const N=ga.find(z=>z===M);N&&o.commands.dispatch(new u.SetLegendAlignCommand({align:N}))},P=M=>{const N=va.find(z=>z===M);N&&o.commands.dispatch(new u.SetLegendDisplayCommand({display:N}))},A=m?.position==="left"||m?.position==="right"?"column":"row",E=A==="row"?"ltr":d,O=M=>s(M==="start"||M==="end"?`editor.graphPanel.legendSection.${vf[A][M]}`:`editor.graphPanel.legendSection.align.${M}`),T=ga.map(M=>({value:M,label:O(M)})),R=va.map(M=>({value:M,label:s(`editor.graphPanel.legendSection.display.${M}`)})),L=t??s("editor.graphPanel.legendSection.title"),C=k.find(M=>M.value===y)?.label,S=m!==void 0;return(0,r.jsx)(U,{title:L,layout:n,preview:a??C,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:s("editor.axesPanel.controls.position"),layout:"stack",children:(0,r.jsx)(c,{value:y,options:k,onChange:w})}),S&&(0,r.jsx)(I,{label:s("editor.graphPanel.legendSection.alignLabel"),layout:"stack",children:(0,r.jsx)(gn.DirectionProvider,{direction:E,children:(0,r.jsx)("div",{dir:E,className:"_1v6dqrh0",children:(0,r.jsx)(c,{value:i.config.legend.align,options:T,onChange:j})})})}),g&&(0,r.jsx)(I,{label:s("editor.graphPanel.legendSection.displayLabel"),layout:"stack",children:(0,r.jsx)(c,{value:i.config.legend.display,options:R,onChange:P})})]})})},xf=1,bf=20,Sf=.5,Zi=({layerId:e})=>{const t=V(),n=l.useHandleScene(t),{Slider:a}=D(),o=Kn(n,e,"point");if(!n)return null;const i=(0,u.findLayerById)(n.layers,e)?.data?.findFirst(d=>(o?.get("size",d)??0)>0)??void 0,s=o?.get("size",i)??u.DEFAULT_POINT_SIZE_PX,c=d=>{const h=new u.SetPointSizeCommand({layerId:e,size:d});t.commands.dispatch(h,{transient:!0})};return(0,r.jsx)(a,{value:s,min:xf,max:bf,step:Sf,formatValue:Pt,onChange:c,onCommit:t.commands.commit})},Ji=({layerId:e})=>{const t=V(),n=l.useHandleScene(t),a=Kn(n,e,"point");return n?(0,r.jsx)(yn,{symbol:a?.get("symbol")??"circle",coordType:n.coordSystem.type,onChange:o=>{t.commands.dispatch(new u.SetPointSymbolCommand({layerId:e,symbol:o}))}}):null},yf=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Select:s,Slider:c,Switch:d,ToggleGroup:h}=D(),p=Ve(o),m=(0,u.findLayerByGeom)(o?.spec.layers??[],"line","area"),g=o&&p&&m?Sn(o,p,m.id):null;if(!o||!g)return null;const v=g.missingValueOptions.map(A=>({value:A,label:Qa(i,A)})),x=[{value:"auto",label:i("editor.graphPanel.numberFormat.options.auto"),disabled:g.hasUnderlyingStrokeWidth},{value:"custom",label:i("editor.graphPanel.numberFormat.options.custom")}],b=A=>{a.commands.dispatch(new u.ToggleLinePointsCommand({layerId:g.layerId,showPoints:A}))},y=A=>{a.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,showFill:A,drawnFillAlpha:g.drawnFillAlpha}))},k=A=>{a.commands.dispatch(new u.SetLineCurveCommand({layerId:g.layerId,curve:A?"smooth":"linear"}))},w=A=>{a.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:A==="custom"?g.strokeWidth:null}))},j=A=>{a.commands.dispatch(new u.SetLineStyleCommand({layerId:g.layerId,strokeWidth:A}),{transient:!0})},P=A=>{const E=Kt.find(O=>O===A);E&&a.commands.dispatch(new u.SetLineMissingValuesCommand({layerId:g.layerId,missingValues:E}))};return(0,r.jsx)(U,{title:e??i("editor.fineTunePanel.lineStyleSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.graphPanel.graphOptions.showPoints"),children:(0,r.jsx)(d,{checked:g.showPoints,onChange:b})}),g.pointLayerId&&(0,r.jsx)(I,{label:i("editor.graphPanel.pointSize.label"),children:(0,r.jsx)(Zi,{layerId:g.pointLayerId})}),g.showPoints&&g.pointLayerId!==null&&(0,r.jsx)(Ji,{layerId:g.pointLayerId}),g.showFill!==null&&(0,r.jsx)(I,{label:i("editor.graphPanel.graphOptions.lineFill"),children:(0,r.jsx)(d,{checked:g.showFill,onChange:y})}),g.smooth!==null&&(0,r.jsx)(I,{label:i("editor.graphPanel.graphOptions.smoothLines"),children:(0,r.jsx)(d,{checked:g.smooth,onChange:k})}),(0,r.jsx)(I,{label:i("editor.graphPanel.lineThickness.label"),children:(0,r.jsx)(h,{value:g.widthMode,options:x,onChange:w})}),g.widthMode==="custom"&&(0,r.jsx)(I,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,r.jsx)(c,{value:g.strokeWidth,min:1,max:10,step:.1,formatValue:Pt,onChange:j,onCommit:a.commands.commit})}),g.missingValues!==null&&(0,r.jsx)(I,{label:i("editor.fineTunePanel.detailSection.missingValues"),children:(0,r.jsx)(s,{value:g.missingValues,options:v,onChange:P})})]})})},hn="\0none",Cf=["x","y","color","size","label"],wf={x:"editor.graphPanel.mappingSection.x",y:"editor.graphPanel.mappingSection.y",color:"editor.graphPanel.mappingSection.color",size:"editor.graphPanel.mappingSection.size",label:"editor.graphPanel.mappingSection.label"},jf=({title:e,layout:t="collapsible"})=>{const n=V(),a=l.useHandleScene(n),o=l.useI18n(),{Select:i}=D(),s=o("editor.graphPanel.mappingSection.none"),c=a?.spec,d=(0,f.useMemo)(()=>c===void 0?[]:(0,u.readMappableAesthetics)(c,Cf).map(({aesthetic:h,variables:p,required:m})=>{const g=(0,u.readMappedVariable)(c.mapping,h);return{aesthetic:h,label:o(wf[h]),value:g??(m?null:hn),options:Tf(p,g,m?null:s),chooseColumn:v=>{n.commands.dispatch(new u.SetMappingCommand({aesthetic:h,variable:v===hn?null:v}))}}}),[c,o,s,n]);return a?(0,r.jsx)(U,{title:e??o("editor.graphPanel.mappingSection.title"),layout:t,children:(0,r.jsx)(Z,{children:d.map(({aesthetic:h,label:p,value:m,options:g,chooseColumn:v})=>(0,r.jsx)(I,{label:p,children:(0,r.jsx)(i,{value:m,options:g,placeholder:s,onChange:v})},h))})}):null},Tf=(e,t,n)=>{const a=t!==null&&!e.includes(t)?[t,...e]:e;return[...n===null?[]:[{value:hn,label:n}],...a.map(o=>({value:o,label:o}))]},kf="k",Af=2,Lf=0,Pf=5,pn=[{value:"k",labelKey:"thousands"},{value:"m",labelKey:"millions"},{value:"b",labelKey:"billions"}],If=["auto","none"],Ef=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{NumberField:s,ToggleGroup:c}=D();if(!o)return null;const{abbreviation:d,decimals:h}=o.config.numberFormat,p=Mf(d)!==void 0,m=h!=="auto",g=j=>j.map(P=>({value:P,label:i(`editor.graphPanel.numberFormat.options.${P}`)})),v=pn.map(({value:j,labelKey:P})=>({value:j,label:i(`common.abbreviations.${P}`)})),x=j=>{a.commands.dispatch(new u.SetNumberFormatAbbreviationCommand({abbreviation:j}))},b=j=>{const P=If.find(A=>A===j);x(P??kf)},y=j=>{const P=pn.find(A=>A.value===j);P&&x(P.value)},k=j=>{a.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:j==="custom"?Af:"auto"}))},w=j=>{j!==null&&a.commands.dispatch(new u.SetNumberFormatDecimalsCommand({decimals:j}),{transient:!0})};return(0,r.jsx)(U,{title:e??i("editor.graphPanel.numberFormatSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.graphPanel.numberFormat.abbreviationLabel"),children:(0,r.jsx)(c,{value:p?"custom":d,options:g(["auto","none","custom"]),onChange:b})}),p&&(0,r.jsx)(I,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,r.jsx)(c,{value:d,options:v,onChange:y})}),(0,r.jsx)(I,{label:i("editor.graphPanel.numberFormat.decimalPlacesLabel"),children:(0,r.jsx)(c,{value:m?"custom":"auto",options:g(["auto","custom"]),onChange:k})}),m&&(0,r.jsx)(I,{label:i("editor.graphPanel.numberFormat.valueLabel"),children:(0,r.jsx)(s,{value:h,min:Lf,max:Pf,onChange:w,onCommit:a.commands.commit})})]})})},Mf=e=>pn.find(t=>t.value===e),Rf=({title:e,layout:t="collapsible",preview:n})=>{const a=l.useHandleScene(V()),o=l.useI18n();if(!a)return null;const i=Of(a.spec.layers);return i?(0,r.jsx)(U,{title:e??o("editor.graphPanel.pointSize.label"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:o("editor.graphPanel.numberFormat.valueLabel"),children:(0,r.jsx)(Zi,{layerId:i.id})}),(0,r.jsx)(Ji,{layerId:i.id})]})}):null},Of=e=>{const t=(0,u.filterLayersByGeoms)(e,"line","area");return(0,u.filterLayersByGeoms)(e,"point").find(n=>!(0,u.isCompanionLayer)(n,t))},_f=.9,Nf=360,Df=.05,Ff=15,Bf=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Slider:s}=D();if(!o||o.spec.coords.coordType!=="polar")return null;const{innerRadius:c,startAngle:d}=o.spec.coords.params,h=m=>{a.commands.dispatch(new u.SetPolarInnerRadiusCommand({innerRadius:m}),{transient:!0})},p=m=>{a.commands.dispatch(new u.SetPolarStartAngleCommand({startAngle:m}),{transient:!0})};return(0,r.jsx)(U,{title:e??i("editor.graphPanel.polarSection.title"),layout:t,preview:n,children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.graphPanel.polarSection.innerRadius"),children:(0,r.jsx)(s,{value:c,min:0,max:_f,step:Df,formatValue:Ki,onChange:h,onCommit:a.commands.commit})}),(0,r.jsx)(I,{label:i("editor.graphPanel.polarSection.startAngle"),children:(0,r.jsx)(s,{value:d,min:0,max:Nf-1,step:Ff,formatValue:Ov,onChange:p,onCommit:a.commands.commit})})]})})},Gf=e=>(0,r.jsxs)(l.Icon,{...e,children:[(0,r.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,r.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,r.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"})]}),fa=e=>(0,r.jsxs)(l.Icon,{...e,children:[(0,r.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,r.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,r.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"})]}),xa=["linear","exponential","quadratic","polynomial","logarithmic","power","loess"],zf="linear",Hf=({title:e,layout:t="collapsible",preview:n})=>{const a=V(),o=l.useHandleScene(a),i=l.useI18n(),{Select:s,Switch:c}=D(),{options:d,findValue:h}=Tt(o,a.formattingLocale);if(!o||o.coordSystem.type==="polar")return null;const p=(0,u.findTrendLineLayer)(o.spec.layers),m=(0,u.findAverageLineLayer)(o.spec.layers),g=p?.stat.type==="smooth"?p.stat.method:zf,v=Vf(m),x=xa.map(P=>({value:P,label:i(`editor.annotationsPanel.trendType.options.${P}`)})),b=(P,A={})=>{const E=p??m,O=new u.SetStatLineCommand({line:P,...A,...E!==void 0&&{layerId:E.id},label:i("editor.annotationsPanel.trendsAndAveragesSection.average")});a.commands.dispatch(O)},y=P=>b(P?"trend":"none",{method:g}),k=P=>b(P?"average":"none",{group:v??h(d[0]?.value??"")}),w=P=>{const A=xa.find(E=>E===P);A!==void 0&&b("trend",{method:A})},j=P=>{const A=P===null?void 0:h(P);A!==void 0&&b("average",{group:A})};return(0,r.jsx)(U,{title:e??i("editor.annotationsPanel.trendsAndAveragesSection.title"),layout:t,preview:n??(0,r.jsx)(fa,{size:"lg"}),children:(0,r.jsxs)(Z,{children:[(0,r.jsx)(I,{label:i("editor.annotationsPanel.trendsAndAveragesSection.trend"),icon:(0,r.jsx)(fa,{size:"lg"}),children:(0,r.jsx)(c,{checked:p!==void 0,onChange:y})}),p!==void 0&&(0,r.jsx)(I,{label:i("editor.annotationsPanel.trendType.label"),children:(0,r.jsx)(s,{value:g,options:x,onChange:w,placeholder:i("editor.annotationsPanel.trendType.placeholder")})}),(0,r.jsx)(I,{label:i("editor.annotationsPanel.trendsAndAveragesSection.average"),icon:(0,r.jsx)(Gf,{size:"lg"}),children:(0,r.jsx)(c,{checked:m!==void 0,onChange:k})}),m!==void 0&&d.length>0&&(0,r.jsx)(I,{label:i("editor.annotationsPanel.averageLineSeries.label"),children:(0,r.jsx)(s,{value:v===void 0?null:String(v),options:d,onChange:j,placeholder:i("editor.annotationsPanel.averageLineSeries.placeholder"),ariaLabel:i("editor.annotationsPanel.averageLineSeries.ariaLabel")})})]})})},Vf=e=>{const t=e?.transforms.find(n=>n.transformType==="filter")?.options.value;return t instanceof Date?t.getTime():t};exports.AppearanceSection=Dv;exports.AxesPanel=Rv;exports.AxisEditMenu=xn;exports.AxisSection=dn;exports.BarEditMenu=bn;exports.BarSection=zv;exports.Button=Pa;exports.CalloutsSection=Qv;exports.CaptionSection=Vi;exports.ChartEditMenu=wn;exports.ColorRow=ce;exports.ColorSwatches=Oa;exports.ComboSection=tf;exports.ControlRegistryProvider=Xa;exports.ControlTooltip=xe;exports.CustomColor=Da;exports.EditableGraphRenderer=av;exports.EditorIntlProvider=Pn;exports.EditorPanel=$n;exports.ElementsPanel=Mv;exports.FileInput=Fa;exports.GoalSection=af;exports.GraphOptionsSection=sf;exports.GraphTypeSection=cf;exports.GridEditMenu=jn;exports.GridSection=df;exports.HeadlineSection=mf;exports.LegendEditMenu=xo;exports.LegendSection=ff;exports.LineEditMenu=ht;exports.LineSection=yf;exports.MappingSection=jf;exports.NumberField=za;exports.NumberFormatSection=Ef;exports.PANEL_ROOT_ATTRIBUTE=Gi;exports.PaletteRow=ho;exports.PointEditMenu=An;exports.PointSection=Rf;exports.PolarSection=Bf;exports.RadioGrid=Ha;exports.Row=I;exports.Section=U;exports.Select=$a;exports.Separator=vv;exports.Slider=Wa;exports.SourceSection=$i;exports.SubtitleSection=Wi;exports.Switch=Ua;exports.TextField=qa;exports.TextSizeSection=Ui;exports.TitleSection=qi;exports.ToggleGroup=fn;exports.ToggledSection=Hi;exports.TrendsAndAveragesSection=Hf;exports.useAnnotateAnchor=ja;exports.useControls=D;exports.usePanelExpansion=Bi;exports.usePanelGraph=V;
|