deepspotscreen-sdk 0.1.0 → 0.1.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.
@@ -4,7 +4,7 @@ class K {
4
4
  }
5
5
  // ── Embed Token ─────────────────────────────────────────────────────────────
6
6
  async getEmbedToken(e) {
7
- var r, a, o, l;
7
+ var r, a, o, c;
8
8
  const t = [
9
9
  e.dashboardId,
10
10
  e.embedType,
@@ -18,7 +18,7 @@ class K {
18
18
  {
19
19
  dashboardId: e.dashboardId,
20
20
  embedType: e.embedType,
21
- embedLevel: (l = e.embedLevel) != null ? l : "dashboard",
21
+ embedLevel: (c = e.embedLevel) != null ? c : "dashboard",
22
22
  componentId: e.componentId,
23
23
  userId: e.userId,
24
24
  tenantId: e.tenantId,
@@ -214,7 +214,7 @@ class E {
214
214
  });
215
215
  }
216
216
  }
217
- const be = 24, M = 10, O = 12;
217
+ const be = 24, O = 10, M = 12;
218
218
  class ae {
219
219
  /**
220
220
  * @param containerWidth Actual pixel width of the grid container.
@@ -230,19 +230,19 @@ class ae {
230
230
  }
231
231
  /** Convert grid position {x,y,w,h} → CSS absolute pixel values */
232
232
  toPx(e) {
233
- const t = this.colWidth, s = O / 2;
233
+ const t = this.colWidth, s = M / 2;
234
234
  return {
235
235
  left: e.x * t + s,
236
- top: (e.y - this.minY) * M + s,
237
- width: e.w * t - O,
238
- height: e.h * M - O
236
+ top: (e.y - this.minY) * O + s,
237
+ width: e.w * t - M,
238
+ height: e.h * O - M
239
239
  };
240
240
  }
241
241
  /** Total pixel height required to fit all positioned components */
242
242
  static totalHeight(e) {
243
243
  if (!e.length) return 400;
244
244
  const t = Math.min(...e.map((i) => i.y));
245
- return (Math.max(...e.map((i) => i.y + i.h)) - t) * M + 40;
245
+ return (Math.max(...e.map((i) => i.y + i.h)) - t) * O + 40;
246
246
  }
247
247
  /** Apply absolute positioning styles directly to a DOM element */
248
248
  applyStyles(e, t) {
@@ -252,7 +252,7 @@ class ae {
252
252
  }
253
253
  let N = null;
254
254
  function fe() {
255
- return N || (N = import("./apexcharts.common-k3hLWpB8.js").then((w) => w.a)), N;
255
+ return N || (N = import("./apexcharts.common-k3hLWpB8.js").then((k) => k.a)), N;
256
256
  }
257
257
  class ne {
258
258
  constructor(e) {
@@ -314,8 +314,16 @@ class ne {
314
314
  return r === "pie" || r === "donut" ? this.buildPieOptions(e, t, s, i) : r === "bar" || r === "line" || r === "area" ? this.buildCartesianOptions(e, t, s, i) : null;
315
315
  }
316
316
  buildCartesianOptions(e, t, s, i) {
317
- var n;
318
- const { series: r, categories: a, xAxisLabel: o, yAxisLabel: l } = this.extractSeriesAndCategories(e, t), d = e.properties || {}, h = d.colors ? Object.values(d.colors) : ["#6366f1", "#8b5cf6", "#ec4899", "#f59e0b", "#10b981", "#3b82f6"], b = s === "dark";
317
+ var f;
318
+ const { series: r, categories: a, xAxisLabel: o, yAxisLabel: c, seriesColors: d } = this.extractSeriesAndCategories(e, t), b = e.properties || {}, u = ["#4f46e5", "#10b981", "#f59e0b", "#ef4444", "#3b82f6", "#8b5cf6", "#ec4899", "#14b8a6"];
319
+ let g;
320
+ if (d.length > 0 && d.length === r.length)
321
+ g = d;
322
+ else {
323
+ const p = b.colors ? Object.values(b.colors).filter(Boolean) : [];
324
+ g = p.length > 0 ? p : u;
325
+ }
326
+ const n = s === "dark";
319
327
  return {
320
328
  chart: {
321
329
  type: e.type === "area" ? "area" : e.type === "line" ? "line" : "bar",
@@ -334,23 +342,23 @@ class ne {
334
342
  title: { text: o },
335
343
  labels: {
336
344
  rotate: a.length > 8 ? -45 : 0,
337
- style: { colors: b ? "#94a3b8" : "#6b7280", fontSize: "11px" }
345
+ style: { colors: n ? "#94a3b8" : "#6b7280", fontSize: "11px" }
338
346
  },
339
- axisBorder: { color: b ? "#334155" : "#e5e7eb" },
340
- axisTicks: { color: b ? "#334155" : "#e5e7eb" }
347
+ axisBorder: { color: n ? "#334155" : "#e5e7eb" },
348
+ axisTicks: { color: n ? "#334155" : "#e5e7eb" }
341
349
  },
342
350
  yaxis: {
343
- title: { text: l },
344
- labels: { style: { colors: b ? "#94a3b8" : "#6b7280", fontSize: "11px" } }
351
+ title: { text: c },
352
+ labels: { style: { colors: n ? "#94a3b8" : "#6b7280", fontSize: "11px" } }
345
353
  },
346
- colors: h,
354
+ colors: g,
347
355
  legend: {
348
- show: r.length > 1 || ((n = d.showLegend) != null ? n : !1),
356
+ show: r.length > 1 || ((f = b.showLegend) != null ? f : !1),
349
357
  position: "bottom",
350
- labels: { colors: b ? "#94a3b8" : "#6b7280" }
358
+ labels: { colors: n ? "#94a3b8" : "#6b7280" }
351
359
  },
352
360
  grid: {
353
- borderColor: b ? "#1e293b" : "#f3f4f6",
361
+ borderColor: n ? "#1e293b" : "#f3f4f6",
354
362
  strokeDashArray: 4,
355
363
  padding: {
356
364
  bottom: a.length > 8 ? 60 : 10
@@ -372,10 +380,10 @@ class ne {
372
380
  };
373
381
  }
374
382
  buildPieOptions(e, t, s, i) {
375
- const r = e.properties || {}, a = t.length > 0 ? Object.keys(t[0]) : [], o = a[0] || "label", l = a[1] || "value", d = t.map((p) => {
376
- var f;
377
- return String((f = p[o]) != null ? f : "");
378
- }), h = t.map((p) => Number(p[l]) || 0), b = s === "dark", n = r.colors ? Object.values(r.colors) : ["#6366f1", "#8b5cf6", "#ec4899", "#f59e0b", "#10b981", "#3b82f6"];
383
+ const r = e.properties || {}, a = t.length > 0 ? Object.keys(t[0]) : [], o = a[0] || "label", c = a[1] || "value", d = t.map((p) => {
384
+ var l;
385
+ return String((l = p[o]) != null ? l : "");
386
+ }), b = t.map((p) => Number(p[c]) || 0), u = s === "dark", g = ["#4f46e5", "#10b981", "#f59e0b", "#ef4444", "#3b82f6", "#8b5cf6", "#ec4899", "#14b8a6"], n = r.colors ? Object.values(r.colors).filter(Boolean) : [], f = n.length > 0 ? n : g;
379
387
  return {
380
388
  chart: {
381
389
  type: e.type,
@@ -385,12 +393,12 @@ class ne {
385
393
  height: i != null ? i : "100%"
386
394
  },
387
395
  theme: { mode: s },
388
- series: h,
396
+ series: b,
389
397
  labels: d,
390
- colors: n,
398
+ colors: f,
391
399
  legend: {
392
400
  position: "bottom",
393
- labels: { colors: b ? "#94a3b8" : "#6b7280" }
401
+ labels: { colors: u ? "#94a3b8" : "#6b7280" }
394
402
  },
395
403
  tooltip: { theme: s },
396
404
  dataLabels: { enabled: d.length <= 8 },
@@ -408,32 +416,34 @@ class ne {
408
416
  try {
409
417
  const n = typeof s.selectedYAxisColumn == "string" ? JSON.parse(s.selectedYAxisColumn) : s.selectedYAxisColumn;
410
418
  Array.isArray(n) && (a = n.map(
411
- (p) => typeof p == "string" ? { column: p } : p
419
+ (f) => typeof f == "string" ? { column: f } : f
412
420
  ));
413
421
  } catch (n) {
414
422
  }
415
423
  if (!a.length && s.yAxis) {
416
424
  const n = s.yAxis;
417
- a = (Array.isArray(n) ? n : [n]).map((f) => ({ column: String(f) }));
425
+ a = (Array.isArray(n) ? n : [n]).map((p) => ({ column: String(p) }));
418
426
  }
419
427
  !a.length && i.length > 1 && (a = i.slice(1).map((n) => ({ column: n })));
420
428
  const o = t.map((n) => {
421
- var p;
422
- return String((p = n[r]) != null ? p : "");
423
- }), l = t.length > 0 ? Object.keys(t[0]) : [], d = a.map((n) => {
424
- const p = l.includes(n.column) ? n.column : null, f = p ? null : l.find((u) => u.includes(n.column) || n.column.includes(u)), m = !p && !f ? l.find((u) => {
425
- var g;
426
- return u !== r && !isNaN(Number((g = t[0]) == null ? void 0 : g[u]));
427
- }) : null, c = p || f || m || n.column;
429
+ var f;
430
+ return String((f = n[r]) != null ? f : "");
431
+ }), c = t.length > 0 ? Object.keys(t[0]) : [], d = a.map((n) => {
432
+ const f = c.includes(n.column) ? n.column : null, p = f ? null : c.find((h) => h.includes(n.column) || n.column.includes(h)), l = !f && !p ? c.find((h) => {
433
+ var y;
434
+ return h !== r && !isNaN(Number((y = t[0]) == null ? void 0 : y[h]));
435
+ }) : null, x = f || p || l || n.column;
428
436
  return {
429
- name: n.label || n.column.replace(/_/g, " "),
430
- data: t.map((u) => {
431
- const g = u[c];
432
- return g != null ? Number(g) : null;
437
+ // Use the column name directly as the series label (matches builder behaviour).
438
+ // col.label often stores the chart title, not the series name — ignore it.
439
+ name: n.column,
440
+ data: t.map((h) => {
441
+ const y = h[x];
442
+ return y != null ? Number(y) : null;
433
443
  })
434
444
  };
435
- }), h = s.xAxisLabel || r.replace(/_/g, " "), b = s.yAxisLabel || (d.length === 1 ? d[0].name : "Values");
436
- return { series: d, categories: o, xAxisLabel: h, yAxisLabel: b };
445
+ }), b = a.map((n) => n.color || n.colorHex || "").filter(Boolean), u = s.xAxisLabel || r, g = s.yAxisLabel || (a.length === 1 ? a[0].column : "");
446
+ return { series: d, categories: o, xAxisLabel: u, yAxisLabel: g, seriesColors: b };
437
447
  }
438
448
  renderEmpty(e) {
439
449
  this.container.innerHTML = `
@@ -450,12 +460,12 @@ class le {
450
460
  }
451
461
  // ── Public API ─────────────────────────────────────────────────────────────
452
462
  render(e, t, s, i) {
453
- var h;
463
+ var b;
454
464
  this.container = e, this.component = t, this.fetchPage = i, this.searchTerm = "", this.currentPage = 1, this.currentPageSize = 10;
455
465
  const r = s && !Array.isArray(s) && "rows" in s;
456
466
  if (r) {
457
- const b = s;
458
- this.currentRows = b.rows, this.allData = [], this.totalRows = b.total, this.currentPage = b.page, this.currentPageSize = b.pageSize;
467
+ const u = s;
468
+ this.currentRows = u.rows, this.allData = [], this.totalRows = u.total, this.currentPage = u.page, this.currentPageSize = u.pageSize;
459
469
  } else
460
470
  this.allData = s || [], this.currentRows = [], this.totalRows = this.allData.length, this.currentPage = 1;
461
471
  if (r && s.rows.length === 0 && s.total === 0 || !r && this.allData.length === 0) {
@@ -470,18 +480,18 @@ class le {
470
480
  `;
471
481
  return;
472
482
  }
473
- const a = r ? s.rows[0] : this.allData[0], o = a ? Object.keys(a) : [], l = ((h = t.properties) == null ? void 0 : h.columns) || [], d = l.length ? l.filter((b) => o.includes(b)) : [];
483
+ const a = r ? s.rows[0] : this.allData[0], o = a ? Object.keys(a) : [], c = ((b = t.properties) == null ? void 0 : b.columns) || [], d = c.length ? c.filter((u) => o.includes(u)) : [];
474
484
  this.columns = d.length ? d : o, this.paint();
475
485
  }
476
486
  // ── Rendering ──────────────────────────────────────────────────────────────
477
487
  paint() {
478
- const { rows: e, startNum: t } = this.getPageRows(), s = Math.max(1, Math.ceil(this.totalRows / this.currentPageSize)), i = (this.currentPage - 1) * this.currentPageSize + 1, r = this.fetchPage ? Math.min(i - 1 + (this.isLoading ? this.currentPageSize : e.length), this.totalRows) : Math.min(this.currentPage * this.currentPageSize, this.totalRows), a = this.columns.map((n) => `<th>${this.escape(this.formatHeader(n))}</th>`).join(""), o = e.length === 0 ? `<tr><td colspan="${this.columns.length + 1}" style="text-align:center;padding:20px;color:#9ca3af">No results found</td></tr>` : e.map((n, p) => {
479
- const f = this.columns.map((m) => {
480
- const c = n[m];
481
- return `<td title="${this.escape(String(c != null ? c : ""))}">${this.escape(this.formatValue(c))}</td>`;
488
+ const { rows: e, startNum: t } = this.getPageRows(), s = Math.max(1, Math.ceil(this.totalRows / this.currentPageSize)), i = (this.currentPage - 1) * this.currentPageSize + 1, r = this.fetchPage ? Math.min(i - 1 + (this.isLoading ? this.currentPageSize : e.length), this.totalRows) : Math.min(this.currentPage * this.currentPageSize, this.totalRows), a = this.columns.map((g) => `<th>${this.escape(this.formatHeader(g))}</th>`).join(""), o = e.length === 0 ? `<tr><td colspan="${this.columns.length + 1}" style="text-align:center;padding:20px;color:#9ca3af">No results found</td></tr>` : e.map((g, n) => {
489
+ const f = this.columns.map((p) => {
490
+ const l = g[p];
491
+ return `<td title="${this.escape(String(l != null ? l : ""))}">${this.escape(this.formatValue(l))}</td>`;
482
492
  }).join("");
483
- return `<tr><td class="ds-table-sno">${t + p}</td>${f}</tr>`;
484
- }).join(""), l = this.currentPageSize, d = [10, 25, 50, 100].map((n) => `<option value="${n}"${n === l ? " selected" : ""}>${n}</option>`).join(""), h = this.currentPage <= 1, b = this.currentPage >= s;
493
+ return `<tr><td class="ds-table-sno">${t + n}</td>${f}</tr>`;
494
+ }).join(""), c = this.currentPageSize, d = [10, 25, 50, 100].map((g) => `<option value="${g}"${g === c ? " selected" : ""}>${g}</option>`).join(""), b = this.currentPage <= 1, u = this.currentPage >= s;
485
495
  this.container.innerHTML = `
486
496
  <div class="ds-table-card">
487
497
  <div class="ds-table-header-row">
@@ -503,11 +513,11 @@ class le {
503
513
  <select class="ds-table-page-size">${d}</select>
504
514
  </div>
505
515
  <div class="ds-table-pagination">
506
- <button class="ds-table-pg-btn" data-action="first" ${h ? "disabled" : ""}>&#171;</button>
507
- <button class="ds-table-pg-btn" data-action="prev" ${h ? "disabled" : ""}>Previous</button>
516
+ <button class="ds-table-pg-btn" data-action="first" ${b ? "disabled" : ""}>&#171;</button>
517
+ <button class="ds-table-pg-btn" data-action="prev" ${b ? "disabled" : ""}>Previous</button>
508
518
  <span class="ds-table-pg-info">Page ${this.currentPage} of ${s}</span>
509
- <button class="ds-table-pg-btn" data-action="next" ${b ? "disabled" : ""}>Next</button>
510
- <button class="ds-table-pg-btn" data-action="last" ${b ? "disabled" : ""}>&#187;</button>
519
+ <button class="ds-table-pg-btn" data-action="next" ${u ? "disabled" : ""}>Next</button>
520
+ <button class="ds-table-pg-btn" data-action="last" ${u ? "disabled" : ""}>&#187;</button>
511
521
  </div>
512
522
  </div>
513
523
  ${this.isLoading ? '<div class="ds-table-loading-overlay"><div class="ds-embed-spinner"></div></div>' : ""}
@@ -576,24 +586,35 @@ class le {
576
586
  }
577
587
  class ce {
578
588
  render(e, t, s) {
589
+ var f;
579
590
  const i = t.properties || {};
580
591
  let r = null;
581
592
  if (s && s.length > 0) {
582
- const f = s[0], m = i.metric || Object.keys(f)[0], c = f[m];
583
- if (c !== void 0)
584
- r = c;
593
+ const p = s[0], l = i.metric || Object.keys(p)[0], x = p[l];
594
+ if (x !== void 0)
595
+ r = x;
585
596
  else {
586
- const u = Object.keys(f).find(
587
- (g) => g.includes(m) || m.includes(g)
597
+ const h = Object.keys(p).find(
598
+ (y) => y.includes(l) || l.includes(y)
588
599
  );
589
- r = f[u != null ? u : Object.keys(f)[0]];
600
+ r = p[h != null ? h : Object.keys(p)[0]];
590
601
  }
591
602
  }
592
- const a = this.formatValue(r, i), o = i.styleConfig || {}, l = o.backgroundColor || i.backgroundColor || "", d = o.color || o.textColor || i.textColor || "", h = t.title || "", b = l ? `background:${l};border-color:${l};` : "", n = d ? `color:${d};` : "", p = d ? `color:${d};opacity:0.7;` : "";
603
+ let a;
604
+ if (r == null)
605
+ try {
606
+ const p = (f = i == null ? void 0 : i.data) == null ? void 0 : f.dataContent, l = p ? typeof p == "string" ? JSON.parse(p) : p : null;
607
+ a = l != null && l.value ? String(l.value) : "—";
608
+ } catch (p) {
609
+ a = "—";
610
+ }
611
+ else
612
+ a = this.formatValue(r, i);
613
+ const o = i.styleConfig || {}, c = o.backgroundColor || i.backgroundColor || "", d = o.color || o.textColor || i.textColor || "", b = t.title || "", u = c ? `background:${c};border:none;` : "", g = d ? `color:${d};` : "", n = d ? `color:${d};opacity:0.7;` : "";
593
614
  e.innerHTML = `
594
- <div class="ds-card"${b ? ` style="${b}"` : ""}>
595
- <div class="ds-card-label"${p ? ` style="${p}"` : ""}>${h}</div>
596
- <div class="ds-card-value"${n ? ` style="${n}"` : ""}>${a}</div>
615
+ <div class="ds-card"${u ? ` style="${u}"` : ""}>
616
+ <div class="ds-card-label"${n ? ` style="${n}"` : ""}>${b}</div>
617
+ <div class="ds-card-value"${g ? ` style="${g}"` : ""}>${a}</div>
597
618
  </div>
598
619
  `;
599
620
  }
@@ -601,9 +622,8 @@ class ce {
601
622
  if (e == null) return "—";
602
623
  const s = Number(e);
603
624
  if (isNaN(s)) return String(e);
604
- const i = (t == null ? void 0 : t.prefix) || (t == null ? void 0 : t.currencySymbol) || "", r = (t == null ? void 0 : t.suffix) || "";
605
- let a;
606
- return Math.abs(s) >= 1e6 ? a = (s / 1e6).toFixed(1) + "M" : Math.abs(s) >= 1e3 ? a = (s / 1e3).toFixed(1) + "K" : a = s % 1 === 0 ? s.toLocaleString() : s.toFixed(2), `${i}${a}${r}`;
625
+ const i = (t == null ? void 0 : t.prefix) || (t == null ? void 0 : t.currencySymbol) || "", r = (t == null ? void 0 : t.suffix) || "", a = s % 1 === 0 ? s.toLocaleString() : parseFloat(s.toFixed(2)).toLocaleString();
626
+ return `${i}${a}${r}`;
607
627
  }
608
628
  }
609
629
  class pe {
@@ -704,16 +724,16 @@ class pe {
704
724
  attachListeners(e) {
705
725
  const t = {};
706
726
  this.container.querySelectorAll("[data-filter-id]").forEach((s) => {
707
- const i = s.dataset.filterId, r = s.dataset.datePart, a = e.find((l) => l.filterId === i), o = () => {
708
- let l;
727
+ const i = s.dataset.filterId, r = s.dataset.datePart, a = e.find((c) => c.filterId === i), o = () => {
728
+ let c;
709
729
  if ((a == null ? void 0 : a.type) === "date-range" && r)
710
- t[i] = t[i] || {}, t[i][r] = s.value, l = { ...t[i] };
730
+ t[i] = t[i] || {}, t[i][r] = s.value, c = { ...t[i] };
711
731
  else if ((a == null ? void 0 : a.type) === "multi-select") {
712
732
  const d = s;
713
- l = Array.from(d.selectedOptions).map((h) => h.value).filter(Boolean);
733
+ c = Array.from(d.selectedOptions).map((b) => b.value).filter(Boolean);
714
734
  } else
715
- l = s.value;
716
- this.currentValues[i] = l, this.onFilterChange(i, l);
735
+ c = s.value;
736
+ this.currentValues[i] = c, this.onFilterChange(i, c);
717
737
  };
718
738
  s.addEventListener(
719
739
  (a == null ? void 0 : a.type) === "text-input" ? "input" : "change",
@@ -730,7 +750,7 @@ class pe {
730
750
  }
731
751
  const H = class H {
732
752
  constructor(e, t) {
733
- this.activePageId = "", this.activeTabId = "", this.activeFilters = {}, this.chartRenderers = /* @__PURE__ */ new Map(), this.tableRenderer = new le(), this.cardRenderer = new ce(), this.isLoadingTab = !1, this.root = e, this.opts = t, this.activeFilters = { ...t.initialFilters };
753
+ this.activePageId = "", this.activeTabId = "", this.activeFilters = {}, this.chartRenderers = /* @__PURE__ */ new Map(), this.tableRenderer = new le(), this.cardRenderer = new ce(), this.isLoadingTab = !1, this.tooltipEl = null, this.root = e, this.opts = t, this.activeFilters = { ...t.initialFilters };
734
754
  }
735
755
  // ── Initial full render ───────────────────────────────────────────────────
736
756
  render(e) {
@@ -752,14 +772,14 @@ const H = class H {
752
772
  this.chartRenderers.forEach((e) => e.destroy()), this.chartRenderers.clear(), this.root.innerHTML = "";
753
773
  }
754
774
  exportPDF() {
755
- var n, p;
775
+ var g, n;
756
776
  const e = this.root.querySelector("#ds-grid");
757
777
  if (!e) return;
758
778
  const t = this.root.style.height, s = this.root.style.overflow;
759
779
  this.root.style.height = "auto", this.root.style.overflow = "visible";
760
- const i = this.root.querySelector("#ds-canvas"), r = (n = i == null ? void 0 : i.style.height) != null ? n : "", a = (p = i == null ? void 0 : i.style.overflow) != null ? p : "";
780
+ const i = this.root.querySelector("#ds-canvas"), r = (g = i == null ? void 0 : i.style.height) != null ? g : "", a = (n = i == null ? void 0 : i.style.overflow) != null ? n : "";
761
781
  i && (i.style.height = "auto", i.style.overflow = "visible");
762
- const o = Array.from(e.querySelectorAll(".ds-table-scroll")), l = o.map((f) => ({
782
+ const o = Array.from(e.querySelectorAll(".ds-table-scroll")), c = o.map((f) => ({
763
783
  el: f,
764
784
  overflow: f.style.overflow,
765
785
  maxHeight: f.style.maxHeight,
@@ -768,7 +788,7 @@ const H = class H {
768
788
  o.forEach((f) => {
769
789
  f.style.overflow = "visible", f.style.maxHeight = "none", f.style.height = "auto";
770
790
  });
771
- const d = e.offsetWidth, h = parseInt(e.style.height, 10) || e.offsetHeight, b = e.getBoundingClientRect().top + window.scrollY;
791
+ const d = e.offsetWidth, b = parseInt(e.style.height, 10) || e.offsetHeight, u = e.getBoundingClientRect().top + window.scrollY;
772
792
  import("./html2canvas.esm-CzwMv54K.js").then(
773
793
  ({ default: f }) => f(e, {
774
794
  scale: 2,
@@ -776,21 +796,21 @@ const H = class H {
776
796
  allowTaint: !0,
777
797
  logging: !1,
778
798
  width: d,
779
- height: h,
799
+ height: b,
780
800
  windowWidth: d,
781
- windowHeight: h,
801
+ windowHeight: b,
782
802
  scrollX: 0,
783
- scrollY: -b
784
- }).then((m) => {
785
- this.root.style.height = t, this.root.style.overflow = s, i && (i.style.height = r, i.style.overflow = a), l.forEach(({ el: c, overflow: u, maxHeight: g, height: k }) => {
786
- c.style.overflow = u, c.style.maxHeight = g, c.style.height = k;
787
- }), import("./jspdf.es.min-d9hlG26J.js").then((c) => c.j).then(({ jsPDF: c }) => {
788
- const u = m.width / 2, g = m.height / 2, k = new c({
789
- orientation: u >= g ? "landscape" : "portrait",
803
+ scrollY: -u
804
+ }).then((p) => {
805
+ this.root.style.height = t, this.root.style.overflow = s, i && (i.style.height = r, i.style.overflow = a), c.forEach(({ el: l, overflow: x, maxHeight: h, height: y }) => {
806
+ l.style.overflow = x, l.style.maxHeight = h, l.style.height = y;
807
+ }), import("./jspdf.es.min-d9hlG26J.js").then((l) => l.j).then(({ jsPDF: l }) => {
808
+ const x = p.width / 2, h = p.height / 2, y = new l({
809
+ orientation: x >= h ? "landscape" : "portrait",
790
810
  unit: "px",
791
- format: [u, g]
811
+ format: [x, h]
792
812
  });
793
- k.addImage(m.toDataURL("image/png"), "PNG", 0, 0, u, g), k.save(`${this.renderData.dashboard.name || "dashboard"}.pdf`);
813
+ y.addImage(p.toDataURL("image/png"), "PNG", 0, 0, x, h), y.save(`${this.renderData.dashboard.name || "dashboard"}.pdf`);
794
814
  });
795
815
  })
796
816
  );
@@ -801,8 +821,8 @@ const H = class H {
801
821
  if (!(t != null && t.length) || !["table", "bar", "line", "area"].includes(e.type)) return;
802
822
  const s = Object.keys(t[0]), i = [s.join(","), ...t.map(
803
823
  (a) => s.map((o) => {
804
- var l;
805
- return JSON.stringify((l = a[o]) != null ? l : "");
824
+ var c;
825
+ return JSON.stringify((c = a[o]) != null ? c : "");
806
826
  }).join(",")
807
827
  )].join(`
808
828
  `);
@@ -834,11 +854,11 @@ const H = class H {
834
854
  `, this.root.style.position = "relative", this.opts.hideExport || this.buildExportToolbar();
835
855
  const r = this.root.querySelector("#ds-filter-container");
836
856
  this.filterRenderer = new pe(r, (a, o) => {
837
- var b, n, p, f, m;
838
- const l = (b = this.renderData.filters) == null ? void 0 : b.find((c) => c.filterId === a), d = (n = this.renderData.components) == null ? void 0 : n.find(
839
- (c) => c.type === "inline-filter" && c.id === a
840
- ), h = (l == null ? void 0 : l.applyToField) || ((p = d == null ? void 0 : d.properties) == null ? void 0 : p.applyToField) || a;
841
- this.activeFilters[h] = o, (m = (f = this.opts).onFilterChange) == null || m.call(f, this.activeFilters), this.opts.onTabSwitch(this.activePageId, this.activeTabId);
857
+ var u, g, n, f, p;
858
+ const c = (u = this.renderData.filters) == null ? void 0 : u.find((l) => l.filterId === a), d = (g = this.renderData.components) == null ? void 0 : g.find(
859
+ (l) => l.type === "inline-filter" && l.id === a
860
+ ), b = (c == null ? void 0 : c.applyToField) || ((n = d == null ? void 0 : d.properties) == null ? void 0 : n.applyToField) || a;
861
+ this.activeFilters[b] = o, (p = (f = this.opts).onFilterChange) == null || p.call(f, this.activeFilters), this.opts.onTabSwitch(this.activePageId, this.activeTabId);
842
862
  });
843
863
  }
844
864
  buildExportToolbar() {
@@ -919,7 +939,7 @@ const H = class H {
919
939
  /** Convert inline-filter ComponentConfig entries to FilterDefinition shape */
920
940
  inlineFiltersAsDefinitions() {
921
941
  return this.opts.hideInlineFilters ? [] : (this.renderData.components || []).filter((e) => e.type === "inline-filter").map((e) => {
922
- var t, s, i, r, a, o, l, d;
942
+ var t, s, i, r, a, o, c, d;
923
943
  return {
924
944
  filterId: e.id,
925
945
  label: ((t = e.properties) == null ? void 0 : t.filterLabel) || e.title || "",
@@ -927,7 +947,7 @@ const H = class H {
927
947
  options: ((i = e.properties) == null ? void 0 : i.filterOptions) || ((r = e.properties) == null ? void 0 : r.options) || [],
928
948
  defaultValue: (a = e.properties) == null ? void 0 : a.defaultValue,
929
949
  targetComponents: ((o = e.properties) == null ? void 0 : o.targetComponents) || [],
930
- filterOperator: (l = e.properties) == null ? void 0 : l.filterOperator,
950
+ filterOperator: (c = e.properties) == null ? void 0 : c.filterOperator,
931
951
  applyToField: ((d = e.properties) == null ? void 0 : d.applyToField) || e.id
932
952
  };
933
953
  });
@@ -946,10 +966,10 @@ const H = class H {
946
966
  const e = this.root.querySelector("#ds-grid");
947
967
  if (!e) return;
948
968
  if (!this.opts.hideBackground) {
949
- const d = this.root.querySelector("#ds-canvas"), h = this.renderData.dashboard.pages.find(
950
- (n) => n.pageId === this.activePageId
951
- ), b = (h == null ? void 0 : h.backgroundColor) || "";
952
- d && (d.style.background = b), this.root.style.background = b;
969
+ const d = this.root.querySelector("#ds-canvas"), b = this.renderData.dashboard.pages.find(
970
+ (g) => g.pageId === this.activePageId
971
+ ), u = (b == null ? void 0 : b.backgroundColor) || "";
972
+ d && (d.style.background = u), this.root.style.background = u;
953
973
  }
954
974
  this.chartRenderers.forEach((d) => d.destroy()), this.chartRenderers.clear();
955
975
  const t = (this.renderData.components || []).filter(
@@ -961,27 +981,39 @@ const H = class H {
961
981
  }
962
982
  const s = e.clientWidth || this.root.clientWidth || 800, i = t.map((d) => d.position), r = i.length ? Math.min(...i.map((d) => d.y)) : 0, a = new ae(s, r);
963
983
  e.style.height = `${ae.totalHeight(i)}px`, e.innerHTML = "";
964
- const o = 36, l = [];
984
+ const o = 36, c = [];
965
985
  t.forEach((d) => {
966
- var p, f, m;
967
- const h = document.createElement("div");
968
- if (h.className = "ds-component-wrapper", h.dataset.componentId = d.id, a.applyStyles(h, d.position), !this.opts.hideBackground) {
969
- const c = ((f = (p = d.properties) == null ? void 0 : p.styleConfig) == null ? void 0 : f.backgroundColor) || ((m = d.properties) == null ? void 0 : m.backgroundColor);
970
- c && (h.style.background = c);
986
+ var p, l, x;
987
+ const b = document.createElement("div");
988
+ if (b.className = "ds-component-wrapper", b.dataset.componentId = d.id, a.applyStyles(b, d.position), !this.opts.hideBackground) {
989
+ const h = ((l = (p = d.properties) == null ? void 0 : p.styleConfig) == null ? void 0 : l.backgroundColor) || ((x = d.properties) == null ? void 0 : x.backgroundColor);
990
+ h && (b.style.background = h);
971
991
  }
972
- e.appendChild(h);
973
- const b = a.toPx(d.position), n = Math.max(50, b.height - o);
974
- l.push(
975
- this.renderComponent(h, d, n).catch((c) => {
976
- console.error(`[Deepspot SDK] Failed to render component ${d.id} (${d.type}):`, c), h.innerHTML = `<div style="padding:8px;color:#ef4444;font-size:12px;">⚠ ${d.type} render error</div>`;
992
+ e.appendChild(b);
993
+ const u = a.toPx(d.position), g = Math.max(50, u.height - o), n = document.createElement("div");
994
+ n.style.cssText = "width:100%;height:100%;", b.appendChild(n);
995
+ const f = this.getComponentDescription(d);
996
+ if (f) {
997
+ const h = this.getTooltipEl();
998
+ b.addEventListener("mouseenter", () => {
999
+ h.textContent = f, h.style.display = "block";
1000
+ const y = b.getBoundingClientRect(), T = h.offsetHeight || 36;
1001
+ window.innerHeight - y.bottom >= T + 6 ? h.style.top = `${y.bottom + 4}px` : h.style.top = `${y.top - T - 4}px`, h.style.left = `${y.left}px`, h.style.width = `${y.width}px`;
1002
+ }), b.addEventListener("mouseleave", () => {
1003
+ h.style.display = "none";
1004
+ });
1005
+ }
1006
+ c.push(
1007
+ this.renderComponent(n, d, g).catch((h) => {
1008
+ console.error(`[Deepspot SDK] Failed to render component ${d.id} (${d.type}):`, h), n.innerHTML = `<div style="padding:8px;color:#ef4444;font-size:12px;">⚠ ${d.type} render error</div>`;
977
1009
  })
978
1010
  );
979
- }), Promise.all(l).catch(() => {
1011
+ }), Promise.all(c).catch(() => {
980
1012
  });
981
1013
  }
982
1014
  // ── Component renderer switch ─────────────────────────────────────────────
983
1015
  async renderComponent(e, t, s) {
984
- var a, o, l, d, h, b, n, p, f, m, c, u, g, k, T, C, $, R, I, P, L, U, W, _, Y, J, X, Z, Q, V, ee, te, se, ie, re;
1016
+ var a, o, c, d, b, u, g, n, f, p, l, x, h, y, T, C, $, R, I, L, F, U, W, _, Y, J, V, X, Z, Q, ee, te, se, ie, re;
985
1017
  const i = this.renderData.data[t.id] || [], r = this.opts.theme;
986
1018
  switch (t.type) {
987
1019
  case "bar":
@@ -991,13 +1023,13 @@ const H = class H {
991
1023
  case "area":
992
1024
  case "scatter":
993
1025
  case "stacked-bar": {
994
- const v = new ne(e);
995
- await v.render(t, i, r, s), this.chartRenderers.set(t.id, v);
1026
+ const w = new ne(e);
1027
+ await w.render(t, i, r, s), this.chartRenderers.set(t.id, w);
996
1028
  break;
997
1029
  }
998
1030
  case "table": {
999
- const v = this.opts.onFetchTablePage ? (x, S) => this.opts.onFetchTablePage(t.id, x, S) : void 0;
1000
- this.tableRenderer.render(e, t, i, v);
1031
+ const w = this.opts.onFetchTablePage ? (v, S) => this.opts.onFetchTablePage(t.id, v, S) : void 0;
1032
+ this.tableRenderer.render(e, t, i, w);
1001
1033
  break;
1002
1034
  }
1003
1035
  case "number-card":
@@ -1005,62 +1037,62 @@ const H = class H {
1005
1037
  break;
1006
1038
  case "text-heading": {
1007
1039
  if (this.opts.hideText) break;
1008
- const v = ((o = (a = t.properties) == null ? void 0 : a.data) == null ? void 0 : o.dataContent) || ((l = t.properties) == null ? void 0 : l.content) || t.title || "", x = ((d = t.properties) == null ? void 0 : d.styleConfig) || {}, S = this.scToInlineStyle(x), y = this.opts.hideBackground ? {} : this.parseTwColor((b = (h = t.properties) == null ? void 0 : h.color) != null ? b : ""), F = [[
1009
- y.bg ? `background:${y.bg}` : "",
1010
- y.text ? `color:${y.text}` : ""
1040
+ const w = ((o = (a = t.properties) == null ? void 0 : a.data) == null ? void 0 : o.dataContent) || ((c = t.properties) == null ? void 0 : c.content) || t.title || "", v = ((d = t.properties) == null ? void 0 : d.styleConfig) || {}, S = this.scToInlineStyle(v), m = this.opts.hideBackground ? {} : this.parseTwColor((u = (b = t.properties) == null ? void 0 : b.color) != null ? u : ""), P = [[
1041
+ m.bg ? `background:${m.bg}` : "",
1042
+ m.text ? `color:${m.text}` : ""
1011
1043
  ].filter(Boolean).join(";"), S].filter(Boolean).join(";");
1012
- e.innerHTML = `<div class="ds-text-heading" style="${F}">${v}</div>`;
1044
+ e.innerHTML = `<div class="ds-text-heading" style="${P}">${w}</div>`;
1013
1045
  break;
1014
1046
  }
1015
1047
  case "text-subheading": {
1016
1048
  if (this.opts.hideText) break;
1017
- const v = ((p = (n = t.properties) == null ? void 0 : n.data) == null ? void 0 : p.dataContent) || ((f = t.properties) == null ? void 0 : f.content) || t.title || "", x = ((m = t.properties) == null ? void 0 : m.styleConfig) || {}, S = this.scToInlineStyle(x), y = this.opts.hideBackground ? {} : this.parseTwColor((u = (c = t.properties) == null ? void 0 : c.color) != null ? u : ""), F = [[
1018
- y.bg ? `background:${y.bg}` : "",
1019
- y.text ? `color:${y.text}` : ""
1049
+ const w = ((n = (g = t.properties) == null ? void 0 : g.data) == null ? void 0 : n.dataContent) || ((f = t.properties) == null ? void 0 : f.content) || t.title || "", v = ((p = t.properties) == null ? void 0 : p.styleConfig) || {}, S = this.scToInlineStyle(v), m = this.opts.hideBackground ? {} : this.parseTwColor((x = (l = t.properties) == null ? void 0 : l.color) != null ? x : ""), P = [[
1050
+ m.bg ? `background:${m.bg}` : "",
1051
+ m.text ? `color:${m.text}` : ""
1020
1052
  ].filter(Boolean).join(";"), S].filter(Boolean).join(";");
1021
- e.innerHTML = `<div class="ds-text-subheading" style="${F}">${v}</div>`;
1053
+ e.innerHTML = `<div class="ds-text-subheading" style="${P}">${w}</div>`;
1022
1054
  break;
1023
1055
  }
1024
1056
  case "text-body": {
1025
1057
  if (this.opts.hideText) break;
1026
- const v = ((k = (g = t.properties) == null ? void 0 : g.data) == null ? void 0 : k.dataContent) || ((T = t.properties) == null ? void 0 : T.content) || "", x = ((C = t.properties) == null ? void 0 : C.styleConfig) || {}, S = this.scToInlineStyle(x), y = this.opts.hideBackground ? {} : this.parseTwColor((R = ($ = t.properties) == null ? void 0 : $.color) != null ? R : ""), F = [[
1027
- y.bg ? `background:${y.bg}` : "",
1028
- y.text ? `color:${y.text}` : ""
1058
+ const w = ((y = (h = t.properties) == null ? void 0 : h.data) == null ? void 0 : y.dataContent) || ((T = t.properties) == null ? void 0 : T.content) || "", v = ((C = t.properties) == null ? void 0 : C.styleConfig) || {}, S = this.scToInlineStyle(v), m = this.opts.hideBackground ? {} : this.parseTwColor((R = ($ = t.properties) == null ? void 0 : $.color) != null ? R : ""), P = [[
1059
+ m.bg ? `background:${m.bg}` : "",
1060
+ m.text ? `color:${m.text}` : ""
1029
1061
  ].filter(Boolean).join(";"), S].filter(Boolean).join(";");
1030
- e.innerHTML = `<div class="ds-text-body" style="${F}">${v}</div>`;
1062
+ e.innerHTML = `<div class="ds-text-body" style="${P}">${w}</div>`;
1031
1063
  break;
1032
1064
  }
1033
1065
  case "text-box": {
1034
1066
  if (this.opts.hideText) break;
1035
- const v = ((P = (I = t.properties) == null ? void 0 : I.data) == null ? void 0 : P.dataContent) || ((L = t.properties) == null ? void 0 : L.content) || "", x = ((U = t.properties) == null ? void 0 : U.styleConfig) || {}, S = this.scToInlineStyle(x), y = this.opts.hideBackground ? {} : this.parseTwColor((_ = (W = t.properties) == null ? void 0 : W.color) != null ? _ : ""), F = [[
1036
- y.bg ? `background:${y.bg}` : "",
1037
- y.text ? `color:${y.text}` : ""
1067
+ const w = ((L = (I = t.properties) == null ? void 0 : I.data) == null ? void 0 : L.dataContent) || ((F = t.properties) == null ? void 0 : F.content) || "", v = ((U = t.properties) == null ? void 0 : U.styleConfig) || {}, S = this.scToInlineStyle(v), m = this.opts.hideBackground ? {} : this.parseTwColor((_ = (W = t.properties) == null ? void 0 : W.color) != null ? _ : ""), P = [[
1068
+ m.bg ? `background:${m.bg}` : "",
1069
+ m.text ? `color:${m.text}` : ""
1038
1070
  ].filter(Boolean).join(";"), S].filter(Boolean).join(";");
1039
- e.innerHTML = `<div class="ds-text-box" style="${F}">${v}</div>`;
1071
+ e.innerHTML = `<div class="ds-text-box" style="${P}">${w}</div>`;
1040
1072
  break;
1041
1073
  }
1042
1074
  case "text": {
1043
1075
  if (this.opts.hideText) break;
1044
- const v = ((J = (Y = t.properties) == null ? void 0 : Y.data) == null ? void 0 : J.dataContent) || ((X = t.properties) == null ? void 0 : X.content) || "", x = ((Z = t.properties) == null ? void 0 : Z.styleConfig) || {}, S = this.scToInlineStyle(x), y = this.opts.hideBackground ? {} : this.parseTwColor((V = (Q = t.properties) == null ? void 0 : Q.color) != null ? V : ""), F = [[
1045
- y.bg ? `background:${y.bg}` : "",
1046
- y.text ? `color:${y.text}` : ""
1076
+ const w = ((J = (Y = t.properties) == null ? void 0 : Y.data) == null ? void 0 : J.dataContent) || ((V = t.properties) == null ? void 0 : V.content) || "", v = ((X = t.properties) == null ? void 0 : X.styleConfig) || {}, S = this.scToInlineStyle(v), m = this.opts.hideBackground ? {} : this.parseTwColor((Q = (Z = t.properties) == null ? void 0 : Z.color) != null ? Q : ""), P = [[
1077
+ m.bg ? `background:${m.bg}` : "",
1078
+ m.text ? `color:${m.text}` : ""
1047
1079
  ].filter(Boolean).join(";"), S].filter(Boolean).join(";");
1048
- e.innerHTML = `<div class="ds-text-body" style="${F}">${v}</div>`;
1080
+ e.innerHTML = `<div class="ds-text-body" style="${P}">${w}</div>`;
1049
1081
  break;
1050
1082
  }
1051
1083
  case "header": {
1052
1084
  if (this.opts.hideHeader) break;
1053
- const v = ((te = (ee = t.properties) == null ? void 0 : ee.data) == null ? void 0 : te.dataContent) || ((se = t.properties) == null ? void 0 : se.content) || t.title || "", x = ((ie = t.properties) == null ? void 0 : ie.styleConfig) || {}, S = !this.opts.hideBackground && x.backgroundColor ? `background:${x.backgroundColor};` : "", y = x.color ? `color:${x.color};` : x.textColor ? `color:${x.textColor};` : "";
1085
+ const w = ((te = (ee = t.properties) == null ? void 0 : ee.data) == null ? void 0 : te.dataContent) || ((se = t.properties) == null ? void 0 : se.content) || t.title || "", v = ((ie = t.properties) == null ? void 0 : ie.styleConfig) || {}, S = !this.opts.hideBackground && v.backgroundColor ? `background:${v.backgroundColor};` : "", m = v.color ? `color:${v.color};` : v.textColor ? `color:${v.textColor};` : "";
1054
1086
  e.innerHTML = `
1055
- <div class="ds-header-component" style="${S}${y}">
1056
- <div class="ds-header-content">${v}</div>
1087
+ <div class="ds-header-component" style="${S}${m}">
1088
+ <div class="ds-header-content">${w}</div>
1057
1089
  </div>`;
1058
1090
  break;
1059
1091
  }
1060
1092
  case "section": {
1061
- const v = ((re = t.properties) == null ? void 0 : re.styleConfig) || {}, x = !this.opts.hideBackground && v.backgroundColor ? `background:${v.backgroundColor};` : "";
1093
+ const w = ((re = t.properties) == null ? void 0 : re.styleConfig) || {}, v = !this.opts.hideBackground && w.backgroundColor ? `background:${w.backgroundColor};` : "";
1062
1094
  e.innerHTML = `
1063
- <div class="ds-section-wrapper" style="${x}">
1095
+ <div class="ds-section-wrapper" style="${v}">
1064
1096
  ${t.title ? `<div class="ds-section-title">${t.title}</div>` : ""}
1065
1097
  </div>`;
1066
1098
  break;
@@ -1124,6 +1156,26 @@ const H = class H {
1124
1156
  }
1125
1157
  return t;
1126
1158
  }
1159
+ getTooltipEl() {
1160
+ if (!this.tooltipEl) {
1161
+ const e = document.createElement("div");
1162
+ e.className = "ds-global-tooltip", e.style.display = "none", document.body.appendChild(e), this.tooltipEl = e;
1163
+ }
1164
+ return this.tooltipEl;
1165
+ }
1166
+ getComponentDescription(e) {
1167
+ var t, s, i, r;
1168
+ if ((t = e.properties) != null && t.description) return String(e.properties.description);
1169
+ try {
1170
+ const a = (i = (s = e.properties) == null ? void 0 : s.data) == null ? void 0 : i.dataContent;
1171
+ if (a) {
1172
+ const o = typeof a == "string" ? JSON.parse(a) : a;
1173
+ return (o == null ? void 0 : o.description) || ((r = o == null ? void 0 : o.config) == null ? void 0 : r.description) || "";
1174
+ }
1175
+ } catch (a) {
1176
+ }
1177
+ return "";
1178
+ }
1127
1179
  getTabsForPage(e) {
1128
1180
  var t, s;
1129
1181
  return (s = (t = this.renderData.dashboard.pages.find((i) => i.pageId === e)) == null ? void 0 : t.tabs) != null ? s : [];
@@ -1216,11 +1268,11 @@ class he {
1216
1268
  }
1217
1269
  }
1218
1270
  let oe = !1;
1219
- function q() {
1271
+ function B() {
1220
1272
  if (!(oe || typeof document == "undefined")) {
1221
1273
  oe = !0;
1222
1274
  try {
1223
- const w = `/* ─────────────────────────────────────────────────────────────────────────────
1275
+ const k = `/* ─────────────────────────────────────────────────────────────────────────────
1224
1276
  Deepspot SDK — Base Embed Styles
1225
1277
  Injected once into the host page's <head> by the SDK.
1226
1278
  All selectors are scoped under .ds-embed-* to avoid leaking into host styles.
@@ -1450,7 +1502,25 @@ function q() {
1450
1502
 
1451
1503
  .ds-component-wrapper {
1452
1504
  position: absolute;
1453
- overflow: hidden;
1505
+ /* overflow intentionally not set — individual card components handle their own clipping,
1506
+ and tooltip bubbles must be able to overflow the wrapper boundary */
1507
+ }
1508
+
1509
+ /* ── Description tooltip — fixed on body, positioned via JS, never clips content ── */
1510
+ .ds-global-tooltip {
1511
+ position: fixed;
1512
+ z-index: 9999;
1513
+ background: rgba(15, 23, 42, 0.92);
1514
+ color: #f1f5f9;
1515
+ font-size: 12px;
1516
+ line-height: 1.6;
1517
+ padding: 8px 14px;
1518
+ border-radius: 8px;
1519
+ white-space: normal;
1520
+ pointer-events: none;
1521
+ backdrop-filter: blur(4px);
1522
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
1523
+ max-width: 600px;
1454
1524
  }
1455
1525
 
1456
1526
  /* ── Chart component ───────────────────────────────────────────────────────── */
@@ -2043,42 +2113,42 @@ function q() {
2043
2113
  background: #0f172a;
2044
2114
  }
2045
2115
  `, e = document.createElement("style");
2046
- e.id = "deepspot-sdk-styles", e.textContent = w, document.head.appendChild(e);
2047
- } catch (w) {
2116
+ e.id = "deepspot-sdk-styles", e.textContent = k, document.head.appendChild(e);
2117
+ } catch (k) {
2048
2118
  }
2049
2119
  }
2050
2120
  }
2051
- function de(w) {
2052
- if (typeof w == "string") {
2053
- const e = document.querySelector(w);
2054
- if (!e) throw new Error(`Deepspot SDK: container "${w}" not found in DOM`);
2121
+ function de(k) {
2122
+ if (typeof k == "string") {
2123
+ const e = document.querySelector(k);
2124
+ if (!e) throw new Error(`Deepspot SDK: container "${k}" not found in DOM`);
2055
2125
  return e;
2056
2126
  }
2057
- return w;
2127
+ return k;
2058
2128
  }
2059
2129
  class ge {
2060
2130
  constructor(e) {
2061
2131
  if (!e.apiKey) throw new Error("Deepspot SDK: apiKey is required");
2062
2132
  if (!e.baseUrl) throw new Error("Deepspot SDK: baseUrl is required");
2063
- this.apiClient = new K(e.baseUrl, e.apiKey), q();
2133
+ this.apiClient = new K(e.baseUrl, e.apiKey), B();
2064
2134
  }
2065
2135
  // ── Embed full dashboard ────────────────────────────────────────────────────
2066
2136
  async embedDashboard(e) {
2067
- var a, o, l, d, h, b, n, p, f, m;
2137
+ var a, o, c, d, b, u, g, n, f, p;
2068
2138
  const t = de(e.container), s = (a = e.embedLevel) != null ? a : "dashboard", i = (o = e.theme) != null ? o : "light";
2069
2139
  t.style.height = e.height || "600px", t.style.display = "block";
2070
2140
  const r = this.createRoot(t, i);
2071
2141
  this.showLoading(r);
2072
2142
  try {
2073
- const c = await this.apiClient.getEmbedToken({
2143
+ const l = await this.apiClient.getEmbedToken({
2074
2144
  dashboardId: e.dashboardId,
2075
2145
  embedType: "dashboard",
2076
2146
  embedLevel: s,
2077
2147
  userId: e.userId,
2078
2148
  tenantId: e.tenantId
2079
- }), u = await this.apiClient.getDashboardRender(
2149
+ }), x = await this.apiClient.getDashboardRender(
2080
2150
  e.dashboardId,
2081
- c,
2151
+ l,
2082
2152
  {
2083
2153
  embedLevel: s,
2084
2154
  pageId: e.pageId,
@@ -2086,58 +2156,58 @@ class ge {
2086
2156
  filters: e.filters || {}
2087
2157
  }
2088
2158
  );
2089
- let g;
2090
- const k = new D(r, {
2159
+ let h;
2160
+ const y = new D(r, {
2091
2161
  embedLevel: s,
2092
2162
  theme: i,
2093
2163
  // v1 backward compat (hideFilters → hideGlobalFilters)
2094
- hideFilters: (l = e.hideGlobalFilters) != null ? l : !1,
2164
+ hideFilters: (c = e.hideGlobalFilters) != null ? c : !1,
2095
2165
  hideExport: (d = e.hideExport) != null ? d : !1,
2096
2166
  // v2 visibility
2097
- hideGlobalFilters: (h = e.hideGlobalFilters) != null ? h : !1,
2098
- hideInlineFilters: (b = e.hideInlineFilters) != null ? b : !1,
2099
- hideText: (n = e.hideText) != null ? n : !1,
2100
- hideHeader: (p = e.hideHeader) != null ? p : !1,
2167
+ hideGlobalFilters: (b = e.hideGlobalFilters) != null ? b : !1,
2168
+ hideInlineFilters: (u = e.hideInlineFilters) != null ? u : !1,
2169
+ hideText: (g = e.hideText) != null ? g : !1,
2170
+ hideHeader: (n = e.hideHeader) != null ? n : !1,
2101
2171
  hideBackground: (f = e.hideBackground) != null ? f : !1,
2102
2172
  initialFilters: e.filters || {},
2103
2173
  onFilterChange: e.onFilterChange,
2104
2174
  onReady: e.onReady,
2105
- onFetchFilterOptions: (T) => this.apiClient.getFilterOptions(e.dashboardId, T, c),
2106
- onFetchTablePage: (T, C, $) => this.apiClient.getTablePage(e.dashboardId, T, C, $, c),
2175
+ onFetchFilterOptions: (T) => this.apiClient.getFilterOptions(e.dashboardId, T, l),
2176
+ onFetchTablePage: (T, C, $) => this.apiClient.getTablePage(e.dashboardId, T, C, $, l),
2107
2177
  onTabSwitch: async (T, C) => {
2108
2178
  var $, R, I;
2109
2179
  ($ = e.onTabSwitch) == null || $.call(e, T, C);
2110
2180
  try {
2111
- const P = await this.apiClient.getDashboardRender(
2181
+ const L = await this.apiClient.getDashboardRender(
2112
2182
  e.dashboardId,
2113
- c,
2183
+ l,
2114
2184
  {
2115
2185
  embedLevel: s,
2116
2186
  pageId: T,
2117
2187
  tabId: C,
2118
- filters: (I = (R = g == null ? void 0 : g.getActiveFilters()) != null ? R : e.filters) != null ? I : {}
2188
+ filters: (I = (R = h == null ? void 0 : h.getActiveFilters()) != null ? R : e.filters) != null ? I : {}
2119
2189
  }
2120
2190
  );
2121
- k.update(P);
2122
- } catch (P) {
2123
- console.error("Deepspot SDK: tab fetch failed", P);
2191
+ y.update(L);
2192
+ } catch (L) {
2193
+ console.error("Deepspot SDK: tab fetch failed", L);
2124
2194
  }
2125
2195
  }
2126
2196
  });
2127
- return k.render(u), g = new E({
2197
+ return y.render(x), h = new E({
2128
2198
  dashboardId: e.dashboardId,
2129
- token: c,
2199
+ token: l,
2130
2200
  embedType: "dashboard",
2131
2201
  embedLevel: s,
2132
- activePageId: u.activePage,
2133
- activeTabId: u.activeTab,
2202
+ activePageId: x.activePage,
2203
+ activeTabId: x.activeTab,
2134
2204
  activeFilters: e.filters || {},
2135
2205
  apiClient: this.apiClient,
2136
- renderer: k,
2206
+ renderer: y,
2137
2207
  onFilterChange: e.onFilterChange
2138
- }), g;
2139
- } catch (c) {
2140
- throw this.showError(r, (c == null ? void 0 : c.message) || "Failed to load dashboard"), (m = e.onError) == null || m.call(e, (c == null ? void 0 : c.message) || "Failed to load dashboard"), c;
2208
+ }), h;
2209
+ } catch (l) {
2210
+ throw this.showError(r, (l == null ? void 0 : l.message) || "Failed to load dashboard"), (p = e.onError) == null || p.call(e, (l == null ? void 0 : l.message) || "Failed to load dashboard"), l;
2141
2211
  }
2142
2212
  }
2143
2213
  // ── Embed single report (component) ────────────────────────────────────────
@@ -2197,12 +2267,12 @@ class ge {
2197
2267
  `;
2198
2268
  }
2199
2269
  }
2200
- const B = class B extends HTMLElement {
2270
+ const q = class q extends HTMLElement {
2201
2271
  constructor() {
2202
2272
  super(...arguments), this.instance = null, this.connected = !1;
2203
2273
  }
2204
2274
  connectedCallback() {
2205
- this.connected = !0, q(), this.style.display = "block", this.renderRoot = document.createElement("div"), this.renderRoot.className = "ds-embed-root", this.appendChild(this.renderRoot), this.mount();
2275
+ this.connected = !0, B(), this.style.display = "block", this.renderRoot = document.createElement("div"), this.renderRoot.className = "ds-embed-root", this.appendChild(this.renderRoot), this.mount();
2206
2276
  }
2207
2277
  disconnectedCallback() {
2208
2278
  var e;
@@ -2213,67 +2283,67 @@ const B = class B extends HTMLElement {
2213
2283
  t === s || !this.connected || ((i = this.instance) == null || i.destroy(), this.instance = null, this.mount());
2214
2284
  }
2215
2285
  async mount() {
2216
- const e = this.getAttribute("dashboard-id"), t = this.getAttribute("api-key"), s = this.getAttribute("base-url") || "", i = this.getAttribute("user-id") || void 0, r = this.getAttribute("tenant-id") || void 0, a = this.getAttribute("embed-level") || "dashboard", o = this.getAttribute("theme") || "light", l = this.getAttribute("height") || "600px", d = this.getAttribute("page-id") || void 0, h = this.getAttribute("tab-id") || void 0, b = this.getAttribute("hide-filters") === "true", n = this.getAttribute("hide-export") === "true", p = this.getAttribute("hide-global-filters") === "true" || b, f = this.getAttribute("hide-inline-filters") === "true", m = this.getAttribute("hide-text") === "true", c = this.getAttribute("hide-header") === "true", u = this.getAttribute("hide-background") === "true";
2286
+ const e = this.getAttribute("dashboard-id"), t = this.getAttribute("api-key"), s = this.getAttribute("base-url") || "", i = this.getAttribute("user-id") || void 0, r = this.getAttribute("tenant-id") || void 0, a = this.getAttribute("embed-level") || "dashboard", o = this.getAttribute("theme") || "light", c = this.getAttribute("height") || "600px", d = this.getAttribute("page-id") || void 0, b = this.getAttribute("tab-id") || void 0, u = this.getAttribute("hide-filters") === "true", g = this.getAttribute("hide-export") === "true", n = this.getAttribute("hide-global-filters") === "true" || u, f = this.getAttribute("hide-inline-filters") === "true", p = this.getAttribute("hide-text") === "true", l = this.getAttribute("hide-header") === "true", x = this.getAttribute("hide-background") === "true";
2217
2287
  if (!e || !t || !s) {
2218
2288
  this.showError("Missing required attributes: dashboard-id, api-key, base-url");
2219
2289
  return;
2220
2290
  }
2221
- this.renderRoot.style.height = l, this.renderRoot.className = `ds-embed-root ds-theme-${o}`, this.showLoading();
2291
+ this.renderRoot.style.height = c, this.renderRoot.className = `ds-embed-root ds-theme-${o}`, this.showLoading();
2222
2292
  try {
2223
- const g = new K(s, t), k = await g.getEmbedToken({
2293
+ const h = new K(s, t), y = await h.getEmbedToken({
2224
2294
  dashboardId: e,
2225
2295
  embedType: "dashboard",
2226
2296
  embedLevel: a,
2227
2297
  userId: i,
2228
2298
  tenantId: r
2229
- }), T = await g.getDashboardRender(e, k, {
2299
+ }), T = await h.getDashboardRender(e, y, {
2230
2300
  embedLevel: a,
2231
2301
  pageId: d,
2232
- tabId: h,
2302
+ tabId: b,
2233
2303
  filters: {}
2234
2304
  }), C = new D(this.renderRoot, {
2235
2305
  embedLevel: a,
2236
2306
  theme: o,
2237
2307
  // v1 backward compat
2238
- hideFilters: p,
2239
- hideExport: n,
2308
+ hideFilters: n,
2309
+ hideExport: g,
2240
2310
  // v2 visibility
2241
- hideGlobalFilters: p,
2311
+ hideGlobalFilters: n,
2242
2312
  hideInlineFilters: f,
2243
- hideText: m,
2244
- hideHeader: c,
2245
- hideBackground: u,
2313
+ hideText: p,
2314
+ hideHeader: l,
2315
+ hideBackground: x,
2246
2316
  initialFilters: {},
2247
- onFetchFilterOptions: ($) => g.getFilterOptions(e, $, k),
2248
- onFetchTablePage: ($, R, I) => g.getTablePage(e, $, R, I, k),
2317
+ onFetchFilterOptions: ($) => h.getFilterOptions(e, $, y),
2318
+ onFetchTablePage: ($, R, I) => h.getTablePage(e, $, R, I, y),
2249
2319
  onTabSwitch: async ($, R) => {
2250
- var I, P;
2320
+ var I, L;
2251
2321
  try {
2252
- const L = await g.getDashboardRender(e, k, {
2322
+ const F = await h.getDashboardRender(e, y, {
2253
2323
  embedLevel: a,
2254
2324
  pageId: $,
2255
2325
  tabId: R,
2256
- filters: (P = (I = this.instance) == null ? void 0 : I.getActiveFilters()) != null ? P : {}
2326
+ filters: (L = (I = this.instance) == null ? void 0 : I.getActiveFilters()) != null ? L : {}
2257
2327
  });
2258
- C.update(L);
2259
- } catch (L) {
2260
- console.error("Deepspot SDK: tab fetch failed", L);
2328
+ C.update(F);
2329
+ } catch (F) {
2330
+ console.error("Deepspot SDK: tab fetch failed", F);
2261
2331
  }
2262
2332
  }
2263
2333
  });
2264
2334
  C.render(T), this.instance = new E({
2265
2335
  dashboardId: e,
2266
- token: k,
2336
+ token: y,
2267
2337
  embedLevel: a,
2268
2338
  embedType: "dashboard",
2269
2339
  activePageId: T.activePage,
2270
2340
  activeTabId: T.activeTab,
2271
2341
  activeFilters: {},
2272
- apiClient: g,
2342
+ apiClient: h,
2273
2343
  renderer: C
2274
2344
  });
2275
- } catch (g) {
2276
- this.showError((g == null ? void 0 : g.message) || "Failed to load dashboard");
2345
+ } catch (h) {
2346
+ this.showError((h == null ? void 0 : h.message) || "Failed to load dashboard");
2277
2347
  }
2278
2348
  }
2279
2349
  showLoading() {
@@ -2317,7 +2387,7 @@ const B = class B extends HTMLElement {
2317
2387
  (e = this.instance) == null || e.exportPDF();
2318
2388
  }
2319
2389
  };
2320
- B.observedAttributes = [
2390
+ q.observedAttributes = [
2321
2391
  "dashboard-id",
2322
2392
  "api-key",
2323
2393
  "user-id",
@@ -2338,14 +2408,14 @@ B.observedAttributes = [
2338
2408
  "hide-header",
2339
2409
  "hide-background"
2340
2410
  ];
2341
- let j = B;
2342
- customElements.get("deepspot-dashboard") || customElements.define("deepspot-dashboard", j);
2411
+ let z = q;
2412
+ customElements.get("deepspot-dashboard") || customElements.define("deepspot-dashboard", z);
2343
2413
  const G = class G extends HTMLElement {
2344
2414
  constructor() {
2345
2415
  super(...arguments), this.instance = null, this.isConnected_ = !1;
2346
2416
  }
2347
2417
  connectedCallback() {
2348
- this.isConnected_ = !0, q(), this.style.display = "block", this.renderRoot = document.createElement("div"), this.renderRoot.className = "ds-embed-root", this.appendChild(this.renderRoot), this.mount();
2418
+ this.isConnected_ = !0, B(), this.style.display = "block", this.renderRoot = document.createElement("div"), this.renderRoot.className = "ds-embed-root", this.appendChild(this.renderRoot), this.mount();
2349
2419
  }
2350
2420
  disconnectedCallback() {
2351
2421
  var e;
@@ -2356,31 +2426,31 @@ const G = class G extends HTMLElement {
2356
2426
  t !== s && this.isConnected_ && ((i = this.instance) == null || i.destroy(), this.instance = null, this.mount());
2357
2427
  }
2358
2428
  async mount() {
2359
- const e = this.getAttribute("dashboard-id"), t = this.getAttribute("component-id"), s = this.getAttribute("api-key"), i = this.getAttribute("base-url") || "", r = this.getAttribute("user-id") || void 0, a = this.getAttribute("tenant-id") || void 0, o = this.getAttribute("theme") || "light", l = this.getAttribute("height") || "400px";
2429
+ const e = this.getAttribute("dashboard-id"), t = this.getAttribute("component-id"), s = this.getAttribute("api-key"), i = this.getAttribute("base-url") || "", r = this.getAttribute("user-id") || void 0, a = this.getAttribute("tenant-id") || void 0, o = this.getAttribute("theme") || "light", c = this.getAttribute("height") || "400px";
2360
2430
  if (!e || !t || !s || !i) {
2361
2431
  this.showError("Missing required attributes: dashboard-id, component-id, api-key, base-url");
2362
2432
  return;
2363
2433
  }
2364
- this.renderRoot.style.height = l, this.renderRoot.className = `ds-embed-root ds-theme-${o}`, this.showLoading();
2434
+ this.renderRoot.style.height = c, this.renderRoot.className = `ds-embed-root ds-theme-${o}`, this.showLoading();
2365
2435
  try {
2366
- const d = new K(i, s), h = await d.getEmbedToken({
2436
+ const d = new K(i, s), b = await d.getEmbedToken({
2367
2437
  dashboardId: e,
2368
2438
  embedType: "report",
2369
2439
  componentId: t,
2370
2440
  userId: r,
2371
2441
  tenantId: a
2372
- }), b = await d.getReportRender(e, t, h, {
2442
+ }), u = await d.getReportRender(e, t, b, {
2373
2443
  filters: {}
2374
- }), n = new he(this.renderRoot, o);
2375
- n.render(b, () => {
2444
+ }), g = new he(this.renderRoot, o);
2445
+ g.render(u, () => {
2376
2446
  }), this.instance = new E({
2377
2447
  dashboardId: e,
2378
2448
  componentId: t,
2379
- token: h,
2449
+ token: b,
2380
2450
  embedType: "report",
2381
2451
  activeFilters: {},
2382
2452
  apiClient: d,
2383
- renderer: n
2453
+ renderer: g
2384
2454
  });
2385
2455
  } catch (d) {
2386
2456
  this.showError((d == null ? void 0 : d.message) || "Failed to load report");
@@ -2426,10 +2496,10 @@ G.observedAttributes = [
2426
2496
  "theme",
2427
2497
  "height"
2428
2498
  ];
2429
- let z = G;
2430
- customElements.get("deepspot-report") || customElements.define("deepspot-report", z);
2431
- customElements.get("deepspot-dashboard") || customElements.define("deepspot-dashboard", j);
2432
- customElements.get("deepspot-report") || customElements.define("deepspot-report", z);
2499
+ let j = G;
2500
+ customElements.get("deepspot-report") || customElements.define("deepspot-report", j);
2501
+ customElements.get("deepspot-dashboard") || customElements.define("deepspot-dashboard", z);
2502
+ customElements.get("deepspot-report") || customElements.define("deepspot-report", j);
2433
2503
  export {
2434
2504
  ge as DeepspotSDK
2435
2505
  };