@carto/ps-react-ui 4.12.2 → 4.14.0

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.
Files changed (154) hide show
  1. package/dist/{category-Dnd2_j0x.js → category-CGS_eHr4.js} +2 -2
  2. package/dist/{category-Dnd2_j0x.js.map → category-CGS_eHr4.js.map} +1 -1
  3. package/dist/{change-column-DjjwoPt1.js → change-column-CiVAjOUB.js} +2 -2
  4. package/dist/{change-column-DjjwoPt1.js.map → change-column-CiVAjOUB.js.map} +1 -1
  5. package/dist/components.js +1232 -777
  6. package/dist/components.js.map +1 -1
  7. package/dist/{data-zoom-layout-CkVnm6ej.js → data-zoom-layout-D_FYdnap.js} +2 -2
  8. package/dist/{data-zoom-layout-CkVnm6ej.js.map → data-zoom-layout-D_FYdnap.js.map} +1 -1
  9. package/dist/{download-config-oJIFZ2WC.js → download-config-OKlLLSW_.js} +2 -2
  10. package/dist/{download-config-oJIFZ2WC.js.map → download-config-OKlLLSW_.js.map} +1 -1
  11. package/dist/{lasso-tool-CDFj4zKY.js → lasso-tool-YLFRgb-S.js} +182 -154
  12. package/dist/lasso-tool-YLFRgb-S.js.map +1 -0
  13. package/dist/legend/stores.js +20 -0
  14. package/dist/legend/stores.js.map +1 -0
  15. package/dist/legend.js +1536 -0
  16. package/dist/legend.js.map +1 -0
  17. package/dist/selectors-DwHj6mE2.js +388 -0
  18. package/dist/selectors-DwHj6mE2.js.map +1 -0
  19. package/dist/{spread-DYNpzgh_.js → spread-4MYPOntd.js} +2 -2
  20. package/dist/{spread-DYNpzgh_.js.map → spread-4MYPOntd.js.map} +1 -1
  21. package/dist/{table-B3ZWWhJt.js → table-CTcLOycx.js} +2 -2
  22. package/dist/{table-B3ZWWhJt.js.map → table-CTcLOycx.js.map} +1 -1
  23. package/dist/types/components/index.d.ts +5 -2
  24. package/dist/types/components/lasso-tool/geometry-toolbar.d.ts +13 -0
  25. package/dist/types/components/lasso-tool/icons.d.ts +6 -0
  26. package/dist/types/components/lasso-tool/lasso-tool.d.ts +1 -1
  27. package/dist/types/components/lasso-tool/layer-filters.d.ts +10 -0
  28. package/dist/types/components/lasso-tool/styles.d.ts +1 -1
  29. package/dist/types/components/lasso-tool/types.d.ts +62 -1
  30. package/dist/types/components/responsive-drawer/responsive-drawer.d.ts +35 -3
  31. package/dist/types/legend/components/contexts.d.ts +20 -0
  32. package/dist/types/legend/components/icons.d.ts +12 -0
  33. package/dist/types/legend/components/index.d.ts +26 -0
  34. package/dist/types/legend/components/legend-actions/legend-actions.d.ts +24 -0
  35. package/dist/types/legend/components/legend-actions/styles.d.ts +7 -0
  36. package/dist/types/legend/components/legend-category/legend-category-ui.d.ts +13 -0
  37. package/dist/types/legend/components/legend-category/styles.d.ts +52 -0
  38. package/dist/types/legend/components/legend-config-select/legend-config-select.d.ts +14 -0
  39. package/dist/types/legend/components/legend-config-select/styles.d.ts +44 -0
  40. package/dist/types/legend/components/legend-group/legend-group.d.ts +21 -0
  41. package/dist/types/legend/components/legend-group/styles.d.ts +63 -0
  42. package/dist/types/legend/components/legend-icon/legend-icon-ui.d.ts +10 -0
  43. package/dist/types/legend/components/legend-icon/styles.d.ts +52 -0
  44. package/dist/types/legend/components/legend-item/legend-item-ui.d.ts +14 -0
  45. package/dist/types/legend/components/legend-item/legend-item.d.ts +10 -0
  46. package/dist/types/legend/components/legend-item/styles.d.ts +7 -0
  47. package/dist/types/legend/components/legend-opacity/legend-opacity.d.ts +32 -0
  48. package/dist/types/legend/components/legend-opacity/styles.d.ts +23 -0
  49. package/dist/types/legend/components/legend-proportion/legend-proportion-ui.d.ts +16 -0
  50. package/dist/types/legend/components/legend-proportion/styles.d.ts +37 -0
  51. package/dist/types/legend/components/legend-ramp/legend-ramp-ui.d.ts +20 -0
  52. package/dist/types/legend/components/legend-ramp/styles.d.ts +53 -0
  53. package/dist/types/legend/components/legend-row/legend-row.d.ts +23 -0
  54. package/dist/types/legend/components/legend-row/styles.d.ts +77 -0
  55. package/dist/types/legend/components/legend-row-menu/legend-row-menu.d.ts +18 -0
  56. package/dist/types/legend/components/legend-row-menu/legend-zoom-to.d.ts +15 -0
  57. package/dist/types/legend/components/legend-swatch/legend-swatch.d.ts +26 -0
  58. package/dist/types/legend/components/legend-visibility-toggle/legend-visibility-toggle.d.ts +35 -0
  59. package/dist/types/legend/index.d.ts +88 -0
  60. package/dist/types/legend/provider/index.d.ts +6 -0
  61. package/dist/types/legend/provider/labels.d.ts +27 -0
  62. package/dist/types/legend/provider/legend-config-context.d.ts +7 -0
  63. package/dist/types/legend/provider/legend-provider.d.ts +38 -0
  64. package/dist/types/legend/stores/index.d.ts +5 -0
  65. package/dist/types/legend/stores/legend-context.d.ts +4 -0
  66. package/dist/types/legend/stores/legend-store-registry.d.ts +39 -0
  67. package/dist/types/legend/stores/legend-store.test.d.ts +1 -0
  68. package/dist/types/legend/stores/selectors.d.ts +33 -0
  69. package/dist/types/legend/stores/types.d.ts +275 -0
  70. package/dist/widgets/actions.js +1 -1
  71. package/dist/widgets/bar.js +1 -1
  72. package/dist/widgets/category.js +1 -1
  73. package/dist/widgets/formula.js +1 -1
  74. package/dist/widgets/histogram.js +1 -1
  75. package/dist/widgets/markdown.js +1 -1
  76. package/dist/widgets/pie.js +1 -1
  77. package/dist/widgets/scatterplot.js +1 -1
  78. package/dist/widgets/spread.js +1 -1
  79. package/dist/widgets/table.js +1 -1
  80. package/dist/widgets/timeseries.js +1 -1
  81. package/dist/widgets/utils.js +1 -1
  82. package/dist/widgets/wrapper.js +1 -1
  83. package/dist/widgets-v2/actions.js +1 -1
  84. package/dist/widgets-v2/bar.js +2 -2
  85. package/dist/widgets-v2/category.js +2 -2
  86. package/dist/widgets-v2/formula.js +1 -1
  87. package/dist/widgets-v2/histogram.js +2 -2
  88. package/dist/widgets-v2/markdown.js +1 -1
  89. package/dist/widgets-v2/pie.js +1 -1
  90. package/dist/widgets-v2/scatterplot.js +1 -1
  91. package/dist/widgets-v2/spread.js +2 -2
  92. package/dist/widgets-v2/table.js +3 -3
  93. package/dist/widgets-v2/timeseries.js +2 -2
  94. package/dist/widgets-v2/utils.js +1 -1
  95. package/dist/widgets-v2.js +5 -5
  96. package/package.json +11 -3
  97. package/src/components/geolocation-controls/geolocation-controls.test.tsx +15 -0
  98. package/src/components/geolocation-controls/geolocation-controls.tsx +19 -3
  99. package/src/components/index.ts +10 -0
  100. package/src/components/lasso-tool/const.tsx +1 -0
  101. package/src/components/lasso-tool/geometry-toolbar.test.tsx +138 -0
  102. package/src/components/lasso-tool/geometry-toolbar.tsx +258 -0
  103. package/src/components/lasso-tool/icons.tsx +40 -0
  104. package/src/components/lasso-tool/lasso-tool.tsx +25 -1
  105. package/src/components/lasso-tool/layer-filters.test.tsx +90 -0
  106. package/src/components/lasso-tool/layer-filters.tsx +236 -0
  107. package/src/components/lasso-tool/styles.ts +1 -1
  108. package/src/components/lasso-tool/types.ts +66 -1
  109. package/src/components/responsive-drawer/responsive-drawer.test.tsx +129 -25
  110. package/src/components/responsive-drawer/responsive-drawer.tsx +149 -16
  111. package/src/legend/components/contexts.ts +32 -0
  112. package/src/legend/components/icons.tsx +22 -0
  113. package/src/legend/components/index.ts +39 -0
  114. package/src/legend/components/legend-actions/legend-actions.tsx +57 -0
  115. package/src/legend/components/legend-actions/styles.ts +9 -0
  116. package/src/legend/components/legend-category/legend-category-ui.tsx +91 -0
  117. package/src/legend/components/legend-category/styles.ts +61 -0
  118. package/src/legend/components/legend-config-select/legend-config-select.tsx +96 -0
  119. package/src/legend/components/legend-config-select/styles.ts +48 -0
  120. package/src/legend/components/legend-group/legend-group.test.tsx +115 -0
  121. package/src/legend/components/legend-group/legend-group.tsx +88 -0
  122. package/src/legend/components/legend-group/styles.ts +82 -0
  123. package/src/legend/components/legend-icon/legend-icon-ui.tsx +56 -0
  124. package/src/legend/components/legend-icon/styles.ts +56 -0
  125. package/src/legend/components/legend-item/legend-item-ui.test.tsx +362 -0
  126. package/src/legend/components/legend-item/legend-item-ui.tsx +43 -0
  127. package/src/legend/components/legend-item/legend-item.tsx +34 -0
  128. package/src/legend/components/legend-item/styles.ts +11 -0
  129. package/src/legend/components/legend-opacity/legend-opacity.tsx +179 -0
  130. package/src/legend/components/legend-opacity/styles.ts +28 -0
  131. package/src/legend/components/legend-proportion/legend-proportion-ui.tsx +122 -0
  132. package/src/legend/components/legend-proportion/styles.ts +43 -0
  133. package/src/legend/components/legend-ramp/legend-ramp-ui.tsx +159 -0
  134. package/src/legend/components/legend-ramp/styles.ts +62 -0
  135. package/src/legend/components/legend-row/legend-row.test.tsx +498 -0
  136. package/src/legend/components/legend-row/legend-row.tsx +129 -0
  137. package/src/legend/components/legend-row/styles.ts +111 -0
  138. package/src/legend/components/legend-row-menu/legend-row-menu.tsx +68 -0
  139. package/src/legend/components/legend-row-menu/legend-zoom-to.tsx +35 -0
  140. package/src/legend/components/legend-swatch/legend-swatch.test.tsx +109 -0
  141. package/src/legend/components/legend-swatch/legend-swatch.tsx +237 -0
  142. package/src/legend/components/legend-visibility-toggle/legend-visibility-toggle.tsx +127 -0
  143. package/src/legend/index.ts +121 -0
  144. package/src/legend/provider/index.ts +6 -0
  145. package/src/legend/provider/labels.ts +59 -0
  146. package/src/legend/provider/legend-config-context.ts +15 -0
  147. package/src/legend/provider/legend-provider.tsx +102 -0
  148. package/src/legend/stores/index.ts +46 -0
  149. package/src/legend/stores/legend-context.ts +17 -0
  150. package/src/legend/stores/legend-store-registry.ts +639 -0
  151. package/src/legend/stores/legend-store.test.ts +457 -0
  152. package/src/legend/stores/selectors.ts +65 -0
  153. package/src/legend/stores/types.ts +347 -0
  154. package/dist/lasso-tool-CDFj4zKY.js.map +0 -1
package/dist/legend.js ADDED
@@ -0,0 +1,1536 @@
1
+ import { jsx as s, jsxs as E, Fragment as se } from "react/jsx-runtime";
2
+ import { c as R } from "react/compiler-runtime";
3
+ import { createContext as he, useContext as me, useState as oe, useLayoutEffect as ye, Children as Ae, isValidElement as Be, useEffect as We, useId as Fe } from "react";
4
+ import { L as Ne, h as Ue, g as je, a as Ze, i as Xe, r as Ke, u as qe, j as ee, k as Y, l as X, s as Je } from "./selectors-DwHj6mE2.js";
5
+ import { Box as P, Typography as V, IconButton as de, Collapse as ve, createSvgIcon as Qe, Menu as Le, MenuItem as Ce, ListItemIcon as Ye, Slider as et, Popover as tt, Tooltip as we, InputAdornment as lt, OutlinedInput as ot, ButtonBase as nt } from "@mui/material";
6
+ import { ExpandMore as Se, ExpandLess as Ie, LayersOutlined as it, VisibilityOffOutlined as rt, VisibilityOutlined as st, MoreVert as at, CenterFocusStrong as ct, ArrowDropDown as dt, ErrorOutline as pt } from "@mui/icons-material";
7
+ import { S as $e } from "./smart-tooltip-D4vwQpFf.js";
8
+ import "zustand";
9
+ import "zustand/vanilla";
10
+ import "zustand/middleware";
11
+ import "zustand/react/shallow";
12
+ import { Opacity as ft } from "@carto/meridian-ds/custom-icons";
13
+ const ae = {
14
+ expandLayer: "Expand layer",
15
+ collapseLayer: "Collapse layer",
16
+ hideLayer: "Hide layer",
17
+ showLayer: "Show layer",
18
+ layerOptions: "Layer options",
19
+ zoomTo: "Zoom to",
20
+ hideGroup: "Hide group",
21
+ showGroup: "Show group",
22
+ expandGroup: "Expand group",
23
+ collapseGroup: "Collapse group",
24
+ opacity: "Opacity",
25
+ attribute: "Attribute",
26
+ radiusRangeBy: "Radius range by",
27
+ colorBasedOn: "Color based on",
28
+ colorGradient: "Color gradient",
29
+ maxPrefix: "MAX: ",
30
+ minPrefix: "MIN: "
31
+ }, ke = he({
32
+ labels: ae
33
+ });
34
+ function K() {
35
+ return me(ke);
36
+ }
37
+ function ut(t) {
38
+ const e = R(24), {
39
+ id: o,
40
+ layers: n,
41
+ groups: i,
42
+ labels: r,
43
+ keepAlive: l,
44
+ children: p
45
+ } = t, a = l === void 0 ? !0 : l;
46
+ let d;
47
+ e[0] !== i || e[1] !== o || e[2] !== n ? (d = () => {
48
+ if (Ue(o))
49
+ return je(o);
50
+ const L = Ze(o, {
51
+ layers: n,
52
+ groups: i
53
+ });
54
+ return Xe(o, L), L;
55
+ }, e[0] = i, e[1] = o, e[2] = n, e[3] = d) : d = e[3];
56
+ const [f] = oe(d);
57
+ let m, c;
58
+ e[4] !== o || e[5] !== a || e[6] !== f ? (m = () => (Ke(o, f), () => {
59
+ qe(o, {
60
+ keepAlive: a
61
+ });
62
+ }), c = [o, f, a], e[4] = o, e[5] = a, e[6] = f, e[7] = m, e[8] = c) : (m = e[7], c = e[8]), ye(m, c);
63
+ let g, u;
64
+ e[9] !== i || e[10] !== n || e[11] !== f ? (g = () => {
65
+ f.getState()._sync(n, i ?? []);
66
+ }, u = [f, n, i], e[9] = i, e[10] = n, e[11] = f, e[12] = g, e[13] = u) : (g = e[12], u = e[13]), ye(g, u);
67
+ let h;
68
+ e[14] !== r ? (h = r ? {
69
+ ...ae,
70
+ ...r
71
+ } : ae, e[14] = r, e[15] = h) : h = e[15];
72
+ let y;
73
+ e[16] !== h ? (y = {
74
+ labels: h
75
+ }, e[16] = h, e[17] = y) : y = e[17];
76
+ const x = y;
77
+ let b;
78
+ e[18] !== p || e[19] !== x ? (b = /* @__PURE__ */ s(ke.Provider, { value: x, children: p }), e[18] = p, e[19] = x, e[20] = b) : b = e[20];
79
+ let v;
80
+ return e[21] !== o || e[22] !== b ? (v = /* @__PURE__ */ s(Ne.Provider, { value: o, children: b }), e[21] = o, e[22] = b, e[23] = v) : v = e[23], v;
81
+ }
82
+ const ze = he(null);
83
+ function te() {
84
+ return me(ze);
85
+ }
86
+ const _e = he(null);
87
+ function ht() {
88
+ return me(_e);
89
+ }
90
+ const mt = {
91
+ fadeGroup: {
92
+ display: "flex",
93
+ alignItems: "center",
94
+ gap: 0.25
95
+ }
96
+ };
97
+ function Pe(t) {
98
+ const e = R(3), {
99
+ children: o
100
+ } = t, i = te() !== null ? "PsLegend-rowFade" : "PsLegend-groupFade";
101
+ let r;
102
+ return e[0] !== o || e[1] !== i ? (r = /* @__PURE__ */ s(P, { className: i, sx: mt.fadeGroup, children: o }), e[0] = o, e[1] = i, e[2] = r) : r = e[2], r;
103
+ }
104
+ function Me(t) {
105
+ const e = [], o = [];
106
+ for (const n of Ae.toArray(t))
107
+ gt(n, Pe) ? e.push(n) : o.push(n);
108
+ return {
109
+ actions: e,
110
+ body: o
111
+ };
112
+ }
113
+ function gt(t, e) {
114
+ return Be(t) && t.type === e;
115
+ }
116
+ const Oe = 48, ie = {
117
+ group: {
118
+ display: "flex",
119
+ flexDirection: "column",
120
+ "& + &": {
121
+ borderTop: "1px solid",
122
+ borderColor: "divider"
123
+ },
124
+ // Hover-fade group actions (widgets-v2 Wrapper parity). Revealed by
125
+ // hovering anywhere in the group block (including member rows); a control
126
+ // carrying `.active` (hidden group) stays visible. Touch devices always
127
+ // show them. The collapse chevron sits outside the fade group. Member
128
+ // rows use the distinct `PsLegend-rowFade` class, so group hover never
129
+ // lights up row actions.
130
+ "& .PsLegend-groupFade > *": {
131
+ opacity: 1,
132
+ transition: ({
133
+ transitions: t
134
+ }) => t.create("opacity", {
135
+ duration: t.duration.standard,
136
+ easing: t.easing.easeInOut
137
+ }),
138
+ "@media (hover: hover)": {
139
+ opacity: 0
140
+ },
141
+ "&.active": {
142
+ opacity: 1
143
+ }
144
+ },
145
+ "&:hover .PsLegend-groupFade > *, &:focus-within .PsLegend-groupFade > *": {
146
+ opacity: 1
147
+ }
148
+ },
149
+ // Figma: 48px tall, icon at 12px from the left, 8px gap to the label,
150
+ // actions right-aligned with ~8px edge inset (the small icon-button padding
151
+ // brings the glyphs to the design's 16px optical inset), hairline divider
152
+ // below. Sticky: pins to the top of the panel's scroll container.
153
+ header: {
154
+ display: "flex",
155
+ alignItems: "center",
156
+ gap: 1,
157
+ padding: ({
158
+ spacing: t
159
+ }) => t(1.5, 2, 1.5, 1),
160
+ minHeight: Oe,
161
+ borderBottom: "1px solid",
162
+ borderColor: "divider",
163
+ position: "sticky",
164
+ top: 0,
165
+ // Above the sticky row headers (2), which in turn sit above MUI's
166
+ // z-index-1 form internals in row content.
167
+ zIndex: 3,
168
+ backgroundColor: "background.paper"
169
+ },
170
+ groupIcon: {
171
+ display: "flex",
172
+ color: "text.secondary"
173
+ },
174
+ label: {
175
+ flex: 1,
176
+ minWidth: 0,
177
+ overflow: "hidden",
178
+ textOverflow: "ellipsis",
179
+ whiteSpace: "nowrap"
180
+ },
181
+ // Icon buttons match the row header's 24×24 (2px padding + 20px icon).
182
+ actions: {
183
+ display: "flex",
184
+ alignItems: "center",
185
+ gap: 0.25,
186
+ flexShrink: 0,
187
+ "& .MuiIconButton-root": {
188
+ padding: "2px"
189
+ }
190
+ }
191
+ };
192
+ function yt(t) {
193
+ const e = R(37), {
194
+ groupId: o,
195
+ children: n
196
+ } = t, i = ee();
197
+ let r;
198
+ e[0] !== o ? (r = ($) => $.groups[o], e[0] = o, e[1] = r) : r = e[1];
199
+ const l = Y(i, r), p = Y(i, xt), {
200
+ labels: a
201
+ } = K();
202
+ if (!l)
203
+ return null;
204
+ let d;
205
+ e[2] !== n ? (d = Me(n), e[2] = n, e[3] = d) : d = e[3];
206
+ const {
207
+ actions: f,
208
+ body: m
209
+ } = d;
210
+ let c;
211
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ s(P, { sx: ie.groupIcon, children: /* @__PURE__ */ s(it, { fontSize: "small" }) }), e[4] = c) : c = e[4];
212
+ let g, u;
213
+ e[5] !== l.label ? (g = [l.label], u = ($) => {
214
+ const {
215
+ ref: M
216
+ } = $;
217
+ return /* @__PURE__ */ s(V, { ref: M, variant: "button", color: "text.primary", sx: ie.label, children: l.label });
218
+ }, e[5] = l.label, e[6] = g, e[7] = u) : (g = e[6], u = e[7]);
219
+ let h;
220
+ e[8] !== l.label || e[9] !== g || e[10] !== u ? (h = /* @__PURE__ */ s($e, { title: l.label, dependencies: g, children: u }), e[8] = l.label, e[9] = g, e[10] = u, e[11] = h) : h = e[11];
221
+ let y;
222
+ e[12] !== l.collapsed || e[13] !== o || e[14] !== p ? (y = () => p(o, !l.collapsed), e[12] = l.collapsed, e[13] = o, e[14] = p, e[15] = y) : y = e[15];
223
+ const x = l.collapsed ? a.expandGroup : a.collapseGroup;
224
+ let b;
225
+ e[16] !== l.collapsed ? (b = l.collapsed ? /* @__PURE__ */ s(Se, { fontSize: "small" }) : /* @__PURE__ */ s(Ie, { fontSize: "small" }), e[16] = l.collapsed, e[17] = b) : b = e[17];
226
+ let v;
227
+ e[18] !== y || e[19] !== x || e[20] !== b ? (v = /* @__PURE__ */ s(de, { size: "small", onClick: y, "aria-label": x, children: b }), e[18] = y, e[19] = x, e[20] = b, e[21] = v) : v = e[21];
228
+ let L;
229
+ e[22] !== f || e[23] !== v ? (L = /* @__PURE__ */ E(P, { sx: ie.actions, children: [
230
+ f,
231
+ v
232
+ ] }), e[22] = f, e[23] = v, e[24] = L) : L = e[24];
233
+ let w;
234
+ e[25] !== L || e[26] !== h ? (w = /* @__PURE__ */ E(P, { sx: ie.header, children: [
235
+ c,
236
+ h,
237
+ L
238
+ ] }), e[25] = L, e[26] = h, e[27] = w) : w = e[27];
239
+ const k = !l.collapsed;
240
+ let C;
241
+ e[28] !== m || e[29] !== k ? (C = /* @__PURE__ */ s(ve, { in: k, children: m }), e[28] = m, e[29] = k, e[30] = C) : C = e[30];
242
+ let S;
243
+ e[31] !== w || e[32] !== C ? (S = /* @__PURE__ */ E(P, { sx: ie.group, children: [
244
+ w,
245
+ C
246
+ ] }), e[31] = w, e[32] = C, e[33] = S) : S = e[33];
247
+ let z;
248
+ return e[34] !== o || e[35] !== S ? (z = /* @__PURE__ */ s(_e.Provider, { value: o, children: S }), e[34] = o, e[35] = S, e[36] = z) : z = e[36], z;
249
+ }
250
+ function xt(t) {
251
+ return t.setGroupCollapsed;
252
+ }
253
+ const Z = {
254
+ // Padding lives on header/content/footer (not the root) so the sticky
255
+ // header is opaque and full-bleed while pinned.
256
+ row: {
257
+ display: "flex",
258
+ flexDirection: "column",
259
+ "& + &": {
260
+ borderTop: "1px solid",
261
+ borderColor: "divider"
262
+ },
263
+ // Hover-fade actions (widgets-v2 Wrapper parity). Direct children of
264
+ // `.PsLegend-rowFade` are hidden on fine-pointer devices and fade in when
265
+ // the row is hovered or holds focus; a control carrying `.active` (dirty
266
+ // state — hidden layer, open menu, opacity ≠ 1) stays visible. Coarse-
267
+ // pointer (touch) devices always show them. The collapse chevron sits
268
+ // outside the fade group and never fades.
269
+ "& .PsLegend-rowFade > *": {
270
+ opacity: 1,
271
+ transition: ({
272
+ transitions: t
273
+ }) => t.create("opacity", {
274
+ duration: t.duration.standard,
275
+ easing: t.easing.easeInOut
276
+ }),
277
+ "@media (hover: hover)": {
278
+ opacity: 0
279
+ },
280
+ "&.active": {
281
+ opacity: 1
282
+ }
283
+ },
284
+ "&:hover .PsLegend-rowFade > *, &:focus-within .PsLegend-rowFade > *": {
285
+ opacity: 1
286
+ },
287
+ // Hovering anywhere in the row also reveals the category/icon values
288
+ // (the renderers keep their own list-scoped rule for standalone usage).
289
+ "&:hover .PsLegend-value, &:focus-within .PsLegend-value": {
290
+ opacity: 1
291
+ }
292
+ },
293
+ // Figma `_Legend header`: 16px top/left inset (title glyphs start at
294
+ // y≈17, x=16 in the 68px-tall header), actions share the title's vertical
295
+ // band (subtitle flows below them) — hence `flex-start` with the title
296
+ // optically centered against the 30px icon-button row. Sticky: pins inside
297
+ // the panel's scroll container; `top` is applied inline per row (0, or the
298
+ // group-header height for grouped rows).
299
+ header: {
300
+ display: "flex",
301
+ alignItems: "flex-start",
302
+ gap: 0.5,
303
+ minHeight: 32,
304
+ padding: ({
305
+ spacing: t
306
+ }) => t(1.5, 2, 1.5, 2),
307
+ position: "sticky",
308
+ // Above MUI's z-index-1 form internals (e.g. InputLabel) in row content,
309
+ // below the group header (3).
310
+ zIndex: 2,
311
+ backgroundColor: "background.paper"
312
+ },
313
+ titleBox: {
314
+ flex: 1,
315
+ minWidth: 0,
316
+ display: "flex",
317
+ flexDirection: "column"
318
+ },
319
+ // The title line and the actions box share the same 24px band, centered,
320
+ // so the title and the action icons stay aligned under the header's
321
+ // `flex-start` — no padding magic. The subtitle flows below.
322
+ titleLine: {
323
+ minHeight: 24,
324
+ display: "flex",
325
+ alignItems: "center"
326
+ },
327
+ title: {
328
+ flex: 1,
329
+ minWidth: 0,
330
+ overflow: "hidden",
331
+ textOverflow: "ellipsis",
332
+ whiteSpace: "nowrap"
333
+ },
334
+ // Same 24px band as the title line, so both sides of the header stay
335
+ // aligned even when the composed actions are shorter (or fade out).
336
+ // Icon buttons (actions + collapse chevron) are squeezed to 24×24:
337
+ // 2px padding around the 20px small icon.
338
+ actions: {
339
+ minHeight: 24,
340
+ display: "flex",
341
+ alignItems: "center",
342
+ gap: 0.25,
343
+ flexShrink: 0,
344
+ "& .MuiIconButton-root": {
345
+ padding: "2px"
346
+ }
347
+ },
348
+ // Figma rhythm: ~16px from the subtitle to the select (8px header bottom
349
+ // padding + 4px here + line leading), 8px between body blocks, 8px bottom
350
+ // inset before the next row's divider.
351
+ content: {
352
+ display: "flex",
353
+ flexDirection: "column",
354
+ gap: 1,
355
+ padding: ({
356
+ spacing: t
357
+ }) => t(0.5, 2, 1, 2)
358
+ },
359
+ // ~16px above the note (content's 8px bottom inset + 8px here), per design.
360
+ footer: {
361
+ padding: ({
362
+ spacing: t
363
+ }) => t(1, 2, 1, 2)
364
+ },
365
+ dimmed: {
366
+ opacity: 0.5
367
+ }
368
+ };
369
+ function bt(t) {
370
+ const e = R(57), {
371
+ layerId: o,
372
+ children: n
373
+ } = t, i = ee();
374
+ let r;
375
+ e[0] !== o ? (r = (j) => j.layers[o], e[0] = o, e[1] = r) : r = e[1];
376
+ const l = Y(i, r), p = Y(i, vt), {
377
+ labels: a
378
+ } = K(), [d, f] = oe(null), [m, c] = oe(!1);
379
+ let g;
380
+ e[2] !== d || e[3] !== o || e[4] !== m ? (g = {
381
+ layerId: o,
382
+ headerEl: d,
383
+ opacityOpen: m,
384
+ setOpacityOpen: c
385
+ }, e[2] = d, e[3] = o, e[4] = m, e[5] = g) : g = e[5];
386
+ const u = g;
387
+ if (!l)
388
+ return null;
389
+ let h;
390
+ e[6] !== n ? (h = Me(n), e[6] = n, e[7] = h) : h = e[7];
391
+ const {
392
+ actions: y,
393
+ body: x
394
+ } = h, b = !l.visible || l.collapsed, v = l.groupId ? Oe : 0;
395
+ let L;
396
+ e[8] !== v ? (L = {
397
+ top: v
398
+ }, e[8] = v, e[9] = L) : L = e[9];
399
+ let w, k;
400
+ e[10] !== l.name ? (w = [l.name], k = (j) => {
401
+ const {
402
+ ref: q
403
+ } = j;
404
+ return /* @__PURE__ */ s(V, { ref: q, variant: "button", color: "text.primary", sx: Z.title, children: l.name });
405
+ }, e[10] = l.name, e[11] = w, e[12] = k) : (w = e[11], k = e[12]);
406
+ let C;
407
+ e[13] !== l.name || e[14] !== w || e[15] !== k ? (C = /* @__PURE__ */ s(P, { sx: Z.titleLine, children: /* @__PURE__ */ s($e, { title: l.name, dependencies: w, children: k }) }), e[13] = l.name, e[14] = w, e[15] = k, e[16] = C) : C = e[16];
408
+ let S;
409
+ e[17] !== l.subtitle ? (S = l.subtitle && /* @__PURE__ */ s(V, { variant: "caption", color: "text.secondary", children: l.subtitle }), e[17] = l.subtitle, e[18] = S) : S = e[18];
410
+ let z;
411
+ e[19] !== C || e[20] !== S ? (z = /* @__PURE__ */ E(P, { sx: Z.titleBox, children: [
412
+ C,
413
+ S
414
+ ] }), e[19] = C, e[20] = S, e[21] = z) : z = e[21];
415
+ let $;
416
+ e[22] !== l.collapsed || e[23] !== o || e[24] !== p ? ($ = () => p(o, !l.collapsed), e[22] = l.collapsed, e[23] = o, e[24] = p, e[25] = $) : $ = e[25];
417
+ const M = !l.visible, I = b ? a.expandLayer : a.collapseLayer;
418
+ let _;
419
+ e[26] !== b ? (_ = b ? /* @__PURE__ */ s(Se, { fontSize: "small" }) : /* @__PURE__ */ s(Ie, { fontSize: "small" }), e[26] = b, e[27] = _) : _ = e[27];
420
+ let O;
421
+ e[28] !== $ || e[29] !== M || e[30] !== I || e[31] !== _ ? (O = /* @__PURE__ */ s(de, { size: "small", onClick: $, disabled: M, "aria-label": I, children: _ }), e[28] = $, e[29] = M, e[30] = I, e[31] = _, e[32] = O) : O = e[32];
422
+ let T;
423
+ e[33] !== y || e[34] !== O ? (T = /* @__PURE__ */ E(P, { sx: Z.actions, children: [
424
+ y,
425
+ O
426
+ ] }), e[33] = y, e[34] = O, e[35] = T) : T = e[35];
427
+ let D;
428
+ e[36] !== T || e[37] !== L || e[38] !== z ? (D = /* @__PURE__ */ E(P, { ref: f, sx: Z.header, style: L, children: [
429
+ z,
430
+ T
431
+ ] }), e[36] = T, e[37] = L, e[38] = z, e[39] = D) : D = e[39];
432
+ const N = !b;
433
+ let A;
434
+ e[40] !== l.visible ? (A = l.visible ? Z.content : {
435
+ ...Z.content,
436
+ ...Z.dimmed
437
+ }, e[40] = l.visible, e[41] = A) : A = e[41];
438
+ let F;
439
+ e[42] !== x || e[43] !== A ? (F = /* @__PURE__ */ s(P, { sx: A, children: x }), e[42] = x, e[43] = A, e[44] = F) : F = e[44];
440
+ let B;
441
+ e[45] !== l.helperText ? (B = l.helperText && /* @__PURE__ */ s(P, { sx: Z.footer, children: typeof l.helperText == "string" ? /* @__PURE__ */ s(V, { variant: "caption", color: "text.secondary", children: l.helperText }) : l.helperText }), e[45] = l.helperText, e[46] = B) : B = e[46];
442
+ let W;
443
+ e[47] !== N || e[48] !== F || e[49] !== B ? (W = /* @__PURE__ */ E(ve, { in: N, children: [
444
+ F,
445
+ B
446
+ ] }), e[47] = N, e[48] = F, e[49] = B, e[50] = W) : W = e[50];
447
+ let H;
448
+ e[51] !== D || e[52] !== W ? (H = /* @__PURE__ */ E(P, { sx: Z.row, children: [
449
+ D,
450
+ W
451
+ ] }), e[51] = D, e[52] = W, e[53] = H) : H = e[53];
452
+ let G;
453
+ return e[54] !== u || e[55] !== H ? (G = /* @__PURE__ */ s(ze.Provider, { value: u, children: H }), e[54] = u, e[55] = H, e[56] = G) : G = e[56], G;
454
+ }
455
+ function vt(t) {
456
+ return t.setCollapsed;
457
+ }
458
+ const Lt = Qe(/* @__PURE__ */ E("g", { transform: "translate(12 12) scale(1.33333) translate(-184 -24)", children: [
459
+ /* @__PURE__ */ s("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M184.901 29.5794L185.217 29.5415C185.803 29.4604 186.372 29.3216 186.918 29.1319L187 29.1007L187 29.1033L187.208 29.0255L187.536 28.8904C187.722 28.8088 187.906 28.721 188.086 28.6272L188.366 28.4747C188.381 28.4663 188.395 28.4578 188.41 28.4493C188.418 28.4451 188.425 28.4408 188.432 28.4365C188.455 28.4234 188.478 28.4102 188.5 28.3969C188.551 28.3668 188.601 28.3362 188.652 28.3052L188.912 28.1374C189.598 27.6788 190.217 27.1271 190.75 26.5002L190.751 26.4954C190.989 26.2164 191.21 25.9226 191.413 25.6152C191.488 25.5007 191.561 25.3843 191.631 25.2662L191.757 25.0445L191.878 24.8189L192.021 24.5306L192.15 24.2443L192.25 24C190.98 20.7776 187.885 18.4747 184.239 18.3782L184 18.375L183.716 18.3795L183.637 18.3823L183.373 18.3967L183.103 18.4198L182.838 18.4506L182.666 18.4749L182.426 18.5146C182.19 18.557 181.957 18.6087 181.728 18.6684L181.55 18.7175L181.271 18.8039L182.508 20.04L182.801 19.9854C183.194 19.9182 183.592 19.875 184 19.875C186.842 19.875 189.378 21.4725 190.615 24C190.172 24.915 189.55 25.7025 188.807 26.34L188.811 26.3446C188.71 26.4323 188.606 26.5172 188.5 26.5991C188.455 26.6337 188.41 26.6679 188.364 26.7015C188.108 26.8897 187.84 27.0611 187.562 27.2145C187.088 27.4755 186.585 27.6844 186.058 27.836L186.062 27.84L185.778 27.9125C185.707 27.9293 185.635 27.9452 185.563 27.9602C185.297 28.0173 185.025 28.06 184.75 28.0876V28.0866C184.503 28.1118 184.253 28.125 184 28.125C181.158 28.125 178.622 26.5275 177.385 24C177.91 22.9275 178.675 22.0425 179.582 21.3525L180.895 22.665L180.826 22.844C180.697 23.2065 180.625 23.595 180.625 24C180.625 25.86 182.14 27.375 184 27.375C184.258 27.375 184.509 27.3459 184.75 27.2915C185.462 27.129 186.09 26.7397 186.553 26.2048L179.79 19.4389C179.339 19.6833 178.912 19.9656 178.512 20.2817L178.517 20.2875L178.271 20.4884C177.704 20.9671 177.197 21.516 176.766 22.1227C176.404 22.6333 176.095 23.1838 175.845 23.7662L175.75 24C177.048 27.2925 180.25 29.625 184 29.625L184.285 29.6205L184.492 29.6116L184.628 29.6025L184.901 29.5794ZM182.133 23.9025L184.09 25.86L184.045 25.8703L184 25.875C182.965 25.875 182.125 25.035 182.125 24L182.133 23.9025Z" }),
460
+ /* @__PURE__ */ s("path", { d: "M187.368 23.9925C187.375 22.1325 185.86 20.625 184 20.625C183.722 20.625 183.46 20.6625 183.198 20.73L184.75 22.2825L184.889 22.3507C185.252 22.5477 185.543 22.8625 185.71 23.2425L187.263 24.795L187.304 24.6011C187.342 24.4045 187.368 24.2006 187.368 23.9925Z" })
461
+ ] }), "VisibilityIndeterminate"), Ct = {
462
+ visible: st,
463
+ hidden: rt,
464
+ mixed: Lt
465
+ };
466
+ function wt(t) {
467
+ const e = R(33), {
468
+ visibility: o,
469
+ onToggle: n,
470
+ labels: i
471
+ } = t, r = ee(), l = te(), p = ht(), {
472
+ labels: a
473
+ } = K(), d = o !== void 0 && n !== void 0;
474
+ let f;
475
+ e[0] !== d || e[1] !== l ? (f = (I) => !d && l ? I.layers[l.layerId]?.visible ?? !0 : !0, e[0] = d, e[1] = l, e[2] = f) : f = e[2];
476
+ const m = X(r, f);
477
+ let c;
478
+ e[3] !== d || e[4] !== p || e[5] !== l ? (c = (I) => !d && !l && p ? Je(I, p) : "visible", e[3] = d, e[4] = p, e[5] = l, e[6] = c) : c = e[6];
479
+ const g = Y(r, c), u = X(r, It), h = X(r, St);
480
+ let y, x;
481
+ e[7] !== d || e[8] !== p || e[9] !== l ? (y = () => {
482
+ !d && !l && !p && console.warn("Legend.VisibilityToggle needs `visibility`/`onToggle` props or a Legend.Row / Legend.Group context.");
483
+ }, x = [d, l, p], e[7] = d, e[8] = p, e[9] = l, e[10] = y, e[11] = x) : (y = e[10], x = e[11]), We(y, x);
484
+ let b, v, L = i;
485
+ if (d) {
486
+ b = o;
487
+ let I;
488
+ e[12] !== n || e[13] !== o ? (I = () => n(o === "hidden"), e[12] = n, e[13] = o, e[14] = I) : I = e[14], v = I;
489
+ } else if (l) {
490
+ b = m ? "visible" : "hidden";
491
+ let I;
492
+ e[15] !== m || e[16] !== l || e[17] !== u ? (I = () => u(l.layerId, !m), e[15] = m, e[16] = l, e[17] = u, e[18] = I) : I = e[18], v = I;
493
+ } else if (p) {
494
+ b = g;
495
+ let I;
496
+ e[19] !== p || e[20] !== g || e[21] !== h ? (I = () => h(p, g === "hidden"), e[19] = p, e[20] = g, e[21] = h, e[22] = I) : I = e[22], v = I;
497
+ let _;
498
+ e[23] !== a || e[24] !== i ? (_ = i ?? {
499
+ hideLayer: a.hideGroup,
500
+ showLayer: a.showGroup
501
+ }, e[23] = a, e[24] = i, e[25] = _) : _ = e[25], L = _;
502
+ } else
503
+ return null;
504
+ const {
505
+ hideLayer: w,
506
+ showLayer: k
507
+ } = L ?? a, C = Ct[b], S = b === "visible" ? void 0 : "active", z = b === "hidden" ? k : w;
508
+ let $;
509
+ e[26] !== C ? ($ = /* @__PURE__ */ s(C, { fontSize: "small" }), e[26] = C, e[27] = $) : $ = e[27];
510
+ let M;
511
+ return e[28] !== v || e[29] !== S || e[30] !== z || e[31] !== $ ? (M = /* @__PURE__ */ s(de, { size: "small", className: S, onClick: v, "aria-label": z, children: $ }), e[28] = v, e[29] = S, e[30] = z, e[31] = $, e[32] = M) : M = e[32], M;
512
+ }
513
+ function St(t) {
514
+ return t.setGroupVisibility;
515
+ }
516
+ function It(t) {
517
+ return t.setVisibility;
518
+ }
519
+ function $t(t) {
520
+ const e = R(17), {
521
+ children: o
522
+ } = t, n = ee(), [i, r] = oe(null), l = !!i, p = te();
523
+ let a;
524
+ e[0] !== p ? (a = (w) => p ? w.layers[p.layerId]?.visible ?? !0 : !0, e[0] = p, e[1] = a) : a = e[1];
525
+ const d = X(n, a), {
526
+ labels: f
527
+ } = K();
528
+ if (!p || !o || !d)
529
+ return null;
530
+ let m;
531
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = (w) => {
532
+ w.stopPropagation(), r(w.currentTarget);
533
+ }, e[2] = m) : m = e[2];
534
+ const c = m;
535
+ let g;
536
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = () => r(null), e[3] = g) : g = e[3];
537
+ const u = g, h = l ? "active" : void 0, y = !d;
538
+ let x;
539
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ s(at, { fontSize: "small" }), e[4] = x) : x = e[4];
540
+ let b;
541
+ e[5] !== f.layerOptions || e[6] !== l || e[7] !== h || e[8] !== y ? (b = /* @__PURE__ */ s(de, { size: "small", className: h, disabled: y, onClick: c, "aria-label": f.layerOptions, "aria-haspopup": "menu", "aria-expanded": l, children: x }), e[5] = f.layerOptions, e[6] = l, e[7] = h, e[8] = y, e[9] = b) : b = e[9];
542
+ let v;
543
+ e[10] !== i || e[11] !== o || e[12] !== l ? (v = /* @__PURE__ */ s(Le, { anchorEl: i, open: l, onClose: u, onClick: u, children: o }), e[10] = i, e[11] = o, e[12] = l, e[13] = v) : v = e[13];
544
+ let L;
545
+ return e[14] !== b || e[15] !== v ? (L = /* @__PURE__ */ E(se, { children: [
546
+ b,
547
+ v
548
+ ] }), e[14] = b, e[15] = v, e[16] = L) : L = e[16], L;
549
+ }
550
+ function kt(t) {
551
+ const e = R(7), {
552
+ onZoomTo: o
553
+ } = t, n = te(), {
554
+ labels: i
555
+ } = K();
556
+ if (!n)
557
+ return null;
558
+ let r;
559
+ e[0] !== o || e[1] !== n.layerId ? (r = () => o(n.layerId), e[0] = o, e[1] = n.layerId, e[2] = r) : r = e[2];
560
+ let l;
561
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ s(Ye, { children: /* @__PURE__ */ s(ct, { fontSize: "small" }) }), e[3] = l) : l = e[3];
562
+ let p;
563
+ return e[4] !== i.zoomTo || e[5] !== r ? (p = /* @__PURE__ */ E(Ce, { onClick: r, children: [
564
+ l,
565
+ i.zoomTo
566
+ ] }), e[4] = i.zoomTo, e[5] = r, e[6] = p) : p = e[6], p;
567
+ }
568
+ const fe = {
569
+ // Tooltip wrapper around the (possibly disabled) trigger button. A plain
570
+ // inline span would be sized by the line box (baseline + descender) and
571
+ // end up ~1px taller than the 24px button inside.
572
+ triggerWrap: {
573
+ display: "inline-flex"
574
+ },
575
+ popover: {
576
+ display: "flex",
577
+ alignItems: "center",
578
+ gap: 1.5,
579
+ padding: ({
580
+ spacing: t
581
+ }) => t(1, 1.5),
582
+ width: 280
583
+ },
584
+ slider: {
585
+ flex: 1
586
+ },
587
+ // Wide enough for "100 %" — the value must never ellipsize.
588
+ input: {
589
+ width: 76,
590
+ flexShrink: 0,
591
+ "& input": {
592
+ textAlign: "right"
593
+ }
594
+ }
595
+ }, xe = (t) => Math.min(100, Math.max(0, Math.round(t)));
596
+ function zt() {
597
+ const t = R(16), e = ee(), o = te(), n = o?.layerId;
598
+ let i;
599
+ t[0] !== n ? (i = (y) => n ? y.layers[n]?.opacity ?? 1 : 1, t[0] = n, t[1] = i) : i = t[1];
600
+ const r = X(e, i);
601
+ let l;
602
+ t[2] !== n ? (l = (y) => n ? y.layers[n]?.visible ?? !0 : !0, t[2] = n, t[3] = l) : l = t[3];
603
+ const p = X(e, l), {
604
+ labels: a
605
+ } = K();
606
+ if (!o || !p)
607
+ return null;
608
+ const f = r !== 1 || o.opacityOpen ? "active" : void 0;
609
+ let m;
610
+ t[4] !== o ? (m = () => o.setOpacityOpen(!0), t[4] = o, t[5] = m) : m = t[5];
611
+ let c;
612
+ t[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ s(ft, { fontSize: "small" }), t[6] = c) : c = t[6];
613
+ let g;
614
+ t[7] !== a.opacity || t[8] !== m ? (g = /* @__PURE__ */ s(de, { size: "small", onClick: m, "aria-label": a.opacity, children: c }), t[7] = a.opacity, t[8] = m, t[9] = g) : g = t[9];
615
+ let u;
616
+ t[10] !== f || t[11] !== g ? (u = /* @__PURE__ */ s(P, { component: "span", className: f, sx: fe.triggerWrap, children: g }), t[10] = f, t[11] = g, t[12] = u) : u = t[12];
617
+ let h;
618
+ return t[13] !== a.opacity || t[14] !== u ? (h = /* @__PURE__ */ s(we, { title: a.opacity, children: u }), t[13] = a.opacity, t[14] = u, t[15] = h) : h = t[15], h;
619
+ }
620
+ function _t() {
621
+ const t = R(44), e = ee(), o = te(), n = o?.layerId;
622
+ let i;
623
+ t[0] !== n ? (i = (H) => n ? H.layers[n]?.opacity ?? 1 : 1, t[0] = n, t[1] = i) : i = t[1];
624
+ const r = X(e, i);
625
+ let l;
626
+ t[2] !== n ? (l = (H) => n ? H.layers[n]?.visible ?? !0 : !0, t[2] = n, t[3] = l) : l = t[3];
627
+ const p = X(e, l), a = X(e, Mt), {
628
+ labels: d
629
+ } = K(), [f, m] = oe(null), [c, g] = oe(null);
630
+ if (!o || !n || !p)
631
+ return null;
632
+ let u;
633
+ t[4] !== f || t[5] !== r ? (u = f ?? xe(r * 100), t[4] = f, t[5] = r, t[6] = u) : u = t[6];
634
+ const h = u;
635
+ let y;
636
+ t[7] !== n || t[8] !== a ? (y = (H) => {
637
+ const G = xe(H);
638
+ return a(n, G / 100), G;
639
+ }, t[7] = n, t[8] = a, t[9] = y) : y = t[9];
640
+ const x = y;
641
+ let b;
642
+ t[10] !== x ? (b = (H) => {
643
+ if (g(H), H.trim() === "")
644
+ return;
645
+ const G = Number(H);
646
+ if (!Number.isFinite(G))
647
+ return;
648
+ const j = x(G);
649
+ j !== G && g(String(j));
650
+ }, t[10] = x, t[11] = b) : b = t[11];
651
+ const v = b;
652
+ let L;
653
+ t[12] !== o ? (L = () => {
654
+ o.setOpacityOpen(!1), g(null), m(null);
655
+ }, t[12] = o, t[13] = L) : L = t[13];
656
+ const w = L, k = o.opacityOpen && !!o.headerEl;
657
+ let C, S;
658
+ t[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = {
659
+ vertical: "bottom",
660
+ horizontal: "left"
661
+ }, S = {
662
+ vertical: "top",
663
+ horizontal: "left"
664
+ }, t[14] = C, t[15] = S) : (C = t[14], S = t[15]);
665
+ const z = o.headerEl?.clientWidth;
666
+ let $;
667
+ t[16] !== z ? ($ = {
668
+ paper: {
669
+ sx: {
670
+ width: z
671
+ }
672
+ }
673
+ }, t[16] = z, t[17] = $) : $ = t[17];
674
+ let M;
675
+ t[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = (H, G) => {
676
+ m(G), g(null);
677
+ }, t[18] = M) : M = t[18];
678
+ let I;
679
+ t[19] !== x ? (I = (H, G) => {
680
+ x(G), m(null);
681
+ }, t[19] = x, t[20] = I) : I = t[20];
682
+ let _;
683
+ t[21] !== d.opacity || t[22] !== h || t[23] !== I ? (_ = /* @__PURE__ */ s(et, { size: "small", min: 0, max: 100, step: 1, value: h, onChange: M, onChangeCommitted: I, "aria-label": d.opacity, sx: fe.slider }), t[21] = d.opacity, t[22] = h, t[23] = I, t[24] = _) : _ = t[24];
684
+ const O = c ?? String(h);
685
+ let T;
686
+ t[25] !== v ? (T = (H) => v(H.target.value), t[25] = v, t[26] = T) : T = t[26];
687
+ let D;
688
+ t[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = () => g(null), t[27] = D) : D = t[27];
689
+ let N;
690
+ t[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ s(lt, { position: "end", children: "%" }), t[28] = N) : N = t[28];
691
+ let A;
692
+ t[29] !== d.opacity ? (A = {
693
+ inputMode: "numeric",
694
+ "aria-label": d.opacity
695
+ }, t[29] = d.opacity, t[30] = A) : A = t[30];
696
+ let F;
697
+ t[31] !== O || t[32] !== T || t[33] !== A ? (F = /* @__PURE__ */ s(ot, { size: "small", value: O, onChange: T, onBlur: D, onKeyDown: Pt, endAdornment: N, inputProps: A, sx: fe.input }), t[31] = O, t[32] = T, t[33] = A, t[34] = F) : F = t[34];
698
+ let B;
699
+ t[35] !== _ || t[36] !== F ? (B = /* @__PURE__ */ E(P, { sx: fe.popover, children: [
700
+ _,
701
+ F
702
+ ] }), t[35] = _, t[36] = F, t[37] = B) : B = t[37];
703
+ let W;
704
+ return t[38] !== w || t[39] !== o.headerEl || t[40] !== $ || t[41] !== B || t[42] !== k ? (W = /* @__PURE__ */ s(tt, { open: k, anchorEl: o.headerEl, onClose: w, anchorOrigin: C, transformOrigin: S, slotProps: $, children: B }), t[38] = w, t[39] = o.headerEl, t[40] = $, t[41] = B, t[42] = k, t[43] = W) : W = t[43], W;
705
+ }
706
+ function Pt(t) {
707
+ t.key === "Enter" && t.target.blur();
708
+ }
709
+ function Mt(t) {
710
+ return t.setOpacity;
711
+ }
712
+ const Ot = {
713
+ Trigger: zt,
714
+ Popover: _t
715
+ }, le = {
716
+ // Outlined-input look-alike trigger (the design's select has no floating
717
+ // label — just the value + chevron in a 32px bordered field).
718
+ trigger: {
719
+ width: "100%",
720
+ minHeight: 32,
721
+ display: "flex",
722
+ alignItems: "center",
723
+ justifyContent: "space-between",
724
+ gap: 1,
725
+ padding: ({
726
+ spacing: t
727
+ }) => t(0, 1.5),
728
+ border: "1px solid",
729
+ borderColor: "divider",
730
+ borderRadius: 1,
731
+ backgroundColor: "background.paper",
732
+ color: "text.primary",
733
+ "&:hover": {
734
+ borderColor: "text.primary"
735
+ }
736
+ },
737
+ value: {
738
+ minWidth: 0,
739
+ overflow: "hidden",
740
+ textOverflow: "ellipsis",
741
+ whiteSpace: "nowrap"
742
+ },
743
+ chevron: {
744
+ flexShrink: 0,
745
+ color: "action.active",
746
+ transition: ({
747
+ transitions: t
748
+ }) => t.create("transform")
749
+ },
750
+ chevronOpen: {
751
+ transform: "rotate(180deg)"
752
+ },
753
+ sectionTitle: {
754
+ padding: ({
755
+ spacing: t
756
+ }) => t(1, 2, 0.5, 2),
757
+ lineHeight: 1.5
758
+ },
759
+ // Figma: the active option reads as primary-colored text, no background.
760
+ option: {
761
+ "&.Mui-selected, &.Mui-selected:hover": {
762
+ backgroundColor: "transparent",
763
+ color: "primary.main"
764
+ }
765
+ }
766
+ };
767
+ function Tt() {
768
+ const t = R(34), e = ee(), n = te()?.layerId;
769
+ let i;
770
+ t[0] !== n ? (i = (S) => n ? S.layers[n]?.sections : void 0, t[0] = n, t[1] = i) : i = t[1];
771
+ const r = Y(e, i), l = Y(e, Et), {
772
+ labels: p
773
+ } = K(), [a, d] = oe(null), f = !!a;
774
+ if (!n || !r || r.length === 0)
775
+ return null;
776
+ const m = r[0].active, c = r.length > 1;
777
+ let g;
778
+ t[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = (S) => d(S.currentTarget), t[2] = g) : g = t[2];
779
+ let u;
780
+ t[3] !== m ? (u = /* @__PURE__ */ s(V, { variant: "body2", sx: le.value, children: m }), t[3] = m, t[4] = u) : u = t[4];
781
+ let h;
782
+ t[5] !== f ? (h = f ? {
783
+ ...le.chevron,
784
+ ...le.chevronOpen
785
+ } : le.chevron, t[5] = f, t[6] = h) : h = t[6];
786
+ let y;
787
+ t[7] !== h ? (y = /* @__PURE__ */ s(dt, { fontSize: "small", sx: h }), t[7] = h, t[8] = y) : y = t[8];
788
+ let x;
789
+ t[9] !== p.attribute || t[10] !== f || t[11] !== u || t[12] !== y ? (x = /* @__PURE__ */ E(nt, { sx: le.trigger, onClick: g, "aria-label": p.attribute, "aria-haspopup": "listbox", "aria-expanded": f, children: [
790
+ u,
791
+ y
792
+ ] }), t[9] = p.attribute, t[10] = f, t[11] = u, t[12] = y, t[13] = x) : x = t[13];
793
+ let b;
794
+ t[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = () => d(null), t[14] = b) : b = t[14];
795
+ const v = a?.clientWidth;
796
+ let L;
797
+ t[15] !== v ? (L = {
798
+ paper: {
799
+ sx: {
800
+ width: v
801
+ }
802
+ }
803
+ }, t[15] = v, t[16] = L) : L = t[16];
804
+ let w;
805
+ if (t[17] !== n || t[18] !== r || t[19] !== l || t[20] !== c) {
806
+ let S;
807
+ t[22] !== n || t[23] !== l || t[24] !== c ? (S = (z) => [c && z.title ? /* @__PURE__ */ s(V, { variant: "overline", color: "text.secondary", component: "li", sx: le.sectionTitle, children: z.title }, `${z.id}-title`) : null, ...z.options.map(($) => /* @__PURE__ */ s(Ce, { selected: $ === z.active, sx: le.option, onClick: () => {
808
+ l(n, z.id, $), d(null);
809
+ }, children: $ }, `${z.id}-${$}`))], t[22] = n, t[23] = l, t[24] = c, t[25] = S) : S = t[25], w = r.map(S), t[17] = n, t[18] = r, t[19] = l, t[20] = c, t[21] = w;
810
+ } else
811
+ w = t[21];
812
+ let k;
813
+ t[26] !== a || t[27] !== f || t[28] !== L || t[29] !== w ? (k = /* @__PURE__ */ s(Le, { anchorEl: a, open: f, onClose: b, slotProps: L, children: w }), t[26] = a, t[27] = f, t[28] = L, t[29] = w, t[30] = k) : k = t[30];
814
+ let C;
815
+ return t[31] !== k || t[32] !== x ? (C = /* @__PURE__ */ E(se, { children: [
816
+ x,
817
+ k
818
+ ] }), t[31] = k, t[32] = x, t[33] = C) : C = t[33], C;
819
+ }
820
+ function Et(t) {
821
+ return t.setSectionValue;
822
+ }
823
+ const J = {
824
+ list: {
825
+ display: "flex",
826
+ flexDirection: "column",
827
+ gap: 0.5,
828
+ // Values are hidden until the legend content is hovered (or keyboard-
829
+ // focused). On hover-incapable (touch) devices they're always visible —
830
+ // tap-:hover is unreliable on non-interactive elements.
831
+ "&:hover .PsLegend-value, &:focus-within .PsLegend-value": {
832
+ opacity: 1
833
+ },
834
+ "@media (hover: none)": {
835
+ "& .PsLegend-value": {
836
+ opacity: 1
837
+ }
838
+ }
839
+ },
840
+ item: {
841
+ display: "flex",
842
+ alignItems: "center",
843
+ gap: 1
844
+ },
845
+ // Fixed-width gutter so labels stay column-aligned regardless of swatch
846
+ // shape or per-item size; the swatch is centered within it.
847
+ gutter: {
848
+ flexShrink: 0,
849
+ display: "flex",
850
+ alignItems: "center",
851
+ justifyContent: "center"
852
+ },
853
+ label: {
854
+ flex: 1,
855
+ minWidth: 0,
856
+ overflow: "hidden",
857
+ textOverflow: "ellipsis",
858
+ whiteSpace: "nowrap"
859
+ },
860
+ value: {
861
+ flexShrink: 0,
862
+ opacity: 0,
863
+ transition: "opacity 120ms"
864
+ },
865
+ // ─── Horizontal orientation modifiers (spread over the vertical base) ───
866
+ // Items flow left-to-right and wrap; each is a compact swatch+label pair.
867
+ listHorizontal: {
868
+ flexDirection: "row",
869
+ flexWrap: "wrap",
870
+ columnGap: 2,
871
+ rowGap: 0.5
872
+ },
873
+ // No fixed gutter — the swatch sits at its natural size next to the label.
874
+ itemHorizontal: {
875
+ gap: 0.5
876
+ },
877
+ // Each chip sizes to its content (no flex-grow / ellipsis).
878
+ labelHorizontal: {
879
+ flex: "0 0 auto",
880
+ overflow: "visible",
881
+ textOverflow: "clip"
882
+ }
883
+ }, ge = 12, ce = 1.5, Te = 2, Ht = 1;
884
+ function Dt(t) {
885
+ switch (t) {
886
+ case "dashed":
887
+ return {
888
+ dash: "3 2"
889
+ };
890
+ case "dotted":
891
+ return {
892
+ dash: `0.1 ${ce * 2}`,
893
+ round: !0
894
+ };
895
+ // `dash-dot` is line-only and `corners` is handled separately: both
896
+ // degrade to a solid border here.
897
+ default:
898
+ return {};
899
+ }
900
+ }
901
+ function Gt(t) {
902
+ switch (t) {
903
+ case "dashed":
904
+ return {
905
+ dash: "4 3"
906
+ };
907
+ case "dotted":
908
+ return {
909
+ dash: `0.1 ${Te * 2}`,
910
+ round: !0
911
+ };
912
+ case "dash-dot":
913
+ return {
914
+ dash: "5 2 0.1 2",
915
+ round: !0
916
+ };
917
+ // `corners` is square-only → solid line.
918
+ default:
919
+ return {};
920
+ }
921
+ }
922
+ function Vt(t, e) {
923
+ const o = (n) => /* @__PURE__ */ s("path", { d: n, stroke: e, strokeWidth: 1.2, fill: "none" });
924
+ switch (t) {
925
+ case "horizontal":
926
+ return {
927
+ size: 4,
928
+ content: o("M0 2 H4")
929
+ };
930
+ case "vertical":
931
+ return {
932
+ size: 4,
933
+ content: o("M2 0 V4")
934
+ };
935
+ case "diagonal":
936
+ return {
937
+ size: 4,
938
+ content: o("M0 4 L4 0 M-1 1 L1 -1 M3 5 L5 3")
939
+ };
940
+ case "diagonal-alt":
941
+ return {
942
+ size: 4,
943
+ content: o("M0 0 L4 4 M-1 3 L1 5 M3 -1 L5 1")
944
+ };
945
+ case "cross":
946
+ return {
947
+ size: 4,
948
+ content: o("M0 4 L4 0 M-1 1 L1 -1 M3 5 L5 3 M0 0 L4 4 M-1 3 L1 5 M3 -1 L5 1")
949
+ };
950
+ case "dots":
951
+ return {
952
+ size: 4,
953
+ content: /* @__PURE__ */ s("circle", { cx: 2, cy: 2, r: 0.9, fill: e })
954
+ };
955
+ case "grid":
956
+ return {
957
+ size: 3,
958
+ content: /* @__PURE__ */ s("circle", { cx: 1.5, cy: 1.5, r: 0.7, fill: e })
959
+ };
960
+ default:
961
+ return null;
962
+ }
963
+ }
964
+ function Ee(t) {
965
+ const e = R(46), {
966
+ shape: o,
967
+ color: n,
968
+ isStrokeColor: i,
969
+ fillPattern: r,
970
+ strokeStyle: l,
971
+ size: p
972
+ } = t, a = o === void 0 ? "circle" : o, d = i === void 0 ? !1 : i, f = r === void 0 ? "solid" : r, m = l === void 0 ? "solid" : l, c = p === void 0 ? ge : p, g = Fe();
973
+ if (a === "line") {
974
+ let N;
975
+ e[0] !== m ? (N = Gt(m), e[0] = m, e[1] = N) : N = e[1];
976
+ const {
977
+ dash: A,
978
+ round: F
979
+ } = N, B = `0 0 ${c} ${c}`;
980
+ let W;
981
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = {
982
+ display: "block",
983
+ overflow: "visible"
984
+ }, e[2] = W) : W = e[2];
985
+ const H = c / 2, G = c / 2, j = F ? "round" : "butt";
986
+ let q;
987
+ e[3] !== n || e[4] !== A || e[5] !== c || e[6] !== G || e[7] !== j || e[8] !== H ? (q = /* @__PURE__ */ s("line", { x1: 0, y1: H, x2: c, y2: G, stroke: n, strokeWidth: Te, strokeDasharray: A, strokeLinecap: j }), e[3] = n, e[4] = A, e[5] = c, e[6] = G, e[7] = j, e[8] = H, e[9] = q) : q = e[9];
988
+ let pe;
989
+ return e[10] !== c || e[11] !== q || e[12] !== B ? (pe = /* @__PURE__ */ s("svg", { width: c, height: c, viewBox: B, "aria-hidden": !0, "data-shape": "line", style: W, children: q }), e[10] = c, e[11] = q, e[12] = B, e[13] = pe) : pe = e[13], pe;
990
+ }
991
+ const u = d ? ce / 2 : 0, h = !d && f !== "solid";
992
+ let y;
993
+ e[14] !== n || e[15] !== f || e[16] !== h ? (y = h ? Vt(f, n) : null, e[14] = n, e[15] = f, e[16] = h, e[17] = y) : y = e[17];
994
+ const x = y, b = d && m === "corners" && a === "square";
995
+ let v;
996
+ e[18] !== d || e[19] !== m ? (v = d ? Dt(m) : {
997
+ dash: void 0,
998
+ round: !1
999
+ }, e[18] = d, e[19] = m, e[20] = v) : v = e[20];
1000
+ const {
1001
+ dash: L,
1002
+ round: w
1003
+ } = v, k = d ? ce : Ht, C = d ? L : void 0, S = w ? "round" : "butt";
1004
+ let z;
1005
+ e[21] !== n || e[22] !== S || e[23] !== k || e[24] !== C ? (z = {
1006
+ stroke: n,
1007
+ strokeWidth: k,
1008
+ strokeDasharray: C,
1009
+ strokeLinecap: S
1010
+ }, e[21] = n, e[22] = S, e[23] = k, e[24] = C, e[25] = z) : z = e[25];
1011
+ const $ = z, M = d ? "none" : h ? `url(#${g})` : n, I = `0 0 ${c} ${c}`;
1012
+ let _;
1013
+ e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = {
1014
+ display: "block"
1015
+ }, e[26] = _) : _ = e[26];
1016
+ let O;
1017
+ e[27] !== g || e[28] !== x ? (O = x && /* @__PURE__ */ s("defs", { children: /* @__PURE__ */ s("pattern", { id: g, patternUnits: "userSpaceOnUse", width: x.size, height: x.size, children: x.content }) }), e[27] = g, e[28] = x, e[29] = O) : O = e[29];
1018
+ let T;
1019
+ e[30] !== n || e[31] !== $ || e[32] !== M || e[33] !== u || e[34] !== b || e[35] !== d || e[36] !== a || e[37] !== c || e[38] !== h ? (T = b ? /* @__PURE__ */ s(Rt, { size: c, color: n }) : a === "circle" ? /* @__PURE__ */ s("circle", { cx: c / 2, cy: c / 2, r: c / 2 - u, fill: M, ...$, stroke: d || h ? n : "none" }) : /* @__PURE__ */ s("rect", { x: u, y: u, width: c - u * 2, height: c - u * 2, fill: M, ...$, stroke: d || h ? n : "none" }), e[30] = n, e[31] = $, e[32] = M, e[33] = u, e[34] = b, e[35] = d, e[36] = a, e[37] = c, e[38] = h, e[39] = T) : T = e[39];
1020
+ let D;
1021
+ return e[40] !== a || e[41] !== c || e[42] !== I || e[43] !== O || e[44] !== T ? (D = /* @__PURE__ */ E("svg", { width: c, height: c, viewBox: I, "aria-hidden": !0, "data-shape": a, style: _, children: [
1022
+ O,
1023
+ T
1024
+ ] }), e[40] = a, e[41] = c, e[42] = I, e[43] = O, e[44] = T, e[45] = D) : D = e[45], D;
1025
+ }
1026
+ function Rt(t) {
1027
+ const e = R(19), {
1028
+ size: o,
1029
+ color: n
1030
+ } = t, i = Math.max(2, o * 0.3), r = ce / 2, l = o - r;
1031
+ let p;
1032
+ e[0] !== n ? (p = {
1033
+ stroke: n,
1034
+ strokeWidth: ce,
1035
+ fill: "none"
1036
+ }, e[0] = n, e[1] = p) : p = e[1];
1037
+ const a = p, d = `M${r} ${r + i} V${r} H${r + i}`;
1038
+ let f;
1039
+ e[2] !== a || e[3] !== d ? (f = /* @__PURE__ */ s("path", { d, ...a }), e[2] = a, e[3] = d, e[4] = f) : f = e[4];
1040
+ const m = `M${l - i} ${r} H${l} V${r + i}`;
1041
+ let c;
1042
+ e[5] !== a || e[6] !== m ? (c = /* @__PURE__ */ s("path", { d: m, ...a }), e[5] = a, e[6] = m, e[7] = c) : c = e[7];
1043
+ const g = `M${l} ${l - i} V${l} H${l - i}`;
1044
+ let u;
1045
+ e[8] !== a || e[9] !== g ? (u = /* @__PURE__ */ s("path", { d: g, ...a }), e[8] = a, e[9] = g, e[10] = u) : u = e[10];
1046
+ const h = `M${r + i} ${l} H${r} V${l - i}`;
1047
+ let y;
1048
+ e[11] !== a || e[12] !== h ? (y = /* @__PURE__ */ s("path", { d: h, ...a }), e[11] = a, e[12] = h, e[13] = y) : y = e[13];
1049
+ let x;
1050
+ return e[14] !== f || e[15] !== c || e[16] !== u || e[17] !== y ? (x = /* @__PURE__ */ E(se, { children: [
1051
+ f,
1052
+ c,
1053
+ u,
1054
+ y
1055
+ ] }), e[14] = f, e[15] = c, e[16] = u, e[17] = y, e[18] = x) : x = e[18], x;
1056
+ }
1057
+ const At = 16;
1058
+ function He(t) {
1059
+ const e = R(23), {
1060
+ data: o
1061
+ } = t, {
1062
+ items: n,
1063
+ shape: i,
1064
+ isStrokeColor: r,
1065
+ fillPattern: l,
1066
+ strokeStyle: p,
1067
+ orientation: a
1068
+ } = o, d = i === void 0 ? "circle" : i, f = r === void 0 ? !1 : r, m = l === void 0 ? "solid" : l, c = p === void 0 ? "solid" : p, g = a === void 0 ? "vertical" : a, u = g === "horizontal";
1069
+ let h;
1070
+ e[0] !== n ? (h = n.reduce(Bt, 0), e[0] = n, e[1] = h) : h = e[1];
1071
+ const x = Math.max(At, h), b = u ? J.listHorizontal : null;
1072
+ let v;
1073
+ e[2] !== b ? (v = {
1074
+ ...J.list,
1075
+ ...b
1076
+ }, e[2] = b, e[3] = v) : v = e[3];
1077
+ let L;
1078
+ if (e[4] !== m || e[5] !== x || e[6] !== u || e[7] !== f || e[8] !== n || e[9] !== d || e[10] !== c) {
1079
+ let k;
1080
+ e[12] !== m || e[13] !== x || e[14] !== u || e[15] !== f || e[16] !== d || e[17] !== c ? (k = (C, S) => /* @__PURE__ */ E(P, { sx: {
1081
+ ...J.item,
1082
+ ...u ? J.itemHorizontal : null
1083
+ }, children: [
1084
+ /* @__PURE__ */ s(P, { sx: {
1085
+ ...J.gutter,
1086
+ width: u ? void 0 : x
1087
+ }, children: /* @__PURE__ */ s(Ee, { shape: C.shape ?? d, color: C.color, isStrokeColor: C.isStrokeColor ?? f, fillPattern: C.fillPattern ?? m, strokeStyle: C.strokeStyle ?? c, size: C.size ?? ge }) }),
1088
+ /* @__PURE__ */ s(V, { variant: "caption", color: "text.primary", sx: {
1089
+ ...J.label,
1090
+ ...u ? J.labelHorizontal : null
1091
+ }, children: C.label }),
1092
+ C.value != null && /* @__PURE__ */ s(V, { className: "PsLegend-value", variant: "caption", color: "text.secondary", sx: J.value, children: C.value })
1093
+ ] }, `${C.label}-${S}`), e[12] = m, e[13] = x, e[14] = u, e[15] = f, e[16] = d, e[17] = c, e[18] = k) : k = e[18], L = n.map(k), e[4] = m, e[5] = x, e[6] = u, e[7] = f, e[8] = n, e[9] = d, e[10] = c, e[11] = L;
1094
+ } else
1095
+ L = e[11];
1096
+ let w;
1097
+ return e[19] !== g || e[20] !== v || e[21] !== L ? (w = /* @__PURE__ */ s(P, { "data-orientation": g, sx: v, children: L }), e[19] = g, e[20] = v, e[21] = L, e[22] = w) : w = e[22], w;
1098
+ }
1099
+ function Bt(t, e) {
1100
+ return Math.max(t, e.size ?? ge);
1101
+ }
1102
+ const U = {
1103
+ container: {
1104
+ display: "flex",
1105
+ flexDirection: "column",
1106
+ gap: 0.5
1107
+ },
1108
+ attribute: {
1109
+ display: "flex",
1110
+ flexDirection: "column"
1111
+ },
1112
+ // Inline error shown when a discrete ramp's stop count is incoherent.
1113
+ error: {
1114
+ display: "flex",
1115
+ alignItems: "center",
1116
+ gap: 0.5,
1117
+ color: "error.main"
1118
+ },
1119
+ // Positioning context for the avg marker; the inner bar keeps its rounded
1120
+ // clip while the line is free to overflow vertically.
1121
+ barWrap: {
1122
+ position: "relative"
1123
+ },
1124
+ bar: {
1125
+ height: 8,
1126
+ borderRadius: "2px",
1127
+ overflow: "hidden",
1128
+ display: "flex"
1129
+ },
1130
+ avgLine: {
1131
+ position: "absolute",
1132
+ top: -2,
1133
+ bottom: -2,
1134
+ width: 0,
1135
+ borderLeft: "1.5px dashed",
1136
+ borderColor: "text.primary",
1137
+ transform: "translateX(-50%)"
1138
+ },
1139
+ step: {
1140
+ flex: 1,
1141
+ height: "100%"
1142
+ },
1143
+ labels: {
1144
+ display: "flex",
1145
+ justifyContent: "space-between",
1146
+ gap: 1
1147
+ },
1148
+ // Boundary mode: labels absolutely positioned so each centers on the line
1149
+ // between adjacent color steps. The outer two clamp inside the bar's width
1150
+ // (first left-aligned, last right-aligned) so nothing overflows the row.
1151
+ // `left`/`transform` are applied inline per label in the renderer.
1152
+ boundaryLabels: {
1153
+ position: "relative",
1154
+ height: 16
1155
+ },
1156
+ boundaryLabel: {
1157
+ position: "absolute",
1158
+ top: 0,
1159
+ whiteSpace: "nowrap"
1160
+ }
1161
+ };
1162
+ function Wt(t) {
1163
+ const {
1164
+ avg: e,
1165
+ stops: o
1166
+ } = t;
1167
+ if (e == null || o.length < 2) return null;
1168
+ const n = o[0].value, i = o[o.length - 1].value;
1169
+ if (n === i) return null;
1170
+ const r = (e - n) / (i - n) * 100;
1171
+ return Math.min(100, Math.max(0, r));
1172
+ }
1173
+ function De(t) {
1174
+ const e = R(40), {
1175
+ data: o,
1176
+ labels: n
1177
+ } = t, i = n === void 0 ? ae : n, {
1178
+ colors: r,
1179
+ stops: l,
1180
+ isContinuous: p,
1181
+ attribute: a,
1182
+ formatValue: d
1183
+ } = o, f = d === void 0 ? String : d;
1184
+ let m;
1185
+ e[0] !== o ? (m = Wt(o), e[0] = o, e[1] = m) : m = e[1];
1186
+ const c = m, g = l[0], u = l[l.length - 1];
1187
+ let h;
1188
+ e[2] !== r ? (h = r.join(", "), e[2] = r, e[3] = h) : h = e[3];
1189
+ const y = `linear-gradient(90deg, ${h})`, x = !p && l.length === r.length + 1, b = !p && !x;
1190
+ let v;
1191
+ e[4] !== l ? (v = (_) => `${l[_]?.label ?? ""} – ${l[_ + 1]?.label ?? ""}`, e[4] = l, e[5] = v) : v = e[5];
1192
+ const L = v;
1193
+ let w;
1194
+ e[6] !== a || e[7] !== i ? (w = a && /* @__PURE__ */ E(P, { sx: U.attribute, children: [
1195
+ /* @__PURE__ */ s(V, { variant: "overline", color: "text.secondary", children: i.colorBasedOn }),
1196
+ /* @__PURE__ */ s(V, { variant: "caption", color: "text.primary", children: a })
1197
+ ] }), e[6] = a, e[7] = i, e[8] = w) : w = e[8];
1198
+ const k = w;
1199
+ if (b) {
1200
+ let _;
1201
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ s(pt, { fontSize: "small" }), e[9] = _) : _ = e[9];
1202
+ const O = `Discrete ramp needs ${r.length + 1} stops (one per color boundary) but got ${l.length}.`;
1203
+ let T;
1204
+ e[10] !== O ? (T = /* @__PURE__ */ E(P, { sx: U.error, children: [
1205
+ _,
1206
+ /* @__PURE__ */ s(V, { variant: "caption", color: "error", children: O })
1207
+ ] }), e[10] = O, e[11] = T) : T = e[11];
1208
+ let D;
1209
+ return e[12] !== k || e[13] !== T ? (D = /* @__PURE__ */ E(P, { sx: U.container, children: [
1210
+ k,
1211
+ T
1212
+ ] }), e[12] = k, e[13] = T, e[14] = D) : D = e[14], D;
1213
+ }
1214
+ let C;
1215
+ e[15] !== r || e[16] !== y || e[17] !== p || e[18] !== i || e[19] !== L ? (C = p ? /* @__PURE__ */ s(P, { role: "img", "aria-label": i.colorGradient, sx: {
1216
+ width: "100%",
1217
+ height: "100%",
1218
+ background: y
1219
+ } }) : r.map((_, O) => /* @__PURE__ */ s(P, { role: "img", "aria-label": L(O), sx: {
1220
+ ...U.step,
1221
+ backgroundColor: _
1222
+ } }, O)), e[15] = r, e[16] = y, e[17] = p, e[18] = i, e[19] = L, e[20] = C) : C = e[20];
1223
+ let S;
1224
+ e[21] !== C ? (S = /* @__PURE__ */ s(P, { sx: U.bar, children: C }), e[21] = C, e[22] = S) : S = e[22];
1225
+ let z;
1226
+ e[23] !== c || e[24] !== o.avg || e[25] !== f ? (z = c != null && o.avg != null && /* @__PURE__ */ s(we, { title: f(o.avg), placement: "top", arrow: !0, children: /* @__PURE__ */ s(P, { sx: U.avgLine, style: {
1227
+ left: `${c}%`
1228
+ } }) }), e[23] = c, e[24] = o.avg, e[25] = f, e[26] = z) : z = e[26];
1229
+ let $;
1230
+ e[27] !== S || e[28] !== z ? ($ = /* @__PURE__ */ E(P, { sx: U.barWrap, children: [
1231
+ S,
1232
+ z
1233
+ ] }), e[27] = S, e[28] = z, e[29] = $) : $ = e[29];
1234
+ let M;
1235
+ e[30] !== r.length || e[31] !== g?.label || e[32] !== x || e[33] !== u?.label || e[34] !== l ? (M = x ? /* @__PURE__ */ s(P, { sx: U.boundaryLabels, children: l.map((_, O) => {
1236
+ const T = O === l.length - 1, D = O === 0 ? void 0 : T ? "translateX(-100%)" : "translateX(-50%)";
1237
+ return /* @__PURE__ */ s(V, { variant: "overline", color: "text.secondary", sx: U.boundaryLabel, style: {
1238
+ left: `${O / r.length * 100}%`,
1239
+ transform: D
1240
+ }, children: _.label }, `${_.label}-${O}`);
1241
+ }) }) : /* @__PURE__ */ E(P, { sx: U.labels, children: [
1242
+ /* @__PURE__ */ s(V, { variant: "overline", color: "text.secondary", children: g?.label }),
1243
+ /* @__PURE__ */ s(V, { variant: "overline", color: "text.secondary", children: u?.label })
1244
+ ] }), e[30] = r.length, e[31] = g?.label, e[32] = x, e[33] = u?.label, e[34] = l, e[35] = M) : M = e[35];
1245
+ let I;
1246
+ return e[36] !== k || e[37] !== $ || e[38] !== M ? (I = /* @__PURE__ */ E(P, { sx: U.container, children: [
1247
+ k,
1248
+ $,
1249
+ M
1250
+ ] }), e[36] = k, e[37] = $, e[38] = M, e[39] = I) : I = e[39], I;
1251
+ }
1252
+ const ne = {
1253
+ root: {
1254
+ display: "flex",
1255
+ flexDirection: "column",
1256
+ gap: 1
1257
+ },
1258
+ attribute: {
1259
+ display: "flex",
1260
+ flexDirection: "column"
1261
+ },
1262
+ body: {
1263
+ display: "flex",
1264
+ alignItems: "flex-end",
1265
+ gap: 2,
1266
+ paddingTop: 0.5
1267
+ },
1268
+ circles: {
1269
+ position: "relative",
1270
+ flexShrink: 0
1271
+ },
1272
+ // All circles share the bottom and right edges (anchored bottom-right), so
1273
+ // they nest along the diagonal — largest fanning up-left, smallest in the
1274
+ // bottom-right. Every circle has the SAME opaque fill, so overlaps don't
1275
+ // compound (uniform colour) while the borders still read as nested rings.
1276
+ circle: {
1277
+ position: "absolute",
1278
+ right: 0,
1279
+ bottom: 0,
1280
+ borderRadius: "50%",
1281
+ backgroundColor: "grey.50",
1282
+ border: "1px solid",
1283
+ borderColor: "grey.100",
1284
+ boxSizing: "border-box"
1285
+ },
1286
+ labels: {
1287
+ flex: 1,
1288
+ display: "flex",
1289
+ flexDirection: "column",
1290
+ justifyContent: "space-between"
1291
+ }
1292
+ }, re = 72, Ft = 0.3, be = 2, ue = 4;
1293
+ function Nt(t) {
1294
+ const e = (t.stops ?? []).filter((r) => Number.isFinite(r));
1295
+ if (e.length >= be)
1296
+ return e.sort((r, l) => l - r).slice(0, ue);
1297
+ const {
1298
+ min: o,
1299
+ max: n
1300
+ } = t;
1301
+ if (o === n) return [n];
1302
+ const i = Math.min(ue, Math.max(be, t.steps ?? ue));
1303
+ return Array.from({
1304
+ length: i
1305
+ }, (r, l) => n - (n - o) * l / (i - 1));
1306
+ }
1307
+ function Ut(t, e) {
1308
+ if (e <= 1) return re;
1309
+ const o = 1 - (1 - Ft) * (t / (e - 1));
1310
+ return re * o;
1311
+ }
1312
+ function Ge(t) {
1313
+ const e = R(40), {
1314
+ data: o,
1315
+ labels: n
1316
+ } = t, i = n === void 0 ? ae : n, {
1317
+ attribute: r,
1318
+ formatValue: l
1319
+ } = o, p = l === void 0 ? String : l;
1320
+ let a, d, f, m, c, g, u, h, y;
1321
+ if (e[0] !== r || e[1] !== o || e[2] !== p || e[3] !== i) {
1322
+ const L = Nt(o), w = L.length;
1323
+ let k;
1324
+ e[13] !== p || e[14] !== i || e[15] !== w ? (k = (M, I) => {
1325
+ const _ = p(M);
1326
+ return w <= 1 ? _ : I === 0 ? /* @__PURE__ */ E(se, { children: [
1327
+ i.maxPrefix,
1328
+ _
1329
+ ] }) : I === w - 1 ? /* @__PURE__ */ E(se, { children: [
1330
+ i.minPrefix,
1331
+ _
1332
+ ] }) : _;
1333
+ }, e[13] = p, e[14] = i, e[15] = w, e[16] = k) : k = e[16];
1334
+ const C = k;
1335
+ f = P, h = ne.root, e[17] !== r || e[18] !== i ? (y = r && /* @__PURE__ */ E(P, { sx: ne.attribute, children: [
1336
+ /* @__PURE__ */ s(V, { variant: "overline", color: "text.secondary", children: i.radiusRangeBy }),
1337
+ /* @__PURE__ */ s(V, { variant: "caption", color: "text.primary", children: r })
1338
+ ] }), e[17] = r, e[18] = i, e[19] = y) : y = e[19], d = P, g = ne.body;
1339
+ let S;
1340
+ e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = {
1341
+ ...ne.circles,
1342
+ width: re,
1343
+ height: re
1344
+ }, e[20] = S) : S = e[20];
1345
+ let z;
1346
+ e[21] !== w ? (z = (M, I) => {
1347
+ const _ = Ut(I, w);
1348
+ return /* @__PURE__ */ s(P, { "aria-hidden": !0, sx: {
1349
+ ...ne.circle,
1350
+ width: _,
1351
+ height: _
1352
+ } }, I);
1353
+ }, e[21] = w, e[22] = z) : z = e[22], u = /* @__PURE__ */ s(P, { sx: S, children: L.map(z) }), a = P, e[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = {
1354
+ ...ne.labels,
1355
+ height: re
1356
+ }, e[23] = m) : m = e[23];
1357
+ let $;
1358
+ e[24] !== C ? ($ = (M, I) => /* @__PURE__ */ s(V, { variant: "caption", color: "text.secondary", children: C(M, I) }, I), e[24] = C, e[25] = $) : $ = e[25], c = L.map($), e[0] = r, e[1] = o, e[2] = p, e[3] = i, e[4] = a, e[5] = d, e[6] = f, e[7] = m, e[8] = c, e[9] = g, e[10] = u, e[11] = h, e[12] = y;
1359
+ } else
1360
+ a = e[4], d = e[5], f = e[6], m = e[7], c = e[8], g = e[9], u = e[10], h = e[11], y = e[12];
1361
+ let x;
1362
+ e[26] !== a || e[27] !== m || e[28] !== c ? (x = /* @__PURE__ */ s(a, { sx: m, children: c }), e[26] = a, e[27] = m, e[28] = c, e[29] = x) : x = e[29];
1363
+ let b;
1364
+ e[30] !== d || e[31] !== g || e[32] !== u || e[33] !== x ? (b = /* @__PURE__ */ E(d, { sx: g, children: [
1365
+ u,
1366
+ x
1367
+ ] }), e[30] = d, e[31] = g, e[32] = u, e[33] = x, e[34] = b) : b = e[34];
1368
+ let v;
1369
+ return e[35] !== f || e[36] !== b || e[37] !== h || e[38] !== y ? (v = /* @__PURE__ */ E(f, { sx: h, children: [
1370
+ y,
1371
+ b
1372
+ ] }), e[35] = f, e[36] = b, e[37] = h, e[38] = y, e[39] = v) : v = e[39], v;
1373
+ }
1374
+ const Q = {
1375
+ list: {
1376
+ display: "flex",
1377
+ flexDirection: "column",
1378
+ gap: 0.5,
1379
+ // Values are hidden until the legend content is hovered (or keyboard-
1380
+ // focused). On hover-incapable (touch) devices they're always visible —
1381
+ // tap-:hover is unreliable on non-interactive elements.
1382
+ "&:hover .PsLegend-value, &:focus-within .PsLegend-value": {
1383
+ opacity: 1
1384
+ },
1385
+ "@media (hover: none)": {
1386
+ "& .PsLegend-value": {
1387
+ opacity: 1
1388
+ }
1389
+ }
1390
+ },
1391
+ item: {
1392
+ display: "flex",
1393
+ alignItems: "center",
1394
+ gap: 1
1395
+ },
1396
+ icon: {
1397
+ flexShrink: 0,
1398
+ width: 16,
1399
+ height: 16,
1400
+ objectFit: "contain"
1401
+ },
1402
+ label: {
1403
+ flex: 1,
1404
+ minWidth: 0,
1405
+ overflow: "hidden",
1406
+ textOverflow: "ellipsis",
1407
+ whiteSpace: "nowrap"
1408
+ },
1409
+ value: {
1410
+ flexShrink: 0,
1411
+ opacity: 0,
1412
+ transition: "opacity 120ms"
1413
+ },
1414
+ // ─── Horizontal orientation modifiers (spread over the vertical base) ───
1415
+ listHorizontal: {
1416
+ flexDirection: "row",
1417
+ flexWrap: "wrap",
1418
+ columnGap: 2,
1419
+ rowGap: 0.5
1420
+ },
1421
+ itemHorizontal: {
1422
+ gap: 0.5
1423
+ },
1424
+ labelHorizontal: {
1425
+ flex: "0 0 auto",
1426
+ overflow: "visible",
1427
+ textOverflow: "clip"
1428
+ }
1429
+ };
1430
+ function Ve(t) {
1431
+ const e = R(11), {
1432
+ data: o
1433
+ } = t, n = o.orientation ?? "vertical", i = n === "horizontal", r = i ? Q.listHorizontal : null;
1434
+ let l;
1435
+ e[0] !== r ? (l = {
1436
+ ...Q.list,
1437
+ ...r
1438
+ }, e[0] = r, e[1] = l) : l = e[1];
1439
+ let p;
1440
+ if (e[2] !== o.items || e[3] !== i) {
1441
+ let d;
1442
+ e[5] !== i ? (d = (f, m) => /* @__PURE__ */ E(P, { sx: {
1443
+ ...Q.item,
1444
+ ...i ? Q.itemHorizontal : null
1445
+ }, children: [
1446
+ /* @__PURE__ */ s(P, { component: "img", src: f.icon, alt: "", sx: Q.icon }),
1447
+ /* @__PURE__ */ s(V, { variant: "caption", color: "text.primary", sx: {
1448
+ ...Q.label,
1449
+ ...i ? Q.labelHorizontal : null
1450
+ }, children: f.label }),
1451
+ f.value != null && /* @__PURE__ */ s(V, { className: "PsLegend-value", variant: "caption", color: "text.secondary", sx: Q.value, children: f.value })
1452
+ ] }, `${f.label}-${m}`), e[5] = i, e[6] = d) : d = e[6], p = o.items.map(d), e[2] = o.items, e[3] = i, e[4] = p;
1453
+ } else
1454
+ p = e[4];
1455
+ let a;
1456
+ return e[7] !== n || e[8] !== l || e[9] !== p ? (a = /* @__PURE__ */ s(P, { "data-orientation": n, sx: l, children: p }), e[7] = n, e[8] = l, e[9] = p, e[10] = a) : a = e[10], a;
1457
+ }
1458
+ function Re(t) {
1459
+ const e = R(10), {
1460
+ data: o,
1461
+ labels: n
1462
+ } = t;
1463
+ switch (o.type) {
1464
+ case "category": {
1465
+ let i;
1466
+ return e[0] !== o ? (i = /* @__PURE__ */ s(He, { data: o }), e[0] = o, e[1] = i) : i = e[1], i;
1467
+ }
1468
+ case "ramp": {
1469
+ let i;
1470
+ return e[2] !== o || e[3] !== n ? (i = /* @__PURE__ */ s(De, { data: o, labels: n }), e[2] = o, e[3] = n, e[4] = i) : i = e[4], i;
1471
+ }
1472
+ case "proportion": {
1473
+ let i;
1474
+ return e[5] !== o || e[6] !== n ? (i = /* @__PURE__ */ s(Ge, { data: o, labels: n }), e[5] = o, e[6] = n, e[7] = i) : i = e[7], i;
1475
+ }
1476
+ case "icon": {
1477
+ let i;
1478
+ return e[8] !== o ? (i = /* @__PURE__ */ s(Ve, { data: o }), e[8] = o, e[9] = i) : i = e[9], i;
1479
+ }
1480
+ default:
1481
+ return o;
1482
+ }
1483
+ }
1484
+ const jt = {
1485
+ // Figma: stacked variable sections sit ~16px apart (wider than the row
1486
+ // content's 8px block gap).
1487
+ stack: {
1488
+ display: "flex",
1489
+ flexDirection: "column",
1490
+ gap: 2
1491
+ }
1492
+ };
1493
+ function Zt() {
1494
+ const t = R(9), e = ee(), o = te();
1495
+ let n;
1496
+ t[0] !== o ? (n = (a) => o ? a.layers[o.layerId]?.variables : void 0, t[0] = o, t[1] = n) : n = t[1];
1497
+ const i = Y(e, n), {
1498
+ labels: r
1499
+ } = K();
1500
+ if (!i || i.length === 0)
1501
+ return null;
1502
+ let l;
1503
+ if (t[2] !== r || t[3] !== i) {
1504
+ let a;
1505
+ t[5] !== r ? (a = (d, f) => /* @__PURE__ */ s(Re, { data: d, labels: r }, f), t[5] = r, t[6] = a) : a = t[6], l = i.map(a), t[2] = r, t[3] = i, t[4] = l;
1506
+ } else
1507
+ l = t[4];
1508
+ let p;
1509
+ return t[7] !== l ? (p = /* @__PURE__ */ s(P, { sx: jt.stack, children: l }), t[7] = l, t[8] = p) : p = t[8], p;
1510
+ }
1511
+ const rl = {
1512
+ // Composition shell
1513
+ Provider: ut,
1514
+ Group: yt,
1515
+ Row: bt,
1516
+ Actions: Pe,
1517
+ // Store-connected actions & controls (context-driven)
1518
+ VisibilityToggle: wt,
1519
+ RowMenu: $t,
1520
+ ZoomTo: kt,
1521
+ Opacity: Ot,
1522
+ ConfigSelect: Tt,
1523
+ Item: Zt,
1524
+ // Pure UI
1525
+ ItemUI: Re,
1526
+ Swatch: Ee,
1527
+ CategoryUI: He,
1528
+ RampUI: De,
1529
+ ProportionUI: Ge,
1530
+ IconUI: Ve
1531
+ };
1532
+ export {
1533
+ ae as DEFAULT_LEGEND_LABELS,
1534
+ rl as Legend
1535
+ };
1536
+ //# sourceMappingURL=legend.js.map