@graphysdk/react-renderer 0.0.1-plugins.9 → 1.8.1-beta.1786025839240

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.
@@ -0,0 +1,2829 @@
1
+ import { B as ee, D as re, E as Ut, F as $t, I as xe, M as A, P as Zt, Q as L, S as G, X as jt, b as N, c as Wt, d as _, et as E, f as se, h as Qe, i as Xt, j as si, l as Yt, m as Qt, n as H, o as Je, p as Ce, r as Jt, s as en, t as tn, u as ce, v as nn, x as F, y as me, z as Ie } from "./history-chords-CNYK3SiJ.js";
2
+ import { g as rn } from "./font-values-gPf-gY2d.js";
3
+ import { AddAnnotationCommand as pe, AddHighlightCommand as an, CONSTANT_VARIABLES as on, DIFFERENCE_ARROW_DEFAULTS as ln, RESTING_HOVER_STATE as et, RemoveAnnotationCommand as Pe, RemoveHighlightCommand as sn, SetAppearanceTextScaleCommand as cn, SetAxisPositionCommand as dn, SetAxisTickModeCommand as un, SetAxisVisibilityCommand as hn, SetContentCaptionCommand as mn, SetContentSourceCommand as pn, SetContentSubtitleCommand as vn, SetContentTitleCommand as gn, SetLegendPositionCommand as fn, SetNumberFormatAbbreviationCommand as bn, SetNumberFormatDecimalsCommand as Re, SetScaleDomainCommand as le, SetScaleReverseCommand as Cn, SetScaleTransformCommand as Sn, SetScaleZeroCommand as De, ToggleContentVisibilityCommand as ve, UpdateAnnotationCommand as tt, areAnchorsEqual as nt, areEndpointsComparable as yn, buildEditMenuTriggerRegion as wn, buildObservationAnchor as xn, buildObservationPredicate as In, createObservationAnchorParser as Pn, extractVariableName as An, findHighlightsAtObservation as Nn, findObservationAttachment as Tn, formatDifferenceLabel as On, getColor as Ln, hasMultipleGroups as En, inferDifferenceArrowEndpoints as Mn, isObservationAttachmentKind as kn, isPointWithinEditMenuTrigger as rt, isSafeUrl as _n, projectAnchorToPanel as Rn, resolveObservationPoint as Se, stepDifferenceArrowEndpoint as Dn, toPanelCursor as Ae } from "@graphysdk/viz-engine";
4
+ import { createContext as ae, useCallback as de, useContext as X, useEffect as T, useId as ne, useMemo as P, useRef as ue, useState as D } from "react";
5
+ import { Fragment as V, jsx as t, jsxs as p } from "react/jsx-runtime";
6
+ import { useShallow as Ne } from "zustand/react/shallow";
7
+ import { createPortal as zn } from "react-dom";
8
+ import W from "clsx";
9
+ import { assignInlineVars as at } from "@vanilla-extract/dynamic";
10
+ import { Menu as I } from "@base-ui/react/menu";
11
+ import { Menu as K } from "@base-ui/react";
12
+ import { Accordion as J } from "@base-ui/react/accordion";
13
+ import { NumberField as ze } from "@base-ui/react/number-field";
14
+ import { Radio as ot } from "@base-ui/react/radio";
15
+ import { RadioGroup as it } from "@base-ui/react/radio-group";
16
+ import { Select as k } from "@base-ui/react/select";
17
+ import { Slider as Y } from "@base-ui/react/slider";
18
+ import { Switch as Fe } from "@base-ui/react/switch";
19
+ import { Input as Fn } from "@base-ui/react/input";
20
+ import './editable.css';var Kn = "data-graphy-chart-chrome", Hn = "data-graphy-chart-menu", lt = { [Hn]: "" }, he = (e) => ({ [Kn]: e }), st = (e, n) => e instanceof Element && e.closest(`[data-graphy-chart-chrome="${CSS.escape(n)}"]`) !== null, Bn = (e) => e instanceof Element && e.closest("[data-graphy-chart-menu]") !== null, qn = (e) => e instanceof Element && e.closest("[data-graphy-chart-chrome]") !== null, te = (e, n, r) => e instanceof Node && (n.contains(e) || st(e, r)), Vn = "cml7ha0", ct = ae(null), Gn = ({ children: e }) => {
21
+ const { chartId: n } = E(), [r] = D(xe), [o, a] = D(null);
22
+ return r === null ? null : /* @__PURE__ */ p(V, { children: [zn(/* @__PURE__ */ t("div", {
23
+ ref: a,
24
+ className: Vn,
25
+ ...he(n)
26
+ }), r), /* @__PURE__ */ t(ct.Provider, {
27
+ value: o,
28
+ children: e
29
+ })] });
30
+ }, Te = () => X(ct), dt = (e) => /* @__PURE__ */ p(N, {
31
+ viewBox: "0 0 16 16",
32
+ ...e,
33
+ children: [
34
+ /* @__PURE__ */ t("path", {
35
+ fill: "currentColor",
36
+ fillOpacity: ".8",
37
+ d: "M2.333 3h11.334v8.667c-2 0-4 .333-5.667 2.333-2-2-3.667-2.333-5.667-2.333z",
38
+ opacity: ".12"
39
+ }),
40
+ /* @__PURE__ */ t("path", {
41
+ fill: "currentColor",
42
+ fillOpacity: ".8",
43
+ fillRule: "evenodd",
44
+ 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",
45
+ clipRule: "evenodd"
46
+ }),
47
+ /* @__PURE__ */ t("path", {
48
+ fill: "currentColor",
49
+ fillOpacity: ".8",
50
+ fillRule: "evenodd",
51
+ 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",
52
+ clipRule: "evenodd"
53
+ })
54
+ ]
55
+ });
56
+ var ut = "efjmb40", ht = "efjmb41", U = "efjmb42", $ = "efjmb43", Un = "efjmb44", $n = "efjmb45", Zn = /* @__PURE__ */ new Set([
57
+ "item-press",
58
+ "escape-key",
59
+ "outside-press",
60
+ "close-press",
61
+ "sibling-open",
62
+ "trigger-press"
63
+ ]), Oe = ({ label: e, icon: n, onOpened: r, children: o }) => {
64
+ const a = Te(), [i, l] = D(!1), c = (s, d) => {
65
+ s ? (l(!0), r?.()) : Zn.has(d.reason) && l(!1);
66
+ };
67
+ return /* @__PURE__ */ p(K.SubmenuRoot, {
68
+ open: i,
69
+ onOpenChange: c,
70
+ children: [/* @__PURE__ */ t(jn, {
71
+ label: e,
72
+ icon: n
73
+ }), /* @__PURE__ */ t(K.Portal, {
74
+ container: a,
75
+ children: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(K.Positioner, {
76
+ side: "right",
77
+ align: "start",
78
+ sideOffset: 4,
79
+ className: ut,
80
+ ...lt,
81
+ children: /* @__PURE__ */ t(K.Popup, {
82
+ className: ht,
83
+ children: o
84
+ })
85
+ }) })
86
+ })]
87
+ });
88
+ }, jn = ({ label: e, icon: n }) => /* @__PURE__ */ p(K.SubmenuTrigger, {
89
+ className: U,
90
+ openOnHover: !1,
91
+ children: [
92
+ n,
93
+ /* @__PURE__ */ t("span", {
94
+ className: $,
95
+ children: e
96
+ }),
97
+ /* @__PURE__ */ t("span", {
98
+ className: $n,
99
+ children: /* @__PURE__ */ t(me, { size: "sm" })
100
+ })
101
+ ]
102
+ }), Wn = "_1qe7q450", Xn = "_1qe7q451", Yn = "_1qe7q452", Qn = ({ label: e, placeholder: n, addLabel: r, at: o, onRequestClose: a }) => {
103
+ const i = ue(null), [l, c] = D(""), { dispatch: s } = G(), d = l.trim(), u = () => {
104
+ d.length !== 0 && (s(new pe({
105
+ kind: "comment",
106
+ annotation: {
107
+ at: o,
108
+ content: Jn(d)
109
+ }
110
+ })), a());
111
+ };
112
+ return /* @__PURE__ */ t(Oe, {
113
+ label: e,
114
+ icon: /* @__PURE__ */ t(dt, {}),
115
+ onOpened: () => {
116
+ requestAnimationFrame(() => i.current?.focus());
117
+ },
118
+ children: /* @__PURE__ */ p("div", {
119
+ className: Wn,
120
+ children: [/* @__PURE__ */ t("input", {
121
+ ref: i,
122
+ className: Xn,
123
+ value: l,
124
+ placeholder: n,
125
+ onChange: (g) => {
126
+ c(g.target.value);
127
+ },
128
+ onKeyDown: (g) => {
129
+ g.key === "Enter" && (g.preventDefault(), u()), g.key !== "Escape" && g.stopPropagation();
130
+ }
131
+ }), /* @__PURE__ */ t("button", {
132
+ type: "button",
133
+ className: Yn,
134
+ disabled: d.length === 0,
135
+ onClick: u,
136
+ children: r
137
+ })]
138
+ })
139
+ });
140
+ }, Jn = (e) => ({
141
+ type: "doc",
142
+ content: [{
143
+ type: "paragraph",
144
+ content: [{
145
+ type: "text",
146
+ text: e
147
+ }]
148
+ }]
149
+ }), er = (e) => /* @__PURE__ */ t(N, {
150
+ viewBox: "0 0 15 14",
151
+ ...e,
152
+ children: /* @__PURE__ */ t("path", {
153
+ 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",
154
+ fill: "currentColor",
155
+ fillOpacity: "0.8"
156
+ })
157
+ }), tr = "relative-difference", nr = ({ label: e, layer: n, at: r, onRequestClose: o }) => {
158
+ const { dispatch: a } = G(), i = L((s) => s.coordSystem), l = P(() => Mn({
159
+ layer: n,
160
+ at: r,
161
+ coordSystem: i
162
+ }), [
163
+ n,
164
+ r,
165
+ i
166
+ ]);
167
+ if (l === null) return null;
168
+ const c = () => {
169
+ a(new pe({
170
+ kind: "differenceArrow",
171
+ annotation: {
172
+ ...ln,
173
+ ...l,
174
+ label: tr
175
+ }
176
+ })), o();
177
+ };
178
+ return /* @__PURE__ */ p(I.Item, {
179
+ className: U,
180
+ onClick: c,
181
+ children: [/* @__PURE__ */ t(er, {}), /* @__PURE__ */ t("span", {
182
+ className: $,
183
+ children: e
184
+ })]
185
+ });
186
+ };
187
+ function rr(e, n) {
188
+ if (e.type === "polar" && !ar(n)) return [{
189
+ scope: "series",
190
+ labelKey: "pieSlice"
191
+ }];
192
+ const r = En(n.data, n.mapping);
193
+ switch (n.geom) {
194
+ case "bar": {
195
+ const o = [{
196
+ scope: "data-point",
197
+ labelKey: "bar"
198
+ }];
199
+ if (r) {
200
+ const a = n.position === "stack" || n.position === "fill";
201
+ o.push({
202
+ scope: "x-value",
203
+ labelKey: a ? "barStack" : "barGroup"
204
+ }), o.push({
205
+ scope: "series",
206
+ labelKey: "barSeries"
207
+ });
208
+ }
209
+ return o;
210
+ }
211
+ case "line":
212
+ case "area": {
213
+ const o = [{
214
+ scope: "data-point",
215
+ labelKey: "linePoint"
216
+ }];
217
+ return r && o.push({
218
+ scope: "series",
219
+ labelKey: "lineSeries"
220
+ }), o;
221
+ }
222
+ case "point": {
223
+ const o = [{
224
+ scope: "data-point",
225
+ labelKey: "scatterPoint"
226
+ }];
227
+ return r && o.push({
228
+ scope: "series",
229
+ labelKey: "scatterSeries"
230
+ }), o;
231
+ }
232
+ default:
233
+ return [];
234
+ }
235
+ }
236
+ var ar = (e) => {
237
+ const n = An(e.mapping.x);
238
+ return n !== null && n !== on.x;
239
+ }, or = (e) => /* @__PURE__ */ p(N, {
240
+ viewBox: "0 0 16 16",
241
+ ...e,
242
+ children: [
243
+ /* @__PURE__ */ t("rect", {
244
+ width: "3.2",
245
+ height: "7.704",
246
+ y: "8.296",
247
+ fill: "currentColor",
248
+ fillOpacity: "0.3",
249
+ rx: ".533"
250
+ }),
251
+ /* @__PURE__ */ t("rect", {
252
+ width: "3.2",
253
+ height: "4.741",
254
+ x: "8.533",
255
+ y: "11.259",
256
+ fill: "currentColor",
257
+ fillOpacity: "0.3",
258
+ rx: ".533"
259
+ }),
260
+ /* @__PURE__ */ t("rect", {
261
+ width: "3.2",
262
+ height: "11.259",
263
+ x: "4.267",
264
+ y: "4.741",
265
+ fill: "currentColor",
266
+ fillOpacity: "0.8",
267
+ rx: ".533"
268
+ }),
269
+ /* @__PURE__ */ t("rect", {
270
+ width: "3.2",
271
+ height: "16",
272
+ x: "12.8",
273
+ fill: "currentColor",
274
+ fillOpacity: "0.3",
275
+ rx: ".533"
276
+ })
277
+ ]
278
+ }), ir = (e) => /* @__PURE__ */ p(N, {
279
+ viewBox: "0 0 16 16",
280
+ ...e,
281
+ children: [
282
+ /* @__PURE__ */ t("rect", {
283
+ width: "3.2",
284
+ height: "7.704",
285
+ y: "8.296",
286
+ fill: "currentColor",
287
+ fillOpacity: "0.8",
288
+ rx: ".533"
289
+ }),
290
+ /* @__PURE__ */ t("rect", {
291
+ width: "3.2",
292
+ height: "4.741",
293
+ x: "8.533",
294
+ y: "11.259",
295
+ fill: "currentColor",
296
+ fillOpacity: "0.3",
297
+ rx: ".533"
298
+ }),
299
+ /* @__PURE__ */ t("rect", {
300
+ width: "3.2",
301
+ height: "11.259",
302
+ x: "4.267",
303
+ y: "4.741",
304
+ fill: "currentColor",
305
+ fillOpacity: "0.8",
306
+ rx: ".533"
307
+ }),
308
+ /* @__PURE__ */ t("rect", {
309
+ width: "3.2",
310
+ height: "16",
311
+ x: "12.8",
312
+ fill: "currentColor",
313
+ fillOpacity: "0.3",
314
+ rx: ".533"
315
+ })
316
+ ]
317
+ }), lr = (e) => /* @__PURE__ */ p(N, {
318
+ viewBox: "0 0 16 16",
319
+ ...e,
320
+ children: [
321
+ /* @__PURE__ */ t("rect", {
322
+ width: "3.2",
323
+ height: "7.704",
324
+ y: "8.296",
325
+ fill: "currentColor",
326
+ fillOpacity: "0.3",
327
+ rx: ".533"
328
+ }),
329
+ /* @__PURE__ */ t("rect", {
330
+ width: "3.2",
331
+ height: "4.741",
332
+ x: "8.533",
333
+ y: "11.259",
334
+ fill: "currentColor",
335
+ fillOpacity: "0.3",
336
+ rx: ".533"
337
+ }),
338
+ /* @__PURE__ */ t("rect", {
339
+ width: "3.2",
340
+ height: "11.259",
341
+ x: "4.267",
342
+ y: "4.741",
343
+ fill: "currentColor",
344
+ fillOpacity: "0.8",
345
+ rx: ".533"
346
+ }),
347
+ /* @__PURE__ */ t("rect", {
348
+ width: "3.2",
349
+ height: "16",
350
+ x: "12.8",
351
+ fill: "currentColor",
352
+ fillOpacity: ".8",
353
+ rx: ".533"
354
+ })
355
+ ]
356
+ }), sr = (e) => /* @__PURE__ */ p(N, {
357
+ viewBox: "0 0 16 16",
358
+ ...e,
359
+ children: [
360
+ /* @__PURE__ */ t("path", {
361
+ fill: "currentColor",
362
+ fillOpacity: "0.3",
363
+ 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"
364
+ }),
365
+ /* @__PURE__ */ t("path", {
366
+ fill: "currentColor",
367
+ fillOpacity: ".8",
368
+ 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"
369
+ }),
370
+ /* @__PURE__ */ t("path", {
371
+ fill: "currentColor",
372
+ fillOpacity: "0.3",
373
+ 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"
374
+ })
375
+ ]
376
+ }), cr = (e) => /* @__PURE__ */ p(N, {
377
+ viewBox: "0 0 16 16",
378
+ ...e,
379
+ children: [
380
+ /* @__PURE__ */ t("path", {
381
+ stroke: "currentColor",
382
+ strokeLinecap: "round",
383
+ strokeLinejoin: "round",
384
+ strokeOpacity: ".8",
385
+ strokeWidth: "1.163",
386
+ d: "m-1.618 15.96 9.118-5.3 11 2.34"
387
+ }),
388
+ /* @__PURE__ */ t("path", {
389
+ fill: "currentColor",
390
+ fillOpacity: "0.6",
391
+ stroke: "currentColor",
392
+ strokeOpacity: "0.3",
393
+ d: "M8 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"
394
+ }),
395
+ /* @__PURE__ */ t("rect", {
396
+ width: "9.795",
397
+ height: "6",
398
+ x: "3",
399
+ y: "2",
400
+ fill: "currentColor",
401
+ fillOpacity: "0.3",
402
+ rx: "1.513"
403
+ }),
404
+ /* @__PURE__ */ t("path", {
405
+ fill: "currentColor",
406
+ fillOpacity: ".8",
407
+ 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"
408
+ })
409
+ ]
410
+ }), dr = (e) => /* @__PURE__ */ p(N, {
411
+ viewBox: "0 0 16 16",
412
+ ...e,
413
+ children: [
414
+ /* @__PURE__ */ t("path", {
415
+ stroke: "currentColor",
416
+ strokeOpacity: "0.8",
417
+ strokeLinecap: "round",
418
+ strokeLinejoin: "bevel",
419
+ strokeWidth: ".993",
420
+ d: "M1.5 12 6 6.5l4 3.5 4-5.5"
421
+ }),
422
+ /* @__PURE__ */ t("circle", {
423
+ cx: "1.493",
424
+ cy: "11.993",
425
+ r: ".993",
426
+ fill: "currentColor",
427
+ fillOpacity: "0.8"
428
+ }),
429
+ /* @__PURE__ */ t("circle", {
430
+ cx: "5.993",
431
+ cy: "6.493",
432
+ r: ".993",
433
+ fill: "currentColor",
434
+ fillOpacity: "0.8"
435
+ }),
436
+ /* @__PURE__ */ t("circle", {
437
+ cx: "9.993",
438
+ cy: "9.993",
439
+ r: ".993",
440
+ fill: "currentColor",
441
+ fillOpacity: "0.8"
442
+ }),
443
+ /* @__PURE__ */ t("circle", {
444
+ cx: "13.993",
445
+ cy: "4.493",
446
+ r: ".993",
447
+ fill: "currentColor",
448
+ fillOpacity: "0.8"
449
+ })
450
+ ]
451
+ }), ur = (e) => /* @__PURE__ */ p(N, {
452
+ viewBox: "0 0 16 16",
453
+ ...e,
454
+ children: [
455
+ /* @__PURE__ */ t("rect", {
456
+ width: "16",
457
+ height: "16",
458
+ fill: "currentColor",
459
+ fillOpacity: "0.3",
460
+ rx: "8"
461
+ }),
462
+ /* @__PURE__ */ t("path", {
463
+ fill: "currentColor",
464
+ fillOpacity: "0.8",
465
+ d: "m7.999 16 .412-.01A8 8 0 0 0 8 0z"
466
+ }),
467
+ /* @__PURE__ */ t("path", {
468
+ fill: "currentColor",
469
+ fillOpacity: "0.6",
470
+ d: "M15.999 8a8 8 0 0 1-7.588 7.989l-.412.01V8z"
471
+ })
472
+ ]
473
+ }), hr = (e) => /* @__PURE__ */ p(N, {
474
+ viewBox: "0 0 16 16",
475
+ ...e,
476
+ children: [
477
+ /* @__PURE__ */ t("rect", {
478
+ width: "2.056",
479
+ height: "2.056",
480
+ fill: "currentColor",
481
+ fillOpacity: "0.3",
482
+ rx: "1.028",
483
+ transform: "matrix(-1 0 0 1 3.598 7.215)"
484
+ }),
485
+ /* @__PURE__ */ t("rect", {
486
+ width: "2.056",
487
+ height: "2.056",
488
+ fill: "currentColor",
489
+ fillOpacity: "0.3",
490
+ rx: "1.028",
491
+ transform: "matrix(-1 0 0 1 6.681 11.327)"
492
+ }),
493
+ /* @__PURE__ */ t("rect", {
494
+ width: "2.056",
495
+ height: "2.056",
496
+ fill: "currentColor",
497
+ fillOpacity: "0.3",
498
+ rx: "1.028",
499
+ transform: "matrix(-1 0 0 1 9.251 7.215)"
500
+ }),
501
+ /* @__PURE__ */ t("rect", {
502
+ width: "2.056",
503
+ height: "2.056",
504
+ fill: "currentColor",
505
+ fillOpacity: ".8",
506
+ rx: "1.028",
507
+ transform: "matrix(-1 0 0 1 10.28 2.59)"
508
+ }),
509
+ /* @__PURE__ */ t("rect", {
510
+ width: "2.056",
511
+ height: "2.056",
512
+ fill: "currentColor",
513
+ fillOpacity: "0.3",
514
+ rx: "1.028",
515
+ transform: "matrix(-1 0 0 1 13.877 6.187)"
516
+ }),
517
+ /* @__PURE__ */ t("rect", {
518
+ width: "2.056",
519
+ height: "2.056",
520
+ fill: "currentColor",
521
+ fillOpacity: "0.3",
522
+ rx: "1.028",
523
+ transform: "matrix(-1 0 0 1 2.056 12.869)"
524
+ }),
525
+ /* @__PURE__ */ t("rect", {
526
+ width: "2.056",
527
+ height: "2.056",
528
+ fill: "currentColor",
529
+ fillOpacity: "0.3",
530
+ rx: "1.028",
531
+ transform: "matrix(-1 0 0 1 15.933 .533)"
532
+ })
533
+ ]
534
+ }), mr = (e) => /* @__PURE__ */ p(N, {
535
+ viewBox: "0 0 16 16",
536
+ ...e,
537
+ children: [
538
+ /* @__PURE__ */ t("rect", {
539
+ width: "2.056",
540
+ height: "2.056",
541
+ fill: "currentColor",
542
+ fillOpacity: ".8",
543
+ rx: "1.028",
544
+ transform: "matrix(-1 0 0 1 3.598 7.215)"
545
+ }),
546
+ /* @__PURE__ */ t("rect", {
547
+ width: "2.056",
548
+ height: "2.056",
549
+ fill: "currentColor",
550
+ fillOpacity: ".8",
551
+ rx: "1.028",
552
+ transform: "matrix(-1 0 0 1 6.681 11.327)"
553
+ }),
554
+ /* @__PURE__ */ t("rect", {
555
+ width: "2.056",
556
+ height: "2.056",
557
+ fill: "currentColor",
558
+ fillOpacity: "0.3",
559
+ rx: "1.028",
560
+ transform: "matrix(-1 0 0 1 9.251 7.215)"
561
+ }),
562
+ /* @__PURE__ */ t("rect", {
563
+ width: "2.056",
564
+ height: "2.056",
565
+ fill: "currentColor",
566
+ fillOpacity: ".8",
567
+ rx: "1.028",
568
+ transform: "matrix(-1 0 0 1 10.28 2.59)"
569
+ }),
570
+ /* @__PURE__ */ t("rect", {
571
+ width: "2.056",
572
+ height: "2.056",
573
+ fill: "currentColor",
574
+ fillOpacity: "0.3",
575
+ rx: "1.028",
576
+ transform: "matrix(-1 0 0 1 13.877 6.187)"
577
+ }),
578
+ /* @__PURE__ */ t("rect", {
579
+ width: "2.056",
580
+ height: "2.056",
581
+ fill: "currentColor",
582
+ fillOpacity: "0.3",
583
+ rx: "1.028",
584
+ transform: "matrix(-1 0 0 1 2.056 12.869)"
585
+ }),
586
+ /* @__PURE__ */ t("rect", {
587
+ width: "2.056",
588
+ height: "2.056",
589
+ fill: "currentColor",
590
+ fillOpacity: "0.3",
591
+ rx: "1.028",
592
+ transform: "matrix(-1 0 0 1 15.933 .533)"
593
+ })
594
+ ]
595
+ }), pr = {
596
+ bar: or,
597
+ barGroup: ir,
598
+ barStack: sr,
599
+ barSeries: lr,
600
+ linePoint: cr,
601
+ lineSeries: dr,
602
+ scatterPoint: hr,
603
+ scatterSeries: mr,
604
+ pieSlice: ur
605
+ }, mt = ({ labelKey: e }) => {
606
+ const n = pr[e];
607
+ return /* @__PURE__ */ t(n, {});
608
+ }, pt = (e) => /* @__PURE__ */ p(N, {
609
+ viewBox: "0 0 16 16",
610
+ ...e,
611
+ children: [/* @__PURE__ */ t("path", {
612
+ opacity: "0.12",
613
+ d: "M15 4.66667L12.3333 2L2.33334 12L5.00001 14.6667L15 4.66667Z",
614
+ fill: "currentColor",
615
+ fillOpacity: "0.8"
616
+ }), /* @__PURE__ */ t("path", {
617
+ 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",
618
+ fill: "currentColor",
619
+ fillOpacity: "0.8"
620
+ })]
621
+ }), vr = ({ label: e, options: n, onSelect: r }) => {
622
+ const o = A();
623
+ return /* @__PURE__ */ t(Oe, {
624
+ label: e,
625
+ icon: /* @__PURE__ */ t(pt, {}),
626
+ children: n.map((a) => /* @__PURE__ */ p(K.Item, {
627
+ className: U,
628
+ onClick: () => r(a.scope),
629
+ children: [/* @__PURE__ */ t(mt, { labelKey: a.labelKey }), /* @__PURE__ */ t("span", {
630
+ className: $,
631
+ children: o(`graph.annotations.highlights.labels.${a.labelKey}`)
632
+ })]
633
+ }, a.scope))
634
+ });
635
+ }, gr = ({ label: e, layer: n, observation: r, highlights: o, onRequestClose: a }) => {
636
+ const i = A(), { dispatch: l } = G(), c = L((m) => m.coordSystem), s = P(() => In(n, r), [n, r]), d = P(() => rr(c, n), [c, n]), u = P(() => {
637
+ const m = new Set(o.map((g) => g.scope));
638
+ return d.filter((g) => !m.has(g.scope));
639
+ }, [d, o]), [h] = u;
640
+ if (s === null || h === void 0) return null;
641
+ const v = (m) => {
642
+ l(new an({
643
+ predicate: s,
644
+ scope: m,
645
+ layerId: n.id
646
+ })), a();
647
+ };
648
+ if (u.length === 1) {
649
+ const m = d.length === 1 ? e : i("graph.annotations.baseMenu.highlightWithLabel", { label: i(`graph.annotations.highlights.labels.${h.labelKey}`) });
650
+ return /* @__PURE__ */ p(K.Item, {
651
+ className: U,
652
+ onClick: () => v(h.scope),
653
+ children: [/* @__PURE__ */ t(mt, { labelKey: h.labelKey }), /* @__PURE__ */ t("span", {
654
+ className: $,
655
+ children: m
656
+ })]
657
+ });
658
+ }
659
+ return /* @__PURE__ */ t(vr, {
660
+ label: e,
661
+ options: u,
662
+ onSelect: v
663
+ });
664
+ }, fr = "_1aafi1g0", br = "_1aafi1g1", vt = ({ children: e }) => /* @__PURE__ */ p("span", {
665
+ className: fr,
666
+ "aria-hidden": "true",
667
+ children: [e, /* @__PURE__ */ t("span", { className: br })]
668
+ }), Cr = ({ label: e, highlights: n, onRequestClose: r }) => {
669
+ const { dispatch: o } = G(), a = n.at(-1);
670
+ if (a === void 0) return null;
671
+ const i = () => {
672
+ o(new sn({ id: a.id })), r();
673
+ };
674
+ return /* @__PURE__ */ p(I.Item, {
675
+ className: U,
676
+ onClick: i,
677
+ children: [/* @__PURE__ */ t(vt, { children: /* @__PURE__ */ t(pt, {}) }), /* @__PURE__ */ t("span", {
678
+ className: $,
679
+ children: e
680
+ })]
681
+ });
682
+ }, Sr = (e, n) => {
683
+ const r = L((a) => a.spec.highlights), o = L((a) => a.config.parsingLocale);
684
+ return P(() => Nn({
685
+ layer: e,
686
+ highlights: r,
687
+ observation: n,
688
+ parsingLocale: o
689
+ }), [
690
+ e,
691
+ r,
692
+ n,
693
+ o
694
+ ]);
695
+ }, gt = (e) => /* @__PURE__ */ p(N, {
696
+ viewBox: "0 0 16 16",
697
+ ...e,
698
+ children: [
699
+ /* @__PURE__ */ t("path", {
700
+ opacity: "0.12",
701
+ 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",
702
+ fill: "currentColor",
703
+ fillOpacity: "0.8"
704
+ }),
705
+ /* @__PURE__ */ t("path", {
706
+ fillRule: "evenodd",
707
+ clipRule: "evenodd",
708
+ 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",
709
+ fill: "currentColor",
710
+ fillOpacity: "0.8"
711
+ }),
712
+ /* @__PURE__ */ t("path", {
713
+ 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",
714
+ fill: "currentColor",
715
+ fillOpacity: "0.8"
716
+ })
717
+ ]
718
+ }), yr = ({ label: e, at: n, onRequestClose: r }) => {
719
+ const { dispatch: o } = G(), a = () => {
720
+ o(new pe({
721
+ kind: "pinnedNumber",
722
+ annotation: { at: n }
723
+ })), r();
724
+ };
725
+ return /* @__PURE__ */ p(I.Item, {
726
+ className: U,
727
+ onClick: a,
728
+ children: [/* @__PURE__ */ t(gt, {}), /* @__PURE__ */ t("span", {
729
+ className: $,
730
+ children: e
731
+ })]
732
+ });
733
+ }, ft = (e) => /* @__PURE__ */ p(N, {
734
+ viewBox: "0 0 16 16",
735
+ ...e,
736
+ children: [
737
+ /* @__PURE__ */ t("path", {
738
+ opacity: "0.12",
739
+ 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",
740
+ fill: "currentColor",
741
+ fillOpacity: "0.8"
742
+ }),
743
+ /* @__PURE__ */ t("path", {
744
+ 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",
745
+ fill: "currentColor",
746
+ fillOpacity: "0.8"
747
+ }),
748
+ /* @__PURE__ */ t("path", {
749
+ 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",
750
+ fill: "currentColor",
751
+ fillOpacity: "0.8"
752
+ }),
753
+ /* @__PURE__ */ t("path", {
754
+ 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",
755
+ fill: "currentColor",
756
+ fillOpacity: "0.8"
757
+ }),
758
+ /* @__PURE__ */ t("path", {
759
+ fillRule: "evenodd",
760
+ clipRule: "evenodd",
761
+ 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",
762
+ fill: "currentColor",
763
+ fillOpacity: "0.8"
764
+ })
765
+ ]
766
+ }), bt = {
767
+ pinnedNumber: {
768
+ icon: gt,
769
+ labelKey: "graph.annotations.baseMenu.unpinNumber"
770
+ },
771
+ comment: {
772
+ icon: dt,
773
+ labelKey: "graph.annotations.baseMenu.removeAnnotation"
774
+ },
775
+ sticker: {
776
+ icon: ft,
777
+ labelKey: "graph.annotations.baseMenu.removeSticker"
778
+ },
779
+ image: null
780
+ }, wr = (e) => kn(e.kind) && bt[e.kind] !== null, xr = ({ attachment: e, onRequestClose: n }) => {
781
+ const r = A(), { dispatch: o } = G(), { icon: a, labelKey: i } = bt[e.kind], l = () => {
782
+ o(new Pe({ id: e.annotation.id })), n();
783
+ };
784
+ return /* @__PURE__ */ p(I.Item, {
785
+ className: U,
786
+ onClick: l,
787
+ children: [/* @__PURE__ */ t(vt, { children: /* @__PURE__ */ t(a, {}) }), /* @__PURE__ */ t("span", {
788
+ className: $,
789
+ children: r(i)
790
+ })]
791
+ });
792
+ }, Ir = "ceeojg0", Pr = "ceeojg1", Ar = "ceeojg2", Nr = ({ label: e, at: n, onRequestClose: r }) => {
793
+ const { dispatch: o } = G(), a = (i) => {
794
+ o(new pe({
795
+ kind: "sticker",
796
+ annotation: {
797
+ at: {
798
+ anchorType: "observation",
799
+ ...n
800
+ },
801
+ sticker: i
802
+ }
803
+ })), r();
804
+ };
805
+ return /* @__PURE__ */ t(Oe, {
806
+ label: e,
807
+ icon: /* @__PURE__ */ t(ft, {}),
808
+ children: /* @__PURE__ */ t("div", {
809
+ className: Ir,
810
+ children: Object.entries(en).map(([i, l]) => /* @__PURE__ */ t(K.Item, {
811
+ className: Pr,
812
+ "aria-label": i,
813
+ onClick: () => a(i),
814
+ children: /* @__PURE__ */ t("img", {
815
+ className: Ar,
816
+ src: l.src,
817
+ alt: i
818
+ })
819
+ }, i))
820
+ })
821
+ });
822
+ }, Tr = ({ interaction: e, panelOrigin: n }) => {
823
+ const r = _(), o = ce((i) => i.menuTrigger);
824
+ if (e.kind !== "menu" || o === null) return null;
825
+ const a = () => {
826
+ r.getState().releaseInteraction("menu");
827
+ };
828
+ return /* @__PURE__ */ t(Or, {
829
+ trigger: {
830
+ x: n.x + o.center.x,
831
+ y: n.y + o.center.y,
832
+ radius: o.radius
833
+ },
834
+ layer: e.anchor.layer,
835
+ at: e.anchor.at,
836
+ observation: e.anchor.observation,
837
+ onClose: a
838
+ });
839
+ }, Or = ({ trigger: e, layer: n, at: r, observation: o, onClose: a }) => {
840
+ const i = A(), l = Te(), c = L((f) => f.spec.annotations), s = L((f) => f.config.parsingLocale), d = Er(), { x: u, y: h, radius: v } = e, m = P(() => Lr(u, h, v), [
841
+ u,
842
+ h,
843
+ v
844
+ ]), g = Tn(c, r, P(() => Pn(n, s), [n, s])), x = g !== null && wr(g) ? g : null, S = Sr(n, o), b = (f, y) => {
845
+ !f && Mr(y.reason) && a();
846
+ };
847
+ return /* @__PURE__ */ t(I.Root, {
848
+ open: d,
849
+ modal: !1,
850
+ onOpenChange: b,
851
+ children: /* @__PURE__ */ t(I.Portal, {
852
+ container: l,
853
+ children: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(I.Positioner, {
854
+ anchor: m,
855
+ side: "right",
856
+ align: "start",
857
+ sideOffset: 8,
858
+ className: ut,
859
+ ...lt,
860
+ children: /* @__PURE__ */ p(I.Popup, {
861
+ className: ht,
862
+ "data-testid": "observation-menu",
863
+ children: [
864
+ x !== null && /* @__PURE__ */ t(xr, {
865
+ attachment: x,
866
+ onRequestClose: a
867
+ }),
868
+ /* @__PURE__ */ t(Cr, {
869
+ label: i("graph.annotations.baseMenu.removeHighlight"),
870
+ highlights: S,
871
+ onRequestClose: a
872
+ }),
873
+ /* @__PURE__ */ t(I.Separator, { className: Un }),
874
+ x === null && /* @__PURE__ */ p(V, { children: [
875
+ /* @__PURE__ */ t(yr, {
876
+ label: i("graph.annotations.baseMenu.pinNumber"),
877
+ at: r,
878
+ onRequestClose: a
879
+ }),
880
+ /* @__PURE__ */ t(Qn, {
881
+ label: i("graph.annotations.baseMenu.annotate"),
882
+ placeholder: i("graph.annotations.textMenu.placeholder"),
883
+ addLabel: i("graph.annotations.textMenu.addButton"),
884
+ at: r,
885
+ onRequestClose: a
886
+ }),
887
+ /* @__PURE__ */ t(Nr, {
888
+ label: i("graph.annotations.baseMenu.addSticker"),
889
+ at: r,
890
+ onRequestClose: a
891
+ })
892
+ ] }),
893
+ n.highlight !== null && /* @__PURE__ */ t(gr, {
894
+ label: i("graph.annotations.baseMenu.highlight"),
895
+ layer: n,
896
+ observation: o,
897
+ highlights: S,
898
+ onRequestClose: a
899
+ }),
900
+ /* @__PURE__ */ t(nr, {
901
+ label: i("graph.annotations.baseMenu.differenceArrow"),
902
+ layer: n,
903
+ at: r,
904
+ onRequestClose: a
905
+ })
906
+ ]
907
+ })
908
+ }) })
909
+ })
910
+ });
911
+ }, Lr = (e, n, r) => ({ getBoundingClientRect: () => new DOMRect(e - r, n - r, r * 2, r * 2) }), Er = () => {
912
+ const [e, n] = D(!1);
913
+ return T(() => {
914
+ n(!0);
915
+ }, []), e;
916
+ }, Mr = (e) => e === "outside-press" || e === "escape-key" || e === "item-press", kr = () => {
917
+ const e = Je();
918
+ return Ct(e);
919
+ }, Ct = (e) => {
920
+ if (e.length !== 1) return null;
921
+ const [n] = e;
922
+ return n?.kind === "annotation" ? n.id : null;
923
+ }, _r = (e) => /* @__PURE__ */ t(N, {
924
+ ...e,
925
+ children: /* @__PURE__ */ p("g", {
926
+ stroke: "currentColor",
927
+ strokeWidth: 2,
928
+ strokeLinecap: "round",
929
+ strokeLinejoin: "round",
930
+ children: [/* @__PURE__ */ t("path", { d: "M4 9h16m-4-4 4 4" }), /* @__PURE__ */ t("path", { d: "M20 15H4m4 4-4-4" })]
931
+ })
932
+ }), Rr = (e) => /* @__PURE__ */ t(N, {
933
+ ...e,
934
+ children: /* @__PURE__ */ p("g", {
935
+ stroke: "currentColor",
936
+ strokeWidth: 2,
937
+ strokeLinecap: "round",
938
+ strokeLinejoin: "round",
939
+ children: [
940
+ /* @__PURE__ */ t("path", { d: "M4 7h16" }),
941
+ /* @__PURE__ */ t("path", { d: "M10 11v6M14 11v6" }),
942
+ /* @__PURE__ */ t("path", { d: "M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12" }),
943
+ /* @__PURE__ */ t("path", { d: "M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2" })
944
+ ]
945
+ })
946
+ }), Dr = { kind: "chrome-popup" }, zr = "var(--q7gcrz0)", Fr = "var(--q7gcrz1)", Kr = "q7gcrz2", Hr = "q7gcrz3";
947
+ var Br = "q7gcrz5", qr = "q7gcrz6", Vr = "q7gcrz7", Gr = "q7gcrz8", St = "q7gcrz9", Ur = "q7gcrza";
948
+ var Ke = "q7gcrzd q7gcrzc", yt = "q7gcrze q7gcrzc", $r = [
949
+ "absolute-difference",
950
+ "relative-difference",
951
+ "proportion"
952
+ ], He = ["absolute-difference", "relative-difference"], Zr = ["relative-difference", "proportion"], jr = {
953
+ "absolute-difference": "graph.annotations.differenceArrowToolbar.labelKind.absoluteDifference",
954
+ "relative-difference": "graph.annotations.differenceArrowToolbar.labelKind.relativeDifference",
955
+ proportion: "graph.annotations.differenceArrowToolbar.labelKind.proportion"
956
+ }, Wr = (e) => {
957
+ const { formattingLocale: n } = E(), r = L((a) => a.config.parsingLocale), o = n ?? r;
958
+ return P(() => {
959
+ const a = yn(e.start, e.end);
960
+ return $r.filter((i) => a || !He.includes(i) || i === e.label).map((i) => ({
961
+ kind: i,
962
+ nameKey: jr[i],
963
+ preview: On({
964
+ locale: o,
965
+ kind: i,
966
+ startValue: e.start.measurementValue,
967
+ endValue: e.end.measurementValue,
968
+ valueFormat: e.start.valueFormat
969
+ }),
970
+ isPickable: a || !He.includes(i),
971
+ isSuspect: Zr.includes(i) && e.start.measurementValue === 0
972
+ }));
973
+ }, [e, o]);
974
+ }, Q = 8, Xr = ({ labelBox: e, panelRect: n, frameWidth: r, frameHeight: o }) => {
975
+ const a = n.y + e.y, i = a + e.height, l = a - 8 - 36, c = i + 8, s = Yr(Q, l >= Q ? l : c, o - Q - 36), d = Q;
976
+ return {
977
+ top: s,
978
+ left: d,
979
+ available: Math.max(0, r - Q * 2),
980
+ centre: n.x + e.x + e.width / 2 - d
981
+ };
982
+ }, Yr = (e, n, r) => Math.max(e, Math.min(n, r)), fe = [
983
+ {
984
+ id: "small",
985
+ nameKey: "graph.annotations.differenceArrowToolbar.size.small"
986
+ },
987
+ {
988
+ id: "medium",
989
+ nameKey: "graph.annotations.differenceArrowToolbar.size.medium"
990
+ },
991
+ {
992
+ id: "large",
993
+ nameKey: "graph.annotations.differenceArrowToolbar.size.large"
994
+ }
995
+ ], Qr = ({ arrow: e, labelBox: n, panelRect: r, frameWidth: o, frameHeight: a, frameElement: i }) => {
996
+ const l = A(), { chartId: c, commands: s } = E(), d = _(), [u, h] = D(null), v = Wr(e), m = Xr({
997
+ labelBox: n,
998
+ panelRect: r,
999
+ frameWidth: o,
1000
+ frameHeight: a
1001
+ }), g = (b, f) => {
1002
+ s.dispatch(new tt({
1003
+ kind: "differenceArrow",
1004
+ id: e.id,
1005
+ patch: b
1006
+ }), f);
1007
+ };
1008
+ T(() => () => s.seal(), [s]), T(() => {
1009
+ const { claimInteraction: b, releaseInteraction: f } = d.getState();
1010
+ return u === null ? f("chrome-popup") : b(Dr), () => f("chrome-popup");
1011
+ }, [d, u]);
1012
+ const x = (b) => {
1013
+ h(b ? "color" : null), b || s.seal();
1014
+ }, S = () => {
1015
+ s.dispatch(new Pe({ id: e.id })), i.focus({ preventScroll: !0 });
1016
+ };
1017
+ return /* @__PURE__ */ t("div", {
1018
+ className: Kr,
1019
+ style: {
1020
+ top: m.top,
1021
+ left: m.left,
1022
+ width: m.available
1023
+ },
1024
+ children: /* @__PURE__ */ p(F.Root, {
1025
+ "aria-label": l("graph.annotations.differenceArrowToolbar.label"),
1026
+ className: Hr,
1027
+ "data-testid": "difference-arrow-toolbar",
1028
+ ...he(c),
1029
+ style: at({
1030
+ [zr]: `${m.centre}px`,
1031
+ [Fr]: `${m.available}px`
1032
+ }),
1033
+ children: [
1034
+ /* @__PURE__ */ t(Jr, {
1035
+ options: v,
1036
+ current: e.label,
1037
+ isOpen: u === "labelKind",
1038
+ onOpenChange: (b) => h(b ? "labelKind" : null),
1039
+ onPick: (b) => {
1040
+ g({ label: b }), h(null);
1041
+ }
1042
+ }),
1043
+ /* @__PURE__ */ t(F.Separator, {}),
1044
+ /* @__PURE__ */ t(F.ColorPicker, {
1045
+ color: e.color,
1046
+ label: l("graph.annotations.differenceArrowToolbar.color"),
1047
+ onChange: (b) => g({ color: b }, { transient: !0 }),
1048
+ isOpen: u === "color",
1049
+ onOpenChange: x,
1050
+ popupAttributes: he(c),
1051
+ children: /* @__PURE__ */ t("span", {
1052
+ className: qr,
1053
+ style: { background: e.color ?? "transparent" }
1054
+ })
1055
+ }),
1056
+ /* @__PURE__ */ t(ea, {
1057
+ current: e.size,
1058
+ isOpen: u === "size",
1059
+ onOpenChange: (b) => h(b ? "size" : null),
1060
+ onPick: (b) => {
1061
+ g({ size: b }), h(null);
1062
+ }
1063
+ }),
1064
+ /* @__PURE__ */ t(F.Separator, {}),
1065
+ /* @__PURE__ */ t(F.Button, {
1066
+ "aria-label": l("graph.annotations.differenceArrowToolbar.swap"),
1067
+ className: Ke,
1068
+ onClick: () => g({
1069
+ start: e.end.anchor,
1070
+ end: e.start.anchor
1071
+ }),
1072
+ children: /* @__PURE__ */ t(_r, {
1073
+ size: "sm",
1074
+ title: ""
1075
+ })
1076
+ }),
1077
+ /* @__PURE__ */ t(F.Button, {
1078
+ "aria-label": l("graph.annotations.differenceArrowToolbar.remove"),
1079
+ className: Ke,
1080
+ onClick: S,
1081
+ children: /* @__PURE__ */ t(Rr, {
1082
+ size: "sm",
1083
+ title: ""
1084
+ })
1085
+ })
1086
+ ]
1087
+ })
1088
+ });
1089
+ }, Jr = ({ options: e, current: n, isOpen: r, onOpenChange: o, onPick: a }) => {
1090
+ const i = A(), l = e.find((s) => s.kind === n), c = e.some((s) => s.isPickable && s.kind !== n);
1091
+ return /* @__PURE__ */ p(I.Root, {
1092
+ open: r,
1093
+ modal: !1,
1094
+ onOpenChange: o,
1095
+ children: [/* @__PURE__ */ p(I.Trigger, {
1096
+ render: /* @__PURE__ */ t(F.Button, {}),
1097
+ "aria-label": i("graph.annotations.differenceArrowToolbar.labelKind.ariaLabel"),
1098
+ className: yt,
1099
+ disabled: !c,
1100
+ onMouseDown: (s) => s.preventDefault(),
1101
+ children: [
1102
+ /* @__PURE__ */ t("span", {
1103
+ className: Br,
1104
+ children: l === void 0 ? "" : i(l.nameKey)
1105
+ }),
1106
+ l !== void 0 && /* @__PURE__ */ p("span", {
1107
+ className: "q7gcrz4",
1108
+ children: [
1109
+ "(",
1110
+ l.preview,
1111
+ ")"
1112
+ ]
1113
+ }),
1114
+ /* @__PURE__ */ t(me, { size: "sm" })
1115
+ ]
1116
+ }), /* @__PURE__ */ t(wt, { children: e.map((s) => /* @__PURE__ */ p(I.Item, {
1117
+ className: St,
1118
+ "data-selected": s.kind === n,
1119
+ disabled: !s.isPickable,
1120
+ onClick: () => a(s.kind),
1121
+ children: [
1122
+ /* @__PURE__ */ t("span", { children: i(s.nameKey) }),
1123
+ (s.isSuspect || !s.isPickable) && /* @__PURE__ */ t("span", {
1124
+ "aria-label": i(s.isPickable ? "graph.annotations.differenceArrowToolbar.labelKind.suspectValue" : "graph.annotations.differenceArrowToolbar.labelKind.incomparableEnds"),
1125
+ className: "q7gcrzb",
1126
+ role: "img",
1127
+ children: "⚠"
1128
+ }),
1129
+ /* @__PURE__ */ t("span", {
1130
+ className: Ur,
1131
+ children: s.preview
1132
+ })
1133
+ ]
1134
+ }, s.kind)) })]
1135
+ });
1136
+ }, ea = ({ current: e, isOpen: n, onOpenChange: r, onPick: o }) => {
1137
+ const a = A(), i = fe.find((l) => l.id === e) ?? fe[0];
1138
+ return /* @__PURE__ */ p(I.Root, {
1139
+ open: n,
1140
+ modal: !1,
1141
+ onOpenChange: r,
1142
+ children: [/* @__PURE__ */ p(I.Trigger, {
1143
+ render: /* @__PURE__ */ t(F.Button, {}),
1144
+ "aria-label": a("graph.annotations.differenceArrowToolbar.size.ariaLabel"),
1145
+ className: yt,
1146
+ onMouseDown: (l) => l.preventDefault(),
1147
+ children: [/* @__PURE__ */ t("span", { children: i === void 0 ? "" : a(i.nameKey) }), /* @__PURE__ */ t(me, { size: "sm" })]
1148
+ }), /* @__PURE__ */ t(wt, { children: fe.map((l) => /* @__PURE__ */ t(I.Item, {
1149
+ className: St,
1150
+ "data-selected": l.id === e,
1151
+ onClick: () => o(l.id),
1152
+ children: a(l.nameKey)
1153
+ }, l.id)) })]
1154
+ });
1155
+ }, wt = ({ children: e }) => {
1156
+ const { chartId: n } = E();
1157
+ return /* @__PURE__ */ t(I.Portal, {
1158
+ container: xe(),
1159
+ children: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(I.Positioner, {
1160
+ side: "bottom",
1161
+ align: "start",
1162
+ sideOffset: 6,
1163
+ className: Vr,
1164
+ children: /* @__PURE__ */ t(I.Popup, {
1165
+ className: Gr,
1166
+ onMouseDown: (r) => r.preventDefault(),
1167
+ ...he(n),
1168
+ children: e
1169
+ })
1170
+ }) })
1171
+ });
1172
+ };
1173
+ var ta = "ydgo3h0", na = "ydgo3h1", ra = "ydgo3h2", xt = (e) => e === "start" ? "end" : "start", It = ({ dispatch: e, arrow: n, endpoint: r, anchor: o }) => {
1174
+ nt(o, n[r].anchor) || e(new tt({
1175
+ kind: "differenceArrow",
1176
+ id: n.id,
1177
+ patch: { [r]: o }
1178
+ }));
1179
+ }, aa = ({ clientPoint: e, panelOrigin: n, panelRect: r, engine: o, layers: a, coordSystem: i, resolver: l, fixedAnchor: c, align: s }) => {
1180
+ const d = oa({
1181
+ x: e.x - n.x,
1182
+ y: e.y - n.y
1183
+ }, r), { primary: u } = o.query(Ae(d, r));
1184
+ if (u === null) return null;
1185
+ const h = a.find((m) => m.id === u.layerId);
1186
+ if (h === void 0) return null;
1187
+ const v = Se({
1188
+ resolver: l,
1189
+ layer: h,
1190
+ observation: u.observation,
1191
+ coordSystem: i,
1192
+ align: s
1193
+ });
1194
+ return v === null || nt(v.anchor, c) ? null : v;
1195
+ }, oa = (e, n) => ({
1196
+ x: Math.max(0, Math.min(e.x, n.width)),
1197
+ y: Math.max(0, Math.min(e.y, n.height))
1198
+ }), ia = class {
1199
+ constructor(e) {
1200
+ this.params = e, this.listeners = new AbortController(), this.pendingEvent = null, this.scheduledFrame = null, this.hasMoved = !1, this.hasPublished = !1, this.handleMove = (n) => {
1201
+ n.pointerId === this.params.pointerId && (this.pendingEvent = n, this.hasMoved = !0, this.scheduledFrame === null && (this.scheduledFrame = requestAnimationFrame(this.runFrame)));
1202
+ }, this.handleUp = (n) => {
1203
+ n.pointerId === this.params.pointerId && (this.pendingEvent = n, this.finish(!0));
1204
+ }, this.handleLost = (n) => {
1205
+ n.pointerId === this.params.pointerId && this.finish(!1);
1206
+ }, this.runFrame = () => {
1207
+ this.scheduledFrame = null;
1208
+ const n = this.pendingEvent;
1209
+ if (this.pendingEvent = null, n === null) return;
1210
+ const { editorStore: r, engine: o, anchorResolver: a, endpoint: i, readInputs: l } = this.params, { arrow: c, panelOrigin: s, panelRect: d, layers: u, coordSystem: h } = l(), v = r.getState();
1211
+ if (this.hasPublished && Ce(se(v, "endpoint-drag"), c.id, i) === null) return;
1212
+ const m = aa({
1213
+ clientPoint: {
1214
+ x: n.clientX,
1215
+ y: n.clientY
1216
+ },
1217
+ panelOrigin: s,
1218
+ panelRect: d,
1219
+ engine: o,
1220
+ layers: u,
1221
+ coordSystem: h,
1222
+ resolver: a,
1223
+ fixedAnchor: c[xt(i)].anchor,
1224
+ align: c[i].anchor.align
1225
+ });
1226
+ m !== null && this.publish(m);
1227
+ };
1228
+ }
1229
+ start() {
1230
+ const { handle: e } = this.params, { signal: n } = this.listeners;
1231
+ e.addEventListener("pointermove", this.handleMove, { signal: n }), e.addEventListener("pointerup", this.handleUp, { signal: n }), e.addEventListener("lostpointercapture", this.handleLost, { signal: n });
1232
+ }
1233
+ finish(e) {
1234
+ this.params.onSettled(), this.listeners.abort(), this.cancelFrame(), e && this.hasMoved && this.runFrame(), this.pendingEvent = null;
1235
+ const { editorStore: n, endpoint: r, readInputs: o, dispatch: a } = this.params, { arrow: i } = o(), l = n.getState(), c = Ce(se(l, "endpoint-drag"), i.id, r);
1236
+ c !== null && (l.releaseInteraction("endpoint-drag"), e && It({
1237
+ dispatch: a,
1238
+ arrow: i,
1239
+ endpoint: r,
1240
+ anchor: c.point.anchor
1241
+ }));
1242
+ }
1243
+ publish(e) {
1244
+ const { editorStore: n, readInputs: r, endpoint: o } = this.params;
1245
+ n.getState().claimInteraction({
1246
+ kind: "endpoint-drag",
1247
+ annotationId: r().arrow.id,
1248
+ endpoint: o,
1249
+ point: e
1250
+ }), this.hasPublished = !0;
1251
+ }
1252
+ cancelFrame() {
1253
+ this.scheduledFrame !== null && (cancelAnimationFrame(this.scheduledFrame), this.scheduledFrame = null);
1254
+ }
1255
+ }, la = ({ arrow: e, panelOrigin: n, panelRect: r }) => {
1256
+ const { commands: o, anchorResolver: a } = E(), { engine: i } = Ie(), l = _(), c = ee({
1257
+ arrow: e,
1258
+ panelOrigin: n,
1259
+ panelRect: r,
1260
+ ...L(Ne((d) => ({
1261
+ layers: d.layers,
1262
+ coordSystem: d.coordSystem
1263
+ })))
1264
+ }), s = ue(null);
1265
+ return T(() => () => s.current?.finish(!1), []), de((d) => ({
1266
+ onClick: (u) => u.stopPropagation(),
1267
+ onPointerDown: (u) => {
1268
+ if (u.button !== 0 || s.current !== null) return;
1269
+ try {
1270
+ u.currentTarget.setPointerCapture(u.pointerId);
1271
+ } catch {
1272
+ return;
1273
+ }
1274
+ u.currentTarget.focus({ preventScroll: !0 }), u.preventDefault();
1275
+ const h = new ia({
1276
+ handle: u.currentTarget,
1277
+ pointerId: u.pointerId,
1278
+ endpoint: d,
1279
+ readInputs: () => c.current,
1280
+ editorStore: l,
1281
+ engine: i,
1282
+ anchorResolver: a,
1283
+ dispatch: o.dispatch,
1284
+ onSettled: () => {
1285
+ s.current = null;
1286
+ }
1287
+ });
1288
+ s.current = h, h.start();
1289
+ }
1290
+ }), [
1291
+ c,
1292
+ l,
1293
+ i,
1294
+ a,
1295
+ o
1296
+ ]);
1297
+ }, sa = [" ", "Enter"], ca = ({ arrow: e }) => {
1298
+ const { commands: n, anchorResolver: r } = E(), o = _(), { layers: a, coordSystem: i, mainAxis: l } = L(Ne((s) => ({
1299
+ layers: s.layers,
1300
+ coordSystem: s.coordSystem,
1301
+ mainAxis: s.coordSystem.type === "cartesian" ? s.coordSystem.mainAxis : "x"
1302
+ }))), c = e.id;
1303
+ return T(() => () => {
1304
+ const s = o.getState();
1305
+ se(s, "endpoint-drag")?.annotationId === c && s.releaseInteraction("endpoint-drag");
1306
+ }, [o, c]), de((s) => ({ onKeyDown: (d) => {
1307
+ if (d.altKey || d.ctrlKey || d.metaKey || d.shiftKey) return;
1308
+ const u = o.getState(), h = Ce(se(u, "endpoint-drag"), e.id, s);
1309
+ if (sa.includes(d.key)) {
1310
+ if (d.preventDefault(), d.repeat) return;
1311
+ if (h === null) return u.claimInteraction({
1312
+ kind: "endpoint-drag",
1313
+ annotationId: e.id,
1314
+ endpoint: s,
1315
+ point: e[s]
1316
+ });
1317
+ u.releaseInteraction("endpoint-drag"), It({
1318
+ dispatch: n.dispatch,
1319
+ arrow: e,
1320
+ endpoint: s,
1321
+ anchor: h.point.anchor
1322
+ });
1323
+ return;
1324
+ }
1325
+ if (h === null) return;
1326
+ const v = da(d.key, l);
1327
+ if (v === null) return;
1328
+ d.preventDefault();
1329
+ const m = ua({
1330
+ arrow: e,
1331
+ endpoint: s,
1332
+ from: h.point.anchor,
1333
+ move: v,
1334
+ layers: a,
1335
+ coordSystem: i,
1336
+ resolver: r
1337
+ });
1338
+ m !== null && u.claimInteraction({
1339
+ kind: "endpoint-drag",
1340
+ annotationId: e.id,
1341
+ endpoint: s,
1342
+ point: m
1343
+ });
1344
+ } }), [
1345
+ e,
1346
+ o,
1347
+ n,
1348
+ r,
1349
+ a,
1350
+ i,
1351
+ l
1352
+ ]);
1353
+ }, da = (e, n) => {
1354
+ const r = e === "ArrowUp" || e === "ArrowDown";
1355
+ return !r && !(e === "ArrowLeft" || e === "ArrowRight") ? null : {
1356
+ axis: n === "x" === r ? "cross" : "main",
1357
+ step: e === "ArrowDown" || e === "ArrowRight" ? 1 : -1
1358
+ };
1359
+ }, ua = ({ arrow: e, endpoint: n, from: r, move: o, layers: a, coordSystem: i, resolver: l }) => {
1360
+ const c = a.find((d) => d.id === r.layerId);
1361
+ if (c === void 0) return null;
1362
+ const s = Dn({
1363
+ layer: c,
1364
+ from: r,
1365
+ partner: e[xt(n)].anchor,
1366
+ axis: o.axis,
1367
+ step: o.step,
1368
+ canLandOn: (d) => Se({
1369
+ resolver: l,
1370
+ layer: c,
1371
+ observation: d,
1372
+ coordSystem: i,
1373
+ align: e[n].anchor.align
1374
+ }) !== null
1375
+ });
1376
+ return s === null ? null : Se({
1377
+ resolver: l,
1378
+ layer: c,
1379
+ observation: s.observation,
1380
+ coordSystem: i,
1381
+ align: e[n].anchor.align
1382
+ });
1383
+ }, ha = (e) => {
1384
+ const n = kr();
1385
+ return n === null ? null : /* @__PURE__ */ t(ma, {
1386
+ annotationId: n,
1387
+ ...e
1388
+ });
1389
+ }, ma = ({ annotationId: e, ...n }) => {
1390
+ const r = Wt(), o = P(() => r.find((a) => a.id === e), [r, e]);
1391
+ return o === void 0 ? null : /* @__PURE__ */ t(pa, {
1392
+ committedArrow: o.committedArrow,
1393
+ committedLabelBox: o.committedLabelBox,
1394
+ labelBox: o.labelBox,
1395
+ start: o.start,
1396
+ end: o.end,
1397
+ isDragged: o.isDragged,
1398
+ ...n
1399
+ });
1400
+ }, pa = ({ committedArrow: e, committedLabelBox: n, labelBox: r, start: o, end: a, panelRect: i, panelOrigin: l, frameRect: c, frameElement: s, isDragged: d }) => {
1401
+ const u = la({
1402
+ arrow: e,
1403
+ panelOrigin: l,
1404
+ panelRect: i
1405
+ }), h = ca({ arrow: e });
1406
+ return /* @__PURE__ */ p("div", {
1407
+ "data-testid": "difference-arrow-selection",
1408
+ children: [
1409
+ !d && /* @__PURE__ */ t(Qr, {
1410
+ arrow: e,
1411
+ labelBox: n,
1412
+ panelRect: i,
1413
+ frameWidth: c.width,
1414
+ frameHeight: c.height,
1415
+ frameElement: s
1416
+ }),
1417
+ /* @__PURE__ */ t("div", {
1418
+ "aria-hidden": "true",
1419
+ className: ra,
1420
+ "data-testid": "difference-arrow-selection-label",
1421
+ style: {
1422
+ left: i.x + r.x - 2,
1423
+ top: i.y + r.y - 2,
1424
+ width: r.width + 4,
1425
+ height: r.height + 4
1426
+ }
1427
+ }),
1428
+ /* @__PURE__ */ t(Be, {
1429
+ endpoint: "start",
1430
+ point: o,
1431
+ panelRect: i,
1432
+ dragHandlers: u("start"),
1433
+ keyboardHandlers: h("start")
1434
+ }),
1435
+ /* @__PURE__ */ t(Be, {
1436
+ endpoint: "end",
1437
+ point: a,
1438
+ panelRect: i,
1439
+ dragHandlers: u("end"),
1440
+ keyboardHandlers: h("end")
1441
+ })
1442
+ ]
1443
+ });
1444
+ }, Be = ({ endpoint: e, point: n, panelRect: r, dragHandlers: o, keyboardHandlers: a }) => /* @__PURE__ */ t("div", {
1445
+ className: ta,
1446
+ "data-testid": "difference-arrow-selection-handle",
1447
+ "data-endpoint": e,
1448
+ role: "button",
1449
+ style: {
1450
+ left: r.x + n.x,
1451
+ top: r.y + n.y
1452
+ },
1453
+ tabIndex: 0,
1454
+ ...o,
1455
+ ...a,
1456
+ children: /* @__PURE__ */ t("span", {
1457
+ "aria-hidden": "true",
1458
+ className: na
1459
+ })
1460
+ }), va = (e) => /* @__PURE__ */ t(N, {
1461
+ ...e,
1462
+ children: /* @__PURE__ */ p("g", {
1463
+ stroke: "currentColor",
1464
+ strokeWidth: 2,
1465
+ strokeLinecap: "round",
1466
+ strokeLinejoin: "round",
1467
+ children: [/* @__PURE__ */ t("path", { d: "M12 5v14" }), /* @__PURE__ */ t("path", { d: "M5 12h14" })]
1468
+ })
1469
+ }), ga = "var(--_1tyillx0)", fa = {
1470
+ rest: 0.5,
1471
+ hovered: 0.75,
1472
+ open: 1
1473
+ };
1474
+ var ba = "_1tyillx1", Ca = {
1475
+ rest: "_1tyillx2",
1476
+ hovered: "_1tyillx3",
1477
+ open: "_1tyillx4"
1478
+ }, Sa = "_1tyillx5", ya = {
1479
+ closed: "_1tyillx6",
1480
+ open: "_1tyillx7"
1481
+ }, wa = ({ interaction: e, panelRect: n }) => {
1482
+ const r = _(), o = L((c) => c.coordSystem), a = e.kind === "trigger" || e.kind === "menu" ? e.anchor : null, i = xa(e), l = P(() => {
1483
+ if (a === null) return null;
1484
+ const c = Rn(a.position, n, o);
1485
+ return {
1486
+ center: c,
1487
+ radius: 19 * fa[i],
1488
+ target: {
1489
+ kind: "observation",
1490
+ cursor: Ae(c, n)
1491
+ }
1492
+ };
1493
+ }, [
1494
+ a,
1495
+ n,
1496
+ o,
1497
+ i
1498
+ ]);
1499
+ return T(() => {
1500
+ r.getState().setMenuTrigger(l);
1501
+ }, [r, l]), T(() => () => r.getState().setMenuTrigger(null), [r]), a === null || l === null ? null : /* @__PURE__ */ t("div", {
1502
+ "aria-hidden": "true",
1503
+ "data-testid": "observation-menu-trigger",
1504
+ "data-state": i,
1505
+ className: W(ba, Ca[i]),
1506
+ style: {
1507
+ left: n.x + l.center.x,
1508
+ top: n.y + l.center.y,
1509
+ ...at({ [ga]: a.color ?? rn.border50 })
1510
+ },
1511
+ children: /* @__PURE__ */ t("span", {
1512
+ className: W(Sa, ya[i === "open" ? "open" : "closed"]),
1513
+ children: /* @__PURE__ */ t(va, { size: "lg" })
1514
+ })
1515
+ });
1516
+ }, xa = (e) => e.kind === "menu" ? "open" : e.kind === "trigger" && e.isEngaged ? "hovered" : "rest", Ia = 'button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])', Pa = (e, n) => {
1517
+ const { chartId: r } = E(), o = _();
1518
+ T(() => {
1519
+ if (n === null) return;
1520
+ const a = (i) => {
1521
+ if (i.key !== "Tab" || i.defaultPrevented || !te(i.target, e, r) || o.getState().standingInteraction?.kind === "chrome-popup") return;
1522
+ const l = [...n.querySelectorAll(Ia)];
1523
+ if (l.length === 0) return;
1524
+ i.preventDefault();
1525
+ const c = l.findIndex((s) => s === document.activeElement);
1526
+ l[c === -1 ? i.shiftKey ? l.length - 1 : 0 : (c + (i.shiftKey ? -1 : 1) + l.length) % l.length]?.focus();
1527
+ };
1528
+ return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
1529
+ }, [
1530
+ e,
1531
+ n,
1532
+ r,
1533
+ o
1534
+ ]);
1535
+ }, Aa = (e) => {
1536
+ const { selectionStore: n, chartId: r } = E();
1537
+ T(() => {
1538
+ let o = null;
1539
+ const a = () => {
1540
+ e.focus({ preventScroll: !0 });
1541
+ }, i = (c) => {
1542
+ const { selection: s, clearSelection: d } = n.getState();
1543
+ s.length !== 0 && (te(c.target, e, r) || d());
1544
+ }, l = (c) => {
1545
+ n.getState().selection.length !== 0 && te(c.target, e, r) && c.relatedTarget === null && (o !== null && cancelAnimationFrame(o), o = requestAnimationFrame(() => {
1546
+ o = null, document.hasFocus() && (te(document.activeElement, e, r) || n.getState().clearSelection());
1547
+ }));
1548
+ };
1549
+ return e.addEventListener("pointerdown", a), document.addEventListener("focusin", i), document.addEventListener("focusout", l), () => {
1550
+ o !== null && cancelAnimationFrame(o), e.removeEventListener("pointerdown", a), document.removeEventListener("focusin", i), document.removeEventListener("focusout", l);
1551
+ };
1552
+ }, [
1553
+ e,
1554
+ n,
1555
+ r
1556
+ ]);
1557
+ }, Na = (e) => {
1558
+ const { selectionStore: n, commands: r, chartId: o } = E(), a = _(), i = de((c) => {
1559
+ const { selection: s } = n.getState(), d = Ct(s);
1560
+ d !== null && (c.preventDefault(), r.dispatch(new Pe({ id: d })), e.focus({ preventScroll: !0 }));
1561
+ }, [
1562
+ e,
1563
+ r,
1564
+ n
1565
+ ]), l = de((c) => {
1566
+ const s = a.getState();
1567
+ switch (s.standingInteraction?.kind) {
1568
+ case "endpoint-drag":
1569
+ s.releaseInteraction("endpoint-drag");
1570
+ return;
1571
+ case "chrome-popup":
1572
+ return;
1573
+ case "menu":
1574
+ s.releaseInteraction("menu");
1575
+ return;
1576
+ default:
1577
+ if (st(c.target, o)) {
1578
+ e.focus({ preventScroll: !0 });
1579
+ return;
1580
+ }
1581
+ n.getState().clearSelection();
1582
+ return;
1583
+ }
1584
+ }, [
1585
+ a,
1586
+ n,
1587
+ e,
1588
+ o
1589
+ ]);
1590
+ T(() => {
1591
+ const c = (s) => {
1592
+ if (te(s.target, e, o) && !Ta(s.target) && !Bn(s.target))
1593
+ switch (s.key) {
1594
+ case "Escape":
1595
+ return l(s);
1596
+ case "Delete":
1597
+ case "Backspace":
1598
+ return i(s);
1599
+ default:
1600
+ return;
1601
+ }
1602
+ };
1603
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
1604
+ }, [
1605
+ e,
1606
+ i,
1607
+ l,
1608
+ o
1609
+ ]);
1610
+ }, Ta = (e) => e instanceof HTMLElement && (e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement), Oa = `[${Qe}]`, Pt = (e, n, r) => {
1611
+ if (typeof document.elementsFromPoint != "function") return null;
1612
+ const o = document.elementsFromPoint(e, n);
1613
+ return La(o, r);
1614
+ }, La = (e, n) => {
1615
+ for (const r of e) {
1616
+ const o = r.closest(Oa);
1617
+ if (o === null || !n.contains(o)) continue;
1618
+ const a = Ea(o);
1619
+ if (a !== null) return a;
1620
+ }
1621
+ return null;
1622
+ }, Ea = (e) => {
1623
+ const n = e.getAttribute(Qe);
1624
+ if (n !== "annotation") return null;
1625
+ const r = e.getAttribute(Qt);
1626
+ return r === null || r === "" ? null : {
1627
+ kind: n,
1628
+ id: r
1629
+ };
1630
+ }, Ma = () => {
1631
+ const e = Ut((a) => a.hover.primary), { layers: n, coordSystem: r } = L(Ne((a) => ({
1632
+ layers: a.layers,
1633
+ coordSystem: a.coordSystem
1634
+ }))), { anchorResolver: o } = E();
1635
+ return P(() => {
1636
+ if (e === null) return null;
1637
+ const a = n.find((c) => c.id === e.layerId);
1638
+ if (a === void 0) return null;
1639
+ const i = o.resolve(a.geom, e.observation, {
1640
+ coordSystem: r,
1641
+ position: a.position,
1642
+ purpose: "pin"
1643
+ });
1644
+ if (i === null) return null;
1645
+ const l = xn(a, e.observation);
1646
+ return l === null ? null : {
1647
+ position: i,
1648
+ color: Ln(e.observation),
1649
+ layer: a,
1650
+ at: l,
1651
+ observation: e.observation
1652
+ };
1653
+ }, [
1654
+ e,
1655
+ n,
1656
+ r,
1657
+ o
1658
+ ]);
1659
+ }, ka = { kind: "idle" }, At = () => {
1660
+ const e = ce((o) => o.standingInteraction), n = ce((o) => o.chromeUnderPointer), r = Ma();
1661
+ return P(() => e !== null ? e : r === null ? ka : {
1662
+ kind: "trigger",
1663
+ anchor: r,
1664
+ isEngaged: n === "menu-trigger"
1665
+ }, [
1666
+ e,
1667
+ r,
1668
+ n
1669
+ ]);
1670
+ }, _a = (e, n) => {
1671
+ const r = _(), o = ee(n);
1672
+ T(() => {
1673
+ let a = null, i = null;
1674
+ const l = (h) => {
1675
+ const { menuTrigger: v } = r.getState();
1676
+ return v === null ? null : rt(h, v) ? "menu-trigger" : null;
1677
+ }, c = () => {
1678
+ a = null;
1679
+ const h = i;
1680
+ if (i = null, h === null) return;
1681
+ const v = o.current, m = r.getState();
1682
+ m.setChromeUnderPointer(l({
1683
+ x: h.x - v.x,
1684
+ y: h.y - v.y
1685
+ })), m.standingInteraction?.kind !== "menu" && m.setEditTargetUnderPointer(Pt(h.x, h.y, e));
1686
+ }, s = () => {
1687
+ const h = r.getState();
1688
+ h.setChromeUnderPointer(null), h.setEditTargetUnderPointer(null);
1689
+ }, d = (h) => {
1690
+ i = {
1691
+ x: h.clientX,
1692
+ y: h.clientY
1693
+ }, a === null && (a = requestAnimationFrame(c));
1694
+ }, u = () => {
1695
+ i = null, a !== null && (cancelAnimationFrame(a), a = null), s();
1696
+ };
1697
+ return e.addEventListener("pointermove", d), e.addEventListener("pointerleave", u), () => {
1698
+ a !== null && cancelAnimationFrame(a), e.removeEventListener("pointermove", d), e.removeEventListener("pointerleave", u), s();
1699
+ };
1700
+ }, [
1701
+ e,
1702
+ r,
1703
+ o
1704
+ ]);
1705
+ }, qe = "editor", Ve = [], Ra = (e, n, r, o) => {
1706
+ const a = At(), { store: i } = Ie(), l = Je().length > 0, c = ce((u) => u.menuTrigger), s = a.kind === "menu", d = P(() => c === null ? Ve : [wn(c)], [c]);
1707
+ _a(e, n), Da(a, e, n, r), Aa(e), Na(e), Pa(e, o), T(() => (i.getState().publishPointerRegions(qe, d), () => i.getState().publishPointerRegions(qe, Ve)), [i, d]), T(() => (i.getState().setPointerSuspended(s || l), () => i.getState().setPointerSuspended(!1)), [
1708
+ i,
1709
+ s,
1710
+ l
1711
+ ]), T(() => {
1712
+ if (!l) return;
1713
+ const u = i.getState();
1714
+ u.setHoverState(et), u.setTooltipAnchor(null);
1715
+ }, [i, l]);
1716
+ }, Da = (e, n, r, o) => {
1717
+ const a = _(), { selectionStore: i } = E(), { store: l, engine: c } = Ie(), s = ee(e), d = ee(r), u = ee(o);
1718
+ T(() => {
1719
+ const h = (b) => {
1720
+ const { menuTrigger: f } = a.getState();
1721
+ return f === null ? !1 : rt(Ge(b, d.current), f);
1722
+ }, v = (b) => {
1723
+ if (h(b) || i.getState().selection.length > 0) return;
1724
+ const f = u.current, y = Ge(b, d.current), O = za(y, f) ? c.query(Ae(y, f)) : et;
1725
+ l.getState().setHoverState(O);
1726
+ };
1727
+ let m = !1;
1728
+ const g = () => {
1729
+ m = s.current.kind === "menu";
1730
+ }, x = (b) => {
1731
+ const f = Pt(b.clientX, b.clientY, n), y = i.getState();
1732
+ if (f === null) {
1733
+ y.clearSelection();
1734
+ return;
1735
+ }
1736
+ y.setSelection([f]);
1737
+ }, S = (b) => {
1738
+ if (qn(b.target)) return;
1739
+ const { claimInteraction: f, releaseInteraction: y } = a.getState(), O = h(b);
1740
+ if (!O || m) {
1741
+ y("menu"), O || x(b), m && v(b);
1742
+ return;
1743
+ }
1744
+ const oe = s.current;
1745
+ oe.kind === "trigger" && f({
1746
+ kind: "menu",
1747
+ anchor: oe.anchor
1748
+ });
1749
+ };
1750
+ return document.addEventListener("pointerdown", g, !0), document.addEventListener("click", S), () => {
1751
+ document.removeEventListener("pointerdown", g, !0), document.removeEventListener("click", S);
1752
+ };
1753
+ }, [
1754
+ a,
1755
+ i,
1756
+ n,
1757
+ s,
1758
+ l,
1759
+ c,
1760
+ d,
1761
+ u
1762
+ ]);
1763
+ }, Ge = (e, n) => ({
1764
+ x: e.clientX - n.x,
1765
+ y: e.clientY - n.y
1766
+ }), za = (e, n) => e.x >= 0 && e.x <= n.width && e.y >= 0 && e.y <= n.height, Fa = ({ frameElement: e, panelRect: n }) => {
1767
+ const { measureRef: r, screenRect: o } = Zt(), a = _();
1768
+ return T(() => (r(e), () => r(null)), [r, e]), T(() => () => a.getState().releaseInteraction("menu"), [a]), o === null ? null : /* @__PURE__ */ t(Gn, { children: /* @__PURE__ */ t(Ka, {
1769
+ frameElement: e,
1770
+ frameRect: o,
1771
+ panelRect: n
1772
+ }) });
1773
+ }, Ka = ({ frameElement: e, frameRect: n, panelRect: r }) => {
1774
+ const o = P(() => ({
1775
+ x: n.left + r.x,
1776
+ y: n.top + r.y
1777
+ }), [
1778
+ n.left,
1779
+ n.top,
1780
+ r.x,
1781
+ r.y
1782
+ ]), [a, i] = D(null);
1783
+ return Ra(e, o, r, a), /* @__PURE__ */ t(Ha, {
1784
+ frameElement: e,
1785
+ frameRect: n,
1786
+ panelOrigin: o,
1787
+ panelRect: r,
1788
+ boxRef: i
1789
+ });
1790
+ }, Ha = ({ frameElement: e, frameRect: n, panelOrigin: r, panelRect: o, boxRef: a }) => {
1791
+ const i = Te(), l = At();
1792
+ return /* @__PURE__ */ t($t, {
1793
+ rect: n,
1794
+ zIndex: jt.editorOverlay,
1795
+ container: i,
1796
+ "data-testid": "editor-overlay",
1797
+ boxRef: a,
1798
+ children: /* @__PURE__ */ p(re, { children: [
1799
+ /* @__PURE__ */ t(ha, {
1800
+ panelRect: o,
1801
+ panelOrigin: r,
1802
+ frameRect: n,
1803
+ frameElement: e
1804
+ }),
1805
+ /* @__PURE__ */ t(wa, {
1806
+ interaction: l,
1807
+ panelRect: o
1808
+ }),
1809
+ /* @__PURE__ */ t(Tr, {
1810
+ interaction: l,
1811
+ panelOrigin: r
1812
+ })
1813
+ ] })
1814
+ });
1815
+ }, Ni = ({ slots: e, ...n }) => /* @__PURE__ */ t(Yt, { children: /* @__PURE__ */ t(Xt, {
1816
+ slots: P(() => ({
1817
+ EditorSurface: Fa,
1818
+ ...e
1819
+ }), [e]),
1820
+ ...n
1821
+ }) }), Nt = ae(null), Tt = ({ labelId: e, controlId: n, children: r }) => {
1822
+ const o = P(() => {
1823
+ let a = null;
1824
+ return {
1825
+ labelId: e,
1826
+ controlId: n,
1827
+ claimControlId: (i) => (a ??= i, a === i)
1828
+ };
1829
+ }, [e, n]);
1830
+ return /* @__PURE__ */ t(Nt.Provider, {
1831
+ value: o,
1832
+ children: r
1833
+ });
1834
+ }, B = ({ id: e, ariaLabel: n, ariaLabelledBy: r }, o = !0) => {
1835
+ const a = X(Nt), i = ne(), [l] = D(() => o ? a?.claimControlId(i) ?? !1 : !1), c = e ?? (l ? a?.controlId : void 0), s = r ?? (n === void 0 ? a?.labelId : void 0);
1836
+ return {
1837
+ ...c !== void 0 && { id: c },
1838
+ ...n !== void 0 && { "aria-label": n },
1839
+ ...s !== void 0 && { "aria-labelledby": s }
1840
+ };
1841
+ };
1842
+ var Ba = {
1843
+ default: "woi4bh4 woi4bh3",
1844
+ tile: "woi4bh5 woi4bh3"
1845
+ }, qa = ({ label: e, icon: n, onClick: r, variant: o = "default", isDisabled: a, ariaLabel: i, ariaLabelledBy: l, id: c }) => {
1846
+ const s = B({
1847
+ id: c,
1848
+ ariaLabel: i,
1849
+ ariaLabelledBy: l
1850
+ }), d = o === "tile";
1851
+ return /* @__PURE__ */ p("button", {
1852
+ type: "button",
1853
+ className: Ba[o],
1854
+ disabled: a,
1855
+ onClick: r,
1856
+ ...s,
1857
+ children: [n !== void 0 && /* @__PURE__ */ t("span", {
1858
+ className: "woi4bh0",
1859
+ children: n
1860
+ }), e !== void 0 && /* @__PURE__ */ t("span", {
1861
+ className: d ? "woi4bh2" : "woi4bh1",
1862
+ children: e
1863
+ })]
1864
+ });
1865
+ }, Le = ae(null), R = () => {
1866
+ const e = X(Le);
1867
+ 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>.");
1868
+ return e;
1869
+ }, Ot = ({ children: e, onKeyDown: n, ...r }) => {
1870
+ const o = X(Le);
1871
+ return /* @__PURE__ */ t("div", {
1872
+ onKeyDown: (i) => {
1873
+ if (n?.(i), !o || i.defaultPrevented) return;
1874
+ const l = tn(i.nativeEvent);
1875
+ l && (i.preventDefault(), l === "undo" ? o.undo() : o.redo());
1876
+ },
1877
+ ...r,
1878
+ children: e
1879
+ });
1880
+ }, Lt = "keyboard", ge = (e) => {
1881
+ const n = ue(!1), r = ue(!1), o = () => {
1882
+ n.current = !1, r.current && (r.current = !1, e?.());
1883
+ };
1884
+ return {
1885
+ commitAfterChange: () => {
1886
+ if (n.current) {
1887
+ r.current = !0;
1888
+ return;
1889
+ }
1890
+ e?.();
1891
+ },
1892
+ commitUnlessHeldKey: (a) => {
1893
+ if (a) {
1894
+ r.current = !0;
1895
+ return;
1896
+ }
1897
+ e?.();
1898
+ },
1899
+ gestureHandlers: {
1900
+ onKeyDown: () => {
1901
+ n.current = !0;
1902
+ },
1903
+ onKeyUp: o,
1904
+ onBlur: (a) => {
1905
+ a.relatedTarget instanceof Node && a.currentTarget.contains(a.relatedTarget) || o();
1906
+ }
1907
+ }
1908
+ };
1909
+ }, Va = "eh8dvc0", Ga = "eh8dvc1 uz3g760", Ua = "eh8dvc2 uz3g761";
1910
+ var $a = ({ value: e, onChange: n, onCommit: r, min: o, max: a, step: i, prefix: l, suffix: c, isDisabled: s, hasError: d, ariaLabel: u, ariaLabelledBy: h, id: v }) => {
1911
+ const m = B({
1912
+ id: v,
1913
+ ariaLabel: u,
1914
+ ariaLabelledBy: h
1915
+ }), { commitUnlessHeldKey: g, gestureHandlers: x } = ge(r);
1916
+ return /* @__PURE__ */ t(ze.Root, {
1917
+ className: Va,
1918
+ value: e,
1919
+ onValueChange: (S) => n(S),
1920
+ onValueCommitted: (S, b) => {
1921
+ g(b.reason === Lt);
1922
+ },
1923
+ min: o,
1924
+ max: a,
1925
+ step: i,
1926
+ disabled: s,
1927
+ children: /* @__PURE__ */ p(Ot, {
1928
+ className: Ga,
1929
+ "data-error": d === !0,
1930
+ "data-disabled": s === !0 ? "" : void 0,
1931
+ children: [
1932
+ l !== void 0 && /* @__PURE__ */ t("span", {
1933
+ className: "eh8dvc3",
1934
+ children: l
1935
+ }),
1936
+ /* @__PURE__ */ t(ze.Input, {
1937
+ className: Ua,
1938
+ ...x,
1939
+ "aria-invalid": d === !0 ? !0 : void 0,
1940
+ ...m
1941
+ }),
1942
+ c !== void 0 && /* @__PURE__ */ t("span", {
1943
+ className: "eh8dvc3",
1944
+ children: c
1945
+ })
1946
+ ]
1947
+ })
1948
+ });
1949
+ }, Za = "_1b7s5f0", j = {
1950
+ 1: "_1b7s5f1",
1951
+ 2: "_1b7s5f2",
1952
+ 3: "_1b7s5f3",
1953
+ 4: "_1b7s5f4",
1954
+ 5: "_1b7s5f5",
1955
+ 6: "_1b7s5f6"
1956
+ }, ja = "_1b7s5f7";
1957
+ var Wa = 6, Xa = ({ options: e, value: n, onChange: r, onCommit: o, columns: a, itemLayout: i = "tile", isDisabled: l, ariaLabel: c, ariaLabelledBy: s, id: d }) => {
1958
+ const u = B({
1959
+ id: d,
1960
+ ariaLabel: c,
1961
+ ariaLabelledBy: s
1962
+ }), h = i === "swatch", { commitAfterChange: v, gestureHandlers: m } = ge(o);
1963
+ return /* @__PURE__ */ t(it, {
1964
+ className: W(Za, Ya(a ?? e.length)),
1965
+ value: n,
1966
+ onValueChange: (g) => {
1967
+ r(g), v();
1968
+ },
1969
+ ...m,
1970
+ disabled: l,
1971
+ ...u,
1972
+ children: e.map((g) => /* @__PURE__ */ p(ot.Root, {
1973
+ value: g.value,
1974
+ disabled: g.isDisabled,
1975
+ className: W(ja, h && "_1b7s5f8"),
1976
+ "aria-label": h ? g.label : void 0,
1977
+ children: [g.icon, !h && /* @__PURE__ */ t("span", {
1978
+ className: "_1b7s5f9",
1979
+ children: g.label
1980
+ })]
1981
+ }, g.value))
1982
+ });
1983
+ }, Ya = (e) => {
1984
+ switch (Math.min(Math.max(Math.round(e), 1), Wa)) {
1985
+ case 1:
1986
+ return j[1];
1987
+ case 2:
1988
+ return j[2];
1989
+ case 3:
1990
+ return j[3];
1991
+ case 4:
1992
+ return j[4];
1993
+ case 5:
1994
+ return j[5];
1995
+ default:
1996
+ return j[6];
1997
+ }
1998
+ }, Qa = "_1g5x15w0 uz3g760", Ja = "_1g5x15w1", eo = "_1g5x15w2", Ue = "_1g5x15w3", to = "_1g5x15w4", no = "_1g5x15w5", ro = "_1g5x15w6", ao = "_1g5x15w7";
1999
+ var oo = ({ options: e, value: n, onChange: r, placeholder: o, isDisabled: a, hasError: i, ariaLabel: l, ariaLabelledBy: c, id: s }) => {
2000
+ const d = B({
2001
+ id: s,
2002
+ ariaLabel: l,
2003
+ ariaLabelledBy: c
2004
+ });
2005
+ return /* @__PURE__ */ p(k.Root, {
2006
+ value: n,
2007
+ onValueChange: (u) => u !== null && r(u),
2008
+ disabled: a,
2009
+ items: e.map((u) => ({
2010
+ value: u.value,
2011
+ label: u.label
2012
+ })),
2013
+ children: [/* @__PURE__ */ p(k.Trigger, {
2014
+ className: Qa,
2015
+ "data-error": i === !0,
2016
+ ...d,
2017
+ children: [/* @__PURE__ */ t(k.Value, {
2018
+ className: Ja,
2019
+ children: (u) => io(e, u, o)
2020
+ }), /* @__PURE__ */ t(k.Icon, {
2021
+ className: Ue,
2022
+ children: /* @__PURE__ */ t(me, { size: "sm" })
2023
+ })]
2024
+ }), /* @__PURE__ */ t(k.Portal, {
2025
+ container: xe(),
2026
+ children: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(k.Positioner, {
2027
+ className: to,
2028
+ sideOffset: 4,
2029
+ alignItemWithTrigger: !1,
2030
+ children: /* @__PURE__ */ t(k.Popup, {
2031
+ className: no,
2032
+ children: e.map((u) => /* @__PURE__ */ p(k.Item, {
2033
+ value: u.value,
2034
+ disabled: u.isDisabled,
2035
+ className: ro,
2036
+ children: [
2037
+ u.icon,
2038
+ /* @__PURE__ */ p("span", {
2039
+ className: ao,
2040
+ children: [/* @__PURE__ */ t(k.ItemText, { children: u.label }), u.description !== void 0 && /* @__PURE__ */ t("span", {
2041
+ className: "_1g5x15w8",
2042
+ children: u.description
2043
+ })]
2044
+ }),
2045
+ /* @__PURE__ */ t(k.ItemIndicator, {
2046
+ className: Ue,
2047
+ children: /* @__PURE__ */ t(nn, { size: "sm" })
2048
+ })
2049
+ ]
2050
+ }, u.value))
2051
+ })
2052
+ }) })
2053
+ })]
2054
+ });
2055
+ }, io = (e, n, r) => n === null ? /* @__PURE__ */ t("span", {
2056
+ className: eo,
2057
+ children: r
2058
+ }) : lo(e, n), lo = (e, n) => e.find((r) => r.value === n)?.label ?? n, so = "vod76w0", co = "vod76w1", uo = "vod76w2", ho = "vod76w3", mo = "vod76w4", po = "vod76w5";
2059
+ var vo = ({ value: e, onChange: n, onCommit: r, min: o, max: a, step: i, suffix: l, formatValue: c, isDisabled: s, ariaLabel: d, ariaLabelledBy: u }) => {
2060
+ const h = B({
2061
+ ariaLabel: d,
2062
+ ariaLabelledBy: u
2063
+ }, !1), v = go(e, l, c), { commitUnlessHeldKey: m, gestureHandlers: g } = ge(r);
2064
+ return /* @__PURE__ */ p("div", {
2065
+ className: so,
2066
+ children: [/* @__PURE__ */ t(Y.Root, {
2067
+ className: co,
2068
+ value: e,
2069
+ onValueChange: (x) => n(x),
2070
+ onValueCommitted: (x, S) => {
2071
+ m(S.reason === Lt);
2072
+ },
2073
+ min: o,
2074
+ max: a,
2075
+ step: i,
2076
+ disabled: s,
2077
+ children: /* @__PURE__ */ t(Y.Control, {
2078
+ className: uo,
2079
+ children: /* @__PURE__ */ p(Y.Track, {
2080
+ className: ho,
2081
+ children: [/* @__PURE__ */ t(Y.Indicator, { className: mo }), /* @__PURE__ */ t(Y.Thumb, {
2082
+ className: po,
2083
+ ...g,
2084
+ ...h
2085
+ })]
2086
+ })
2087
+ })
2088
+ }), v !== null && /* @__PURE__ */ t("span", {
2089
+ className: "vod76w6",
2090
+ children: v
2091
+ })]
2092
+ });
2093
+ }, go = (e, n, r) => r !== void 0 ? r(e) : n !== void 0 ? `${e}${n}` : null, fo = "_1hyrlw60", bo = "_1hyrlw61", Co = ({ isChecked: e, onChange: n, isDisabled: r, ariaLabel: o, ariaLabelledBy: a, id: i }) => {
2094
+ const l = B({
2095
+ id: i,
2096
+ ariaLabel: o,
2097
+ ariaLabelledBy: a
2098
+ });
2099
+ return /* @__PURE__ */ t(Fe.Root, {
2100
+ checked: e,
2101
+ onCheckedChange: (c) => n(c),
2102
+ disabled: r,
2103
+ className: fo,
2104
+ ...l,
2105
+ children: /* @__PURE__ */ t(Fe.Thumb, { className: bo })
2106
+ });
2107
+ }, So = "uz3g761", yo = "tpcnun0 uz3g760", wo = ({ value: e, onChange: n, onCommit: r, placeholder: o, isDisabled: a, hasError: i, ariaLabel: l, ariaLabelledBy: c, id: s }) => {
2108
+ const d = B({
2109
+ id: s,
2110
+ ariaLabel: l,
2111
+ ariaLabelledBy: c
2112
+ });
2113
+ return /* @__PURE__ */ t(Ot, {
2114
+ className: yo,
2115
+ "data-error": i === !0,
2116
+ children: /* @__PURE__ */ t(Fn, {
2117
+ className: So,
2118
+ value: e,
2119
+ onValueChange: (u) => n(u),
2120
+ onBlur: r,
2121
+ placeholder: o,
2122
+ disabled: a,
2123
+ "aria-invalid": i === !0 ? !0 : void 0,
2124
+ ...d
2125
+ })
2126
+ });
2127
+ }, xo = "cnu9yl0", Io = "cnu9yl1";
2128
+ var Po = ({ options: e, value: n, onChange: r, onCommit: o, itemLayout: a = "inline", isDisabled: i, ariaLabel: l, ariaLabelledBy: c, id: s }) => {
2129
+ const d = B({
2130
+ id: s,
2131
+ ariaLabel: l,
2132
+ ariaLabelledBy: c
2133
+ }), u = a === "stacked", { commitAfterChange: h, gestureHandlers: v } = ge(o);
2134
+ return /* @__PURE__ */ t(it, {
2135
+ className: xo,
2136
+ value: n,
2137
+ onValueChange: (m) => {
2138
+ r(m), h();
2139
+ },
2140
+ ...v,
2141
+ disabled: i,
2142
+ ...d,
2143
+ children: e.map((m) => /* @__PURE__ */ p(ot.Root, {
2144
+ value: m.value,
2145
+ disabled: m.isDisabled,
2146
+ className: W(Io, u && "cnu9yl2"),
2147
+ "aria-label": Ao(m, u),
2148
+ children: [m.icon, Et(m, u) && /* @__PURE__ */ t("span", {
2149
+ className: "cnu9yl3",
2150
+ children: m.label
2151
+ })]
2152
+ }, m.value))
2153
+ });
2154
+ }, Et = (e, n) => e.icon === void 0 || n, Ao = (e, n) => {
2155
+ if (!Et(e, n))
2156
+ return e.label;
2157
+ }, Mt = {
2158
+ ToggleGroup: Po,
2159
+ Switch: Co,
2160
+ Slider: vo,
2161
+ RadioGrid: Xa,
2162
+ Button: qa,
2163
+ TextField: wo,
2164
+ NumberField: $a,
2165
+ Select: oo
2166
+ }, kt = ae(Mt), No = ({ controls: e, children: n }) => {
2167
+ const r = P(() => ({
2168
+ ...Mt,
2169
+ ...e
2170
+ }), [e]);
2171
+ return /* @__PURE__ */ t(kt.Provider, {
2172
+ value: r,
2173
+ children: n
2174
+ });
2175
+ }, M = () => X(kt), To = "_12lhx9e0", Oo = ({ children: e }) => /* @__PURE__ */ t("div", {
2176
+ className: To,
2177
+ children: e
2178
+ }), Lo = "_139ohwv0", q = ({ children: e }) => /* @__PURE__ */ t("div", {
2179
+ className: Lo,
2180
+ children: e
2181
+ }), _t = ae(null), Eo = _t.Provider, Mo = () => {
2182
+ const e = X(_t);
2183
+ if (!e) throw new Error("A section must be rendered inside <EditorPanel.Root>.");
2184
+ return e;
2185
+ }, ko = "_1jlczkt0", _o = "data-graphy-editor-panel", Ro = {
2186
+ List: q,
2187
+ Grid: Oo
2188
+ }, Do = ({ handle: e, children: n, controls: r, defaultExpandedSection: o = void 0, className: a }) => {
2189
+ const i = Jt(e), [l, c] = D(() => o ? [o] : []), s = P(() => ({
2190
+ expandSection: (d) => c([d]),
2191
+ collapseAllSections: () => c([])
2192
+ }), []);
2193
+ return /* @__PURE__ */ t(Le.Provider, {
2194
+ value: i,
2195
+ children: /* @__PURE__ */ t(No, {
2196
+ controls: r,
2197
+ children: /* @__PURE__ */ t(Eo, {
2198
+ value: s,
2199
+ children: /* @__PURE__ */ t(J.Root, {
2200
+ [_o]: "",
2201
+ className: W(ko, a),
2202
+ value: l,
2203
+ onValueChange: (d) => c(d),
2204
+ children: n
2205
+ })
2206
+ })
2207
+ })
2208
+ });
2209
+ }, Rt = {
2210
+ Root: Do,
2211
+ Controls: Ro
2212
+ }, $e = {
2213
+ stack: "pr583x0",
2214
+ grid: "pr583x1"
2215
+ }, Ze = "pr583x2", zo = "pr583x3", w = ({ label: e, layout: n = "grid", children: r }) => {
2216
+ const o = ne(), a = ne();
2217
+ return e === void 0 ? /* @__PURE__ */ t("div", {
2218
+ className: $e[n],
2219
+ children: /* @__PURE__ */ t("div", {
2220
+ className: Ze,
2221
+ children: r
2222
+ })
2223
+ }) : /* @__PURE__ */ p("div", {
2224
+ className: $e[n],
2225
+ children: [/* @__PURE__ */ t("label", {
2226
+ id: o,
2227
+ htmlFor: a,
2228
+ className: zo,
2229
+ children: e
2230
+ }), /* @__PURE__ */ t("div", {
2231
+ className: Ze,
2232
+ children: /* @__PURE__ */ t(Tt, {
2233
+ labelId: o,
2234
+ controlId: a,
2235
+ children: r
2236
+ })
2237
+ })]
2238
+ });
2239
+ }, Fo = (e) => /* @__PURE__ */ t(N, {
2240
+ ...e,
2241
+ children: /* @__PURE__ */ t("g", {
2242
+ stroke: "currentColor",
2243
+ strokeWidth: 2,
2244
+ strokeLinecap: "round",
2245
+ strokeLinejoin: "round",
2246
+ children: /* @__PURE__ */ t("path", { d: "m9 6 6 6-6 6" })
2247
+ })
2248
+ }), Ee = "_40zvwv0", Me = "_40zvwv1", Ko = "_40zvwv2", Dt = "_40zvwv3", Ho = "_40zvwv4 _40zvwv3";
2249
+ var Bo = "_40zvwv6";
2250
+ var qo = "_40zvwv8", z = ({ title: e, layout: n = "fixed", preview: r, accessory: o, onOpenChange: a, children: i }) => n === "collapsible" ? /* @__PURE__ */ t(Go, {
2251
+ title: e,
2252
+ preview: r,
2253
+ accessory: o,
2254
+ onOpenChange: a,
2255
+ children: i
2256
+ }) : n === "inline" && r === void 0 ? /* @__PURE__ */ t(Vo, {
2257
+ title: e,
2258
+ accessory: o,
2259
+ children: i
2260
+ }) : /* @__PURE__ */ p("div", {
2261
+ className: Ee,
2262
+ children: [/* @__PURE__ */ p("div", {
2263
+ className: Me,
2264
+ children: [
2265
+ /* @__PURE__ */ t("span", {
2266
+ className: Dt,
2267
+ children: e
2268
+ }),
2269
+ r !== void 0 && /* @__PURE__ */ t("span", {
2270
+ className: "_40zvwv5",
2271
+ children: r
2272
+ }),
2273
+ o !== void 0 && /* @__PURE__ */ t("span", {
2274
+ className: "_40zvwv7",
2275
+ children: o
2276
+ })
2277
+ ]
2278
+ }), /* @__PURE__ */ t("div", { children: i })]
2279
+ }), Vo = ({ title: e, accessory: n, children: r }) => {
2280
+ const o = ne(), a = ne();
2281
+ return /* @__PURE__ */ t("div", {
2282
+ className: Ee,
2283
+ children: /* @__PURE__ */ p("div", {
2284
+ className: Me,
2285
+ children: [
2286
+ /* @__PURE__ */ t("label", {
2287
+ id: o,
2288
+ htmlFor: a,
2289
+ className: Ho,
2290
+ children: e
2291
+ }),
2292
+ /* @__PURE__ */ t("span", {
2293
+ className: Bo,
2294
+ children: /* @__PURE__ */ t(Tt, {
2295
+ labelId: o,
2296
+ controlId: a,
2297
+ children: r
2298
+ })
2299
+ }),
2300
+ n !== void 0 && /* @__PURE__ */ t("span", {
2301
+ className: "_40zvwv7",
2302
+ children: n
2303
+ })
2304
+ ]
2305
+ })
2306
+ });
2307
+ }, Go = ({ title: e, preview: n, accessory: r, onOpenChange: o, children: a }) => {
2308
+ const i = A();
2309
+ return /* @__PURE__ */ p(J.Item, {
2310
+ value: e,
2311
+ className: Ee,
2312
+ onOpenChange: o,
2313
+ children: [/* @__PURE__ */ p(J.Header, {
2314
+ className: Me,
2315
+ render: /* @__PURE__ */ t("div", {}),
2316
+ children: [
2317
+ /* @__PURE__ */ t(J.Trigger, {
2318
+ className: Ko,
2319
+ "aria-label": i("editor.accessibility.toggleSection", { title: e })
2320
+ }),
2321
+ /* @__PURE__ */ t("span", {
2322
+ className: Dt,
2323
+ children: e
2324
+ }),
2325
+ n !== void 0 && /* @__PURE__ */ t("span", {
2326
+ className: "_40zvwv5",
2327
+ children: n
2328
+ }),
2329
+ r !== void 0 && /* @__PURE__ */ t("span", {
2330
+ className: "_40zvwv7",
2331
+ children: r
2332
+ }),
2333
+ /* @__PURE__ */ t("span", {
2334
+ className: qo,
2335
+ children: /* @__PURE__ */ t(Fo, { size: "sm" })
2336
+ })
2337
+ ]
2338
+ }), /* @__PURE__ */ t(J.Panel, { children: /* @__PURE__ */ t("div", { children: a }) })]
2339
+ });
2340
+ }, Ti = ({ title: e, isChecked: n, onToggle: r, isDisabled: o, preview: a, children: i }) => {
2341
+ const { expandSection: l, collapseAllSections: c } = Mo(), { Switch: s } = M();
2342
+ return /* @__PURE__ */ t(z, {
2343
+ title: e,
2344
+ layout: "collapsible",
2345
+ preview: a,
2346
+ onOpenChange: (h) => {
2347
+ h && !n && o !== !0 && r(!0);
2348
+ },
2349
+ accessory: /* @__PURE__ */ t(s, {
2350
+ isChecked: n,
2351
+ onChange: (h) => {
2352
+ r(h), h ? l(e) : c();
2353
+ },
2354
+ isDisabled: o,
2355
+ ariaLabel: e
2356
+ }),
2357
+ children: i
2358
+ });
2359
+ }, je = {
2360
+ x: ["bottom", "top"],
2361
+ y: ["left", "right"]
2362
+ }, Uo = {
2363
+ left: "editor.axesPanel.position.left",
2364
+ right: "editor.axesPanel.position.right",
2365
+ top: "editor.axesPanel.position.top",
2366
+ bottom: "editor.axesPanel.position.bottom"
2367
+ }, $o = {
2368
+ x: "editor.axesPanel.mainAxisSection.xAxis",
2369
+ y: "editor.axesPanel.mainAxisSection.yAxis"
2370
+ }, We = ({ axis: e, title: n, layout: r = "collapsible", preview: o }) => {
2371
+ const a = R(), i = H(a), l = A(), { NumberField: c, Switch: s, ToggleGroup: d } = M();
2372
+ if (!i) return null;
2373
+ const u = i.config.axes[e], h = i.scales[e], v = h?.spec, m = v?.scaleType === "continuous" ? v : void 0, g = v !== void 0 && "reverse" in v ? v : void 0, x = v?.scaleType === "continuous" || v?.scaleType === "datetime", S = m !== void 0 && i.layers.some((C) => C.geom === "bar"), b = m?.transform === "log", f = m?.domainMax ?? null, y = Zo(m), O = (C, Z) => C.map((ie) => ({
2374
+ value: ie,
2375
+ label: Z(ie)
2376
+ })), oe = je[e].map((C) => ({
2377
+ value: C,
2378
+ label: l(Uo[C])
2379
+ })), zt = O(["auto", "edges"], (C) => l(C === "edges" ? "editor.axesPanel.labelMode.edges" : "editor.axesPanel.labelMode.auto")), Ft = O(["linear", "log"], (C) => l(C === "log" ? "editor.axesPanel.scale.log" : "editor.axesPanel.scale.auto")), Kt = O([
2380
+ "auto",
2381
+ "zero",
2382
+ "custom"
2383
+ ], (C) => l(C === "zero" ? "editor.axesPanel.startFrom.zero" : C === "custom" ? "editor.axesPanel.startFrom.custom" : "editor.axesPanel.startFrom.auto")), Ht = O(["auto", "custom"], (C) => l(C === "custom" ? "editor.axesPanel.endAt.custom" : "editor.axesPanel.endAt.auto")), Bt = O(["no", "yes"], (C) => l(C === "yes" ? "editor.axesPanel.yesNo.yes" : "editor.axesPanel.yesNo.no")), _e = (C) => {
2384
+ a.commands.dispatch(new le({
2385
+ scaledAesthetic: e,
2386
+ ...C
2387
+ }), { transient: !0 });
2388
+ }, qt = (C) => {
2389
+ if (m) {
2390
+ if (C === "custom") {
2391
+ m.zero && a.commands.dispatch(new De({
2392
+ scaledAesthetic: e,
2393
+ zero: !1
2394
+ })), a.commands.dispatch(new le({
2395
+ scaledAesthetic: e,
2396
+ domainMin: Xe(h?.domain, "start")
2397
+ }));
2398
+ return;
2399
+ }
2400
+ m.domainMin !== null && a.commands.dispatch(new le({
2401
+ scaledAesthetic: e,
2402
+ domainMin: null
2403
+ })), a.commands.dispatch(new De({
2404
+ scaledAesthetic: e,
2405
+ zero: C === "zero"
2406
+ }));
2407
+ }
2408
+ }, Vt = (C) => {
2409
+ const Z = C === "custom" ? Xe(h?.domain, "end") : null;
2410
+ a.commands.dispatch(new le({
2411
+ scaledAesthetic: e,
2412
+ domainMax: Z
2413
+ }));
2414
+ }, Gt = (C) => {
2415
+ const Z = je[e].find((ie) => ie === C);
2416
+ Z && a.commands.dispatch(new dn({
2417
+ axis: e,
2418
+ position: Z
2419
+ }));
2420
+ };
2421
+ return /* @__PURE__ */ t(z, {
2422
+ title: n ?? l($o[e]),
2423
+ layout: r,
2424
+ preview: o,
2425
+ children: /* @__PURE__ */ p(q, { children: [
2426
+ /* @__PURE__ */ t(w, {
2427
+ label: l("editor.axesPanel.controls.visible"),
2428
+ children: /* @__PURE__ */ t(s, {
2429
+ isChecked: u.isVisible,
2430
+ onChange: (C) => a.commands.dispatch(new hn({
2431
+ axis: e,
2432
+ isVisible: C
2433
+ }))
2434
+ })
2435
+ }),
2436
+ x && /* @__PURE__ */ t(w, {
2437
+ label: l("editor.axesPanel.controls.labels"),
2438
+ children: /* @__PURE__ */ t(d, {
2439
+ value: u.ticks.mode,
2440
+ options: zt,
2441
+ onChange: (C) => a.commands.dispatch(new un({
2442
+ axis: e,
2443
+ tickMode: C === "edges" ? "edges" : "auto"
2444
+ }))
2445
+ })
2446
+ }),
2447
+ m && /* @__PURE__ */ t(w, {
2448
+ label: l("editor.axesPanel.controls.position"),
2449
+ children: /* @__PURE__ */ t(d, {
2450
+ value: u.position,
2451
+ options: oe,
2452
+ onChange: Gt
2453
+ })
2454
+ }),
2455
+ g !== void 0 && /* @__PURE__ */ t(w, {
2456
+ label: l("editor.axesPanel.controls.reverse"),
2457
+ children: /* @__PURE__ */ t(d, {
2458
+ value: g.reverse === !0 ? "yes" : "no",
2459
+ options: Bt,
2460
+ onChange: (C) => a.commands.dispatch(new Cn({
2461
+ scaledAesthetic: e,
2462
+ reverse: C === "yes"
2463
+ }))
2464
+ })
2465
+ }),
2466
+ m && !S && /* @__PURE__ */ t(w, {
2467
+ label: l("editor.axesPanel.controls.scale"),
2468
+ children: /* @__PURE__ */ t(d, {
2469
+ value: b ? "log" : "linear",
2470
+ options: Ft,
2471
+ onChange: (C) => a.commands.dispatch(new Sn({
2472
+ scaledAesthetic: e,
2473
+ transform: C === "log" ? "log" : "linear"
2474
+ }))
2475
+ })
2476
+ }),
2477
+ m && !b && /* @__PURE__ */ p(V, { children: [
2478
+ !S && /* @__PURE__ */ p(V, { children: [/* @__PURE__ */ t(w, {
2479
+ label: l("editor.axesPanel.controls.startFrom"),
2480
+ children: /* @__PURE__ */ t(d, {
2481
+ value: y,
2482
+ options: Kt,
2483
+ onChange: qt
2484
+ })
2485
+ }), y === "custom" && /* @__PURE__ */ t(w, {
2486
+ label: l("editor.axesPanel.controls.value"),
2487
+ children: /* @__PURE__ */ t(c, {
2488
+ value: m.domainMin ?? null,
2489
+ onChange: (C) => C !== null && _e({ domainMin: C }),
2490
+ onCommit: a.commands.seal
2491
+ })
2492
+ })] }),
2493
+ /* @__PURE__ */ t(w, {
2494
+ label: l("editor.axesPanel.controls.endAt"),
2495
+ children: /* @__PURE__ */ t(d, {
2496
+ value: f === null ? "auto" : "custom",
2497
+ options: Ht,
2498
+ onChange: Vt
2499
+ })
2500
+ }),
2501
+ f !== null && /* @__PURE__ */ t(w, {
2502
+ label: l("editor.axesPanel.controls.value"),
2503
+ children: /* @__PURE__ */ t(c, {
2504
+ value: f,
2505
+ onChange: (C) => C !== null && _e({ domainMax: C }),
2506
+ onCommit: a.commands.seal
2507
+ })
2508
+ })
2509
+ ] })
2510
+ ] })
2511
+ });
2512
+ }, Zo = (e) => e === void 0 ? "auto" : e.domainMin !== null && e.domainMin !== void 0 ? "custom" : e.zero === !0 ? "zero" : "auto", Xe = (e, n) => {
2513
+ const r = n === "start" ? e?.[0] : e?.[e.length - 1];
2514
+ return typeof r == "number" ? r : 0;
2515
+ }, ke = ({ value: e, onChange: n }) => {
2516
+ const r = R(), o = A(), { TextField: a } = M(), i = e !== null && typeof e != "string", l = (c) => n(c === "" ? null : c);
2517
+ return /* @__PURE__ */ t(w, {
2518
+ label: o("editor.elementsPanel.contentValue"),
2519
+ children: /* @__PURE__ */ t(a, {
2520
+ value: typeof e == "string" ? e : "",
2521
+ onChange: l,
2522
+ onCommit: r.commands.seal,
2523
+ isDisabled: i
2524
+ })
2525
+ });
2526
+ }, jo = ({ title: e, layout: n = "collapsible", preview: r }) => {
2527
+ const o = R(), a = H(o), i = A(), { Switch: l } = M();
2528
+ if (!a) return null;
2529
+ const c = a.config.content;
2530
+ return /* @__PURE__ */ t(z, {
2531
+ title: e ?? i("editor.elementsPanel.footerSection.caption"),
2532
+ layout: n,
2533
+ preview: r,
2534
+ children: /* @__PURE__ */ p(q, { children: [/* @__PURE__ */ t(w, {
2535
+ label: i("editor.elementsPanel.contentVisible"),
2536
+ children: /* @__PURE__ */ t(l, {
2537
+ isChecked: c.isCaptionVisible,
2538
+ onChange: (s) => o.commands.dispatch(new ve({
2539
+ slot: "caption",
2540
+ isVisible: s
2541
+ }))
2542
+ })
2543
+ }), /* @__PURE__ */ t(ke, {
2544
+ value: c.caption,
2545
+ onChange: (s) => o.commands.dispatch(new mn({ caption: s }), { transient: !0 })
2546
+ })] })
2547
+ });
2548
+ }, Ye = /^[a-z][a-z\d+.-]*:/i, Wo = {}, Xo = ({ title: e, layout: n = "collapsible", preview: r }) => {
2549
+ const o = R(), a = H(o), i = A(), { Switch: l } = M();
2550
+ if (!a) return null;
2551
+ const c = a.config.content;
2552
+ return /* @__PURE__ */ t(z, {
2553
+ title: e ?? i("editor.elementsPanel.sourceSection.title"),
2554
+ layout: n,
2555
+ preview: r,
2556
+ children: /* @__PURE__ */ p(q, { children: [/* @__PURE__ */ t(w, {
2557
+ label: i("editor.elementsPanel.contentVisible"),
2558
+ children: /* @__PURE__ */ t(l, {
2559
+ isChecked: c.isSourceVisible,
2560
+ onChange: (s) => o.commands.dispatch(new ve({
2561
+ slot: "source",
2562
+ isVisible: s
2563
+ }))
2564
+ })
2565
+ }), /* @__PURE__ */ t(Yo, { source: c.source ?? Wo })] })
2566
+ });
2567
+ }, Yo = ({ source: e }) => {
2568
+ const n = R(), r = A(), { TextField: o } = M(), a = (l) => {
2569
+ const c = (l.label ?? "") !== "" || (l.url ?? "") !== "";
2570
+ n.commands.dispatch(new pn({ source: c ? l : null }), { transient: !0 });
2571
+ }, i = () => {
2572
+ const l = e.url ?? "";
2573
+ l !== "" && !Ye.test(l) && a({
2574
+ ...e,
2575
+ url: `https://${l}`
2576
+ }), n.commands.seal();
2577
+ };
2578
+ return /* @__PURE__ */ p(V, { children: [/* @__PURE__ */ t(w, {
2579
+ label: r("editor.elementsPanel.sourceSection.url"),
2580
+ children: /* @__PURE__ */ t(o, {
2581
+ value: e.url ?? "",
2582
+ onChange: (l) => a({
2583
+ ...e,
2584
+ url: l
2585
+ }),
2586
+ onCommit: i,
2587
+ hasError: Ye.test(e.url ?? "") && !_n(e.url)
2588
+ })
2589
+ }), /* @__PURE__ */ t(w, {
2590
+ label: r("editor.elementsPanel.sourceSection.name"),
2591
+ children: /* @__PURE__ */ t(o, {
2592
+ value: e.label ?? "",
2593
+ onChange: (l) => a({
2594
+ ...e,
2595
+ label: l
2596
+ }),
2597
+ onCommit: n.commands.seal
2598
+ })
2599
+ })] });
2600
+ }, Qo = ({ title: e, layout: n = "collapsible", preview: r }) => {
2601
+ const o = R(), a = H(o), i = A(), { Switch: l } = M();
2602
+ if (!a) return null;
2603
+ const c = a.config.content;
2604
+ return /* @__PURE__ */ t(z, {
2605
+ title: e ?? i("editor.elementsPanel.headerSection.subtitle"),
2606
+ layout: n,
2607
+ preview: r,
2608
+ children: /* @__PURE__ */ p(q, { children: [/* @__PURE__ */ t(w, {
2609
+ label: i("editor.elementsPanel.contentVisible"),
2610
+ children: /* @__PURE__ */ t(l, {
2611
+ isChecked: c.isSubtitleVisible,
2612
+ onChange: (s) => o.commands.dispatch(new ve({
2613
+ slot: "subtitle",
2614
+ isVisible: s
2615
+ }))
2616
+ })
2617
+ }), /* @__PURE__ */ t(ke, {
2618
+ value: c.subtitle,
2619
+ onChange: (s) => o.commands.dispatch(new vn({ subtitle: s }), { transient: !0 })
2620
+ })] })
2621
+ });
2622
+ }, ye = [
2623
+ 0.8,
2624
+ 1,
2625
+ 1.2,
2626
+ 1.4,
2627
+ 1.6,
2628
+ 1.8,
2629
+ 2,
2630
+ 2.5,
2631
+ 3,
2632
+ 4
2633
+ ], Jo = ye.length / 2, ei = ({ title: e, layout: n = "collapsible", preview: r }) => {
2634
+ const o = R(), a = H(o), i = A(), { RadioGrid: l } = M();
2635
+ if (!a) return null;
2636
+ const { textScale: c } = a.config.appearance, s = (h) => i("editor.elementsPanel.textSizeSection.scaleFormat", { value: `${h}` }), d = ye.map((h) => ({
2637
+ value: `${h}`,
2638
+ label: s(h)
2639
+ })), u = (h) => {
2640
+ const v = ye.find((m) => `${m}` === h);
2641
+ v !== void 0 && o.commands.dispatch(new cn({ textScale: v }));
2642
+ };
2643
+ return /* @__PURE__ */ t(z, {
2644
+ title: e ?? i("editor.elementsPanel.textSizeSection.title"),
2645
+ layout: n,
2646
+ preview: r ?? s(c),
2647
+ children: /* @__PURE__ */ t(l, {
2648
+ value: `${c}`,
2649
+ options: d,
2650
+ columns: Jo,
2651
+ onChange: u,
2652
+ ariaLabel: i("editor.elementsPanel.textSizeSection.title")
2653
+ })
2654
+ });
2655
+ }, ti = ({ title: e, layout: n = "collapsible", preview: r }) => {
2656
+ const o = R(), a = H(o), i = A(), { Switch: l } = M();
2657
+ if (!a) return null;
2658
+ const c = a.config.content;
2659
+ return /* @__PURE__ */ t(z, {
2660
+ title: e ?? i("editor.elementsPanel.headerSection.toggleTitle"),
2661
+ layout: n,
2662
+ preview: r,
2663
+ children: /* @__PURE__ */ p(q, { children: [/* @__PURE__ */ t(w, {
2664
+ label: i("editor.elementsPanel.contentVisible"),
2665
+ children: /* @__PURE__ */ t(l, {
2666
+ isChecked: c.isTitleVisible,
2667
+ onChange: (s) => o.commands.dispatch(new ve({
2668
+ slot: "title",
2669
+ isVisible: s
2670
+ }))
2671
+ })
2672
+ }), /* @__PURE__ */ t(ke, {
2673
+ value: c.title,
2674
+ onChange: (s) => o.commands.dispatch(new gn({ title: s }), { transient: !0 })
2675
+ })] })
2676
+ });
2677
+ }, Oi = ({ children: e, ...n }) => /* @__PURE__ */ t(Rt.Root, {
2678
+ ...n,
2679
+ children: e ?? /* @__PURE__ */ p(V, { children: [
2680
+ /* @__PURE__ */ t(ti, {}),
2681
+ /* @__PURE__ */ t(Qo, {}),
2682
+ /* @__PURE__ */ t(jo, {}),
2683
+ /* @__PURE__ */ t(Xo, {}),
2684
+ /* @__PURE__ */ t(ei, {})
2685
+ ] })
2686
+ }), Li = ({ children: e, ...n }) => /* @__PURE__ */ t(Rt.Root, {
2687
+ ...n,
2688
+ children: e ?? /* @__PURE__ */ p(V, { children: [/* @__PURE__ */ t(We, { axis: "x" }), /* @__PURE__ */ t(We, { axis: "y" })] })
2689
+ }), be = [
2690
+ "top",
2691
+ "bottom",
2692
+ "left",
2693
+ "right",
2694
+ "none"
2695
+ ], Ei = ({ positions: e, title: n, layout: r = "collapsible", preview: o }) => {
2696
+ const a = R(), i = H(a), l = A(), { ToggleGroup: c } = M();
2697
+ if (!i) return null;
2698
+ const s = i.config.legend.position, d = e ?? be, u = i.guides.legends[0]?.position ?? "none", h = s === "auto" ? u : s, v = be.filter((S) => S === h || d.includes(S)).map((S) => ({
2699
+ value: S,
2700
+ label: l(`editor.graphPanel.legendSection.${S}`)
2701
+ })), m = (S) => {
2702
+ const b = be.find((f) => f === S);
2703
+ b && a.commands.dispatch(new fn({ position: b }));
2704
+ }, g = n ?? l("editor.graphPanel.legendSection.title"), x = v.find((S) => S.value === h)?.label;
2705
+ return /* @__PURE__ */ t(z, {
2706
+ title: g,
2707
+ layout: r,
2708
+ preview: o ?? x,
2709
+ children: /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(w, {
2710
+ label: l("editor.axesPanel.controls.position"),
2711
+ layout: "stack",
2712
+ children: /* @__PURE__ */ t(c, {
2713
+ value: h,
2714
+ options: v,
2715
+ onChange: m
2716
+ })
2717
+ }) })
2718
+ });
2719
+ }, ni = "k", ri = 2, ai = 5, we = [
2720
+ {
2721
+ value: "k",
2722
+ labelKey: "thousands"
2723
+ },
2724
+ {
2725
+ value: "m",
2726
+ labelKey: "millions"
2727
+ },
2728
+ {
2729
+ value: "b",
2730
+ labelKey: "billions"
2731
+ }
2732
+ ], oi = ["auto", "none"], Mi = ({ title: e, layout: n = "collapsible", preview: r }) => {
2733
+ const o = R(), a = H(o), i = A(), { NumberField: l, ToggleGroup: c } = M();
2734
+ if (!a) return null;
2735
+ const { abbreviation: s, decimals: d } = a.config.numberFormat, u = ii(s) !== void 0, h = d !== "auto", v = (f) => f.map((y) => ({
2736
+ value: y,
2737
+ label: i(`editor.graphPanel.numberFormat.options.${y}`)
2738
+ })), m = we.map(({ value: f, labelKey: y }) => ({
2739
+ value: f,
2740
+ label: i(`common.abbreviations.${y}`)
2741
+ })), g = (f) => {
2742
+ o.commands.dispatch(new bn({ abbreviation: f }));
2743
+ }, x = (f) => {
2744
+ const y = oi.find((O) => O === f);
2745
+ g(y ?? ni);
2746
+ }, S = (f) => {
2747
+ const y = we.find((O) => O.value === f);
2748
+ y && g(y.value);
2749
+ }, b = (f) => {
2750
+ o.commands.dispatch(new Re({ decimals: f === "custom" ? ri : "auto" }));
2751
+ };
2752
+ return /* @__PURE__ */ t(z, {
2753
+ title: e ?? i("editor.graphPanel.numberFormatSection.title"),
2754
+ layout: n,
2755
+ preview: r,
2756
+ children: /* @__PURE__ */ p(q, { children: [
2757
+ /* @__PURE__ */ t(w, {
2758
+ label: i("editor.graphPanel.numberFormat.abbreviationLabel"),
2759
+ children: /* @__PURE__ */ t(c, {
2760
+ value: u ? "custom" : s,
2761
+ options: v([
2762
+ "auto",
2763
+ "none",
2764
+ "custom"
2765
+ ]),
2766
+ onChange: x
2767
+ })
2768
+ }),
2769
+ u && /* @__PURE__ */ t(w, {
2770
+ label: i("editor.graphPanel.numberFormat.valueLabel"),
2771
+ children: /* @__PURE__ */ t(c, {
2772
+ value: s,
2773
+ options: m,
2774
+ onChange: S
2775
+ })
2776
+ }),
2777
+ /* @__PURE__ */ t(w, {
2778
+ label: i("editor.graphPanel.numberFormat.decimalPlacesLabel"),
2779
+ children: /* @__PURE__ */ t(c, {
2780
+ value: h ? "custom" : "auto",
2781
+ options: v(["auto", "custom"]),
2782
+ onChange: b
2783
+ })
2784
+ }),
2785
+ h && /* @__PURE__ */ t(w, {
2786
+ label: i("editor.graphPanel.numberFormat.valueLabel"),
2787
+ children: /* @__PURE__ */ t(l, {
2788
+ value: d,
2789
+ min: 0,
2790
+ max: ai,
2791
+ onChange: (f) => {
2792
+ f !== null && o.commands.dispatch(new Re({ decimals: f }), { transient: !0 });
2793
+ },
2794
+ onCommit: o.commands.seal
2795
+ })
2796
+ })
2797
+ ] })
2798
+ });
2799
+ }, ii = (e) => we.find((n) => n.value === e);
2800
+ export {
2801
+ Li as AxesPanel,
2802
+ We as AxisSection,
2803
+ qa as Button,
2804
+ jo as CaptionSection,
2805
+ Ni as EditableGraphRenderer,
2806
+ Rt as EditorPanel,
2807
+ Oi as ElementsPanel,
2808
+ si as IntlProvider,
2809
+ Ei as LegendSection,
2810
+ $a as NumberField,
2811
+ Mi as NumberFormatSection,
2812
+ _o as PANEL_ROOT_ATTRIBUTE,
2813
+ Xa as RadioGrid,
2814
+ w as Row,
2815
+ z as Section,
2816
+ oo as Select,
2817
+ vo as Slider,
2818
+ Xo as SourceSection,
2819
+ Qo as SubtitleSection,
2820
+ Co as Switch,
2821
+ wo as TextField,
2822
+ ei as TextSizeSection,
2823
+ ti as TitleSection,
2824
+ Po as ToggleGroup,
2825
+ Ti as ToggledSection,
2826
+ M as useControls,
2827
+ Mo as usePanelExpansion,
2828
+ R as usePanelGraph
2829
+ };