@actionexec/dashboards 0.16.0 → 0.16.2

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.
@@ -1,13 +1,13 @@
1
- import { jsx as u, jsxs as S } from "react/jsx-runtime";
2
- import se from "react-datepicker";
3
- import { useState as R, useRef as H, useMemo as j, useLayoutEffect as oe, useEffect as ce } from "react";
4
- import { createPortal as ie } from "react-dom";
5
- const le = "https://action-data-api-7mbrztperq-rj.a.run.app", V = "/external/dashboards", C = "/external/statements";
6
- let J = le;
7
- function Fe(e) {
1
+ import { jsx as u, jsxs as T } from "react/jsx-runtime";
2
+ import oe from "react-datepicker";
3
+ import { useState as I, useRef as H, useMemo as j, useLayoutEffect as ce, useEffect as ie } from "react";
4
+ import { createPortal as le } from "react-dom";
5
+ const ue = "https://action-data-api-7mbrztperq-rj.a.run.app", V = "/external/dashboards", C = "/external/statements";
6
+ let J = ue;
7
+ function ve(e) {
8
8
  J = e.replace(/\/$/, "");
9
9
  }
10
- class ue extends Error {
10
+ class fe extends Error {
11
11
  constructor(t, n, a) {
12
12
  super(t), this.status = n, this.payload = a, this.name = "ApiError";
13
13
  }
@@ -25,7 +25,7 @@ async function X(e, t, n, a) {
25
25
  c = await s.json();
26
26
  } catch {
27
27
  }
28
- throw new ue(
28
+ throw new fe(
29
29
  `Requisicao falhou (${s.status}) em ${t}`,
30
30
  s.status,
31
31
  c
@@ -33,10 +33,10 @@ async function X(e, t, n, a) {
33
33
  }
34
34
  return s;
35
35
  }
36
- async function x(e, t, n, a) {
36
+ async function R(e, t, n, a) {
37
37
  return await (await X(e, t, n, a)).json();
38
38
  }
39
- const Ie = (e) => x(V, "/layout", e), Ce = (e, t) => x(V, "/render", e, t), ke = (e) => x(C, "/layout", e), ve = (e, t) => x(C, "/render", e, t), Ue = async (e, t) => (await X(C, "/pdf", e, t)).blob(), d = {
39
+ const Ue = (e) => R(V, "/layout", e), Ye = (e, t) => R(V, "/render", e, t), Ge = (e) => R(C, "/layout", e), We = (e, t) => R(C, "/render", e, t), He = async (e, t) => (await X(C, "/pdf", e, t)).blob(), d = {
40
40
  series0: 0,
41
41
  series1: 1,
42
42
  series2: 2,
@@ -54,7 +54,7 @@ const Ie = (e) => x(V, "/layout", e), Ce = (e, t) => x(V, "/render", e, t), ke =
54
54
  // trocar a cor de uma serie mudar o significado semantico de "atencao".
55
55
  warning: 13,
56
56
  info: 14
57
- }, fe = 5, O = 15, de = {
57
+ }, de = 5, M = 15, me = {
58
58
  series0: "Série 1",
59
59
  series1: "Série 2",
60
60
  series2: "Série 3",
@@ -70,7 +70,7 @@ const Ie = (e) => x(V, "/layout", e), Ce = (e, t) => x(V, "/render", e, t), ke =
70
70
  error: "Erro",
71
71
  warning: "Alerta",
72
72
  info: "Informação"
73
- }, $ = {
73
+ }, O = {
74
74
  action: {
75
75
  label: "Action",
76
76
  colors: [
@@ -171,20 +171,20 @@ const Ie = (e) => x(V, "/layout", e), Ce = (e, t) => x(V, "/render", e, t), ke =
171
171
  "#8b5cf6"
172
172
  ]
173
173
  }
174
- }, B = $.action.colors;
175
- function M(e) {
174
+ }, B = O.action.colors;
175
+ function A(e) {
176
176
  const t = B;
177
177
  if (!e || e.length === 0) return [...t];
178
- if (e.length >= O) return e.slice(0, O);
178
+ if (e.length >= M) return e.slice(0, M);
179
179
  const n = [...e];
180
- for (let a = e.length; a < O; a++) n.push(t[a]);
180
+ for (let a = e.length; a < M; a++) n.push(t[a]);
181
181
  return n;
182
182
  }
183
183
  function ge(e) {
184
- return M(e).slice(0, fe);
184
+ return A(e).slice(0, de);
185
185
  }
186
- function Ye(e) {
187
- const t = M(e);
186
+ function je(e) {
187
+ const t = A(e);
188
188
  return {
189
189
  "--bg-dark": t[d.bgDark],
190
190
  "--bg-paper": t[d.bgPaper],
@@ -202,11 +202,11 @@ function Ye(e) {
202
202
  "--action-green": t[d.success]
203
203
  };
204
204
  }
205
- const me = B, pe = 30, be = 10, Ge = {
206
- gridColumns: pe,
207
- gridRows: be,
205
+ const pe = B, be = 30, _e = 10, ze = {
206
+ gridColumns: be,
207
+ gridRows: _e,
208
208
  widgets: []
209
- }, We = {
209
+ }, qe = {
210
210
  kpi_card: "Card",
211
211
  gauge: "Gauge",
212
212
  chart: "Gráfico",
@@ -215,39 +215,39 @@ const me = B, pe = 30, be = 10, Ge = {
215
215
  filter: "Filtro",
216
216
  variable: "Variável",
217
217
  color_palette: "Paleta de Cores"
218
- }, He = ["kpi_card", "gauge", "chart", "composition", "table"], je = ["filter", "variable", "color_palette"], ze = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), qe = {
218
+ }, Ve = ["kpi_card", "gauge", "chart", "composition", "table"], Je = ["filter", "variable", "color_palette"], Xe = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Be = {
219
219
  day: ["dia", "dias"],
220
220
  week: ["semana", "semanas"],
221
221
  month: ["mês", "meses"],
222
222
  quarter: ["trimestre", "trimestres"],
223
223
  year: ["ano", "anos"]
224
- }, Ve = ["período", "períodos"], Je = {
224
+ }, Ke = ["período", "períodos"], Qe = {
225
225
  sum: "Soma",
226
226
  avg: "Média",
227
227
  count: "Contagem",
228
228
  min: "Mínimo",
229
229
  max: "Máximo",
230
230
  count_distinct: "Contagem Distinta"
231
- }, _e = {
231
+ }, he = {
232
232
  currency: "Moeda (R$)",
233
233
  number: "Número",
234
234
  integer: "Inteiro",
235
235
  percentage: "Porcentagem",
236
236
  date: "Data",
237
237
  text: "Texto"
238
- }, Xe = Object.entries(_e).filter(([e]) => e !== "date" && e !== "text"), Be = {
238
+ }, Ze = Object.entries(he).filter(([e]) => e !== "date" && e !== "text"), et = {
239
239
  variance: "Variação %",
240
240
  difference: "Diferença",
241
241
  ratio: "Proporção",
242
242
  value: "Base"
243
- }, Ke = {
243
+ }, tt = {
244
244
  scroll: "Rolar",
245
245
  clip: "Cortar"
246
- }, Qe = {
246
+ }, nt = {
247
247
  higher: "Positivo",
248
248
  lower: "Negativo",
249
249
  neutral: "Neutro"
250
- }, Ze = {
250
+ }, at = {
251
251
  eq: "Igual a",
252
252
  neq: "Diferente de",
253
253
  in: "Está entre os valores",
@@ -261,21 +261,21 @@ const me = B, pe = 30, be = 10, Ge = {
261
261
  not_contains: "Não contém",
262
262
  is_empty: "Está vazio",
263
263
  not_empty: "Não está vazio"
264
- }, et = ["is_empty", "not_empty"], tt = ["in", "not_in"], nt = {
264
+ }, rt = ["is_empty", "not_empty"], st = ["in", "not_in"], ot = {
265
265
  bar: "Barras",
266
266
  line: "Linhas",
267
267
  area: "Área"
268
- }, at = {
268
+ }, ct = {
269
269
  pie: "Pizza",
270
270
  bridge: "Ponte"
271
- }, rt = {
271
+ }, it = {
272
272
  descending: "Descendente",
273
273
  ascending: "Ascendente"
274
- }, st = {
274
+ }, lt = {
275
275
  date_range: "Periodo",
276
276
  select: "Seleção Única",
277
277
  multi_select: "Seleção Múltipla"
278
- }, z = "", ot = {
278
+ }, z = "", ut = {
279
279
  kpi_card: { x: 0, y: 0, w: 6, h: 3 },
280
280
  gauge: { x: 0, y: 0, w: 6, h: 5 },
281
281
  chart: { x: 0, y: 0, w: 6, h: 6 },
@@ -284,7 +284,7 @@ const me = B, pe = 30, be = 10, Ge = {
284
284
  filter: { x: 0, y: 0, w: 4, h: 2 },
285
285
  variable: { x: 0, y: 0, w: 4, h: 2 },
286
286
  color_palette: { x: 0, y: 0, w: 4, h: 2 }
287
- }, ct = {
287
+ }, ft = {
288
288
  kpi_card: { label: "Novo card", aggregation: "sum", format: "number" },
289
289
  gauge: { label: "Novo Gauge", aggregation: "sum" },
290
290
  chart: { label: "Novo gráfico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
@@ -297,59 +297,59 @@ const me = B, pe = 30, be = 10, Ge = {
297
297
  table: { label: "Nova Tabela", columns: [] },
298
298
  filter: { label: "Novo Filtro", filterType: "select" },
299
299
  variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
300
- color_palette: { label: "Paleta de Cores", paletteColors: me, locked: !1 }
301
- }, k = 6, v = 16, U = 1, I = 24, he = 80, Ee = (e, t, n) => Math.min(Math.max(e, t), n), T = (e) => Number.isFinite(e) && e > 0;
302
- function it(e, t, n = k, a = v) {
303
- if (!T(t) || !Number.isFinite(e)) return 0;
300
+ color_palette: { label: "Paleta de Cores", paletteColors: pe, locked: !1 }
301
+ }, k = 6, v = 16, U = 1, x = 24, Ee = 80, Te = (e, t, n) => Math.min(Math.max(e, t), n), S = (e) => Number.isFinite(e) && e > 0;
302
+ function dt(e, t, n = k, a = v) {
303
+ if (!S(t) || !Number.isFinite(e)) return 0;
304
304
  const r = e - a * 2 - n * (t - 1);
305
305
  return Math.max(0, r / t);
306
306
  }
307
- function lt(e, t = U) {
308
- return !T(e) || !T(t) ? I : Ee(e / t, I, he);
307
+ function mt(e, t = U) {
308
+ return !S(e) || !S(t) ? x : Te(e / t, x, Ee);
309
309
  }
310
- function ut(e, t, n = k, a = v) {
310
+ function gt(e, t, n = k, a = v) {
311
311
  return e <= 0 ? a * 2 : e * t + (e - 1) * n + a * 2;
312
312
  }
313
- function ft(e, t, n = U) {
314
- return !T(e) || !T(t) || !T(n) ? 1 : e * n / t;
313
+ function pt(e, t, n = U) {
314
+ return !S(e) || !S(t) || !S(n) ? 1 : e * n / t;
315
315
  }
316
- function dt(e, t = U, n = k, a = v) {
317
- return !T(e) || !T(t) ? 0 : I * t * e + n * (e - 1) + a * 2;
316
+ function bt(e, t = U, n = k, a = v) {
317
+ return !S(e) || !S(t) ? 0 : x * t * e + n * (e - 1) + a * 2;
318
318
  }
319
- const A = "pt-BR", Se = 100, Te = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
320
- function gt(e) {
321
- return !!e && Te.has(e);
319
+ const $ = "pt-BR", Se = 100, we = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]), ye = new Intl.NumberFormat($, { style: "currency", currency: "BRL" }), De = new Intl.NumberFormat($), Le = new Intl.NumberFormat($, { maximumFractionDigits: 1 }), K = new Intl.NumberFormat($, { maximumFractionDigits: 2 });
320
+ function _t(e) {
321
+ return !!e && we.has(e);
322
322
  }
323
- function K(e) {
323
+ function Q(e) {
324
324
  if (e == null || e === "") return null;
325
325
  const t = typeof e == "number" ? e : Number(e);
326
326
  return Number.isFinite(t) ? t : null;
327
327
  }
328
- function we(e, t, n = "-") {
328
+ function Ne(e, t, n = "-") {
329
329
  if (e == null || e === "") return n;
330
- const a = K(e);
330
+ const a = Q(e);
331
331
  if (a === null) return String(e);
332
332
  switch (t) {
333
333
  case "currency":
334
- return a.toLocaleString(A, { style: "currency", currency: "BRL" });
334
+ return ye.format(a);
335
335
  case "integer":
336
- return Math.round(a).toLocaleString(A);
336
+ return De.format(Math.round(a));
337
337
  case "percentage":
338
- return `${(a * Se).toLocaleString(A, { maximumFractionDigits: 1 })}%`;
338
+ return `${Le.format(a * Se)}%`;
339
339
  case "number":
340
- return a.toLocaleString(A, { maximumFractionDigits: 2 });
340
+ return K.format(a);
341
341
  default:
342
342
  return String(e);
343
343
  }
344
344
  }
345
- function mt(e, t) {
346
- const n = K(e);
345
+ function ht(e, t) {
346
+ const n = Q(e);
347
347
  if (n === null) return "-";
348
- if (t === "percentage") return we(n, "percentage");
348
+ if (t === "percentage") return Ne(n, "percentage");
349
349
  const a = t === "currency" ? "R$ " : "", r = Math.abs(n);
350
- return r >= 1e9 ? `${a}${(n / 1e9).toFixed(1)}B` : r >= 1e6 ? `${a}${(n / 1e6).toFixed(1)}M` : r >= 1e3 ? `${a}${(n / 1e3).toFixed(1)}K` : `${a}${n.toLocaleString(A, { maximumFractionDigits: 2 })}`;
350
+ return r >= 1e9 ? `${a}${(n / 1e9).toFixed(1)}B` : r >= 1e6 ? `${a}${(n / 1e6).toFixed(1)}M` : r >= 1e3 ? `${a}${(n / 1e3).toFixed(1)}K` : `${a}${K.format(n)}`;
351
351
  }
352
- const ye = [
352
+ const Ae = [
353
353
  "Jan",
354
354
  "Fev",
355
355
  "Mar",
@@ -362,7 +362,7 @@ const ye = [
362
362
  "Out",
363
363
  "Nov",
364
364
  "Dez"
365
- ], pt = [
365
+ ], Et = [
366
366
  "Janeiro",
367
367
  "Fevereiro",
368
368
  "Marco",
@@ -376,15 +376,15 @@ const ye = [
376
376
  "Novembro",
377
377
  "Dezembro"
378
378
  ];
379
- function bt(e) {
379
+ function Tt(e) {
380
380
  return { start: `${e}-01-01`, end: `${e}-12-31` };
381
381
  }
382
- function _t(e) {
382
+ function St(e) {
383
383
  if (!e) return null;
384
384
  const t = e.match(/^(\d{4})/);
385
385
  return t ? { year: parseInt(t[1]) } : null;
386
386
  }
387
- function De(e, t) {
387
+ function Me(e, t) {
388
388
  const n = new Date(e, t, 0).getDate(), a = (r) => String(r).padStart(2, "0");
389
389
  return {
390
390
  start: `${e}-${a(t)}-01`,
@@ -397,43 +397,43 @@ function Y(e) {
397
397
  const n = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
398
398
  return Math.ceil(((t.getTime() - n.getTime()) / 864e5 + 1) / 7);
399
399
  }
400
- function ht(e, t) {
401
- const n = new Date(e, 0, 4), a = (n.getDay() + 6) % 7, r = new Date(n.getTime() - a * 864e5), s = new Date(r.getTime() + (t - 1) * 7 * 864e5), c = new Date(s.getTime() + 6 * 864e5), i = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${i(b.getMonth() + 1)}-${i(b.getDate())}`;
402
- return { start: g(s), end: g(c) };
400
+ function wt(e, t) {
401
+ const n = new Date(e, 0, 4), a = (n.getDay() + 6) % 7, r = new Date(n.getTime() - a * 864e5), s = new Date(r.getTime() + (t - 1) * 7 * 864e5), c = new Date(s.getTime() + 6 * 864e5), i = (b) => String(b).padStart(2, "0"), m = (b) => `${b.getFullYear()}-${i(b.getMonth() + 1)}-${i(b.getDate())}`;
402
+ return { start: m(s), end: m(c) };
403
403
  }
404
- function Et(e, t) {
404
+ function yt(e, t) {
405
405
  const n = /* @__PURE__ */ new Set(), a = new Date(e, t, 0).getDate();
406
406
  for (let r = 1; r <= a; r++)
407
407
  n.add(Y(new Date(e, t - 1, r)));
408
408
  return Array.from(n).sort((r, s) => r - s);
409
409
  }
410
- function St(e, t) {
410
+ function Dt(e, t) {
411
411
  const n = new Date(e, t, 0).getDate(), a = (i) => String(i).padStart(2, "0"), r = [];
412
412
  let s = 1, c = 1;
413
413
  for (; s <= n; ) {
414
- const i = s, g = Math.min(s + 6, n), b = `${e}-${a(t)}-${a(i)}`, l = `${e}-${a(t)}-${a(g)}`, f = `${c}° Semana (${a(i)}/${a(t)} - ${a(g)}/${a(t)})`;
415
- r.push({ index: c, startDay: i, endDay: g, start: b, end: l, label: f }), s = g + 1, c++;
414
+ const i = s, m = Math.min(s + 6, n), b = `${e}-${a(t)}-${a(i)}`, l = `${e}-${a(t)}-${a(m)}`, f = `${c}° Semana (${a(i)}/${a(t)} - ${a(m)}/${a(t)})`;
415
+ r.push({ index: c, startDay: i, endDay: m, start: b, end: l, label: f }), s = m + 1, c++;
416
416
  }
417
417
  return r;
418
418
  }
419
- function Tt(e, t, n) {
419
+ function Lt(e, t, n) {
420
420
  if (!e) return 1;
421
421
  const a = (c) => String(c).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${a(n)}-(\\d{2})`));
422
422
  if (!r) return 1;
423
423
  const s = parseInt(r[1]);
424
424
  return Math.ceil(s / 7);
425
425
  }
426
- function wt(e) {
426
+ function Nt(e) {
427
427
  if (!e) return null;
428
428
  const t = e.match(/^(\d{4})-(\d{2})/);
429
429
  return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
430
430
  }
431
- function yt(e) {
431
+ function At(e) {
432
432
  if (!e) return null;
433
433
  const t = /* @__PURE__ */ new Date(e + "T00:00:00");
434
434
  return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: Y(t) };
435
435
  }
436
- function Dt(e) {
436
+ function Mt(e) {
437
437
  const t = /* @__PURE__ */ new Date(), n = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, a = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), r = [];
438
438
  for (let s = a; s >= n; s--) r.push(s);
439
439
  return r;
@@ -442,7 +442,7 @@ const h = (e) => String(e).padStart(2, "0");
442
442
  function L(e) {
443
443
  return `${e.getFullYear()}-${h(e.getMonth() + 1)}-${h(e.getDate())}`;
444
444
  }
445
- function F(e) {
445
+ function P(e) {
446
446
  const [t, n, a] = e.split("-").map(Number);
447
447
  return new Date(t, (n || 1) - 1, a || 1);
448
448
  }
@@ -451,10 +451,10 @@ function q(e, t) {
451
451
  if (t === "year")
452
452
  return { key: `${n}`, label: `${n}`, start: `${n}-01-01`, end: `${n}-12-31` };
453
453
  if (t === "month") {
454
- const a = e.getMonth() + 1, r = De(n, a);
454
+ const a = e.getMonth() + 1, r = Me(n, a);
455
455
  return {
456
456
  key: `${n}-${h(a)}`,
457
- label: `${ye[a - 1].toLowerCase()}/${h(n % 100)}`,
457
+ label: `${Ae[a - 1].toLowerCase()}/${h(n % 100)}`,
458
458
  ...r
459
459
  };
460
460
  }
@@ -474,15 +474,15 @@ function q(e, t) {
474
474
  end: L(e)
475
475
  };
476
476
  }
477
- const Le = 400;
478
- function Lt(e, t) {
479
- const n = /* @__PURE__ */ new Date(), a = t != null && t.min ? F(t.min) : new Date(n.getFullYear() - 1, 0, 1), r = t != null && t.max ? F(t.max) : n;
477
+ const Oe = 400;
478
+ function Ot(e, t) {
479
+ const n = /* @__PURE__ */ new Date(), a = t != null && t.min ? P(t.min) : new Date(n.getFullYear() - 1, 0, 1), r = t != null && t.max ? P(t.max) : n;
480
480
  if (a > r) return [];
481
481
  const s = [];
482
482
  let c = q(r, e);
483
- for (; s.length < Le; ) {
483
+ for (; s.length < Oe; ) {
484
484
  s.push(c);
485
- const i = F(c.start);
485
+ const i = P(c.start);
486
486
  if (i.setDate(i.getDate() - 1), i < a) break;
487
487
  c = q(i, e);
488
488
  }
@@ -493,12 +493,12 @@ function N(e) {
493
493
  const [t, n, a] = e.split("-").map(Number);
494
494
  return !t || !n || !a ? null : new Date(t, n - 1, a);
495
495
  }
496
- function Ne(e) {
496
+ function Re(e) {
497
497
  if (!e) return "";
498
498
  const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
499
499
  return `${t}-${n}-${a}`;
500
500
  }
501
- function Nt({
501
+ function Rt({
502
502
  value: e,
503
503
  onChange: t,
504
504
  minIso: n,
@@ -507,19 +507,19 @@ function Nt({
507
507
  selectsStart: s,
508
508
  selectsEnd: c,
509
509
  startIso: i,
510
- endIso: g,
510
+ endIso: m,
511
511
  className: b,
512
512
  disabled: l
513
513
  }) {
514
514
  return /* @__PURE__ */ u("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ u(
515
- se,
515
+ oe,
516
516
  {
517
517
  selected: N(e),
518
- onChange: (f) => t(Ne(f)),
518
+ onChange: (f) => t(Re(f)),
519
519
  selectsStart: s,
520
520
  selectsEnd: c,
521
521
  startDate: N(i) ?? void 0,
522
- endDate: N(g) ?? void 0,
522
+ endDate: N(m) ?? void 0,
523
523
  minDate: N(n) ?? void 0,
524
524
  maxDate: N(a) ?? void 0,
525
525
  dateFormat: "dd/MM/yyyy",
@@ -537,8 +537,8 @@ function Nt({
537
537
  }
538
538
  ) });
539
539
  }
540
- function At({ options: e, value: t, multi: n, onChange: a }) {
541
- const [r, s] = R(!1), [c, i] = R(""), [g, b] = R(null), l = H(null), f = H(null), m = j(
540
+ function $t({ options: e, value: t, multi: n, onChange: a }) {
541
+ const [r, s] = I(!1), [c, i] = I(""), [m, b] = I(null), l = H(null), f = H(null), g = j(
542
542
  () => t ? t.split(z).filter(Boolean) : [],
543
543
  [t]
544
544
  ), _ = j(() => {
@@ -547,22 +547,22 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
547
547
  }, [e, c]), w = () => {
548
548
  const o = l.current;
549
549
  if (!o) return;
550
- const p = o.getBoundingClientRect(), E = 4, y = window.innerHeight - p.bottom - E, D = p.top - E, W = y < 200 && D > y, re = Math.max(150, Math.min(360, W ? D : y));
550
+ const p = o.getBoundingClientRect(), E = 4, y = window.innerHeight - p.bottom - E, D = p.top - E, W = y < 200 && D > y, se = Math.max(150, Math.min(360, W ? D : y));
551
551
  b({
552
552
  left: p.left,
553
553
  width: p.width,
554
- maxHeight: re,
554
+ maxHeight: se,
555
555
  ...W ? { bottom: window.innerHeight - p.top + E } : { top: p.bottom + E }
556
556
  });
557
557
  };
558
- oe(() => {
558
+ ce(() => {
559
559
  if (!r) return;
560
560
  w();
561
561
  const o = () => w();
562
562
  return window.addEventListener("scroll", o, !0), window.addEventListener("resize", o), () => {
563
563
  window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
564
564
  };
565
- }, [r]), ce(() => {
565
+ }, [r]), ie(() => {
566
566
  if (!r) return;
567
567
  const o = (p) => {
568
568
  var y, D;
@@ -571,20 +571,20 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
571
571
  };
572
572
  return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
573
573
  }, [r]);
574
- const Q = () => {
574
+ const Z = () => {
575
575
  s(!1), i("");
576
- }, P = (o) => {
576
+ }, F = (o) => {
577
577
  var p;
578
578
  a(o), i(""), s(!1), (p = l.current) == null || p.blur();
579
579
  }, G = (o) => {
580
- const p = m.includes(o) ? m.filter((E) => E !== o) : [...m, o];
580
+ const p = g.includes(o) ? g.filter((E) => E !== o) : [...g, o];
581
581
  a(p.join(z));
582
- }, Z = () => {
582
+ }, ee = () => {
583
583
  s(!0), n || i("");
584
- }, ee = (o) => {
584
+ }, te = (o) => {
585
585
  var p;
586
- o.key === "Escape" ? (Q(), (p = l.current) == null || p.blur()) : o.key === "Enter" && _.length > 0 && (o.preventDefault(), n ? (G(_[0]), i("")) : P(_[0]));
587
- }, te = n || r ? c : t || "", ne = n && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", ae = r && g ? ie(
586
+ o.key === "Escape" ? (Z(), (p = l.current) == null || p.blur()) : o.key === "Enter" && _.length > 0 && (o.preventDefault(), n ? (G(_[0]), i("")) : F(_[0]));
587
+ }, ne = n || r ? c : t || "", ae = n && g.length > 0 ? `${g.length} selecionado(s)` : r ? "Buscar..." : "Todos", re = r && m ? le(
588
588
  /* @__PURE__ */ u(
589
589
  "div",
590
590
  {
@@ -592,14 +592,14 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
592
592
  className: "widget-filter__search-panel",
593
593
  style: {
594
594
  position: "fixed",
595
- left: g.left,
596
- width: g.width,
597
- top: g.top,
598
- bottom: g.bottom,
599
- maxHeight: g.maxHeight
595
+ left: m.left,
596
+ width: m.width,
597
+ top: m.top,
598
+ bottom: m.bottom,
599
+ maxHeight: m.maxHeight
600
600
  },
601
- children: /* @__PURE__ */ S("div", { className: "widget-filter__search-list", children: [
602
- n && m.length > 0 && /* @__PURE__ */ u(
601
+ children: /* @__PURE__ */ T("div", { className: "widget-filter__search-list", children: [
602
+ n && g.length > 0 && /* @__PURE__ */ u(
603
603
  "button",
604
604
  {
605
605
  type: "button",
@@ -608,12 +608,12 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
608
608
  children: "Limpar seleção"
609
609
  }
610
610
  ),
611
- !n && /* @__PURE__ */ S(
611
+ !n && /* @__PURE__ */ T(
612
612
  "button",
613
613
  {
614
614
  type: "button",
615
615
  className: `widget-filter__search-option${t ? "" : " is-selected"}`,
616
- onClick: () => P(""),
616
+ onClick: () => F(""),
617
617
  children: [
618
618
  /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
619
619
  "Todos"
@@ -621,16 +621,16 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
621
621
  }
622
622
  ),
623
623
  _.length === 0 ? /* @__PURE__ */ u("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
624
- (o) => n ? /* @__PURE__ */ S(
624
+ (o) => n ? /* @__PURE__ */ T(
625
625
  "label",
626
626
  {
627
- className: `widget-filter__search-option${m.includes(o) ? " is-selected" : ""}`,
627
+ className: `widget-filter__search-option${g.includes(o) ? " is-selected" : ""}`,
628
628
  children: [
629
629
  /* @__PURE__ */ u(
630
630
  "input",
631
631
  {
632
632
  type: "checkbox",
633
- checked: m.includes(o),
633
+ checked: g.includes(o),
634
634
  onChange: () => G(o)
635
635
  }
636
636
  ),
@@ -638,12 +638,12 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
638
638
  ]
639
639
  },
640
640
  o
641
- ) : /* @__PURE__ */ S(
641
+ ) : /* @__PURE__ */ T(
642
642
  "button",
643
643
  {
644
644
  type: "button",
645
645
  className: `widget-filter__search-option${t === o ? " is-selected" : ""}`,
646
- onClick: () => P(o),
646
+ onClick: () => F(o),
647
647
  children: [
648
648
  /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === o ? "✓" : "" }),
649
649
  o
@@ -657,46 +657,46 @@ function At({ options: e, value: t, multi: n, onChange: a }) {
657
657
  ),
658
658
  document.body
659
659
  ) : null;
660
- return /* @__PURE__ */ S("div", { className: "widget-filter__search", children: [
660
+ return /* @__PURE__ */ T("div", { className: "widget-filter__search", children: [
661
661
  /* @__PURE__ */ u(
662
662
  "input",
663
663
  {
664
664
  ref: l,
665
665
  type: "text",
666
666
  className: "widget-filter__search-field",
667
- value: te,
668
- placeholder: ne,
669
- onFocus: Z,
667
+ value: ne,
668
+ placeholder: ae,
669
+ onFocus: ee,
670
670
  onClick: () => s(!0),
671
671
  onChange: (o) => {
672
672
  i(o.target.value), s(!0);
673
673
  },
674
- onKeyDown: ee
674
+ onKeyDown: te
675
675
  }
676
676
  ),
677
- ae
677
+ re
678
678
  ] });
679
679
  }
680
- const Ae = [
680
+ const $e = [
681
681
  d.bgDark,
682
682
  d.bgPaper,
683
683
  d.bgElevated,
684
684
  d.accent,
685
685
  d.success
686
686
  ];
687
- function Me(e) {
687
+ function Fe(e) {
688
688
  if (!e) return !0;
689
- const t = M(e);
690
- return Object.values($).some(
689
+ const t = A(e);
690
+ return Object.values(O).some(
691
691
  (n) => JSON.stringify(n.colors) === JSON.stringify(t)
692
692
  );
693
693
  }
694
- const Oe = [
694
+ const Ie = [
695
695
  { label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
696
696
  { label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
697
697
  { label: "Estados", slots: ["accent", "success", "error"] }
698
698
  ];
699
- function Mt({
699
+ function Ft({
700
700
  selected: e,
701
701
  onSelect: t,
702
702
  customMode: n,
@@ -704,15 +704,15 @@ function Mt({
704
704
  disabled: r
705
705
  }) {
706
706
  var b;
707
- const s = n ?? !Me(e), c = M(e), i = s || (b = Object.entries($).find(
707
+ const s = n ?? !Fe(e), c = A(e), i = s || (b = Object.entries(O).find(
708
708
  ([, l]) => JSON.stringify(l.colors) === JSON.stringify(c)
709
- )) == null ? void 0 : b[0], g = (l, f) => {
710
- const m = [...c];
711
- for (; m.length < O; ) m.push("#000000");
712
- m[l] = f, t(m);
709
+ )) == null ? void 0 : b[0], m = (l, f) => {
710
+ const g = [...c];
711
+ for (; g.length < M; ) g.push("#000000");
712
+ g[l] = f, t(g);
713
713
  };
714
- return /* @__PURE__ */ S("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
715
- a && /* @__PURE__ */ S("label", { className: "config-panel__checkbox", children: [
714
+ return /* @__PURE__ */ T("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
715
+ a && /* @__PURE__ */ T("label", { className: "config-panel__checkbox", children: [
716
716
  /* @__PURE__ */ u(
717
717
  "input",
718
718
  {
@@ -724,26 +724,26 @@ function Mt({
724
724
  ),
725
725
  "Customizar"
726
726
  ] }),
727
- s ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: Oe.map((l) => /* @__PURE__ */ S("div", { className: "palette-selector__row", children: [
727
+ s ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: Ie.map((l) => /* @__PURE__ */ T("div", { className: "palette-selector__row", children: [
728
728
  /* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: l.label }),
729
729
  /* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: l.slots.map((f) => {
730
- const m = d[f];
730
+ const g = d[f];
731
731
  return /* @__PURE__ */ u(
732
732
  "input",
733
733
  {
734
734
  type: "color",
735
735
  className: "palette-selector__color-input",
736
- value: c[m] || "#000000",
737
- onChange: (_) => g(m, _.target.value),
736
+ value: c[g] || "#000000",
737
+ onChange: (_) => m(g, _.target.value),
738
738
  disabled: r,
739
- title: de[f]
739
+ title: me[f]
740
740
  },
741
741
  f
742
742
  );
743
743
  }) })
744
- ] }, l.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries($).map(([l, f]) => {
745
- const m = M(f.colors);
746
- return /* @__PURE__ */ S(
744
+ ] }, l.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(O).map(([l, f]) => {
745
+ const g = A(f.colors);
746
+ return /* @__PURE__ */ T(
747
747
  "button",
748
748
  {
749
749
  className: `palette-selector__option ${i === l ? "palette-selector__option--active" : ""}`,
@@ -758,11 +758,11 @@ function Mt({
758
758
  },
759
759
  w
760
760
  )) }),
761
- /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: Ae.map((_, w) => /* @__PURE__ */ u(
761
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: $e.map((_, w) => /* @__PURE__ */ u(
762
762
  "span",
763
763
  {
764
764
  className: "palette-selector__swatch",
765
- style: { backgroundColor: m[_] }
765
+ style: { backgroundColor: g[_] }
766
766
  },
767
767
  w
768
768
  )) }),
@@ -775,79 +775,79 @@ function Mt({
775
775
  ] });
776
776
  }
777
777
  export {
778
- Qe as $,
779
- ve as A,
780
- Ue as B,
781
- Mt as C,
782
- Nt as D,
783
- ue as E,
784
- qe as F,
778
+ nt as $,
779
+ We as A,
780
+ He as B,
781
+ Ft as C,
782
+ Rt as D,
783
+ fe as E,
784
+ Be as F,
785
785
  v as G,
786
- Je as H,
787
- rt as I,
788
- nt as J,
789
- Be as K,
790
- at as L,
786
+ Qe as H,
787
+ it as I,
788
+ ot as J,
789
+ et as K,
790
+ ct as L,
791
791
  z as M,
792
- je as N,
793
- He as O,
794
- ct as P,
795
- ot as Q,
796
- pe as R,
797
- At as S,
798
- Ve as T,
799
- be as U,
800
- me as V,
792
+ Je as N,
793
+ Ve as O,
794
+ ft as P,
795
+ ut as Q,
796
+ be as R,
797
+ $t as S,
798
+ Ke as T,
799
+ _e as U,
800
+ pe as V,
801
801
  B as W,
802
- Ge as X,
803
- Ze as Y,
804
- st as Z,
805
- _e as _,
806
- Ce as a,
807
- tt as a0,
808
- he as a1,
809
- pt as a2,
810
- Xe as a3,
811
- $ as a4,
812
- fe as a5,
802
+ ze as X,
803
+ at as Y,
804
+ lt as Z,
805
+ he as _,
806
+ Ye as a,
807
+ st as a0,
808
+ Ee as a1,
809
+ Et as a2,
810
+ Ze as a3,
811
+ O as a4,
812
+ de as a5,
813
813
  d as a6,
814
- de as a7,
815
- Ke as a8,
816
- O as a9,
817
- et as aa,
818
- We as ab,
819
- Ne as ac,
820
- M as ad,
814
+ me as a7,
815
+ tt as a8,
816
+ M as a9,
817
+ rt as aa,
818
+ qe as ab,
819
+ Re as ac,
820
+ A as ad,
821
821
  Y as ae,
822
- ht as af,
823
- Et as ag,
822
+ wt as af,
823
+ yt as ag,
824
824
  N as ah,
825
- yt as ai,
826
- Fe as aj,
827
- it as b,
828
- lt as c,
829
- dt as d,
830
- mt as e,
831
- Ie as f,
832
- we as g,
833
- Dt as h,
834
- gt as i,
835
- wt as j,
836
- ye as k,
837
- St as l,
838
- Tt as m,
839
- De as n,
840
- bt as o,
841
- _t as p,
825
+ At as ai,
826
+ ve as aj,
827
+ dt as b,
828
+ mt as c,
829
+ bt as d,
830
+ ht as e,
831
+ Ue as f,
832
+ Ne as g,
833
+ Mt as h,
834
+ _t as i,
835
+ Nt as j,
836
+ Ae as k,
837
+ Dt as l,
838
+ Lt as m,
839
+ Me as n,
840
+ Tt as o,
841
+ St as p,
842
842
  ge as q,
843
- Lt as r,
844
- Ye as s,
845
- ze as t,
846
- ut as u,
847
- ft as v,
843
+ Ot as r,
844
+ je as s,
845
+ Xe as t,
846
+ gt as u,
847
+ pt as v,
848
848
  k as w,
849
849
  U as x,
850
- I as y,
851
- ke as z
850
+ x as y,
851
+ Ge as z
852
852
  };
853
- //# sourceMappingURL=ColorPaletteSelector-CxUQv9E9.js.map
853
+ //# sourceMappingURL=ColorPaletteSelector-nBO_fbbj.js.map