@blocklet/labels 1.5.13 → 1.5.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,24 +1,23 @@
1
- import { createContext as V, useRef as D, useState as S, useCallback as O, useEffect as E, useMemo as z, useContext as q } from "react";
2
- import j from "@mui/icons-material/ExpandMore";
1
+ import { createContext as V, useRef as j, useState as I, useCallback as T, useEffect as D, useMemo as z, useContext as q } from "react";
2
+ import F from "@mui/icons-material/ExpandMore";
3
3
  import p from "@mui/material/Box";
4
- import { styled as F } from "@mui/material/styles";
4
+ import { styled as H } from "@mui/material/styles";
5
5
  import { Tree as U } from "react-arborist";
6
6
  import { Icon as X } from "@iconify/react";
7
- import { jsx as e, jsxs as C, Fragment as B } from "react/jsx-runtime";
8
- import _ from "lodash/omit";
9
- import ee, { components as H } from "react-select";
10
- import te from "@mui/material/Typography";
11
- import T from "@mui/material/Button";
7
+ import { jsx as n, jsxs as C, Fragment as P } from "react/jsx-runtime";
8
+ import ee from "lodash/omit";
9
+ import te, { components as J } from "react-select";
10
+ import ne from "@mui/material/Typography";
11
+ import O from "@mui/material/Button";
12
12
  import N from "@mui/material/IconButton";
13
- import ne from "@mui/icons-material/DeleteOutlineOutlined";
14
- import re from "@mui/icons-material/EditOutlined";
15
- import oe from "@mui/icons-material/Add";
16
- import le from "react-use/lib/useSetState";
13
+ import re from "@mui/icons-material/DeleteOutlineOutlined";
14
+ import oe from "@mui/icons-material/EditOutlined";
15
+ import le from "@mui/icons-material/Add";
17
16
  import M from "@mui/material/TextField";
18
17
  import ie from "@mui/base/ClickAwayListener";
19
18
  import { GithubPicker as se } from "react-color";
20
- import J from "@arcblock/ux/lib/Dialog";
21
- import { TextField as R, InputAdornment as ae, IconButton as ce, Box as P } from "@mui/material";
19
+ import _ from "@arcblock/ux/lib/Dialog";
20
+ import { TextField as R, InputAdornment as ae, IconButton as ce, Box as B } from "@mui/material";
22
21
  import de from "@mui/icons-material/Translate";
23
22
  import ue from "@mui/material/Popover";
24
23
  import { useLocaleContext as $ } from "@arcblock/ux/lib/Locale/context";
@@ -27,110 +26,110 @@ import pe from "@mui/icons-material/Edit";
27
26
  import me from "@mui/icons-material/LabelOutlined";
28
27
  import fe from "@mui/material/ClickAwayListener";
29
28
  import ge from "@mui/material/Chip";
30
- const xe = (t) => /* @__PURE__ */ e("svg", {
29
+ const xe = (e) => /* @__PURE__ */ n("svg", {
31
30
  viewBox: "0 0 24 24",
32
31
  width: "1.2em",
33
32
  height: "1.2em",
34
- ...t,
35
- children: /* @__PURE__ */ e("path", {
33
+ ...e,
34
+ children: /* @__PURE__ */ n("path", {
36
35
  fill: "currentColor",
37
36
  d: "M5 19q-.825 0-1.413-.587Q3 17.825 3 17V7q0-.825.587-1.412Q4.175 5 5 5h10q.5 0 .938.225q.437.225.712.625l3.525 5q.375.525.375 1.15q0 .625-.375 1.15l-3.525 5q-.275.4-.712.625Q15.5 19 15 19Z"
38
37
  })
39
- }), ye = (t) => /* @__PURE__ */ e("svg", {
38
+ }), ye = (e) => /* @__PURE__ */ n("svg", {
40
39
  viewBox: "0 0 24 24",
41
40
  width: "1.2em",
42
41
  height: "1.2em",
43
- ...t,
44
- children: /* @__PURE__ */ e("path", {
42
+ ...e,
43
+ children: /* @__PURE__ */ n("path", {
45
44
  fill: "currentColor",
46
45
  d: "m10 16.4l-4-4L7.4 11l2.6 2.6L16.6 7L18 8.4Z"
47
46
  })
48
47
  }), K = V({});
49
48
  function Ce({
50
- selectable: t = !1,
51
- selected: n = [],
52
- onSelect: c,
53
- renderItem: l,
54
- children: o
49
+ selectable: e = !1,
50
+ selected: t = [],
51
+ onSelect: s,
52
+ renderItem: o,
53
+ children: l
55
54
  }) {
56
- const r = (h) => n.indexOf(h) !== -1, i = (h) => {
57
- Array.from(new Set(n).add(h)), c == null || c(h);
58
- }, d = z(
55
+ const r = (h) => t.indexOf(h) !== -1, i = (h) => {
56
+ Array.from(new Set(t).add(h)), s == null || s(h);
57
+ }, a = z(
59
58
  () => ({
60
- selectable: t,
61
- selected: n,
59
+ selectable: e,
60
+ selected: t,
62
61
  isSelected: r,
63
62
  select: i,
64
- renderItem: l
63
+ renderItem: o
65
64
  }),
66
- [n]
65
+ [t]
67
66
  );
68
- return /* @__PURE__ */ e(K.Provider, {
69
- value: d,
70
- children: o
67
+ return /* @__PURE__ */ n(K.Provider, {
68
+ value: a,
69
+ children: l
71
70
  });
72
71
  }
73
- const ve = (t) => {
74
- var n;
75
- return t.isLeaf || !((n = t.data.children) != null && n.length);
72
+ const ve = (e) => {
73
+ var t;
74
+ return e.isLeaf || !((t = e.data.children) != null && t.length);
76
75
  };
77
76
  function be({
78
- node: t
77
+ node: e
79
78
  }) {
80
- return ve(t) ? /* @__PURE__ */ e("span", {}) : t.isOpen ? /* @__PURE__ */ e(j, {
79
+ return ve(e) ? /* @__PURE__ */ n("span", {}) : e.isOpen ? /* @__PURE__ */ n(F, {
81
80
  style: {
82
81
  fontSize: 20
83
82
  }
84
- }) : /* @__PURE__ */ e(j, {
83
+ }) : /* @__PURE__ */ n(F, {
85
84
  style: {
86
85
  fontSize: 20,
87
86
  transform: "rotate(-90deg)"
88
87
  }
89
88
  });
90
89
  }
91
- function Ie({
92
- node: t,
93
- style: n,
94
- dragHandle: c
90
+ function Se({
91
+ node: e,
92
+ style: t,
93
+ dragHandle: s
95
94
  }) {
96
95
  const {
97
- selectable: l,
98
- select: o,
96
+ selectable: o,
97
+ select: l,
99
98
  isSelected: r,
100
99
  renderItem: i
101
100
  } = q(K), {
102
- data: d
103
- } = t, h = d.icon ? /* @__PURE__ */ e(X, {
104
- icon: d.icon,
101
+ data: a
102
+ } = e, h = a.icon ? /* @__PURE__ */ n(X, {
103
+ icon: a.icon,
105
104
  style: {
106
105
  fontSize: 18
107
106
  }
108
- }) : /* @__PURE__ */ e(xe, {
107
+ }) : /* @__PURE__ */ n(xe, {
109
108
  style: {
110
109
  fontSize: 18,
111
- color: d.color || "#ddd"
110
+ color: a.color || "#ddd"
112
111
  }
113
- }), g = (s) => {
114
- s.stopPropagation(), t.isInternal && t.toggle();
115
- }, f = (s) => {
116
- s.stopPropagation(), l && o(t.id);
117
- }, x = /* @__PURE__ */ C(B, {
112
+ }), g = (c) => {
113
+ c.stopPropagation(), e.isInternal && e.toggle();
114
+ }, f = (c) => {
115
+ c.stopPropagation(), o && l(e.id);
116
+ }, x = /* @__PURE__ */ C(P, {
118
117
  children: [/* @__PURE__ */ C(p, {
119
118
  sx: {
120
119
  display: "flex",
121
120
  alignItems: "center",
122
121
  flex: 1
123
122
  },
124
- children: [/* @__PURE__ */ e(p, {
123
+ children: [/* @__PURE__ */ n(p, {
125
124
  sx: {
126
125
  display: "flex",
127
126
  cursor: "pointer"
128
127
  },
129
128
  onClick: g,
130
- children: /* @__PURE__ */ e(be, {
131
- node: t
129
+ children: /* @__PURE__ */ n(be, {
130
+ node: e
132
131
  })
133
- }), /* @__PURE__ */ e(p, {
132
+ }), /* @__PURE__ */ n(p, {
134
133
  sx: {
135
134
  display: "flex",
136
135
  alignItems: "center",
@@ -138,29 +137,29 @@ function Ie({
138
137
  height: 22
139
138
  },
140
139
  children: h
141
- }), /* @__PURE__ */ e(p, {
140
+ }), /* @__PURE__ */ n(p, {
142
141
  component: "span",
143
142
  sx: {
144
143
  color: "grey.700"
145
144
  },
146
- children: t.data.name
145
+ children: e.data.name
147
146
  })]
148
- }), l && r(t.id) && /* @__PURE__ */ e(ye, {})]
147
+ }), o && r(e.id) && /* @__PURE__ */ n(ye, {})]
149
148
  });
150
149
  return /* @__PURE__ */ C(p, {
151
150
  className: "label-tree-item",
152
- style: n,
151
+ style: t,
153
152
  sx: {
154
153
  display: "flex",
155
154
  alignItems: "center",
156
155
  justifyContent: "space-between"
157
156
  },
158
- ref: c,
157
+ ref: s,
159
158
  onClick: f,
160
- children: [!i && x, !!i && i(x, t.data)]
159
+ children: [!i && x, !!i && i(x, e.data)]
161
160
  });
162
161
  }
163
- const we = F(p)`
162
+ const we = H(p)`
164
163
  > div,
165
164
  > div > div,
166
165
  > div > div > div {
@@ -175,107 +174,107 @@ const we = F(p)`
175
174
  }
176
175
  `;
177
176
  function W({
178
- data: t,
179
- selectable: n,
180
- selected: c = [],
181
- onSelect: l,
182
- rowHeight: o = 28,
177
+ data: e,
178
+ selectable: t,
179
+ selected: s = [],
180
+ onSelect: o,
181
+ rowHeight: l = 28,
183
182
  renderItem: r,
184
183
  sx: i,
185
- ...d
184
+ ...a
186
185
  }) {
187
- const h = D(), g = [...Array.isArray(i) ? i : [i]], [f, x] = S(0), s = O(() => {
188
- var b, a;
189
- x((((a = (b = h.current) == null ? void 0 : b.visibleNodes) == null ? void 0 : a.length) || 0) * o);
190
- }, [o]);
191
- return E(() => {
192
- s();
193
- }, [t, s]), /* @__PURE__ */ e(Ce, {
194
- selectable: n,
195
- selected: c,
196
- onSelect: l,
186
+ const h = j(), g = [...Array.isArray(i) ? i : [i]], [f, x] = I(0), c = T(() => {
187
+ var b, d;
188
+ x((((d = (b = h.current) == null ? void 0 : b.visibleNodes) == null ? void 0 : d.length) || 0) * l);
189
+ }, [l]);
190
+ return D(() => {
191
+ c();
192
+ }, [e, c]), /* @__PURE__ */ n(Ce, {
193
+ selectable: t,
194
+ selected: s,
195
+ onSelect: o,
197
196
  renderItem: r,
198
- children: /* @__PURE__ */ e(we, {
199
- ...d,
197
+ children: /* @__PURE__ */ n(we, {
198
+ ...a,
200
199
  sx: g,
201
- children: /* @__PURE__ */ e(U, {
202
- data: t,
203
- rowHeight: o,
200
+ children: /* @__PURE__ */ n(U, {
201
+ data: e,
202
+ rowHeight: l,
204
203
  height: f,
205
204
  indent: 32,
206
205
  ref: h,
207
206
  onToggle: () => {
208
- setTimeout(s);
207
+ setTimeout(c);
209
208
  },
210
- children: Ie
209
+ children: Se
211
210
  })
212
211
  })
213
212
  });
214
213
  }
215
- const L = (t) => t.reduce((n, c) => {
216
- var l;
217
- return n.push(c), (l = c.children) != null && l.length && n.push(...L(c.children)), n;
218
- }, []), Q = (t) => t.map((n) => {
219
- var c;
220
- return (c = n.children) != null && c.length && (n.children = Q(n.children)), n;
221
- }), Se = (t, n = null) => {
214
+ const L = (e) => e.reduce((t, s) => {
215
+ var o;
216
+ return t.push(s), (o = s.children) != null && o.length && t.push(...L(s.children)), t;
217
+ }, []), Q = (e) => e.map((t) => {
218
+ var s;
219
+ return (s = t.children) != null && s.length && (t.children = Q(t.children)), t;
220
+ }), Ie = (e, t = null) => {
222
221
  try {
223
- return JSON.parse(t);
222
+ return JSON.parse(e);
224
223
  } catch {
225
- return n;
224
+ return t;
226
225
  }
227
- }, ze = (t) => {
228
- const n = t.reduce((o, r) => (o[r.id] = o[r.id] || {}, r.parentId && (o[r.id].parent = r.parentId, o[r.parentId] = o[r.parentId] || {}, o[r.parentId].children = o[r.parentId].children || [], o[r.parentId].children.push(r.id)), o), {}), c = t.map(({ parentId: o, translation: r, ...i }) => ({
226
+ }, ze = (e) => {
227
+ const t = e.reduce((l, r) => (l[r.id] = l[r.id] || {}, r.parentId && (l[r.id].parent = r.parentId, l[r.parentId] = l[r.parentId] || {}, l[r.parentId].children = l[r.parentId].children || [], l[r.parentId].children.push(r.id)), l), {}), s = e.map(({ parentId: l, translation: r, ...i }) => ({
229
228
  ...i,
230
- translation: Se(r),
229
+ translation: Ie(r),
231
230
  children: []
232
- })), l = c.reduce((o, r) => ({ ...o, [r.id]: r }), {});
233
- return c.forEach((o) => {
234
- const r = n[o.id];
235
- r.parent && l[r.parent] && (o.parent = l[r.parent]), r.children && (o.children = r.children.map((i) => l[i]));
236
- }), c.filter((o) => !o.parent);
237
- }, ke = (t) => {
231
+ })), o = s.reduce((l, r) => ({ ...l, [r.id]: r }), {});
232
+ return s.forEach((l) => {
233
+ const r = t[l.id];
234
+ r.parent && o[r.parent] && (l.parent = o[r.parent]), r.children && (l.children = r.children.map((i) => o[i]));
235
+ }), s.filter((l) => !l.parent);
236
+ }, ke = (e) => {
238
237
  const {
239
- options: n,
240
- getValue: c,
241
- selectProps: l,
242
- selectOption: o
243
- } = t, r = c(), i = (d) => {
244
- const h = n.find((g) => g.data.id === d);
245
- h && o(h);
238
+ options: t,
239
+ getValue: s,
240
+ selectProps: o,
241
+ selectOption: l
242
+ } = e, r = s(), i = (a) => {
243
+ const h = t.find((g) => g.data.id === a);
244
+ h && l(h);
246
245
  };
247
- return /* @__PURE__ */ C(B, {
248
- children: [/* @__PURE__ */ e(H.MenuList, {
249
- ..._(t, ["addon"]),
250
- children: /* @__PURE__ */ e(p, {
246
+ return /* @__PURE__ */ C(P, {
247
+ children: [/* @__PURE__ */ n(J.MenuList, {
248
+ ...ee(e, ["addon"]),
249
+ children: /* @__PURE__ */ n(p, {
251
250
  sx: {
252
251
  px: 2,
253
252
  py: 1
254
253
  },
255
- children: /* @__PURE__ */ e(W, {
256
- data: l.data,
254
+ children: /* @__PURE__ */ n(W, {
255
+ data: o.data,
257
256
  selectable: !0,
258
257
  onSelect: i,
259
- selected: r.map((d) => d.data.id)
258
+ selected: r.map((a) => a.data.id)
260
259
  })
261
260
  })
262
- }), t.addon]
261
+ }), e.addon]
263
262
  });
264
263
  }, Te = ({
265
- children: t,
266
- ...n
264
+ children: e,
265
+ ...t
267
266
  }) => {
268
- const [c, l] = t, o = Array.isArray(c) ? c.length : 0;
269
- return /* @__PURE__ */ C(H.ValueContainer, {
270
- ...n,
271
- children: [/* @__PURE__ */ e(p, {
267
+ const [s, o] = e, l = Array.isArray(s) ? s.length : 0;
268
+ return /* @__PURE__ */ C(J.ValueContainer, {
269
+ ...t,
270
+ children: [/* @__PURE__ */ n(p, {
272
271
  component: "span",
273
272
  sx: {
274
273
  fontSize: 13,
275
274
  fontWeight: "bold"
276
275
  },
277
- children: o ? "Labels" : "Filter by labels"
278
- }), !!o && /* @__PURE__ */ e(p, {
276
+ children: l ? "Labels" : "Filter by labels"
277
+ }), !!l && /* @__PURE__ */ n(p, {
279
278
  sx: {
280
279
  display: "inline-flex",
281
280
  justifyContent: "center",
@@ -287,64 +286,64 @@ const L = (t) => t.reduce((n, c) => {
287
286
  fontSize: 12,
288
287
  bgcolor: "grey.200"
289
288
  },
290
- children: o
291
- }), l]
289
+ children: l
290
+ }), o]
292
291
  });
293
- }, Ae = {
294
- control: (t) => ({
295
- ...t,
292
+ }, Oe = {
293
+ control: (e) => ({
294
+ ...e,
296
295
  minHeight: 31
297
296
  }),
298
- valueContainer: (t) => ({
299
- ...t,
297
+ valueContainer: (e) => ({
298
+ ...e,
300
299
  display: "flex"
301
300
  }),
302
- dropdownIndicator: (t) => ({
303
- ...t,
301
+ dropdownIndicator: (e) => ({
302
+ ...e,
304
303
  padding: "0 4px"
305
304
  }),
306
- clearIndicator: (t) => ({
307
- ...t,
305
+ clearIndicator: (e) => ({
306
+ ...e,
308
307
  padding: "4px"
309
308
  })
310
309
  };
311
- function Oe({
312
- data: t,
313
- value: n = [],
314
- editable: c = !1,
315
- addon: l,
316
- onChange: o,
310
+ function Ae({
311
+ data: e,
312
+ value: t = [],
313
+ editable: s = !1,
314
+ addon: o,
315
+ onChange: l,
317
316
  compact: r,
318
317
  ...i
319
318
  }) {
320
- const d = D(null), h = z(() => L(t).map((a) => ({
321
- data: a,
322
- label: a.name,
323
- value: a.id
324
- })), [t]), g = h.reduce((a, w) => ({
325
- ...a,
319
+ const a = j(null), h = z(() => L(e).map((d) => ({
320
+ data: d,
321
+ label: d.name,
322
+ value: d.id
323
+ })), [e]), g = h.reduce((d, w) => ({
324
+ ...d,
326
325
  [w.data.id]: w
327
- }), {}), f = Array.isArray(n) ? n : [n], x = f.map((a) => g[a]), s = D({
328
- prev: f.map((a) => g[a].data)
329
- }), m = (a, w) => {
330
- s.current.current = a.map((k) => k.data), ["clear", "remove-value"].includes(w.action) && d.current && setTimeout(() => {
326
+ }), {}), f = Array.isArray(t) ? t : [t], x = f.map((d) => g[d]), c = j({
327
+ prev: f.map((d) => g[d].data)
328
+ }), m = (d, w) => {
329
+ c.current.current = d.map((k) => k.data), ["clear", "remove-value"].includes(w.action) && a.current && setTimeout(() => {
331
330
  var k;
332
- return (k = d == null ? void 0 : d.current) == null ? void 0 : k.blur();
331
+ return (k = a == null ? void 0 : a.current) == null ? void 0 : k.blur();
333
332
  }, 1);
334
333
  }, b = () => {
335
- s.current.current && JSON.stringify(s.current.prev.map((w) => w.id)) !== JSON.stringify(s.current.current.map((w) => w.id)) && (o(s.current.current), s.current.prev = s.current.current);
334
+ c.current.current && JSON.stringify(c.current.prev.map((w) => w.id)) !== JSON.stringify(c.current.current.map((w) => w.id)) && (l(c.current.current), c.current.prev = c.current.current);
336
335
  };
337
- return /* @__PURE__ */ e(p, {
336
+ return /* @__PURE__ */ n(p, {
338
337
  ...i,
339
- children: /* @__PURE__ */ e(ee, {
340
- ref: d,
338
+ children: /* @__PURE__ */ n(te, {
339
+ ref: a,
341
340
  defaultValue: x,
342
341
  options: h,
343
342
  onChange: m,
344
343
  components: {
345
- MenuList: (a) => /* @__PURE__ */ e(ke, {
346
- ...a,
347
- addon: l
344
+ MenuList: (d) => /* @__PURE__ */ n(ke, {
345
+ ...d,
346
+ addon: o
348
347
  }),
349
348
  ...r && {
350
349
  ValueContainer: Te
@@ -352,24 +351,24 @@ function Oe({
352
351
  },
353
352
  placeholder: "Select labels",
354
353
  styles: {
355
- ...r && Ae,
356
- menu: (a) => ({
357
- ...a,
358
- ...c && {
354
+ ...r && Oe,
355
+ menu: (d) => ({
356
+ ...d,
357
+ ...s && {
359
358
  paddingBottom: "36px"
360
359
  },
361
360
  zIndex: 99
362
361
  }),
363
- menuList: (a) => ({
364
- ...a,
362
+ menuList: (d) => ({
363
+ ...d,
365
364
  overflowY: "auto",
366
365
  maxHeight: "264px"
367
366
  })
368
367
  },
369
- theme: (a) => ({
370
- ...a,
368
+ theme: (d) => ({
369
+ ...d,
371
370
  colors: {
372
- ...a.colors,
371
+ ...d.colors,
373
372
  primary25: "#ddd",
374
373
  primary50: "#ddd",
375
374
  primary: "#ddd"
@@ -379,35 +378,77 @@ function Oe({
379
378
  isMulti: !0,
380
379
  closeMenuOnSelect: !1,
381
380
  onMenuClose: b,
382
- data: t
381
+ data: e
383
382
  })
384
383
  });
385
384
  }
386
- function Be({
387
- I18NProps: t,
388
- ...n
385
+ var E = function() {
386
+ return E = Object.assign || function(t) {
387
+ for (var s, o = 1, l = arguments.length; o < l; o++) {
388
+ s = arguments[o];
389
+ for (var r in s)
390
+ Object.prototype.hasOwnProperty.call(s, r) && (t[r] = s[r]);
391
+ }
392
+ return t;
393
+ }, E.apply(this, arguments);
394
+ };
395
+ function Pe(e, t) {
396
+ var s = typeof Symbol == "function" && e[Symbol.iterator];
397
+ if (!s)
398
+ return e;
399
+ var o = s.call(e), l, r = [], i;
400
+ try {
401
+ for (; (t === void 0 || t-- > 0) && !(l = o.next()).done; )
402
+ r.push(l.value);
403
+ } catch (a) {
404
+ i = { error: a };
405
+ } finally {
406
+ try {
407
+ l && !l.done && (s = o.return) && s.call(o);
408
+ } finally {
409
+ if (i)
410
+ throw i.error;
411
+ }
412
+ }
413
+ return r;
414
+ }
415
+ var Be = function(e) {
416
+ return typeof e == "function";
417
+ }, Ne = function(e) {
418
+ var t = Pe(I(e), 2), s = t[0], o = t[1], l = T(function(r) {
419
+ o(function(i) {
420
+ var a = Be(r) ? r(i) : r;
421
+ return a ? E(E({}, i), a) : i;
422
+ });
423
+ }, []);
424
+ return [s, l];
425
+ };
426
+ const Ee = Ne;
427
+ function Le({
428
+ I18NProps: e,
429
+ ...t
389
430
  }) {
390
431
  const {
391
- languages: c
432
+ languages: s
392
433
  } = $(), {
393
- translation: l,
394
- onChange: o
395
- } = t, [r, i] = S(null), d = (f) => {
434
+ translation: o,
435
+ onChange: l
436
+ } = e, [r, i] = I(null), a = (f) => {
396
437
  const x = f.currentTarget.closest(".MuiInputBase-root");
397
438
  x && i(x);
398
439
  }, h = () => {
399
440
  i(null);
400
- }, g = c.filter((f) => f.code !== "en");
401
- return /* @__PURE__ */ e(R, {
402
- ...n,
441
+ }, g = s.filter((f) => f.code !== "en");
442
+ return /* @__PURE__ */ n(R, {
443
+ ...t,
403
444
  InputProps: {
404
445
  endAdornment: /* @__PURE__ */ C(ae, {
405
446
  position: "end",
406
- children: [/* @__PURE__ */ e(ce, {
447
+ children: [/* @__PURE__ */ n(ce, {
407
448
  edge: "end",
408
- onClick: d,
409
- children: /* @__PURE__ */ e(de, {})
410
- }), /* @__PURE__ */ e(ue, {
449
+ onClick: a,
450
+ children: /* @__PURE__ */ n(de, {})
451
+ }), /* @__PURE__ */ n(ue, {
411
452
  open: !!r,
412
453
  anchorEl: r,
413
454
  onClose: h,
@@ -431,14 +472,14 @@ function Be({
431
472
  sx: {
432
473
  mt: 2
433
474
  },
434
- children: /* @__PURE__ */ e(P, {
475
+ children: /* @__PURE__ */ n(B, {
435
476
  sx: {
436
477
  p: 2
437
478
  },
438
479
  children: g.map(({
439
480
  code: f,
440
481
  name: x
441
- }) => /* @__PURE__ */ C(P, {
482
+ }) => /* @__PURE__ */ C(B, {
442
483
  sx: {
443
484
  display: "flex",
444
485
  alignItems: "center",
@@ -447,24 +488,24 @@ function Be({
447
488
  mt: 1
448
489
  }
449
490
  },
450
- children: [/* @__PURE__ */ e(P, {
491
+ children: [/* @__PURE__ */ n(B, {
451
492
  sx: {
452
493
  flex: "0 0 120px"
453
494
  },
454
495
  children: x
455
- }), /* @__PURE__ */ e(P, {
496
+ }), /* @__PURE__ */ n(B, {
456
497
  sx: {
457
498
  flex: 1
458
499
  },
459
- children: /* @__PURE__ */ e(R, {
460
- value: l[f] || "",
500
+ children: /* @__PURE__ */ n(R, {
501
+ value: o[f] || "",
461
502
  size: "small",
462
503
  sx: {
463
504
  width: 1
464
505
  },
465
- onChange: (s) => o({
466
- ...l,
467
- [f]: s.target.value
506
+ onChange: (c) => l({
507
+ ...o,
508
+ [f]: c.target.value
468
509
  })
469
510
  })
470
511
  })]
@@ -475,98 +516,98 @@ function Be({
475
516
  }
476
517
  });
477
518
  }
478
- function Pe({
479
- open: t,
480
- initialLabel: n,
481
- onSubmit: c,
482
- onClose: l,
483
- ...o
519
+ function Me({
520
+ open: e,
521
+ initialLabel: t,
522
+ onSubmit: s,
523
+ onClose: o,
524
+ ...l
484
525
  }) {
485
- const r = !(n != null && n.id), [i, d] = le({
486
- name: (n == null ? void 0 : n.name) || "",
487
- color: (n == null ? void 0 : n.color) || "#ddd",
488
- slug: (n == null ? void 0 : n.id) || "",
489
- translation: (n == null ? void 0 : n.translation) || {}
490
- }), h = (a) => /^#([0-9A-F]{3}){1,2}$/i.test(a), g = z(() => r ? i.name && i.color && i.slug && h(i.color) : i.name && i.color && h(i.color), [i, r]), [f, x] = S(!1), s = () => {
491
- c({
492
- ...n,
526
+ const r = !(t != null && t.id), [i, a] = Ee({
527
+ name: (t == null ? void 0 : t.name) || "",
528
+ color: (t == null ? void 0 : t.color) || "#ddd",
529
+ slug: (t == null ? void 0 : t.id) || "",
530
+ translation: (t == null ? void 0 : t.translation) || {}
531
+ }), h = (d) => /^#([0-9A-F]{3}){1,2}$/i.test(d), g = z(() => r ? i.name && i.color && i.slug && h(i.color) : i.name && i.color && h(i.color), [i, r]), [f, x] = I(!1), c = () => {
532
+ s({
533
+ ...t,
493
534
  name: i.name,
494
535
  color: i.color,
495
536
  id: i.slug,
496
537
  translation: i.translation
497
538
  });
498
- }, m = (a) => {
499
- d({
500
- color: a.hex
539
+ }, m = (d) => {
540
+ a({
541
+ color: d.hex
501
542
  }), setTimeout(() => x(!1));
502
- }, b = (a) => {
503
- d({
504
- color: a.target.value
543
+ }, b = (d) => {
544
+ a({
545
+ color: d.target.value
505
546
  });
506
547
  };
507
- return /* @__PURE__ */ e(J, {
508
- open: t,
548
+ return /* @__PURE__ */ n(_, {
549
+ open: e,
509
550
  showCloseButton: !0,
510
551
  maxWidth: "lg",
511
552
  title: r ? "Create label" : "Edit label",
512
- actions: /* @__PURE__ */ C(B, {
513
- children: [/* @__PURE__ */ e(T, {
553
+ actions: /* @__PURE__ */ C(P, {
554
+ children: [/* @__PURE__ */ n(O, {
514
555
  color: "inherit",
515
556
  variant: "contained",
516
557
  size: "small",
517
- onClick: l,
558
+ onClick: o,
518
559
  children: "Cancel"
519
- }), /* @__PURE__ */ e(T, {
560
+ }), /* @__PURE__ */ n(O, {
520
561
  color: "primary",
521
562
  variant: "contained",
522
563
  size: "small",
523
- onClick: s,
564
+ onClick: c,
524
565
  disabled: !g,
525
566
  children: r ? "Create" : "Save Changes"
526
567
  })]
527
568
  }),
528
- onClose: l,
529
- ...o,
569
+ onClose: o,
570
+ ...l,
530
571
  children: /* @__PURE__ */ C(p, {
531
572
  width: 600,
532
573
  minHeight: 280,
533
- children: [/* @__PURE__ */ e(Be, {
574
+ children: [/* @__PURE__ */ n(Le, {
534
575
  label: "Name",
535
576
  value: i.name,
536
577
  placeholder: "New label",
537
578
  size: "small",
538
579
  fullWidth: !0,
539
- onChange: (a) => d({
540
- name: a.target.value
580
+ onChange: (d) => a({
581
+ name: d.target.value
541
582
  }),
542
583
  I18NProps: {
543
584
  translation: i.translation,
544
- onChange: (a) => d({
545
- translation: a
585
+ onChange: (d) => a({
586
+ translation: d
546
587
  })
547
588
  }
548
- }), /* @__PURE__ */ e(M, {
589
+ }), /* @__PURE__ */ n(M, {
549
590
  label: "Slug",
550
591
  value: i.slug,
551
592
  size: "small",
552
593
  fullWidth: !0,
553
594
  disabled: !r,
554
- onChange: (a) => d({
555
- slug: a.target.value
595
+ onChange: (d) => a({
596
+ slug: d.target.value
556
597
  }),
557
598
  sx: {
558
599
  mt: 2
559
600
  }
560
- }), (n == null ? void 0 : n.parent) && /* @__PURE__ */ e(M, {
601
+ }), (t == null ? void 0 : t.parent) && /* @__PURE__ */ n(M, {
561
602
  label: "Parent",
562
- value: n.parent.name,
603
+ value: t.parent.name,
563
604
  size: "small",
564
605
  fullWidth: !0,
565
606
  disabled: !0,
566
607
  sx: {
567
608
  mt: 2
568
609
  }
569
- }), /* @__PURE__ */ e(ie, {
610
+ }), /* @__PURE__ */ n(ie, {
570
611
  onClickAway: () => x(!1),
571
612
  children: /* @__PURE__ */ C(p, {
572
613
  sx: {
@@ -579,7 +620,7 @@ function Pe({
579
620
  alignItems: "center",
580
621
  gap: 1
581
622
  },
582
- children: [/* @__PURE__ */ e(p, {
623
+ children: [/* @__PURE__ */ n(p, {
583
624
  sx: {
584
625
  width: 30,
585
626
  height: 30,
@@ -587,7 +628,7 @@ function Pe({
587
628
  borderRadius: 1
588
629
  },
589
630
  onClick: () => x(!0)
590
- }), /* @__PURE__ */ e(M, {
631
+ }), /* @__PURE__ */ n(M, {
591
632
  label: "",
592
633
  value: i.color,
593
634
  size: "small",
@@ -602,13 +643,13 @@ function Pe({
602
643
  }
603
644
  }
604
645
  })]
605
- }), f && /* @__PURE__ */ e(p, {
646
+ }), f && /* @__PURE__ */ n(p, {
606
647
  sx: {
607
648
  position: "absolute",
608
649
  top: 48,
609
650
  zIndex: 1
610
651
  },
611
- children: /* @__PURE__ */ e(se, {
652
+ children: /* @__PURE__ */ n(se, {
612
653
  color: i.color,
613
654
  onChangeComplete: m
614
655
  })
@@ -618,51 +659,51 @@ function Pe({
618
659
  })
619
660
  });
620
661
  }
621
- function Ne({
622
- open: t,
623
- label: n,
624
- onSubmit: c,
625
- onClose: l,
626
- ...o
662
+ function je({
663
+ open: e,
664
+ label: t,
665
+ onSubmit: s,
666
+ onClose: o,
667
+ ...l
627
668
  }) {
628
- return /* @__PURE__ */ e(J, {
629
- open: t,
669
+ return /* @__PURE__ */ n(_, {
670
+ open: e,
630
671
  showCloseButton: !0,
631
672
  maxWidth: "md",
632
673
  title: "Delete",
633
- actions: /* @__PURE__ */ C(B, {
634
- children: [/* @__PURE__ */ e(T, {
674
+ actions: /* @__PURE__ */ C(P, {
675
+ children: [/* @__PURE__ */ n(O, {
635
676
  color: "inherit",
636
677
  variant: "contained",
637
678
  size: "small",
638
- onClick: l,
679
+ onClick: o,
639
680
  children: "Cancel"
640
- }), /* @__PURE__ */ e(T, {
681
+ }), /* @__PURE__ */ n(O, {
641
682
  color: "primary",
642
683
  variant: "contained",
643
684
  size: "small",
644
- onClick: c,
685
+ onClick: s,
645
686
  children: "Delete"
646
687
  })]
647
688
  }),
648
- onClose: l,
649
- ...o,
689
+ onClose: o,
690
+ ...l,
650
691
  children: /* @__PURE__ */ C(p, {
651
692
  width: 600,
652
693
  minHeight: 280,
653
- children: [/* @__PURE__ */ e(he, {
694
+ children: [/* @__PURE__ */ n(he, {
654
695
  severity: "info",
655
696
  sx: {
656
697
  mb: 2
657
698
  },
658
699
  children: "Are you sure you want to delete these labels ?"
659
- }), /* @__PURE__ */ e(W, {
660
- data: [n]
700
+ }), /* @__PURE__ */ n(W, {
701
+ data: [t]
661
702
  })]
662
703
  })
663
704
  });
664
705
  }
665
- const Le = F(W)`
706
+ const De = H(W)`
666
707
  .label-tree-item {
667
708
  &:before {
668
709
  content: '';
@@ -683,9 +724,9 @@ const Le = F(W)`
683
724
  padding: 0 16px;
684
725
  }
685
726
  `;
686
- function Me({
687
- locale: t,
688
- value: n
727
+ function We({
728
+ locale: e,
729
+ value: t
689
730
  }) {
690
731
  return /* @__PURE__ */ C(p, {
691
732
  sx: {
@@ -698,95 +739,95 @@ function Me({
698
739
  bgcolor: "grey.300",
699
740
  borderRadius: 2
700
741
  },
701
- children: [/* @__PURE__ */ e(p, {
742
+ children: [/* @__PURE__ */ n(p, {
702
743
  sx: {
703
744
  pr: 0.5,
704
745
  borderRight: 1,
705
746
  borderColor: "grey.400"
706
747
  },
707
- children: t
708
- }), /* @__PURE__ */ e(p, {
748
+ children: e
749
+ }), /* @__PURE__ */ n(p, {
709
750
  sx: {
710
751
  pl: 0.5
711
752
  },
712
- children: n
753
+ children: t
713
754
  })]
714
755
  });
715
756
  }
716
- function dt({
717
- data: t,
718
- api: n,
719
- ...c
757
+ function pt({
758
+ data: e,
759
+ api: t,
760
+ ...s
720
761
  }) {
721
- const [l, o] = S(null), [r, i] = S(null), [d, h] = S(Q(t)), g = z(() => L(d), [d]), f = z(() => {
722
- const u = (y, I) => y.map((v) => (I && (v.parent = I), v.children && (v.children = u(v.children, v)), v));
723
- return u(d);
724
- }, [d]), x = (u) => {
725
- var y, I;
726
- u.parent ? (u.parent.children = (I = (y = u.parent) == null ? void 0 : y.children) == null ? void 0 : I.map((v) => v.id === u.id ? {
762
+ const [o, l] = I(null), [r, i] = I(null), [a, h] = I(Q(e)), g = z(() => L(a), [a]), f = z(() => {
763
+ const u = (y, S) => y.map((v) => (S && (v.parent = S), v.children && (v.children = u(v.children, v)), v));
764
+ return u(a);
765
+ }, [a]), x = (u) => {
766
+ var y, S;
767
+ u.parent ? (u.parent.children = (S = (y = u.parent) == null ? void 0 : y.children) == null ? void 0 : S.map((v) => v.id === u.id ? {
727
768
  ...u
728
- } : v), x(u.parent)) : h(d.map((v) => v.id === u.id ? {
769
+ } : v), x(u.parent)) : h(a.map((v) => v.id === u.id ? {
729
770
  ...u
730
771
  } : v));
731
- }, s = (u) => {
732
- u.parent ? (u.parent.children = u.parent.children || [], u.parent.children.push(u), h([...d])) : h([...d, u]);
772
+ }, c = (u) => {
773
+ u.parent ? (u.parent.children = u.parent.children || [], u.parent.children.push(u), h([...a])) : h([...a, u]);
733
774
  }, m = (u) => {
734
775
  var y;
735
- u.parent ? u.parent.children = (y = u.parent.children) == null ? void 0 : y.filter((I) => I.id !== u.id) : h(d.filter((I) => I.id !== u.id));
776
+ u.parent ? u.parent.children = (y = u.parent.children) == null ? void 0 : y.filter((S) => S.id !== u.id) : h(a.filter((S) => S.id !== u.id));
736
777
  }, b = (u) => {
737
- if (l)
778
+ if (o)
738
779
  return;
739
- o({
780
+ l({
740
781
  id: "",
741
782
  name: "New label",
742
783
  parent: u,
743
784
  color: "#dddddd"
744
785
  });
745
- }, a = (u) => {
746
- l || o(u);
786
+ }, d = (u) => {
787
+ o || l(u);
747
788
  }, w = async (u) => {
748
- if (!l)
789
+ if (!o)
749
790
  return;
750
791
  const {
751
792
  parent: y,
752
- children: I,
793
+ children: S,
753
794
  translation: v,
754
795
  ...A
755
796
  } = u;
756
- l.id ? (await n.updateLabel({
797
+ o.id ? (await t.updateLabel({
757
798
  ...A,
758
799
  translation: JSON.stringify(v),
759
800
  parentId: y == null ? void 0 : y.id
760
- }), x(u)) : (await n.createLabel({
801
+ }), x(u)) : (await t.createLabel({
761
802
  ...A,
762
803
  translation: JSON.stringify(v),
763
804
  parentId: y == null ? void 0 : y.id
764
- }), s(u)), o(null);
805
+ }), c(u)), l(null);
765
806
  }, k = async () => {
766
- !r || (await n.deleteLabel(r.id), m(r), i(null));
767
- }, G = (u, y) => /* @__PURE__ */ C(B, {
807
+ !r || (await t.deleteLabel(r.id), m(r), i(null));
808
+ }, G = (u, y) => /* @__PURE__ */ C(P, {
768
809
  children: [/* @__PURE__ */ C(p, {
769
810
  sx: {
770
811
  display: "flex",
771
812
  alignItems: "center",
772
813
  flexWrap: "wrap"
773
814
  },
774
- children: [/* @__PURE__ */ e(p, {
815
+ children: [/* @__PURE__ */ n(p, {
775
816
  children: u
776
- }), y.translation && /* @__PURE__ */ e(p, {
817
+ }), y.translation && /* @__PURE__ */ n(p, {
777
818
  sx: {
778
819
  display: "flex",
779
820
  alignItems: "center",
780
821
  gap: 0.5,
781
822
  ml: 2
782
823
  },
783
- children: Object.keys(y.translation).map((I) => {
824
+ children: Object.keys(y.translation).map((S) => {
784
825
  var A;
785
- const v = (A = y.translation) == null ? void 0 : A[I];
786
- return v ? /* @__PURE__ */ e(Me, {
787
- locale: I,
826
+ const v = (A = y.translation) == null ? void 0 : A[S];
827
+ return v ? /* @__PURE__ */ n(We, {
828
+ locale: S,
788
829
  value: v
789
- }, I) : null;
830
+ }, S) : null;
790
831
  })
791
832
  })]
792
833
  }), /* @__PURE__ */ C(p, {
@@ -795,38 +836,38 @@ function dt({
795
836
  gap: 1,
796
837
  flex: "0 0 auto"
797
838
  },
798
- children: [/* @__PURE__ */ e(N, {
839
+ children: [/* @__PURE__ */ n(N, {
799
840
  color: "inherit",
800
841
  size: "small",
801
842
  sx: {
802
843
  color: "grey.500"
803
844
  },
804
845
  onClick: () => b(y),
805
- children: /* @__PURE__ */ e(oe, {
846
+ children: /* @__PURE__ */ n(le, {
806
847
  sx: {
807
848
  fontSize: 20
808
849
  }
809
850
  })
810
- }), /* @__PURE__ */ e(N, {
851
+ }), /* @__PURE__ */ n(N, {
811
852
  color: "inherit",
812
853
  size: "small",
813
854
  sx: {
814
855
  color: "grey.500"
815
856
  },
816
- onClick: () => a(y),
817
- children: /* @__PURE__ */ e(re, {
857
+ onClick: () => d(y),
858
+ children: /* @__PURE__ */ n(oe, {
818
859
  sx: {
819
860
  fontSize: 18
820
861
  }
821
862
  })
822
- }), /* @__PURE__ */ e(N, {
863
+ }), /* @__PURE__ */ n(N, {
823
864
  color: "inherit",
824
865
  size: "small",
825
866
  sx: {
826
867
  color: "grey.500"
827
868
  },
828
869
  onClick: () => i(y),
829
- children: /* @__PURE__ */ e(ne, {
870
+ children: /* @__PURE__ */ n(re, {
830
871
  sx: {
831
872
  fontSize: 20
832
873
  }
@@ -835,18 +876,18 @@ function dt({
835
876
  })]
836
877
  });
837
878
  return /* @__PURE__ */ C(p, {
838
- ...c,
879
+ ...s,
839
880
  children: [/* @__PURE__ */ C(p, {
840
881
  sx: {
841
882
  display: "flex",
842
883
  alignItems: "center",
843
884
  justifyContent: "space-between"
844
885
  },
845
- children: [/* @__PURE__ */ e(te, {
886
+ children: [/* @__PURE__ */ n(ne, {
846
887
  component: "h2",
847
888
  variant: "h6",
848
889
  children: "Manage labels"
849
- }), /* @__PURE__ */ e(T, {
890
+ }), /* @__PURE__ */ n(O, {
850
891
  color: "primary",
851
892
  variant: "contained",
852
893
  size: "small",
@@ -872,23 +913,23 @@ function dt({
872
913
  bgcolor: "grey.200"
873
914
  },
874
915
  children: [g.length, " labels"]
875
- }), /* @__PURE__ */ e(p, {
916
+ }), /* @__PURE__ */ n(p, {
876
917
  sx: {
877
918
  pt: 0.5
878
919
  },
879
- children: /* @__PURE__ */ e(Le, {
920
+ children: /* @__PURE__ */ n(De, {
880
921
  data: f,
881
922
  selected: [],
882
923
  renderItem: G,
883
924
  rowHeight: 64
884
925
  })
885
926
  })]
886
- }), /* @__PURE__ */ e(Pe, {
887
- open: !!l,
888
- onClose: () => o(null),
889
- initialLabel: l,
927
+ }), /* @__PURE__ */ n(Me, {
928
+ open: !!o,
929
+ onClose: () => l(null),
930
+ initialLabel: o,
890
931
  onSubmit: w
891
- }, l == null ? void 0 : l.id), /* @__PURE__ */ e(Ne, {
932
+ }, o == null ? void 0 : o.id), /* @__PURE__ */ n(je, {
892
933
  open: !!r,
893
934
  onClose: () => i(null),
894
935
  label: r,
@@ -896,151 +937,151 @@ function dt({
896
937
  }, r == null ? void 0 : r.id)]
897
938
  });
898
939
  }
899
- const Y = V({}), Z = () => q(Y), ut = () => {
940
+ const Y = V({}), Z = () => q(Y), mt = () => {
900
941
  const {
901
- updateLabels: t
942
+ updateLabels: e
902
943
  } = Z();
903
- E(() => () => {
904
- t();
944
+ D(() => () => {
945
+ e();
905
946
  }, []);
906
947
  };
907
- function ht({
908
- fetchLabels: t,
909
- children: n
948
+ function ft({
949
+ fetchLabels: e,
950
+ children: t
910
951
  }) {
911
952
  const {
912
- locale: c
913
- } = $(), [l, o] = S({
953
+ locale: s
954
+ } = $(), [o, l] = I({
914
955
  loading: !0,
915
956
  labels: [],
916
957
  updateCounter: 1
917
958
  });
918
- E(() => {
959
+ D(() => {
919
960
  (async () => {
920
961
  try {
921
- o((b) => ({
962
+ l((b) => ({
922
963
  ...b,
923
964
  loading: !0
924
965
  }));
925
- const m = await t();
926
- o((b) => ({
966
+ const m = await e();
967
+ l((b) => ({
927
968
  ...b,
928
969
  loading: !1,
929
970
  labels: ze(m)
930
971
  }));
931
972
  } catch (m) {
932
- console.error(m), o((b) => ({
973
+ console.error(m), l((b) => ({
933
974
  ...b,
934
975
  loading: !1,
935
976
  labels: []
936
977
  }));
937
978
  }
938
979
  })();
939
- }, [l.updateCounter]);
980
+ }, [o.updateCounter]);
940
981
  const r = z(() => {
941
982
  var m;
942
- return (m = l.labels) != null && m.length ? L(l.labels).reduce((b, a) => ({
983
+ return (m = o.labels) != null && m.length ? L(o.labels).reduce((b, d) => ({
943
984
  ...b,
944
- [a.id]: a
985
+ [d.id]: d
945
986
  }), {}) : {};
946
- }, [l.labels]), i = O((s) => {
987
+ }, [o.labels]), i = T((c) => {
947
988
  var m;
948
989
  return {
949
- ...s,
950
- name: ((m = s.translation) == null ? void 0 : m[c]) || s.name
990
+ ...c,
991
+ name: ((m = c.translation) == null ? void 0 : m[s]) || c.name
951
992
  };
952
- }, [c]), d = O((s) => s.filter(Boolean).map((m) => r[m]).map(i), [r, i]), h = O((s) => (s == null ? void 0 : s.split(",")) || [], []), g = O((s = []) => {
953
- if (!!(s != null && s.length))
954
- return s.join(",");
955
- }, []), f = z(() => l.labels.map(i), [l.labels, i]), x = z(() => ({
956
- loading: l.loading,
957
- labels: l.labels || [],
958
- updateLabels: () => o((s) => ({
959
- ...s,
960
- updateCounter: ++l.updateCounter
993
+ }, [s]), a = T((c) => c.filter(Boolean).map((m) => r[m]).map(i), [r, i]), h = T((c) => (c == null ? void 0 : c.split(",")) || [], []), g = T((c = []) => {
994
+ if (!!(c != null && c.length))
995
+ return c.join(",");
996
+ }, []), f = z(() => o.labels.map(i), [o.labels, i]), x = z(() => ({
997
+ loading: o.loading,
998
+ labels: o.labels || [],
999
+ updateLabels: () => l((c) => ({
1000
+ ...c,
1001
+ updateCounter: ++o.updateCounter
961
1002
  })),
962
- getLabelsById: d,
1003
+ getLabelsById: a,
963
1004
  parseLabelIds: h,
964
1005
  stringifyLabelIds: g,
965
1006
  localizedLabels: f
966
- }), [l, d, h, g, f]);
967
- return /* @__PURE__ */ e(Y.Provider, {
1007
+ }), [o, a, h, g, f]);
1008
+ return /* @__PURE__ */ n(Y.Provider, {
968
1009
  value: x,
969
- children: n
1010
+ children: t
970
1011
  });
971
1012
  }
972
- function pt({
973
- labels: t,
974
- editable: n,
975
- onChange: c,
976
- sx: l
1013
+ function gt({
1014
+ labels: e,
1015
+ editable: t,
1016
+ onChange: s,
1017
+ sx: o
977
1018
  }) {
978
- const o = !(t != null && t.length), {
1019
+ const l = !(e != null && e.length), {
979
1020
  labels: r,
980
1021
  loading: i,
981
- getLabelsById: d
982
- } = Z(), [h, g] = S(!1);
983
- if (i || !n && o)
1022
+ getLabelsById: a
1023
+ } = Z(), [h, g] = I(!1);
1024
+ if (i || !t && l)
984
1025
  return null;
985
1026
  const f = (m) => {
986
- c == null || c(m), setTimeout(() => {
1027
+ s == null || s(m), setTimeout(() => {
987
1028
  g(!1);
988
1029
  }, 300);
989
1030
  };
990
1031
  if (h)
991
- return /* @__PURE__ */ e(fe, {
1032
+ return /* @__PURE__ */ n(fe, {
992
1033
  onClickAway: () => h && g(!1),
993
- children: /* @__PURE__ */ e("div", {
994
- children: /* @__PURE__ */ e(Oe, {
1034
+ children: /* @__PURE__ */ n("div", {
1035
+ children: /* @__PURE__ */ n(Ae, {
995
1036
  data: r,
996
- value: t || [],
1037
+ value: e || [],
997
1038
  onChange: f
998
1039
  })
999
1040
  })
1000
1041
  });
1001
- const x = d(t || []), s = [{
1042
+ const x = a(e || []), c = [{
1002
1043
  display: "flex",
1003
1044
  gap: 1,
1004
1045
  alignItems: "center",
1005
1046
  flexWrap: "wrap"
1006
- }, ...Array.isArray(l) ? l : [l]];
1047
+ }, ...Array.isArray(o) ? o : [o]];
1007
1048
  return /* @__PURE__ */ C(p, {
1008
- sx: s,
1009
- children: [x.map((m) => m ? /* @__PURE__ */ e(ge, {
1049
+ sx: c,
1050
+ children: [x.map((m) => m ? /* @__PURE__ */ n(ge, {
1010
1051
  label: m.name,
1011
1052
  variant: "filled",
1012
1053
  size: "small",
1013
1054
  sx: {
1014
1055
  borderRadius: 1
1015
1056
  }
1016
- }, m.id) : null), n && !o && /* @__PURE__ */ e(N, {
1057
+ }, m.id) : null), t && !l && /* @__PURE__ */ n(N, {
1017
1058
  color: "inherit",
1018
1059
  size: "small",
1019
1060
  onClick: () => g(!0),
1020
1061
  sx: {
1021
1062
  color: "grey.400"
1022
1063
  },
1023
- children: /* @__PURE__ */ e(pe, {
1064
+ children: /* @__PURE__ */ n(pe, {
1024
1065
  sx: {
1025
1066
  fontSize: 20
1026
1067
  }
1027
1068
  })
1028
- }), n && o && /* @__PURE__ */ e(T, {
1069
+ }), t && l && /* @__PURE__ */ n(O, {
1029
1070
  color: "inherit",
1030
1071
  variant: "outlined",
1031
- startIcon: /* @__PURE__ */ e(me, {}),
1072
+ startIcon: /* @__PURE__ */ n(me, {}),
1032
1073
  onClick: () => g(!0),
1033
1074
  children: "Edit labels"
1034
1075
  })]
1035
1076
  });
1036
1077
  }
1037
1078
  export {
1038
- dt as LabelManager,
1039
- Oe as LabelPicker,
1079
+ pt as LabelManager,
1080
+ Ae as LabelPicker,
1040
1081
  W as LabelTree,
1041
- pt as Labels,
1042
- ht as LabelsProvider,
1082
+ gt as Labels,
1083
+ ft as LabelsProvider,
1043
1084
  ze as transformLabels,
1044
1085
  Z as useLabelsContext,
1045
- ut as useLabelsUpdateOnDestroy
1086
+ mt as useLabelsUpdateOnDestroy
1046
1087
  };