myio-js-library 0.1.581 → 0.1.583

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.cjs CHANGED
@@ -719,7 +719,7 @@ __export(src_exports, {
719
719
  injectCustomerCardV1Styles: () => injectCustomerCardV1Styles,
720
720
  injectCustomerCardV2Styles: () => injectCustomerCardV2Styles,
721
721
  injectDeviceCategoryStyles: () => injectDeviceCategoryStyles,
722
- injectDeviceGridV6Styles: () => injectStyles22,
722
+ injectDeviceGridV6Styles: () => injectStyles23,
723
723
  injectDeviceOperationalCardGridStyles: () => injectDeviceOperationalCardGridStyles,
724
724
  injectDeviceOperationalCardStyles: () => injectDeviceOperationalCardStyles,
725
725
  injectExportButtonStyles: () => injectExportButtonStyles,
@@ -989,7 +989,7 @@ module.exports = __toCommonJS(src_exports);
989
989
  // package.json
990
990
  var package_default = {
991
991
  name: "myio-js-library",
992
- version: "0.1.581",
992
+ version: "0.1.583",
993
993
  description: "A clean, standalone JS SDK for MYIO projects",
994
994
  license: "MIT",
995
995
  repository: "github:gh-myio/myio-js-library",
@@ -33190,8 +33190,8 @@ var EnergyDataFetcher = class {
33190
33190
  // src/components/premium-modals/internal/engines/CsvExporter.ts
33191
33191
  var toCsv = (rows, locale = "pt-BR", sep = ";") => {
33192
33192
  const fmt2 = new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
33193
- const esc11 = (v) => (typeof v === "number" ? fmt2.format(v) : String(v)).replace(/"/g, '""');
33194
- return rows.map((r) => r.map((c) => `"${esc11(c)}"`).join(sep)).join("\r\n");
33193
+ const esc12 = (v) => (typeof v === "number" ? fmt2.format(v) : String(v)).replace(/"/g, '""');
33194
+ return rows.map((r) => r.map((c) => `"${esc12(c)}"`).join(sep)).join("\r\n");
33195
33195
  };
33196
33196
 
33197
33197
  // src/components/premium-modals/energy/types.ts
@@ -37599,14 +37599,14 @@ var DeviceReportModal = class {
37599
37599
  // Header: "Relatório - <identifier> - <label>" + nome do device (sutil, com copiar).
37600
37600
  // O customer já aparece no footer premium. Texto escapado — o shell usa innerHTML no título.
37601
37601
  buildHeaderTitleHTML() {
37602
- const esc11 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
37603
- const base = esc11(
37602
+ const esc12 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
37603
+ const base = esc12(
37604
37604
  `Relat\xF3rio - ${this.params.identifier || "SEM IDENTIFICADOR"} - ${this.params.label || "SEM ETIQUETA"}`
37605
37605
  );
37606
37606
  const deviceName = String(this.params.deviceName || "").trim();
37607
37607
  const deviceHTML = deviceName ? `<span class="myio-dr-devname" style="margin-left:10px;font-size:0.72em;font-weight:400;opacity:.75;display:inline-flex;align-items:center;gap:4px;vertical-align:middle;">
37608
- ${esc11(deviceName)}
37609
- <button type="button" class="myio-dr-copy" data-copy="${esc11(deviceName)}" title="Copiar nome do dispositivo"
37608
+ ${esc12(deviceName)}
37609
+ <button type="button" class="myio-dr-copy" data-copy="${esc12(deviceName)}" title="Copiar nome do dispositivo"
37610
37610
  aria-label="Copiar nome do dispositivo"
37611
37611
  style="border:none;background:transparent;color:inherit;cursor:pointer;padding:0 2px;line-height:1;opacity:.9;display:inline-flex;">
37612
37612
  <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
@@ -63392,6 +63392,32 @@ var EDITABLE_ATTRS = [
63392
63392
  { key: "gcdrCustomerId", label: "GCDR Customer ID" },
63393
63393
  { key: "gcdrAssetId", label: "GCDR Asset ID" }
63394
63394
  ];
63395
+ var EDITABLE_OTHER_ATTRS = ["contract", "floor"];
63396
+ var MIN_EPOCH_MS = 1e12;
63397
+ var MAX_EPOCH_MS = 1e13;
63398
+ function attrTimestampMs(key, value) {
63399
+ if (!/(Time|At|Ts|Timestamp)$/.test(key)) return null;
63400
+ if (typeof value === "number" || typeof value === "string" && /^\d{12,13}$/.test(value.trim())) {
63401
+ const n = Number(value);
63402
+ return n >= MIN_EPOCH_MS && n < MAX_EPOCH_MS ? n : null;
63403
+ }
63404
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T/.test(value)) {
63405
+ const n = Date.parse(value);
63406
+ return Number.isFinite(n) ? n : null;
63407
+ }
63408
+ return null;
63409
+ }
63410
+ function relativeTime(ts, now = Date.now()) {
63411
+ const diff = now - ts;
63412
+ const abs = Math.abs(diff);
63413
+ const min = Math.round(abs / 6e4);
63414
+ let txt;
63415
+ if (min < 1) txt = "menos de 1 min";
63416
+ else if (min < 60) txt = `${min} min`;
63417
+ else if (min < 48 * 60) txt = `${Math.round(min / 60)} h`;
63418
+ else txt = `${Math.round(min / 1440)} dias`;
63419
+ return diff >= 0 ? `h\xE1 ${txt}` : `em ${txt}`;
63420
+ }
63395
63421
  var READONLY_ATTRS = [
63396
63422
  { key: "deviceType", label: "Device Type" },
63397
63423
  { key: "slaveId", label: "Slave ID" },
@@ -63665,10 +63691,12 @@ var DeviceProfileTab = class {
63665
63691
  renderRow(field, label, value, kind) {
63666
63692
  const text2 = this.esc(this.displayText(value));
63667
63693
  if (kind === "readonly") {
63694
+ const ts = attrTimestampMs(field, value);
63695
+ const valueHtml = ts !== null ? `<span class="dpt-value" title="${text2}">${this.esc(this.formatDate(ts))} <span class="dpt-rel">(${this.esc(relativeTime(ts))})</span></span>` : `<span class="dpt-value">${text2}</span>`;
63668
63696
  return `
63669
63697
  <div class="dpt-row" data-field="${this.esc(field)}">
63670
63698
  <span class="dpt-label">${this.esc(label)}</span>
63671
- <span class="dpt-value">${text2}</span>
63699
+ ${valueHtml}
63672
63700
  </div>`;
63673
63701
  }
63674
63702
  const syncBtn = kind === "ingestion" ? `<button type="button" class="dpt-icon-btn" data-action="sync-ingestion" title="Buscar ingestionId na Ingestion API">\u{1F504}</button>` : "";
@@ -63699,8 +63727,14 @@ var DeviceProfileTab = class {
63699
63727
  ({ key, label }) => this.renderRow(key, label, this.attrValue(key), "readonly")
63700
63728
  ).join("");
63701
63729
  const highlightedKeys = /* @__PURE__ */ new Set([...EDITABLE_ATTRS.map((a) => a.key), ...READONLY_ATTRS.map((a) => a.key)]);
63702
- const otherAttrs = this.attributes.filter((a) => !highlightedKeys.has(a.key)).sort((a, b) => a.key.localeCompare(b.key));
63703
- const otherRows = otherAttrs.length ? otherAttrs.map((a) => this.renderRow(a.key, a.key, a.value, "readonly")).join("") : `<div class="dpt-empty">Nenhum outro atributo SERVER_SCOPE.</div>`;
63730
+ const otherAttrs = this.attributes.filter((a) => !highlightedKeys.has(a.key));
63731
+ EDITABLE_OTHER_ATTRS.forEach((key) => {
63732
+ if (!otherAttrs.some((a) => a.key === key)) otherAttrs.push({ key, value: void 0 });
63733
+ });
63734
+ otherAttrs.sort((a, b) => a.key.localeCompare(b.key));
63735
+ const otherRows = otherAttrs.length ? otherAttrs.map(
63736
+ (a) => this.renderRow(a.key, a.key, a.value, EDITABLE_OTHER_ATTRS.includes(a.key) ? "attr-text" : "readonly")
63737
+ ).join("") : `<div class="dpt-empty">Nenhum outro atributo SERVER_SCOPE.</div>`;
63704
63738
  return `
63705
63739
  <div class="dpt-tab">
63706
63740
  <div class="dpt-notice">\u{1F512} Aba vis\xEDvel apenas para administradores MyIO \u2014 altera dados direto no ThingsBoard.</div>
@@ -63877,6 +63911,7 @@ var DeviceProfileTab = class {
63877
63911
  .dpt-label { font-size: 12px; color: #6b7280; font-weight: 600; white-space: nowrap; }
63878
63912
  .dpt-value { font-size: 13px; color: #111827; text-align: right; word-break: break-word; }
63879
63913
  .dpt-value-wrap { display: flex; align-items: center; gap: 6px; }
63914
+ .dpt-rel { color: #9ca3af; font-size: 12px; }
63880
63915
  .dpt-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
63881
63916
  .dpt-empty { padding: 16px 0; text-align: center; color: #9ca3af; font-size: 13px; }
63882
63917
  .dpt-icon-btn {
@@ -65725,6 +65760,228 @@ function createTicketsTab(config2) {
65725
65760
  return { destroy: () => tab.destroy() };
65726
65761
  }
65727
65762
 
65763
+ // src/components/premium-modals/settings/myio-ops/DeviceOpsTabs.ts
65764
+ var WO_TYPE_LABELS = {
65765
+ INSTALACAO: "Instala\xE7\xE3o",
65766
+ MANUTENCAO: "Manuten\xE7\xE3o",
65767
+ VISITA_TECNICA: "Visita t\xE9cnica",
65768
+ IMPLANTACAO: "Implanta\xE7\xE3o",
65769
+ RETIRADA: "Retirada",
65770
+ CHAMADO: "Chamado",
65771
+ GRUPO: "Grupo de OS"
65772
+ };
65773
+ var WO_STATUS_LABELS = {
65774
+ PLANEJADA: "Planejada",
65775
+ EM_ANDAMENTO: "Em andamento",
65776
+ INTERROMPIDA: "Interrompida",
65777
+ AGUARDANDO: "Aguardando",
65778
+ REAGENDADA: "Reagendada",
65779
+ FINALIZADA: "Finalizada",
65780
+ CANCELADA: "Cancelada"
65781
+ };
65782
+ var INCIDENT_STATUS_LABELS = {
65783
+ OPEN: "Aberto",
65784
+ ACK: "Reconhecido",
65785
+ ACKNOWLEDGED: "Reconhecido",
65786
+ RESOLVED: "Resolvido",
65787
+ CLOSED: "Fechado"
65788
+ };
65789
+ var SEVERITY_COLORS = {
65790
+ CRITICAL: "#dc2626",
65791
+ HIGH: "#f59e0b",
65792
+ MEDIUM: "#3b82f6",
65793
+ LOW: "#6b7280",
65794
+ INFO: "#6b7280"
65795
+ };
65796
+ var STYLES_ID4 = "myio-dops-styles";
65797
+ function esc5(value) {
65798
+ return String(value ?? "").replace(
65799
+ /[&<>"']/g,
65800
+ (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]
65801
+ );
65802
+ }
65803
+ function fmtDate(value) {
65804
+ if (!value) return "\u2014";
65805
+ const d = new Date(value);
65806
+ return Number.isNaN(d.getTime()) ? esc5(value) : d.toLocaleString("pt-BR", { dateStyle: "short", timeStyle: "short" });
65807
+ }
65808
+ function resolveApi(config2) {
65809
+ const orch = globalThis.window?.MyIOOrchestrator || {};
65810
+ const apiKey = config2.gcdrApiKey ?? orch.gcdrApiKey ?? "";
65811
+ const tenantId = config2.gcdrTenantId ?? orch.gcdrTenantId ?? "";
65812
+ const headers = { Accept: "application/json", "X-API-Key": apiKey };
65813
+ if (tenantId) headers["X-Tenant-ID"] = tenantId;
65814
+ return {
65815
+ gcdrDeviceId: String(config2.gcdrDeviceId || ""),
65816
+ identifier: String(config2.identifier || ""),
65817
+ gcdrRoot: String(config2.gcdrApiBaseUrl ?? orch.gcdrApiBaseUrl ?? "https://gcdr-api.a.myio-bas.com").replace(/\/+$/, "").replace(/\/api\/v1$/, ""),
65818
+ alarmsBase: String(config2.alarmsApiBaseUrl ?? orch.alarmsApiBaseUrl ?? "https://alarms-api.a.myio-bas.com/api/v1").replace(
65819
+ /\/+$/,
65820
+ ""
65821
+ ),
65822
+ headers
65823
+ };
65824
+ }
65825
+ async function fetchDeviceWorkOrders(config2) {
65826
+ const api = resolveApi(config2);
65827
+ if (!api.gcdrDeviceId) return [];
65828
+ const url = `${api.gcdrRoot}/api/v1/wo/work-orders?deviceId=${encodeURIComponent(api.gcdrDeviceId)}&limit=100`;
65829
+ const res = await fetch(url, { headers: api.headers });
65830
+ if (!res.ok) throw Object.assign(new Error(`GCDR work-orders HTTP ${res.status}`), { status: res.status });
65831
+ const body = await res.json();
65832
+ const data = body?.data ?? body;
65833
+ const items = Array.isArray(data) ? data : Array.isArray(data?.items) ? data.items : [];
65834
+ return items;
65835
+ }
65836
+ async function fetchDeviceIncidents(config2) {
65837
+ const api = resolveApi(config2);
65838
+ const deviceKey = String(config2.ingestionId || api.gcdrDeviceId || "");
65839
+ if (!deviceKey) return [];
65840
+ const url = `${api.alarmsBase}/incidents?device=${encodeURIComponent(deviceKey)}&sortBy=firstDetectedAt&sortDir=desc&limit=100`;
65841
+ const res = await fetch(url, { headers: api.headers });
65842
+ if (!res.ok) throw Object.assign(new Error(`Alarms incidents HTTP ${res.status}`), { status: res.status });
65843
+ const body = await res.json();
65844
+ return Array.isArray(body?.data) ? body.data : [];
65845
+ }
65846
+ async function fetchWorkOrderUsers(config2) {
65847
+ const api = resolveApi(config2);
65848
+ const map = /* @__PURE__ */ new Map();
65849
+ try {
65850
+ const res = await fetch(`${api.alarmsBase}/incidents/work-order-users`, { headers: api.headers });
65851
+ if (!res.ok) return map;
65852
+ const body = await res.json();
65853
+ const list = Array.isArray(body) ? body : Array.isArray(body?.data) ? body.data : Array.isArray(body?.items) ? body.items : [];
65854
+ list.forEach((u) => u?.id && map.set(String(u.id), u));
65855
+ } catch {
65856
+ }
65857
+ return map;
65858
+ }
65859
+ function assigneeHTML(id, users) {
65860
+ if (!id) return '<span class="dops-muted">\u2014</span>';
65861
+ const u = users.get(String(id));
65862
+ if (u && (u.name || u.email)) {
65863
+ return `<div class="dops-person" title="${esc5(id)}"><b>${esc5(u.name || u.email)}</b>${u.name && u.email ? `<small>${esc5(u.email)}</small>` : ""}</div>`;
65864
+ }
65865
+ return `<span class="dops-muted dops-mono" title="${esc5(id)}">usu\xE1rio ${esc5(String(id).slice(0, 8))}\u2026</span>`;
65866
+ }
65867
+ function injectStyles9() {
65868
+ if (document.getElementById(STYLES_ID4)) return;
65869
+ const style = document.createElement("style");
65870
+ style.id = STYLES_ID4;
65871
+ style.textContent = `
65872
+ .dops-tab { padding: 4px 2px 20px; font-family: 'Nunito', system-ui, sans-serif; }
65873
+ .dops-notice { background:#f1ecfa; color:#3e1a7d; border-radius:8px; padding:8px 12px; font-size:12px; margin-bottom:14px; }
65874
+ .dops-state { padding:28px 16px; text-align:center; color:#6b7280; font-size:13px; }
65875
+ .dops-error { color:#b91c1c; }
65876
+ .dops-summary { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
65877
+ .dops-kpi { border:1px solid #e5e7eb; border-radius:8px; padding:8px 12px; min-width:110px; background:#fff; }
65878
+ .dops-kpi b { display:block; font-size:18px; color:#111827; }
65879
+ .dops-kpi span { font-size:11px; color:#6b7280; text-transform:uppercase; letter-spacing:.4px; }
65880
+ .dops-table { width:100%; border-collapse:collapse; font-size:12px; background:#fff; border:1px solid #e5e7eb; border-radius:8px; overflow:hidden; }
65881
+ .dops-table th { text-align:left; background:#f9fafb; color:#6b7280; font-weight:700; padding:8px 10px; border-bottom:1px solid #e5e7eb; white-space:nowrap; }
65882
+ .dops-table td { padding:8px 10px; border-bottom:1px solid #f1f5f9; color:#111827; vertical-align:top; }
65883
+ .dops-table tr:last-child td { border-bottom:none; }
65884
+ .dops-chip { display:inline-block; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:700; background:#f3f4f6; color:#374151; white-space:nowrap; }
65885
+ .dops-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
65886
+ .dops-muted { color:#9ca3af; }
65887
+ .dops-person { display:flex; flex-direction:column; gap:1px; min-width:0; }
65888
+ .dops-person b { font-weight:700; }
65889
+ .dops-person small { font-size:11px; color:#6b7280; }
65890
+ .theme-dark .dops-table, .theme-dark .dops-kpi { background:#111827; border-color:#374151; }
65891
+ .theme-dark .dops-table th { background:#1f2937; color:#9ca3af; border-color:#374151; }
65892
+ .theme-dark .dops-table td { color:#e5e7eb; border-color:#1f2937; }
65893
+ .theme-dark .dops-kpi b { color:#e5e7eb; }
65894
+ `;
65895
+ document.head.appendChild(style);
65896
+ }
65897
+ function noDeviceHTML(what) {
65898
+ return `<div class="dops-state">${what} indispon\xEDveis: o dispositivo n\xE3o tem <code>gcdrDeviceId</code>.</div>`;
65899
+ }
65900
+ async function renderDeviceWorkOrdersTab(container, config2) {
65901
+ injectStyles9();
65902
+ if (!config2.gcdrDeviceId) {
65903
+ container.innerHTML = `<div class="dops-tab">${noDeviceHTML("OSs")}</div>`;
65904
+ return 0;
65905
+ }
65906
+ container.innerHTML = `<div class="dops-tab"><div class="dops-state">Carregando ordens de servi\xE7o\u2026</div></div>`;
65907
+ let orders = [];
65908
+ let errorHtml = "";
65909
+ const usersPromise = fetchWorkOrderUsers(config2);
65910
+ try {
65911
+ orders = await fetchDeviceWorkOrders(config2);
65912
+ } catch (e) {
65913
+ errorHtml = e?.status === 401 || e?.status === 403 ? "O GCDR recusou a leitura das OSs com a chave deste customer (falta o escopo wo:read na chave)." : `Erro ao carregar OSs: ${esc5(e?.message || e)}`;
65914
+ }
65915
+ const open = orders.filter((o) => !["FINALIZADA", "CANCELADA"].includes(String(o.status))).length;
65916
+ const users = await usersPromise;
65917
+ const rows = orders.slice().sort((a, b) => String(b.createdAt || "").localeCompare(String(a.createdAt || ""))).map(
65918
+ (o) => `<tr>
65919
+ <td class="dops-mono">${esc5(o.code || o.id)}</td>
65920
+ <td>${esc5(o.title || "\u2014")}</td>
65921
+ <td>${esc5(WO_TYPE_LABELS[String(o.type)] || o.type || "\u2014")}</td>
65922
+ <td><span class="dops-chip">${esc5(WO_STATUS_LABELS[String(o.status)] || o.status || "\u2014")}</span></td>
65923
+ <td>${assigneeHTML(o.assignedTo, users)}</td>
65924
+ <td>${fmtDate(o.scheduledAt)}</td>
65925
+ <td>${fmtDate(o.createdAt)}</td>
65926
+ </tr>`
65927
+ ).join("");
65928
+ container.innerHTML = `
65929
+ <div class="dops-tab">
65930
+ <div class="dops-notice">\u{1F512} Vis\xEDvel s\xF3 para usu\xE1rios MyIO. Ordens de servi\xE7o do GCDR que incluem este dispositivo.</div>
65931
+ <div class="dops-summary">
65932
+ <div class="dops-kpi"><b>${errorHtml ? "\u2014" : orders.length}</b><span>OSs</span></div>
65933
+ <div class="dops-kpi"><b>${errorHtml ? "\u2014" : open}</b><span>OSs em aberto</span></div>
65934
+ </div>
65935
+ ${errorHtml ? `<div class="dops-state dops-error">${errorHtml}</div>` : orders.length ? `<table class="dops-table"><thead><tr><th>C\xF3digo</th><th>T\xEDtulo</th><th>Tipo</th><th>Status</th><th>Respons\xE1vel</th><th>Agendada</th><th>Criada</th></tr></thead><tbody>${rows}</tbody></table>` : `<div class="dops-state">Nenhuma OS para este dispositivo.</div>`}
65936
+ </div>`;
65937
+ return errorHtml ? 0 : open;
65938
+ }
65939
+ async function renderDeviceIncidentsTab(container, config2) {
65940
+ injectStyles9();
65941
+ if (!config2.ingestionId && !config2.gcdrDeviceId) {
65942
+ container.innerHTML = `<div class="dops-tab">${noDeviceHTML("Incidentes")}</div>`;
65943
+ return 0;
65944
+ }
65945
+ container.innerHTML = `<div class="dops-tab"><div class="dops-state">Carregando incidentes\u2026</div></div>`;
65946
+ let incidents = [];
65947
+ try {
65948
+ incidents = await fetchDeviceIncidents(config2);
65949
+ } catch (e) {
65950
+ container.innerHTML = `<div class="dops-tab"><div class="dops-state dops-error">Erro ao carregar incidentes: ${esc5(
65951
+ e?.message || e
65952
+ )}</div></div>`;
65953
+ return 0;
65954
+ }
65955
+ const active = incidents.filter((i) => !["RESOLVED", "CLOSED"].includes(String(i.status))).length;
65956
+ const critical = incidents.filter(
65957
+ (i) => String(i.severity) === "CRITICAL" && !["RESOLVED", "CLOSED"].includes(String(i.status))
65958
+ ).length;
65959
+ const rows = incidents.map((i) => {
65960
+ const sev = String(i.severity || "");
65961
+ return `<tr>
65962
+ <td><span class="dops-chip" style="background:${SEVERITY_COLORS[sev] || "#6b7280"};color:#fff">${esc5(sev || "\u2014")}</span></td>
65963
+ <td>${esc5(i.kind || "\u2014")}</td>
65964
+ <td><span class="dops-chip">${esc5(INCIDENT_STATUS_LABELS[String(i.status)] || i.status || "\u2014")}</span></td>
65965
+ <td>${esc5(i.day || "\u2014")}</td>
65966
+ <td>${esc5(i.centralName || "\u2014")}</td>
65967
+ <td>${fmtDate(i.firstDetectedAt)}</td>
65968
+ <td>${fmtDate(i.lastEvaluatedAt)}</td>
65969
+ <td class="dops-muted">${esc5(i.description || "")}</td>
65970
+ </tr>`;
65971
+ }).join("");
65972
+ container.innerHTML = `
65973
+ <div class="dops-tab">
65974
+ <div class="dops-notice">\u{1F512} Vis\xEDvel s\xF3 para usu\xE1rios MyIO. Incidentes do alarms-backend que envolvem este dispositivo.</div>
65975
+ <div class="dops-summary">
65976
+ <div class="dops-kpi"><b>${incidents.length}</b><span>Incidentes</span></div>
65977
+ <div class="dops-kpi"><b>${active}</b><span>N\xE3o resolvidos</span></div>
65978
+ <div class="dops-kpi"><b>${critical}</b><span>Cr\xEDticos abertos</span></div>
65979
+ </div>
65980
+ ${incidents.length ? `<table class="dops-table"><thead><tr><th>Severidade</th><th>Tipo</th><th>Status</th><th>Dia</th><th>Central</th><th>Detectado</th><th>\xDAltima avalia\xE7\xE3o</th><th>Descri\xE7\xE3o</th></tr></thead><tbody>${rows}</tbody></table>` : `<div class="dops-state">Nenhum incidente para este dispositivo.</div>`}
65981
+ </div>`;
65982
+ return critical;
65983
+ }
65984
+
65728
65985
  // src/components/premium-modals/settings/commercialCatalog.ts
65729
65986
  var DEFAULT_STORE_SEGMENTS = [
65730
65987
  {
@@ -66024,7 +66281,7 @@ async function createInputDateRangePickerInsideDIV(params) {
66024
66281
  placeholder = "Clique para selecionar per\xEDodo",
66025
66282
  pickerOptions = {},
66026
66283
  classNames = {},
66027
- injectStyles: injectStyles26 = true,
66284
+ injectStyles: injectStyles27 = true,
66028
66285
  showHelper = true
66029
66286
  } = params;
66030
66287
  validateId(containerId, "containerId");
@@ -66033,7 +66290,7 @@ async function createInputDateRangePickerInsideDIV(params) {
66033
66290
  if (!container) {
66034
66291
  throw new Error(`[createInputDateRangePickerInsideDIV] Container '#${containerId}' not found`);
66035
66292
  }
66036
- if (injectStyles26) {
66293
+ if (injectStyles27) {
66037
66294
  injectPremiumStyles();
66038
66295
  }
66039
66296
  let inputEl = document.getElementById(inputId);
@@ -66213,6 +66470,44 @@ var SettingsModalView = class _SettingsModalView {
66213
66470
  const email = userEmail.toLowerCase().trim();
66214
66471
  return email.endsWith(ALLOWED_EMAIL_DOMAIN.toLowerCase());
66215
66472
  }
66473
+ /** Usuário @myio.com.br (só pelo e-mail — o flag superadmin não basta). Gate das abas OSs/Incidentes. */
66474
+ isMyioUser() {
66475
+ const email = String(this.config.userEmail || "").toLowerCase().trim();
66476
+ return !!email && email.endsWith(ALLOWED_EMAIL_DOMAIN.toLowerCase());
66477
+ }
66478
+ /** ingestionId do dispositivo pelo estado do dashboard (host antigo que não o envia). */
66479
+ lookupIngestionId() {
66480
+ const id = String(this.config.deviceId || "");
66481
+ const state6 = window.STATE || {};
66482
+ for (const d of ["energy", "water", "temperature"]) {
66483
+ const hit = (state6[d]?._raw || []).find((it) => String(it?.tbId || it?.id) === id);
66484
+ if (hit?.ingestionId) return String(hit.ingestionId);
66485
+ }
66486
+ return null;
66487
+ }
66488
+ /** Abas OSs + Incidentes do dispositivo (GCDR work-orders / alarms-backend incidents). */
66489
+ initDeviceOpsTabs() {
66490
+ const cfg = {
66491
+ gcdrDeviceId: this.config.gcdrDeviceId,
66492
+ ingestionId: this.config.ingestionId || this.lookupIngestionId(),
66493
+ identifier: this.config.identifier,
66494
+ gcdrApiBaseUrl: this.config.gcdrApiBaseUrl
66495
+ };
66496
+ const setBadge = (id, n) => {
66497
+ const el2 = this.modal.querySelector(`#${id}`);
66498
+ if (!el2) return;
66499
+ el2.textContent = n > 99 ? "99+" : String(n);
66500
+ el2.style.display = n > 0 ? "" : "none";
66501
+ };
66502
+ const osEl = this.modal.querySelector("#device-os-tab-content");
66503
+ if (osEl) {
66504
+ renderDeviceWorkOrdersTab(osEl, cfg).then((n) => setBadge("tab-badge-device-os", n)).catch((e) => console.warn("[SettingsModalView] OSs tab:", e));
66505
+ }
66506
+ const incEl = this.modal.querySelector("#device-incidents-tab-content");
66507
+ if (incEl) {
66508
+ renderDeviceIncidentsTab(incEl, cfg).then((n) => setBadge("tab-badge-device-incidents", n)).catch((e) => console.warn("[SettingsModalView] Incidentes tab:", e));
66509
+ }
66510
+ }
66216
66511
  /**
66217
66512
  * Check if the user may edit the "Identificador" field.
66218
66513
  * True when isSuperAdmin() OR the caller already resolved the user as a
@@ -66282,6 +66577,9 @@ var SettingsModalView = class _SettingsModalView {
66282
66577
  this.bindIncidentsTabEvents();
66283
66578
  this.initIncidentsDateRange();
66284
66579
  }
66580
+ if (this.isMyioUser()) {
66581
+ this.initDeviceOpsTabs();
66582
+ }
66285
66583
  this._updateTabBadges(initialData);
66286
66584
  }
66287
66585
  // RFC-0104: Initialize the Annotations Tab
@@ -66603,6 +66901,10 @@ var SettingsModalView = class _SettingsModalView {
66603
66901
  if (retrolavagemContent) retrolavagemContent.style.display = tab === "retrolavagem" ? "block" : "none";
66604
66902
  if (exclusionGroupsContent) exclusionGroupsContent.style.display = tab === "exclusion-groups" ? "block" : "none";
66605
66903
  if (incidentsContent) incidentsContent.style.display = tab === "incidents" ? "block" : "none";
66904
+ const deviceOsContent = this.modal.querySelector("#device-os-tab-content");
66905
+ const deviceIncidentsContent = this.modal.querySelector("#device-incidents-tab-content");
66906
+ if (deviceOsContent) deviceOsContent.style.display = tab === "device-os" ? "block" : "none";
66907
+ if (deviceIncidentsContent) deviceIncidentsContent.style.display = tab === "device-incidents" ? "block" : "none";
66606
66908
  const saveBtn = this.modal.querySelector(".btn-save");
66607
66909
  if (saveBtn) saveBtn.style.display = tab === "general" ? "inline-flex" : "none";
66608
66910
  if (tab === "annotations" && this.annotationsTab) {
@@ -66742,12 +67044,63 @@ var SettingsModalView = class _SettingsModalView {
66742
67044
  data[key] = num;
66743
67045
  }
66744
67046
  } else if (value.trim()) {
66745
- data[key] = value.trim();
67047
+ data[key] = key === "label" ? this.labelCase(value.trim()) : value.trim();
66746
67048
  }
66747
67049
  }
66748
67050
  }
66749
67051
  return data;
66750
67052
  }
67053
+ /** Copia texto para a área de transferência (Clipboard API; fallback execCommand fora de HTTPS). */
67054
+ static async copyText(text2) {
67055
+ if (!text2) return false;
67056
+ try {
67057
+ if (navigator.clipboard?.writeText) {
67058
+ await navigator.clipboard.writeText(text2);
67059
+ return true;
67060
+ }
67061
+ } catch {
67062
+ }
67063
+ try {
67064
+ const ta = document.createElement("textarea");
67065
+ ta.value = text2;
67066
+ ta.setAttribute("readonly", "");
67067
+ ta.style.cssText = "position:fixed;left:-9999px;top:0;opacity:0";
67068
+ document.body.appendChild(ta);
67069
+ ta.select();
67070
+ const ok = document.execCommand("copy");
67071
+ ta.remove();
67072
+ return ok;
67073
+ } catch {
67074
+ return false;
67075
+ }
67076
+ }
67077
+ /** Etiqueta (label) do device sempre em maiúsculas — exibição, digitação, colagem e gravação. */
67078
+ static toLabelCase(value) {
67079
+ return String(value ?? "").toLocaleUpperCase("pt-BR");
67080
+ }
67081
+ /** Etiqueta do modal: maiúsculas para dispositivos; centrais (isGateway) mantêm o nome como está. */
67082
+ labelCase(value) {
67083
+ return this.config.isGateway ? String(value ?? "") : _SettingsModalView.toLabelCase(value);
67084
+ }
67085
+ /**
67086
+ * Input "Etiqueta": converte para maiúsculas enquanto digita/cola (preservando o cursor) e
67087
+ * espelha o valor no título ao lado do ícone.
67088
+ */
67089
+ bindLabelUppercase() {
67090
+ const input = this.form?.querySelector("#label");
67091
+ if (!input || input.dataset.upperBound) return;
67092
+ input.dataset.upperBound = "true";
67093
+ const nameText = this.modal.querySelector(".identity-name-text");
67094
+ input.addEventListener("input", () => {
67095
+ const upper = this.labelCase(input.value);
67096
+ if (upper !== input.value) {
67097
+ const { selectionStart, selectionEnd } = input;
67098
+ input.value = upper;
67099
+ if (selectionStart !== null && selectionEnd !== null) input.setSelectionRange(selectionStart, selectionEnd);
67100
+ }
67101
+ if (nameText) nameText.textContent = input.value.trim() || "\u2014";
67102
+ });
67103
+ }
66751
67104
  createModal() {
66752
67105
  this.container = document.createElement("div");
66753
67106
  this.container.className = "myio-device-settings-overlay";
@@ -66816,7 +67169,7 @@ var SettingsModalView = class _SettingsModalView {
66816
67169
  <line x1="3" y1="9" x2="21" y2="9"></line>
66817
67170
  <line x1="9" y1="21" x2="9" y2="9"></line>
66818
67171
  </svg>
66819
- Perfil de Dispositivo
67172
+ Perfil Disp.
66820
67173
  </button>` : ""}
66821
67174
  ${this.isWellEquipmentDevice() && this.isSuperAdmin() ? `<button type="button" class="modal-tab" data-tab="well-equipment">
66822
67175
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -66833,14 +67186,31 @@ var SettingsModalView = class _SettingsModalView {
66833
67186
  </svg>
66834
67187
  Equipamentos da Retrolavagem
66835
67188
  </button>` : ""}
66836
- <!-- RFC-0232: Incidentes (interpola\xE7\xE3o) \u2014 central + admin MyIO only -->
66837
- ${this.config.isGateway && this.isSuperAdmin() ? `<button type="button" class="modal-tab" data-tab="incidents">
67189
+ <!-- OSs + Incidentes do dispositivo \u2014 s\xF3 @myio.com.br -->
67190
+ ${this.isMyioUser() ? `<button type="button" class="modal-tab" data-tab="device-os">
67191
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
67192
+ <path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.4-.6-.6-2.4z"></path>
67193
+ </svg>
67194
+ OSs
67195
+ <span class="modal-tab-badge modal-tab-badge--os" id="tab-badge-device-os" style="display:none"></span>
67196
+ </button>
67197
+ <button type="button" class="modal-tab" data-tab="device-incidents">
66838
67198
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
66839
67199
  <path d="M12 9v4"></path>
66840
67200
  <path d="M12 17h.01"></path>
66841
67201
  <path d="M10.29 3.86l-8.18 14.14A2 2 0 0 0 3.93 21h16.14a2 2 0 0 0 1.82-2.99L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
66842
67202
  </svg>
66843
67203
  Incidentes
67204
+ <span class="modal-tab-badge modal-tab-badge--incidents" id="tab-badge-device-incidents" style="display:none"></span>
67205
+ </button>` : ""}
67206
+ <!-- RFC-0232: Interpola\xE7\xF5es (antes "Incidentes") \u2014 central + admin MyIO only -->
67207
+ ${this.config.isGateway && this.isSuperAdmin() ? `<button type="button" class="modal-tab" data-tab="incidents">
67208
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
67209
+ <path d="M12 9v4"></path>
67210
+ <path d="M12 17h.01"></path>
67211
+ <path d="M10.29 3.86l-8.18 14.14A2 2 0 0 0 3.93 21h16.14a2 2 0 0 0 1.82-2.99L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
67212
+ </svg>
67213
+ Interpola\xE7\xF5es
66844
67214
  ${(this.config.interpolatedSlots?.length ?? 0) > 0 ? `<span class="modal-tab-badge modal-tab-badge--incidents">${this.config.interpolatedSlots.length}</span>` : ""}
66845
67215
  </button>` : ""}
66846
67216
  </div>
@@ -66897,6 +67267,8 @@ var SettingsModalView = class _SettingsModalView {
66897
67267
  Rendered synchronously (data comes pre-fetched via config.interpolatedSlots,
66898
67268
  same as getGatewayInfoHTML() \u2014 no async loading state needed here). -->
66899
67269
  ${this.config.isGateway && this.isSuperAdmin() ? `<div id="incidents-tab-content" class="tab-content" style="display: none;">${this.getInterpolationIncidentsHTML()}</div>` : ""}
67270
+ ${this.isMyioUser() ? `<div id="device-os-tab-content" class="tab-content" style="display: none;"></div>
67271
+ <div id="device-incidents-tab-content" class="tab-content" style="display: none;"></div>` : ""}
66900
67272
  </div>
66901
67273
  <div class="modal-footer">
66902
67274
  <button type="button" class="btn-cancel">Fechar</button>
@@ -66938,8 +67310,13 @@ var SettingsModalView = class _SettingsModalView {
66938
67310
  <!-- Col 1, rows 1-6: single wrapper \u2192 borda cont\xEDnua -->
66939
67311
  <div class="identity-col1">
66940
67312
  <div class="identity-name-block">
66941
- <div class="identity-name-text">${this.config.deviceLabel || "\u2014"}</div>
66942
- <div class="device-name-subtitle">${this.config.deviceName || ""}</div>
67313
+ <div class="identity-name-text">${this.labelCase(this.config.deviceLabel) || "\u2014"}</div>
67314
+ ${this.config.deviceName ? `<div class="device-name-row">
67315
+ <div class="device-name-subtitle">${this.config.deviceName}</div>
67316
+ <button type="button" class="device-name-copy" id="btnCopyDeviceName" title="Copiar nome do dispositivo" aria-label="Copiar nome do dispositivo">
67317
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
67318
+ </button>
67319
+ </div>` : ""}
66943
67320
  </div>
66944
67321
  <div class="identity-icon-cell">
66945
67322
  ${this.getDeviceImage(deviceType)}
@@ -67042,8 +67419,8 @@ var SettingsModalView = class _SettingsModalView {
67042
67419
  const segmentEl = this.modal.querySelector("#segment");
67043
67420
  const activityEl = this.modal.querySelector("#activity");
67044
67421
  if (!segmentEl || !activityEl) return;
67045
- const esc11 = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
67046
- const options = (values, selected, placeholder) => `<option value="">${placeholder}</option>` + values.map((v) => `<option value="${esc11(v)}"${v === selected ? " selected" : ""}>${esc11(v)}</option>`).join("");
67422
+ const esc12 = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
67423
+ const options = (values, selected, placeholder) => `<option value="">${placeholder}</option>` + values.map((v) => `<option value="${esc12(v)}"${v === selected ? " selected" : ""}>${esc12(v)}</option>`).join("");
67047
67424
  const catalog = await loadStoreSegmentCatalog(this.config.segmentCatalog);
67048
67425
  const savedSegment = String(saved.segment || "");
67049
67426
  const savedActivity = String(saved.activity || "");
@@ -68232,6 +68609,7 @@ var SettingsModalView = class _SettingsModalView {
68232
68609
  .modal-tab-badge--chamados { background: #0891b2; }
68233
68610
  .modal-tab-badge--exclusion { background: #d97706; }
68234
68611
  .modal-tab-badge--incidents { background: #7C3AED; }
68612
+ .modal-tab-badge--os { background: #0891b2; }
68235
68613
 
68236
68614
  .tab-content {
68237
68615
  min-height: 400px;
@@ -68845,6 +69223,40 @@ var SettingsModalView = class _SettingsModalView {
68845
69223
  display: none;
68846
69224
  }
68847
69225
 
69226
+ /* device.name + bot\xE3o copiar */
69227
+ .device-name-row {
69228
+ display: flex;
69229
+ align-items: center;
69230
+ gap: 4px;
69231
+ min-width: 0;
69232
+ margin-top: 2px;
69233
+ }
69234
+ .device-name-row .device-name-subtitle {
69235
+ margin-top: 0;
69236
+ min-width: 0;
69237
+ }
69238
+ .device-name-copy {
69239
+ flex: none;
69240
+ display: inline-flex;
69241
+ align-items: center;
69242
+ justify-content: center;
69243
+ width: 20px;
69244
+ height: 20px;
69245
+ padding: 0;
69246
+ border: none;
69247
+ border-radius: 4px;
69248
+ background: transparent;
69249
+ color: #9ca3af;
69250
+ cursor: pointer;
69251
+ }
69252
+ .device-name-copy:hover {
69253
+ background: #f3f4f6;
69254
+ color: #3e1a7d;
69255
+ }
69256
+ .device-name-copy.is-copied {
69257
+ color: #15803d;
69258
+ }
69259
+
68848
69260
  .section-title {
68849
69261
  margin: 0 0 20px 0;
68850
69262
  font-size: 16px;
@@ -69944,7 +70356,7 @@ var SettingsModalView = class _SettingsModalView {
69944
70356
  for (const [key, value] of Object.entries(data)) {
69945
70357
  const input = this.form.querySelector(`[name="${key}"]`);
69946
70358
  if (input && value !== void 0 && value !== null) {
69947
- input.value = String(value);
70359
+ input.value = key === "label" ? this.labelCase(value) : String(value);
69948
70360
  }
69949
70361
  }
69950
70362
  }
@@ -70040,6 +70452,20 @@ var SettingsModalView = class _SettingsModalView {
70040
70452
  this.switchTab("alarms");
70041
70453
  }
70042
70454
  });
70455
+ this.bindLabelUppercase();
70456
+ const btnCopyName = this.modal.querySelector("#btnCopyDeviceName");
70457
+ btnCopyName?.addEventListener("click", async (e) => {
70458
+ e.preventDefault();
70459
+ e.stopPropagation();
70460
+ const ok = await _SettingsModalView.copyText(String(this.config.deviceName || ""));
70461
+ if (!ok) return;
70462
+ btnCopyName.classList.add("is-copied");
70463
+ btnCopyName.title = "Copiado!";
70464
+ setTimeout(() => {
70465
+ btnCopyName.classList.remove("is-copied");
70466
+ btnCopyName.title = "Copiar nome do dispositivo";
70467
+ }, 1500);
70468
+ });
70043
70469
  this.form.addEventListener("submit", (event) => {
70044
70470
  event.preventDefault();
70045
70471
  this.hideError();
@@ -70508,7 +70934,7 @@ function connectivityFieldsetHtml(data, l, language, errors) {
70508
70934
  `;
70509
70935
  }
70510
70936
  var STYLE_ID5 = "myio-central-settings-modal-styles";
70511
- function injectStyles9() {
70937
+ function injectStyles10() {
70512
70938
  if (typeof document === "undefined" || document.getElementById(STYLE_ID5)) return;
70513
70939
  const tag = document.createElement("style");
70514
70940
  tag.id = STYLE_ID5;
@@ -70586,7 +71012,7 @@ var CentralSettingsModal = class extends SettingsModalView {
70586
71012
  this.csLanguage = language;
70587
71013
  this.csLabels = l;
70588
71014
  this.csCurrentData = initialData;
70589
- injectStyles9();
71015
+ injectStyles10();
70590
71016
  config2.onSave = (formData) => this.handleCentralSave(formData);
70591
71017
  config2.onClose = () => {
70592
71018
  this.close();
@@ -73532,7 +73958,7 @@ var WelcomeModalView = class _WelcomeModalView {
73532
73958
  if (this.metaTipEl) this.metaTipEl.style.display = "none";
73533
73959
  }
73534
73960
  buildMetaTipHtml(type, card) {
73535
- const esc11 = _WelcomeModalView.escapeMetaHtml;
73961
+ const esc12 = _WelcomeModalView.escapeMetaHtml;
73536
73962
  const chip = _WelcomeModalView.metaChip;
73537
73963
  const meta = card.metaCounts || {};
73538
73964
  const details = card.metaDetails || {};
@@ -73542,7 +73968,7 @@ var WelcomeModalView = class _WelcomeModalView {
73542
73968
  ).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
73543
73969
  const frame = (icon2, label, body) => `<div class="myio-welcome-meta-tip__header">
73544
73970
  <span class="myio-welcome-meta-tip__icon">${icon2}</span>
73545
- <span class="myio-welcome-meta-tip__title">${label} (${esc11(card.title)})</span>
73971
+ <span class="myio-welcome-meta-tip__title">${label} (${esc12(card.title)})</span>
73546
73972
  <span class="myio-welcome-meta-tip__timestamp">${stamp}</span>
73547
73973
  <button type="button" class="myio-welcome-meta-tip__close" title="Fechar">\u2715</button>
73548
73974
  </div>
@@ -73570,8 +73996,8 @@ var WelcomeModalView = class _WelcomeModalView {
73570
73996
  const chips = Object.entries(byState).map(([s, n]) => chip(`${s}: ${n}`)).join("");
73571
73997
  const rows = alarms.slice(0, 10).map(
73572
73998
  (a) => row(
73573
- esc11(a.deviceName ? `${a.deviceName} \u2014 ${a.title || "Alarme"}` : a.title || "Alarme"),
73574
- [a.severity, a.state].filter(Boolean).map(esc11).join(" \xB7 ")
73999
+ esc12(a.deviceName ? `${a.deviceName} \u2014 ${a.title || "Alarme"}` : a.title || "Alarme"),
74000
+ [a.severity, a.state].filter(Boolean).map(esc12).join(" \xB7 ")
73575
74001
  )
73576
74002
  ).join("");
73577
74003
  return frame(
@@ -73595,7 +74021,7 @@ var WelcomeModalView = class _WelcomeModalView {
73595
74021
  const rows = annotations.slice(0, 10).map((a) => {
73596
74022
  const when = a.createdAt ? new Date(a.createdAt).toLocaleDateString("pt-BR") : "";
73597
74023
  const text2 = a.text.length > 90 ? `${a.text.slice(0, 90)}\u2026` : a.text;
73598
- return row(esc11(a.deviceLabel || "Dispositivo"), `${esc11(text2)}${when ? ` \xB7 ${esc11(when)}` : ""}`);
74024
+ return row(esc12(a.deviceLabel || "Dispositivo"), `${esc12(text2)}${when ? ` \xB7 ${esc12(when)}` : ""}`);
73599
74025
  }).join("");
73600
74026
  return frame(
73601
74027
  "\u{1F4CB}",
@@ -73606,7 +74032,7 @@ var WelcomeModalView = class _WelcomeModalView {
73606
74032
  if (type === "users") {
73607
74033
  if (meta.users === null) return frame("\u{1F465}", "Usu\xE1rios", loadingBody);
73608
74034
  const users = details.users || [];
73609
- const rows = users.slice(0, 10).map((u) => row(esc11(u.name), esc11(u.email || ""))).join("");
74035
+ const rows = users.slice(0, 10).map((u) => row(esc12(u.name), esc12(u.email || ""))).join("");
73610
74036
  return frame(
73611
74037
  "\u{1F465}",
73612
74038
  "Usu\xE1rios",
@@ -76505,7 +76931,7 @@ var STYLE_ID6 = "myio-footer-component-styles";
76505
76931
  function areStylesInjected() {
76506
76932
  return !!document.getElementById(STYLE_ID6);
76507
76933
  }
76508
- function injectStyles10() {
76934
+ function injectStyles11() {
76509
76935
  if (areStylesInjected()) return;
76510
76936
  const style = document.createElement("style");
76511
76937
  style.id = STYLE_ID6;
@@ -77250,7 +77676,7 @@ var FooterView = class {
77250
77676
  this.chipRenderer = new ChipRenderer();
77251
77677
  this.footerEl = document.createElement("section");
77252
77678
  this.footerEl.className = this.getClassName();
77253
- injectStyles10();
77679
+ injectStyles11();
77254
77680
  this.applyThemeColors();
77255
77681
  }
77256
77682
  container;
@@ -79586,7 +80012,7 @@ var MODAL_CSS = `
79586
80012
  to { transform: rotate(360deg); }
79587
80013
  }
79588
80014
  `;
79589
- function injectStyles11() {
80015
+ function injectStyles12() {
79590
80016
  if (document.getElementById(CSS_ID4)) return;
79591
80017
  const style = document.createElement("style");
79592
80018
  style.id = CSS_ID4;
@@ -79603,7 +80029,7 @@ var IntegrationsModalView = class {
79603
80029
  closeHandlers = [];
79604
80030
  tabChangeHandlers = [];
79605
80031
  constructor(options) {
79606
- injectStyles11();
80032
+ injectStyles12();
79607
80033
  this.options = options;
79608
80034
  this.tabs = options.tabs || DEFAULT_INTEGRATION_TABS;
79609
80035
  this.activeTabId = options.defaultTab || this.tabs[0]?.id || "chiller";
@@ -80437,6 +80863,7 @@ var SettingsController = class {
80437
80863
  // RFC-0180: Raw device name + GCDR identifiers for Alarms tab
80438
80864
  deviceName: params.deviceName,
80439
80865
  gcdrDeviceId: params.gcdrDeviceId,
80866
+ ingestionId: params.ingestionId ?? null,
80440
80867
  gcdrCustomerId: params.gcdrCustomerId,
80441
80868
  gcdrTenantId: params.gcdrTenantId,
80442
80869
  gcdrApiBaseUrl: params.gcdrApiBaseUrl,
@@ -83978,7 +84405,7 @@ var PRESETS = [
83978
84405
  { id: "custom", label: "Personalizado" }
83979
84406
  ];
83980
84407
  var STEPS = ["Dispositivos", "Per\xEDodo", "Telemetrias", "Resumo"];
83981
- var esc5 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
84408
+ var esc6 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
83982
84409
  var norm = (s) => String(s ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
83983
84410
  var fmtN = (n) => n.toLocaleString("pt-BR");
83984
84411
  var pad = (n) => String(n).padStart(2, "0");
@@ -84366,8 +84793,8 @@ var DemandPanelV2 = class {
84366
84793
  highlight(text2) {
84367
84794
  const q = norm(this.s.search).trim();
84368
84795
  const i = q ? norm(text2).indexOf(q) : -1;
84369
- if (i < 0) return esc5(text2);
84370
- return esc5(text2.slice(0, i)) + `<mark class="dp2-mark">${esc5(text2.slice(i, i + q.length))}</mark>` + esc5(text2.slice(i + q.length));
84796
+ if (i < 0) return esc6(text2);
84797
+ return esc6(text2.slice(0, i)) + `<mark class="dp2-mark">${esc6(text2.slice(i, i + q.length))}</mark>` + esc6(text2.slice(i + q.length));
84371
84798
  }
84372
84799
  deviceRow(d, mode) {
84373
84800
  const picked = this.s.selected.includes(d.tbDeviceId);
@@ -84375,13 +84802,13 @@ var DemandPanelV2 = class {
84375
84802
  const cat = this.categoryOf.get(d.tbDeviceId);
84376
84803
  const chip = this.chips.find((c) => c.key === cat);
84377
84804
  const dup = (this.labelCount.get(d.label) || 0) > 1;
84378
- const action = mode === "result" ? picked ? '<span class="dp2-added">\u2713 Adicionado</span>' : `<button class="dp2-btn sm" type="button" data-action="add" data-id="${esc5(d.tbDeviceId)}" ${el2.ok ? "" : "disabled"} aria-label="Adicionar ${esc5(d.label)}">+ Adicionar</button>` : `<button class="dp2-btn sm" type="button" data-action="remove" data-id="${esc5(d.tbDeviceId)}" aria-label="Remover ${esc5(d.label)}">\u2715 Remover</button>`;
84805
+ const action = mode === "result" ? picked ? '<span class="dp2-added">\u2713 Adicionado</span>' : `<button class="dp2-btn sm" type="button" data-action="add" data-id="${esc6(d.tbDeviceId)}" ${el2.ok ? "" : "disabled"} aria-label="Adicionar ${esc6(d.label)}">+ Adicionar</button>` : `<button class="dp2-btn sm" type="button" data-action="remove" data-id="${esc6(d.tbDeviceId)}" aria-label="Remover ${esc6(d.label)}">\u2715 Remover</button>`;
84379
84806
  return `<div class="dp2-item ${el2.ok ? "" : "blocked"}">
84380
- <img class="dp2-ico" src="${esc5(deviceIconUrl(d.deviceProfile))}" alt="" loading="lazy">
84807
+ <img class="dp2-ico" src="${esc6(deviceIconUrl(d.deviceProfile))}" alt="" loading="lazy">
84381
84808
  <div style="min-width:0">
84382
- <div class="dp2-name">${mode === "result" ? this.highlight(d.label) : esc5(d.label)}${dup && d.identifier ? ` <small class="dp2-info">\xB7 ${esc5(d.identifier)}</small>` : ""}</div>
84383
- <div class="dp2-sub">${chip ? `<span class="dp2-tag">${esc5(chip.label)}</span>` : ""}${el2.text ? `<span class="dp2-tag ${el2.cls}" title="${esc5(el2.title)}">${el2.text}</span>` : ""}
84384
- ${mode === "result" ? this.highlight(d.name) : esc5(d.name)}${d.identifier ? " \xB7 " + esc5(d.identifier) : ""}</div>
84809
+ <div class="dp2-name">${mode === "result" ? this.highlight(d.label) : esc6(d.label)}${dup && d.identifier ? ` <small class="dp2-info">\xB7 ${esc6(d.identifier)}</small>` : ""}</div>
84810
+ <div class="dp2-sub">${chip ? `<span class="dp2-tag">${esc6(chip.label)}</span>` : ""}${el2.text ? `<span class="dp2-tag ${el2.cls}" title="${esc6(el2.title)}">${el2.text}</span>` : ""}
84811
+ ${mode === "result" ? this.highlight(d.name) : esc6(d.name)}${d.identifier ? " \xB7 " + esc6(d.identifier) : ""}</div>
84385
84812
  </div>
84386
84813
  <div>${action}</div>
84387
84814
  </div>`;
@@ -84399,8 +84826,8 @@ var DemandPanelV2 = class {
84399
84826
  this.el.body.innerHTML = `<div class="dp2-s1">
84400
84827
  <section class="dp2-col" aria-label="Buscar medidores">
84401
84828
  <div class="dp2-col-head">
84402
- <input class="dp2-search" data-role="search" type="search" placeholder="\u{1F50E} Buscar por nome, identificador ou tipo\u2026" value="${esc5(this.s.search)}" aria-label="Buscar medidores">
84403
- <div class="dp2-chips" role="group" aria-label="Filtrar por tipo">${chips.map((c) => `<button class="dp2-chip" type="button" data-action="category" data-key="${esc5(c.key)}" aria-pressed="${this.s.category === c.key}">${c.icon ? esc5(c.icon) + " " : ""}${esc5(c.label)} \xB7 ${c.count}</button>`).join("")}</div>
84829
+ <input class="dp2-search" data-role="search" type="search" placeholder="\u{1F50E} Buscar por nome, identificador ou tipo\u2026" value="${esc6(this.s.search)}" aria-label="Buscar medidores">
84830
+ <div class="dp2-chips" role="group" aria-label="Filtrar por tipo">${chips.map((c) => `<button class="dp2-chip" type="button" data-action="category" data-key="${esc6(c.key)}" aria-pressed="${this.s.category === c.key}">${c.icon ? esc6(c.icon) + " " : ""}${esc6(c.label)} \xB7 ${c.count}</button>`).join("")}</div>
84404
84831
  <h3><span>${fmtN(results.length)} resultado(s)</span>
84405
84832
  <button class="dp2-btn link" type="button" data-action="add-all" ${addable ? "" : "disabled"}>+ Adicionar todos (${addable})</button></h3>
84406
84833
  </div>
@@ -84439,7 +84866,7 @@ var DemandPanelV2 = class {
84439
84866
  <div class="dp2-card"><h3 tabindex="-1" data-role="step-title">Per\xEDodo</h3>
84440
84867
  <div class="dp2-chips" style="margin-bottom:12px">${PRESETS.map((p) => {
84441
84868
  const off = p.id !== "custom" && presetTooLong(p.id);
84442
- return `<button class="dp2-chip" type="button" data-action="preset" data-preset="${p.id}" aria-pressed="${preset === p.id}" ${off ? `disabled title="at\xE9 ${maxDays} dia(s) com intervalos de ${esc5(r.label)}"` : ""}>${p.label}</button>`;
84869
+ return `<button class="dp2-chip" type="button" data-action="preset" data-preset="${p.id}" aria-pressed="${preset === p.id}" ${off ? `disabled title="at\xE9 ${maxDays} dia(s) com intervalos de ${esc6(r.label)}"` : ""}>${p.label}</button>`;
84443
84870
  }).join("")}</div>
84444
84871
  <div class="dp2-row">
84445
84872
  <label class="dp2-field">In\xEDcio<input type="datetime-local" data-role="start" min="${MIN_PERIOD_START}T00:00" value="${Number.isFinite(start) ? toLocalDateTimeInput(start) : ""}"></label>
@@ -84452,24 +84879,24 @@ var DemandPanelV2 = class {
84452
84879
  const d = limits?.maxDaysByResolution[x.id];
84453
84880
  return `<button class="dp2-chip" type="button" data-action="resolution" data-res="${x.id}" aria-pressed="${this.s.resolution === x.id}">${x.label}${d != null ? ` <small>(at\xE9 ${d} d)</small>` : ""}</button>`;
84454
84881
  }).join("")}</div>
84455
- <p class="dp2-info" style="margin:10px 0 0">Cada linha do relat\xF3rio \xE9 um intervalo com <b>${esc5(BUCKET_STATS_LABEL)}</b> de cada telemetria. Os intervalos contam a partir do in\xEDcio do per\xEDodo${this.s.resolution === "1d" ? " (com 1 dia, cada linha \xE9 um dia do calend\xE1rio)" : ""}.
84456
- ${this.s.telemetries.has("consumption") ? `Com <b>Pot\xEAncia Total</b>, o arquivo traz tamb\xE9m a <b>${esc5(this.demandLabel())}</b>, em janelas de 15 min alinhadas ao rel\xF3gio.` : ""}</p>
84882
+ <p class="dp2-info" style="margin:10px 0 0">Cada linha do relat\xF3rio \xE9 um intervalo com <b>${esc6(BUCKET_STATS_LABEL)}</b> de cada telemetria. Os intervalos contam a partir do in\xEDcio do per\xEDodo${this.s.resolution === "1d" ? " (com 1 dia, cada linha \xE9 um dia do calend\xE1rio)" : ""}.
84883
+ ${this.s.telemetries.has("consumption") ? `Com <b>Pot\xEAncia Total</b>, o arquivo traz tamb\xE9m a <b>${esc6(this.demandLabel())}</b>, em janelas de 15 min alinhadas ao rel\xF3gio.` : ""}</p>
84457
84884
  ${valid && !tooLong ? `<p class="dp2-info" style="margin:6px 0 0">${fmtN(bucketCount(start, end, this.s.resolution))} intervalo(s) por medidor.</p>` : ""}
84458
- ${tooLong ? `<div class="dp2-fix"><span class="dp2-err">O per\xEDodo \xE9 longo demais para intervalos de ${esc5(r.label)} (m\xE1ximo ${maxDays} dia(s)).</span>
84459
- ${fit ? `<button class="dp2-btn sm primary" type="button" data-action="resolution" data-res="${fit}">Usar ${esc5(RESOLUTION_BY_ID[fit].label)}</button>` : ""}
84885
+ ${tooLong ? `<div class="dp2-fix"><span class="dp2-err">O per\xEDodo \xE9 longo demais para intervalos de ${esc6(r.label)} (m\xE1ximo ${maxDays} dia(s)).</span>
84886
+ ${fit ? `<button class="dp2-btn sm primary" type="button" data-action="resolution" data-res="${fit}">Usar ${esc6(RESOLUTION_BY_ID[fit].label)}</button>` : ""}
84460
84887
  <button class="dp2-btn sm" type="button" data-action="shorten">Encurtar para os \xFAltimos ${maxDays} dia(s)</button></div>` : ""}
84461
84888
  ${misaligned ? `<div class="dp2-fix"><span class="dp2-err">Com intervalos de 1 dia, o in\xEDcio precisa ser \xE0 meia-noite.</span>
84462
- <button class="dp2-btn sm primary" type="button" data-action="snap-midnight">Come\xE7ar em ${esc5(formatLocalDateTime(localMidnightOf(start)))}</button></div>` : ""}
84889
+ <button class="dp2-btn sm primary" type="button" data-action="snap-midnight">Come\xE7ar em ${esc6(formatLocalDateTime(localMidnightOf(start)))}</button></div>` : ""}
84463
84890
  </div>
84464
- ${otherErrs.length ? `<p class="dp2-err">${otherErrs.map(esc5).join("<br>")}</p>` : ""}`;
84891
+ ${otherErrs.length ? `<p class="dp2-err">${otherErrs.map(esc6).join("<br>")}</p>` : ""}`;
84465
84892
  }
84466
84893
  renderStep3() {
84467
84894
  this.el.body.innerHTML = `<div class="dp2-tgrid">${TELEMETRY_GROUPS.map((g) => {
84468
84895
  const all = g.items.every((t) => this.s.telemetries.has(t.key));
84469
- return `<div class="dp2-card"><h3><span>${g.icon} ${esc5(g.label)}</span>
84896
+ return `<div class="dp2-card"><h3><span>${g.icon} ${esc6(g.label)}</span>
84470
84897
  <button class="dp2-btn link" type="button" data-action="group-all" data-gid="${g.id}">${all ? "Desmarcar" : "Marcar"} todos</button></h3>
84471
84898
  ${g.items.map((t) => `<label class="dp2-check"><input type="checkbox" data-role="tel" data-key="${t.key}" ${this.s.telemetries.has(t.key) ? "checked" : ""}>
84472
- ${esc5(t.label)}<span class="u">${this.p.supportMode ? esc5(t.key) + " \xB7 " : ""}${esc5(t.unit)}</span></label>`).join("")}
84899
+ ${esc6(t.label)}<span class="u">${this.p.supportMode ? esc6(t.key) + " \xB7 " : ""}${esc6(t.unit)}</span></label>`).join("")}
84473
84900
  </div>`;
84474
84901
  }).join("")}</div>
84475
84902
  <p class="dp2-info">${this.s.telemetries.size} de ${TELEMETRY_CATALOG.length} telemetrias. Mesmo cat\xE1logo da modal "Telemetrias Instant\xE2neas e Pico de Demanda".</p>`;
@@ -84489,14 +84916,14 @@ var DemandPanelV2 = class {
84489
84916
  let validation = "";
84490
84917
  if (v.state === "loading") validation = '<div class="dp2-info">\u23F3 Validando o pedido no servidor\u2026</div>';
84491
84918
  else if (v.state === "error") {
84492
- validation = `<div class="dp2-err">N\xE3o foi poss\xEDvel validar agora: ${esc5(v.error)}
84919
+ validation = `<div class="dp2-err">N\xE3o foi poss\xEDvel validar agora: ${esc6(v.error)}
84493
84920
  <button class="dp2-btn link" type="button" data-action="revalidate">Tentar de novo</button></div>`;
84494
84921
  } else if (vr) {
84495
84922
  const warns = (vr.warnings || []).map((w) => {
84496
84923
  const dev = w.deviceId;
84497
- return `<li>${esc5(warningText(w.code, w.message) + (dev ? this.devicesSuffix({ devices: [{ deviceId: dev }] }) : ""))}</li>`;
84924
+ return `<li>${esc6(warningText(w.code, w.message) + (dev ? this.devicesSuffix({ devices: [{ deviceId: dev }] }) : ""))}</li>`;
84498
84925
  }).join("");
84499
- const reuse = vr.reusable ? `<div class="dp2-banner info" style="margin-top:8px">\u267B J\xE1 existe um relat\xF3rio id\xEAntico${vr.reusable.generatedAt ? ` gerado em ${esc5(formatLocalDateTime(Date.parse(vr.reusable.generatedAt)))}` : ""}${vr.reusable.generatedBy?.userId ? ` por ${esc5(vr.reusable.generatedBy.userId)}` : ""}. Confirmar reaproveita o arquivo (sem custo de cota).
84926
+ const reuse = vr.reusable ? `<div class="dp2-banner info" style="margin-top:8px">\u267B J\xE1 existe um relat\xF3rio id\xEAntico${vr.reusable.generatedAt ? ` gerado em ${esc6(formatLocalDateTime(Date.parse(vr.reusable.generatedAt)))}` : ""}${vr.reusable.generatedBy?.userId ? ` por ${esc6(vr.reusable.generatedBy.userId)}` : ""}. Confirmar reaproveita o arquivo (sem custo de cota).
84500
84927
  <label class="dp2-check" style="margin-top:6px"><input type="checkbox" data-role="force" ${this.s.force ? "checked" : ""}> Gerar novamente mesmo assim</label></div>` : "";
84501
84928
  validation = `${vr.ok ? '<div class="dp2-info">\u2713 Pedido validado no servidor.</div>' : ""}
84502
84929
  ${warns ? `<ul class="dp2-info" style="margin:6px 0 0;padding-left:18px">${warns}</ul>` : ""}${reuse}`;
@@ -84504,12 +84931,12 @@ var DemandPanelV2 = class {
84504
84931
  this.el.body.innerHTML = `
84505
84932
  <div class="dp2-card"><h3 tabindex="-1" data-role="step-title">Resumo do pedido</h3>
84506
84933
  <dl class="dp2-sum">
84507
- <dt>Solicitante</dt><dd>${esc5(this.p.user.name)}</dd>
84508
- <dt>Medidores (${req.devices.length})</dt><dd><div class="dp2-pills">${req.devices.map((d) => `<span class="dp2-pill">${esc5(labelOf(d))}</span>`).join("")}</div></dd>
84934
+ <dt>Solicitante</dt><dd>${esc6(this.p.user.name)}</dd>
84935
+ <dt>Medidores (${req.devices.length})</dt><dd><div class="dp2-pills">${req.devices.map((d) => `<span class="dp2-pill">${esc6(labelOf(d))}</span>`).join("")}</div></dd>
84509
84936
  <dt>Per\xEDodo</dt><dd>${formatLocalDateTime(start)} \u2192 ${formatLocalDateTime(end)} <span class="dp2-info">(${fmtDuration(end - start)}, hor\xE1rio de Bras\xEDlia${req.period.preset === "today" || req.period.preset === "thisMonth" ? `, calculado \xE0s ${formatLocalDateTime(snap.takenAt).slice(11)}` : ""})</span></dd>
84510
- <dt>Resolu\xE7\xE3o</dt><dd>${esc5(this.resolutionLabel(req.resolution))} <span class="dp2-info">(${esc5(BUCKET_STATS_LABEL)})</span></dd>
84511
- <dt>Telemetrias (${req.telemetries.length})</dt><dd><div class="dp2-pills">${req.telemetries.map((t) => `<span class="dp2-pill">${esc5(t.label)} \xB7 ${esc5(t.unit)}</span>`).join("")}</div>
84512
- ${req.telemetries.some((t) => t.key === "consumption") ? `<div class="dp2-info" style="margin-top:4px">Inclui a ${esc5(this.demandLabel())}.</div>` : ""}</dd>
84937
+ <dt>Resolu\xE7\xE3o</dt><dd>${esc6(this.resolutionLabel(req.resolution))} <span class="dp2-info">(${esc6(BUCKET_STATS_LABEL)})</span></dd>
84938
+ <dt>Telemetrias (${req.telemetries.length})</dt><dd><div class="dp2-pills">${req.telemetries.map((t) => `<span class="dp2-pill">${esc6(t.label)} \xB7 ${esc6(t.unit)}</span>`).join("")}</div>
84939
+ ${req.telemetries.some((t) => t.key === "consumption") ? `<div class="dp2-info" style="margin-top:4px">Inclui a ${esc6(this.demandLabel())}.</div>` : ""}</dd>
84513
84940
  <dt>Tamanho</dt><dd><span class="dp2-size ${cls}">${txt}</span> <span class="dp2-info">\u2248 ${fmtN(pts)} pontos</span>
84514
84941
  <details class="dp2-details"><summary>Detalhes</summary><span class="dp2-info">${fmtN(est.buckets)} intervalos \xD7 ${req.devices.length} medidores \xD7 ${req.telemetries.length} telemetrias${this.limits()?.maxPoints != null ? ` \xB7 limite ${fmtN(this.limits().maxPoints)}` : ""}</span></details></dd>
84515
84942
  <dt>Entrega</dt><dd>Arquivos XLSX, CSV e JSON <span class="dp2-info">(dispon\xEDveis por 3 dias; o resumo fica por 1 ano)</span></dd>
@@ -84517,15 +84944,15 @@ var DemandPanelV2 = class {
84517
84944
  <div style="margin-top:12px">${validation}</div>
84518
84945
  <p class="dp2-info" style="margin:12px 0 0">Seu pedido fica registrado (quem, quando, o qu\xEA) e \xE9 processado em segundo plano. <b>Voc\xEA pode fechar este painel</b> e acompanhar em Relat\xF3rios.</p>
84519
84946
  </div>
84520
- ${this.p.supportMode ? `<div class="dp2-card"><h3>Pedido que ser\xE1 registrado (suporte)</h3><pre class="dp2-json">${esc5(JSON.stringify(req, null, 2))}</pre></div>` : ""}
84521
- ${errs.length ? `<p class="dp2-err">${errs.map(esc5).join("<br>")}</p>` : ""}`;
84947
+ ${this.p.supportMode ? `<div class="dp2-card"><h3>Pedido que ser\xE1 registrado (suporte)</h3><pre class="dp2-json">${esc6(JSON.stringify(req, null, 2))}</pre></div>` : ""}
84948
+ ${errs.length ? `<p class="dp2-err">${errs.map(esc6).join("<br>")}</p>` : ""}`;
84522
84949
  }
84523
84950
  renderNav() {
84524
84951
  const errs = this.stepErrors(this.s.step);
84525
84952
  const hints = ["", `${this.s.selected.length} medidor(es) na lista`, "Escolha o per\xEDodo e a resolu\xE7\xE3o", `${this.s.telemetries.size} telemetria(s)`, "Revise e confirme"];
84526
84953
  this.el.nav.innerHTML = `
84527
84954
  <button class="dp2-btn" type="button" data-action="back" ${this.s.step === 1 ? "disabled" : ""}>\u2190 Voltar</button>
84528
- <span class="hint">${esc5(hints[this.s.step])}</span>
84955
+ <span class="hint">${esc6(hints[this.s.step])}</span>
84529
84956
  ${this.s.step === 4 ? `<button class="dp2-btn primary" type="button" data-action="confirm" ${errs.length || this.s.submitting || this.s.validation.state !== "ok" ? "disabled" : ""}>${this.s.submitting ? "Enviando\u2026" : "\u2713 Confirmar e enviar"}</button>` : `<button class="dp2-btn primary" type="button" data-action="next" ${errs.length ? "disabled" : ""}>Pr\xF3ximo \u2192</button>`}`;
84530
84957
  }
84531
84958
  jobTitle(e) {
@@ -84543,7 +84970,7 @@ var DemandPanelV2 = class {
84543
84970
  return;
84544
84971
  }
84545
84972
  if (s.listState === "error") {
84546
- this.el.body.innerHTML = `<div class="dp2-empty">N\xE3o foi poss\xEDvel carregar os relat\xF3rios (${esc5(s.listError)}).<br><button class="dp2-btn" type="button" data-action="reload">Tentar de novo</button></div>`;
84973
+ this.el.body.innerHTML = `<div class="dp2-empty">N\xE3o foi poss\xEDvel carregar os relat\xF3rios (${esc6(s.listError)}).<br><button class="dp2-btn" type="button" data-action="reload">Tentar de novo</button></div>`;
84547
84974
  return;
84548
84975
  }
84549
84976
  const orphans = this.p.supportMode ? s.active.filter((j) => !s.keys.includes(envelopeKey(j.jobId))) : [];
@@ -84561,43 +84988,43 @@ var DemandPanelV2 = class {
84561
84988
  const note = (cls, text2) => `<div class="${cls}" style="margin-top:6px">${text2}</div>`;
84562
84989
  const queue = st === "queued" && j?.queue?.position ? ` (N\xBA ${j.queue.position})` : "";
84563
84990
  const peak = j?.totals?.largestDevicePeak;
84564
- const peakTxt = peak && (peak.kw != null || peak.w != null) ? `Maior pico individual: <b>${esc5(fmtN(Number(peak.kw ?? peak.w / 1e3)))} kW</b>${peak.label ? ` \xB7 ${esc5(peak.label)}` : ""}${peak.at ? ` \xB7 ${esc5(when(peak.at))}` : ""}` : "";
84565
- return `<article class="dp2-job" aria-label="${esc5(this.jobTitle(e))}">
84991
+ const peakTxt = peak && (peak.kw != null || peak.w != null) ? `Maior pico individual: <b>${esc6(fmtN(Number(peak.kw ?? peak.w / 1e3)))} kW</b>${peak.label ? ` \xB7 ${esc6(peak.label)}` : ""}${peak.at ? ` \xB7 ${esc6(when(peak.at))}` : ""}` : "";
84992
+ return `<article class="dp2-job" aria-label="${esc6(this.jobTitle(e))}">
84566
84993
  <div class="dp2-job-top">
84567
- <span class="dp2-job-title">${esc5(this.jobTitle(e))}</span>
84994
+ <span class="dp2-job-title">${esc6(this.jobTitle(e))}</span>
84568
84995
  <span class="dp2-status ${st}">${JOB_STATE_LABEL[st]}${queue}${st === "running" ? ` ${progress}%` : ""}</span>
84569
84996
  <span style="flex:1"></span>
84570
- <span class="dp2-info">${esc5(e.requestedBy.name)} \xB7 ${when(e.requestedAt)}</span>
84997
+ <span class="dp2-info">${esc6(e.requestedBy.name)} \xB7 ${when(e.requestedAt)}</span>
84571
84998
  </div>
84572
84999
  ${st === "queued" || st === "running" ? `<div class="dp2-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${progress}"><span style="width:${progress}%"></span></div>` : ""}
84573
- ${st === "queued" && j?.queue?.estimatedStartAt ? note("dp2-info", `In\xEDcio estimado: ${esc5(when(j.queue.estimatedStartAt))}`) : ""}
84574
- ${st === "failed" ? note("dp2-err", `${esc5(failureText(j?.error?.code))}${this.p.supportMode && j?.error ? ` <small>(${esc5(j.error.code)}: ${esc5(j.error.message)})</small>` : ""}`) : ""}
84575
- ${st === "rejected" ? note("dp2-err", `${esc5(rejectionText(v.code, v.reason, v.message))}${this.p.supportMode ? ` <small>(${esc5(v.code)}${v.reason ? " \xB7 " + esc5(v.reason) : ""})</small>` : ""}`) : ""}
85000
+ ${st === "queued" && j?.queue?.estimatedStartAt ? note("dp2-info", `In\xEDcio estimado: ${esc6(when(j.queue.estimatedStartAt))}`) : ""}
85001
+ ${st === "failed" ? note("dp2-err", `${esc6(failureText(j?.error?.code))}${this.p.supportMode && j?.error ? ` <small>(${esc6(j.error.code)}: ${esc6(j.error.message)})</small>` : ""}`) : ""}
85002
+ ${st === "rejected" ? note("dp2-err", `${esc6(rejectionText(v.code, v.reason, v.message))}${this.p.supportMode ? ` <small>(${esc6(v.code)}${v.reason ? " \xB7 " + esc6(v.reason) : ""})</small>` : ""}`) : ""}
84576
85003
  ${st === "not_received" ? note("dp2-err", "O pedido est\xE1 registrado, mas o processamento n\xE3o o recebeu. Reenviar \xE9 seguro: n\xE3o gera relat\xF3rio duplicado.") : ""}
84577
85004
  ${st === "query_unavailable" ? note("dp2-info", "N\xE3o foi poss\xEDvel consultar o andamento agora \u2014 tentaremos de novo.") : ""}
84578
85005
  ${st === "old_request" ? note("dp2-info", 'Pedido antigo, sem registro de processamento. Use "Duplicar e editar".') : ""}
84579
85006
  ${st === "result_expired" ? note("dp2-info", "O relat\xF3rio foi conclu\xEDdo, mas os arquivos j\xE1 expiraram (ficam 3 dias).") : ""}
84580
85007
  ${st === "purged" ? note("dp2-info", "O conte\xFAdo deste relat\xF3rio foi removido.") : ""}
84581
- ${st === "succeeded" && j?.reused ? note("dp2-info", `\u267B Resultado reaproveitado${j.generatedAt ? ` \u2014 gerado em ${esc5(when(j.generatedAt))}` : ""}${j.generatedBy?.userId ? ` por ${esc5(j.generatedBy.userId)}` : ""}.`) : ""}
85008
+ ${st === "succeeded" && j?.reused ? note("dp2-info", `\u267B Resultado reaproveitado${j.generatedAt ? ` \u2014 gerado em ${esc6(when(j.generatedAt))}` : ""}${j.generatedBy?.userId ? ` por ${esc6(j.generatedBy.userId)}` : ""}.`) : ""}
84582
85009
  ${st === "succeeded" && peakTxt ? note("dp2-info", peakTxt) : ""}
84583
- ${st === "succeeded" && j?.expiresAt ? note("dp2-info", `Arquivos dispon\xEDveis at\xE9 ${esc5(when(j.expiresAt))}.`) : ""}
85010
+ ${st === "succeeded" && j?.expiresAt ? note("dp2-info", `Arquivos dispon\xEDveis at\xE9 ${esc6(when(j.expiresAt))}.`) : ""}
84584
85011
  ${s.auditPending.has(e.jobId) ? '<div class="dp2-audit-warn">\u26A0 A a\xE7\xE3o foi aceita, mas o registro de auditoria falhou \u2014 ser\xE1 reconciliado.</div>' : ""}
84585
85012
  <div class="dp2-job-actions">
84586
- ${st === "succeeded" ? `<button class="dp2-btn sm primary" type="button" data-action="download" data-kind="xlsx" data-job="${esc5(e.jobId)}">\u2B07 XLSX</button>
84587
- <button class="dp2-btn sm" type="button" data-action="download" data-kind="csv" data-job="${esc5(e.jobId)}">CSV</button>
84588
- <button class="dp2-btn sm" type="button" data-action="download" data-kind="json" data-job="${esc5(e.jobId)}">JSON</button>` : ""}
84589
- ${st === "queued" || st === "running" ? `<button class="dp2-btn sm" type="button" data-action="cancel" data-job="${esc5(e.jobId)}" ${busy}>\u2715 Cancelar</button>` : ""}
84590
- ${v.canResend ? `<button class="dp2-btn sm primary" type="button" data-action="resend" data-job="${esc5(e.jobId)}" ${busy}>\u21BB Reenviar</button>` : ""}
84591
- ${["failed", "cancelled", "succeeded", "result_expired", "purged", "old_request", "rejected"].includes(st) ? `<button class="dp2-btn sm" type="button" data-action="clone" data-job="${esc5(e.jobId)}">\u29C9 Duplicar e editar</button>` : ""}
84592
- ${this.p.supportMode ? `<button class="dp2-btn link" type="button" data-action="details" data-job="${esc5(e.jobId)}">${s.openDetails.has(e.jobId) ? "Ocultar" : "Detalhes /"} auditoria</button>` : ""}
84593
- </div>
84594
- ${this.p.supportMode && s.openDetails.has(e.jobId) ? `<pre class="dp2-json">${esc5(JSON.stringify(e, null, 2))}</pre>` : ""}
85013
+ ${st === "succeeded" ? `<button class="dp2-btn sm primary" type="button" data-action="download" data-kind="xlsx" data-job="${esc6(e.jobId)}">\u2B07 XLSX</button>
85014
+ <button class="dp2-btn sm" type="button" data-action="download" data-kind="csv" data-job="${esc6(e.jobId)}">CSV</button>
85015
+ <button class="dp2-btn sm" type="button" data-action="download" data-kind="json" data-job="${esc6(e.jobId)}">JSON</button>` : ""}
85016
+ ${st === "queued" || st === "running" ? `<button class="dp2-btn sm" type="button" data-action="cancel" data-job="${esc6(e.jobId)}" ${busy}>\u2715 Cancelar</button>` : ""}
85017
+ ${v.canResend ? `<button class="dp2-btn sm primary" type="button" data-action="resend" data-job="${esc6(e.jobId)}" ${busy}>\u21BB Reenviar</button>` : ""}
85018
+ ${["failed", "cancelled", "succeeded", "result_expired", "purged", "old_request", "rejected"].includes(st) ? `<button class="dp2-btn sm" type="button" data-action="clone" data-job="${esc6(e.jobId)}">\u29C9 Duplicar e editar</button>` : ""}
85019
+ ${this.p.supportMode ? `<button class="dp2-btn link" type="button" data-action="details" data-job="${esc6(e.jobId)}">${s.openDetails.has(e.jobId) ? "Ocultar" : "Detalhes /"} auditoria</button>` : ""}
85020
+ </div>
85021
+ ${this.p.supportMode && s.openDetails.has(e.jobId) ? `<pre class="dp2-json">${esc6(JSON.stringify(e, null, 2))}</pre>` : ""}
84595
85022
  </article>`;
84596
85023
  }).join("");
84597
85024
  const orphanCards = orphans.map((j) => `<article class="dp2-job ghost"><div class="dp2-job-top">
84598
- <span class="dp2-job-title">Job sem registro no ThingsBoard (O-6)</span><span class="dp2-status ${j.status}">${esc5(JOB_STATE_LABEL[j.status] ?? j.status)}</span>
84599
- <span style="flex:1"></span><span class="dp2-info">${esc5(j.requestedBy?.userId ?? "")} \xB7 ${when(j.createdAt)}</span></div>
84600
- <div class="dp2-info" style="margin-top:4px"><code>${esc5(j.jobId)}</code></div></article>`).join("");
85025
+ <span class="dp2-job-title">Job sem registro no ThingsBoard (O-6)</span><span class="dp2-status ${j.status}">${esc6(JOB_STATE_LABEL[j.status] ?? j.status)}</span>
85026
+ <span style="flex:1"></span><span class="dp2-info">${esc6(j.requestedBy?.userId ?? "")} \xB7 ${when(j.createdAt)}</span></div>
85027
+ <div class="dp2-info" style="margin-top:4px"><code>${esc6(j.jobId)}</code></div></article>`).join("");
84601
85028
  this.el.body.innerHTML = cards + orphanCards;
84602
85029
  }
84603
85030
  /* ------------------------------------------------------------------ data flows */
@@ -86056,7 +86483,7 @@ function buildYearOptions() {
86056
86483
  for (let y = now + 2; y >= now - 2; y--) out.push(y);
86057
86484
  return out;
86058
86485
  }
86059
- function esc6(s) {
86486
+ function esc7(s) {
86060
86487
  return String(s == null ? "" : s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
86061
86488
  }
86062
86489
  function resolveThemeVars(theme) {
@@ -86627,7 +87054,7 @@ function openGoalsPanel(params) {
86627
87054
  });
86628
87055
  }
86629
87056
  container.appendChild(rootEl);
86630
- injectStyles26();
87057
+ injectStyles27();
86631
87058
  rootEl.addEventListener("click", onClick);
86632
87059
  rootEl.addEventListener("change", onChange);
86633
87060
  rootEl.addEventListener("input", onInput);
@@ -86872,13 +87299,13 @@ function openGoalsPanel(params) {
86872
87299
  const g = state6.goals || {};
86873
87300
  const parts = [];
86874
87301
  if (hasCoverageGaps(g.coverageGaps)) {
86875
- parts.push(`<p style="margin:0 0 8px;">${esc6(buildCoverageWarningTextPtBR(g.coverageGaps, "GERAL"))}</p>`);
87302
+ parts.push(`<p style="margin:0 0 8px;">${esc7(buildCoverageWarningTextPtBR(g.coverageGaps, "GERAL"))}</p>`);
86876
87303
  }
86877
87304
  (Array.isArray(g.devices) ? g.devices : []).forEach((d) => {
86878
87305
  if (!hasCoverageGaps(d && d.coverageGaps)) return;
86879
87306
  const label = d.label || d.code || "medidor";
86880
87307
  parts.push(
86881
- `<p style="margin:0 0 8px;">${esc6(buildCoverageWarningTextPtBR(d.coverageGaps, `do medidor ${label}`))}</p>`
87308
+ `<p style="margin:0 0 8px;">${esc7(buildCoverageWarningTextPtBR(d.coverageGaps, `do medidor ${label}`))}</p>`
86882
87309
  );
86883
87310
  });
86884
87311
  return `<div style="font-size:12px;line-height:1.55;color:#334155;">${parts.join("")}</div>`;
@@ -86918,7 +87345,7 @@ function openGoalsPanel(params) {
86918
87345
  html += `<div class="myio-goals-alert myio-goals-alert-amber">${icon2("alert")} ${i18n2.versionConflict}</div>`;
86919
87346
  }
86920
87347
  if (state6.saveError && !state6.conflict) {
86921
- html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${esc6(state6.saveError)}</div>`;
87348
+ html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${esc7(state6.saveError)}</div>`;
86922
87349
  }
86923
87350
  if (state6.saved && !state6.saveError) {
86924
87351
  html += `<div class="myio-goals-alert myio-goals-alert-green">${icon2("check")} ${i18n2.saveSuccess}</div>`;
@@ -86933,7 +87360,7 @@ function openGoalsPanel(params) {
86933
87360
  return `
86934
87361
  <div class="myio-goals-center myio-goals-center-col">
86935
87362
  ${icon2("alert-lg")}
86936
- <p>${esc6(state6.error)}</p>
87363
+ <p>${esc7(state6.error)}</p>
86937
87364
  <button class="myio-goals-btn myio-goals-btn-outline" data-action="retry">${i18n2.retry}</button>
86938
87365
  </div>`;
86939
87366
  }
@@ -87023,7 +87450,7 @@ function openGoalsPanel(params) {
87023
87450
  const cellLabel = state6.level === "month" ? i18n2.months[key] : state6.level === "day" ? i18n2.dayCell.replace("{day}", Number(key)) : `${key}:00`;
87024
87451
  const canDrill = state6.level !== "hour";
87025
87452
  const labelEl = canDrill ? `<button class="myio-goals-cell-drill" data-action="${state6.level === "month" ? "open-month" : "open-day"}" data-key="${key}" title="${i18n2.drill.openTitle}">${cellLabel} ${icon2("chevron-sm")}</button>` : `<span class="myio-goals-cell-label">${cellLabel}</span>`;
87026
- const val = state6.draft[key] !== void 0 ? esc6(state6.draft[key]) : "";
87453
+ const val = state6.draft[key] !== void 0 ? esc7(state6.draft[key]) : "";
87027
87454
  const minAttr = cfg.allowsNegative ? "" : 'min="0"';
87028
87455
  return `
87029
87456
  <div class="myio-goals-cell">
@@ -87091,7 +87518,7 @@ function openGoalsPanel(params) {
87091
87518
  const actor = ev.actor ? `${String(ev.actor).slice(0, 8)}\u2026` : i18n2.history.system;
87092
87519
  const extra = ev.bucketCount - (ev.details ? ev.details.length : 0);
87093
87520
  const chips = (ev.details || []).slice(0, DETAIL_PREVIEW).map(
87094
- (d) => `<span class="myio-goals-tl-chip"><span class="myio-goals-tl-ref">${esc6(formatRef(d.ref))}</span>${d.value === null ? "\u2014" : fmt2(d.value)}</span>`
87521
+ (d) => `<span class="myio-goals-tl-chip"><span class="myio-goals-tl-ref">${esc7(formatRef(d.ref))}</span>${d.value === null ? "\u2014" : fmt2(d.value)}</span>`
87095
87522
  ).join("");
87096
87523
  const more = extra > 0 ? `<span class="myio-goals-tl-more">${i18n2.history.moreDetails.replace("{n}", extra)}</span>` : "";
87097
87524
  return `
@@ -87101,7 +87528,7 @@ function openGoalsPanel(params) {
87101
87528
  <span class="myio-goals-tl-title">${i18n2.history.source[ev.source] || i18n2.history.source.EDIT}</span>
87102
87529
  <span class="myio-goals-tl-ver">v${ev.version}</span>
87103
87530
  </div>
87104
- <p class="myio-goals-tl-meta" title="${esc6(new Date(ev.changedAt).toLocaleString(locale))}">${esc6(actor)} \xB7 ${esc6(timeAgo(ev.changedAt))}</p>
87531
+ <p class="myio-goals-tl-meta" title="${esc7(new Date(ev.changedAt).toLocaleString(locale))}">${esc7(actor)} \xB7 ${esc7(timeAgo(ev.changedAt))}</p>
87105
87532
  <p class="myio-goals-tl-records">${i18n2.history.records.replace("{n}", ev.bucketCount)} \xB7 ${i18n2.levels[ev.actionLevel] || ev.actionLevel}</p>
87106
87533
  ${chips || more ? `<div class="myio-goals-tl-chips">${chips}${more}</div>` : ""}
87107
87534
  </li>`;
@@ -87148,7 +87575,7 @@ ${state6.year}-03-15T08,15`;
87148
87575
  let html = `
87149
87576
  <div class="myio-goals-import-hint">
87150
87577
  <p>${i18n2.import.formatHint}</p>
87151
- <code>${esc6(sample)}</code>
87578
+ <code>${esc7(sample)}</code>
87152
87579
  </div>`;
87153
87580
  if (!applied) {
87154
87581
  html += `
@@ -87162,16 +87589,16 @@ ${state6.year}-03-15T08,15`;
87162
87589
  <input type="file" id="myio-goals-csv-file" accept=".csv,.txt,text/csv,text/plain" style="display:none" />
87163
87590
  </div>
87164
87591
  </div>
87165
- <textarea id="myio-goals-csv-textarea" rows="8" spellcheck="false" placeholder="${esc6(`bucket,value
87592
+ <textarea id="myio-goals-csv-textarea" rows="8" spellcheck="false" placeholder="${esc7(`bucket,value
87166
87593
  ${state6.year},100000
87167
87594
  ${state6.year}-03,9000
87168
87595
  ${state6.year}-03-15,310
87169
- ${state6.year}-03-15T08,15`)}">${esc6(state6.csv)}</textarea>
87596
+ ${state6.year}-03-15T08,15`)}">${esc7(state6.csv)}</textarea>
87170
87597
  <p class="myio-goals-microhint">${i18n2.import.unitNote.replace("{unit}", unitLabel2())}</p>
87171
87598
  </div>`;
87172
87599
  }
87173
87600
  if (state6.saveError && state6.conflictVersion === null) {
87174
- html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${esc6(state6.saveError)}</div>`;
87601
+ html += `<div class="myio-goals-alert myio-goals-alert-red">${icon2("alert")} ${esc7(state6.saveError)}</div>`;
87175
87602
  }
87176
87603
  if (state6.conflictVersion !== null) {
87177
87604
  html += `<div class="myio-goals-alert myio-goals-alert-amber">${icon2("alert")} ${i18n2.import.conflict}</div>`;
@@ -87200,7 +87627,7 @@ ${state6.year}-03-15T08,15`)}">${esc6(state6.csv)}</textarea>
87200
87627
  <div class="myio-goals-import-diags">
87201
87628
  <p class="myio-goals-import-diags-title">${i18n2.import.diagnosticsTitle}</p>
87202
87629
  <ul>${result.diagnostics.map(
87203
- (d) => `<li>${icon2("alert-sm")} <span><span class="myio-goals-diag-line">${i18n2.import.line.replace("{line}", d.line)}</span>${d.bucket ? ` <span class="myio-goals-diag-bucket">[${esc6(d.bucket)}]</span>` : ""} ${esc6(d.reason)}</span></li>`
87630
+ (d) => `<li>${icon2("alert-sm")} <span><span class="myio-goals-diag-line">${i18n2.import.line.replace("{line}", d.line)}</span>${d.bucket ? ` <span class="myio-goals-diag-bucket">[${esc7(d.bucket)}]</span>` : ""} ${esc7(d.reason)}</span></li>`
87204
87631
  ).join("")}</ul>
87205
87632
  </div>`;
87206
87633
  }
@@ -87208,7 +87635,7 @@ ${state6.year}-03-15T08,15`)}">${esc6(state6.csv)}</textarea>
87208
87635
  html += `
87209
87636
  <div class="myio-goals-import-log">
87210
87637
  <p class="myio-goals-import-log-title">${i18n2.import.logTitle}</p>
87211
- <ul>${result.log.map((line) => `<li>${esc6(line)}</li>`).join("")}</ul>
87638
+ <ul>${result.log.map((line) => `<li>${esc7(line)}</li>`).join("")}</ul>
87212
87639
  </div>`;
87213
87640
  }
87214
87641
  html += `</div>`;
@@ -87282,7 +87709,7 @@ ${state6.year}-03-15T08,15`)}">${esc6(state6.csv)}</textarea>
87282
87709
  return "";
87283
87710
  }
87284
87711
  }
87285
- function injectStyles26() {
87712
+ function injectStyles27() {
87286
87713
  const id = "myio-goals-gcdr-styles";
87287
87714
  const prev = document.getElementById(id);
87288
87715
  if (prev) prev.remove();
@@ -94451,7 +94878,7 @@ function injectCSS10() {
94451
94878
  document.head.appendChild(style);
94452
94879
  _cssInjected2 = true;
94453
94880
  }
94454
- function esc7(value) {
94881
+ function esc8(value) {
94455
94882
  return String(value == null ? "" : value).replace(
94456
94883
  /[&<>"]/g,
94457
94884
  (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]
@@ -94501,7 +94928,7 @@ function buildPieSvg(visible, total) {
94501
94928
  const val = Number(v.d.value) || 0;
94502
94929
  return `<svg class="myio-col-summary__pie" viewBox="0 0 220 220">
94503
94930
  <circle class="myio-col-summary__slice" data-idx="${v.idx}" cx="110" cy="110" r="100"
94504
- fill="${sliceColor(v.idx)}"><title>${esc7(v.d.name)} \u2014 ${esc7(fmt2(val))} (${fmtPct2(
94931
+ fill="${sliceColor(v.idx)}"><title>${esc8(v.d.name)} \u2014 ${esc8(fmt2(val))} (${fmtPct2(
94505
94932
  val,
94506
94933
  total,
94507
94934
  pd
@@ -94516,7 +94943,7 @@ function buildPieSvg(visible, total) {
94516
94943
  const a1 = acc / total * 360;
94517
94944
  return `<path class="myio-col-summary__slice" data-idx="${v.idx}"
94518
94945
  d="${arcPath(110, 110, 100, a0, a1)}" fill="${sliceColor(v.idx)}"
94519
- ><title>${esc7(v.d.name)} \u2014 ${esc7(fmt2(val))} (${fmtPct2(val, total, pd)})</title></path>`;
94946
+ ><title>${esc8(v.d.name)} \u2014 ${esc8(fmt2(val))} (${fmtPct2(val, total, pd)})</title></path>`;
94520
94947
  }).join("");
94521
94948
  return `<svg class="myio-col-summary__pie" viewBox="0 0 220 220">${paths}</svg>`;
94522
94949
  }
@@ -94530,8 +94957,8 @@ function buildLegend(total) {
94530
94957
  return `<div class="myio-col-summary__legend-row${isExcl ? " is-excluded" : ""}" data-idx="${idx}"
94531
94958
  title="Clique para ${isExcl ? "incluir" : "remover"} da pizza">
94532
94959
  <span class="myio-col-summary__legend-dot" style="background:${sliceColor(idx)};"></span>
94533
- <span class="myio-col-summary__legend-name">${esc7(d.name)}</span>
94534
- <span class="myio-col-summary__legend-val">${esc7(fmt2(val))}</span>
94960
+ <span class="myio-col-summary__legend-name">${esc8(d.name)}</span>
94961
+ <span class="myio-col-summary__legend-val">${esc8(fmt2(val))}</span>
94535
94962
  <span class="myio-col-summary__legend-pct">${pct}</span>
94536
94963
  </div>`;
94537
94964
  }).join("");
@@ -94552,25 +94979,25 @@ function buildAverageInner() {
94552
94979
  const dash = "\u2014";
94553
94980
  const periodRow = data.periodLabel ? `<div class="myio-col-summary__kpi">
94554
94981
  <span class="myio-col-summary__kpi-label">Per\xEDodo</span>
94555
- <span class="myio-col-summary__kpi-value">${esc7(data.periodLabel)}</span>
94982
+ <span class="myio-col-summary__kpi-value">${esc8(data.periodLabel)}</span>
94556
94983
  </div>` : "";
94557
94984
  const note = "M\xE9dia, m\xEDnima e m\xE1xima consideram apenas dispositivos online (com leitura).";
94558
94985
  const kpis = `<div class="myio-col-summary__kpis">
94559
94986
  ${periodRow}
94560
94987
  <div class="myio-col-summary__kpi">
94561
94988
  <span class="myio-col-summary__kpi-label">Dispositivos
94562
- <span class="myio-col-summary__info" title="${esc7(note)}" aria-label="${esc7(note)}"
94989
+ <span class="myio-col-summary__info" title="${esc8(note)}" aria-label="${esc8(note)}"
94563
94990
  style="display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;margin-left:4px;border-radius:50%;background:#3e1a7d;color:#fff;font-size:9px;font-weight:700;font-style:italic;font-family:Georgia,serif;cursor:help;vertical-align:middle;">i</span>
94564
94991
  </span>
94565
94992
  <span class="myio-col-summary__kpi-value">${online.length} online \xB7 ${offline.length} offline</span>
94566
94993
  </div>
94567
94994
  <div class="myio-col-summary__kpi">
94568
- <span class="myio-col-summary__kpi-label">${esc7(measure)} m\xE9dia</span>
94569
- <span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${avg === null ? dash : esc7(fmt2(avg))}</span>
94995
+ <span class="myio-col-summary__kpi-label">${esc8(measure)} m\xE9dia</span>
94996
+ <span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${avg === null ? dash : esc8(fmt2(avg))}</span>
94570
94997
  </div>
94571
94998
  <div class="myio-col-summary__kpi">
94572
94999
  <span class="myio-col-summary__kpi-label">M\xEDnima \xB7 M\xE1xima</span>
94573
- <span class="myio-col-summary__kpi-value">${minV ? esc7(fmt2(Number(minV.d.value))) : dash} \xB7 ${maxV ? esc7(fmt2(Number(maxV.d.value))) : dash}</span>
95000
+ <span class="myio-col-summary__kpi-value">${minV ? esc8(fmt2(Number(minV.d.value))) : dash} \xB7 ${maxV ? esc8(fmt2(Number(maxV.d.value))) : dash}</span>
94574
95001
  </div>
94575
95002
  </div>`;
94576
95003
  if (!data.devices.length) {
@@ -94579,12 +95006,12 @@ function buildAverageInner() {
94579
95006
  const near3 = avg === null ? [] : online.slice().sort((a, b) => Math.abs(Number(a.d.value) - avg) - Math.abs(Number(b.d.value) - avg)).slice(0, 3);
94580
95007
  const row = (v) => `
94581
95008
  <div class="myio-col-summary__row">
94582
- <span class="myio-col-summary__name" title="${esc7(v.d.name)}">${esc7(v.d.name)}</span>
94583
- <span class="myio-col-summary__val">${esc7(fmt2(Number(v.d.value) || 0))}</span>
95009
+ <span class="myio-col-summary__name" title="${esc8(v.d.name)}">${esc8(v.d.name)}</span>
95010
+ <span class="myio-col-summary__val">${esc8(fmt2(Number(v.d.value) || 0))}</span>
94584
95011
  </div>`;
94585
95012
  const offRow = (v) => `
94586
95013
  <div class="myio-col-summary__row">
94587
- <span class="myio-col-summary__name" title="${esc7(v.d.name)}">${esc7(v.d.name)}</span>
95014
+ <span class="myio-col-summary__name" title="${esc8(v.d.name)}">${esc8(v.d.name)}</span>
94588
95015
  <span class="myio-col-summary__val" style="color:#94a3b8;">sem leitura</span>
94589
95016
  </div>`;
94590
95017
  const group = (label, list, r = row) => list.length ? `<div class="myio-col-summary__group">
@@ -94601,8 +95028,8 @@ function buildAverageInner() {
94601
95028
  </div>
94602
95029
  </div>
94603
95030
  <div class="myio-col-summary__footer">
94604
- <span class="myio-col-summary__footer-label">${esc7(measure)} m\xE9dia \xB7 ${online.length} online</span>
94605
- <span class="myio-col-summary__footer-value">${avg === null ? dash : esc7(fmt2(avg))}</span>
95031
+ <span class="myio-col-summary__footer-label">${esc8(measure)} m\xE9dia \xB7 ${online.length} online</span>
95032
+ <span class="myio-col-summary__footer-value">${avg === null ? dash : esc8(fmt2(avg))}</span>
94606
95033
  </div>`;
94607
95034
  }
94608
95035
  function buildInner() {
@@ -94615,7 +95042,7 @@ function buildInner() {
94615
95042
  const avg = count ? total / count : 0;
94616
95043
  const periodRow = data.periodLabel ? `<div class="myio-col-summary__kpi">
94617
95044
  <span class="myio-col-summary__kpi-label">Per\xEDodo</span>
94618
- <span class="myio-col-summary__kpi-value">${esc7(data.periodLabel)}</span>
95045
+ <span class="myio-col-summary__kpi-value">${esc8(data.periodLabel)}</span>
94619
95046
  </div>` : "";
94620
95047
  const kpis = `<div class="myio-col-summary__kpis">
94621
95048
  ${periodRow}
@@ -94625,13 +95052,13 @@ function buildInner() {
94625
95052
  </div>
94626
95053
  <div class="myio-col-summary__kpi">
94627
95054
  <span class="myio-col-summary__kpi-label">Consumo m\xE9dio</span>
94628
- <span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${esc7(
95055
+ <span class="myio-col-summary__kpi-value myio-col-summary__kpi-value--accent">${esc8(
94629
95056
  fmt2(avg)
94630
95057
  )}</span>
94631
95058
  </div>
94632
95059
  <div class="myio-col-summary__kpi">
94633
95060
  <span class="myio-col-summary__kpi-label">Consumo total</span>
94634
- <span class="myio-col-summary__kpi-value">${esc7(fmt2(total))}</span>
95061
+ <span class="myio-col-summary__kpi-value">${esc8(fmt2(total))}</span>
94635
95062
  </div>
94636
95063
  </div>`;
94637
95064
  if (!data.devices.length) {
@@ -94645,8 +95072,8 @@ function buildInner() {
94645
95072
  ).slice(0, 3);
94646
95073
  const row = (v) => `
94647
95074
  <div class="myio-col-summary__row">
94648
- <span class="myio-col-summary__name" title="${esc7(v.d.name)}">${esc7(v.d.name)}</span>
94649
- <span class="myio-col-summary__val">${esc7(fmt2(Number(v.d.value) || 0))}</span>
95075
+ <span class="myio-col-summary__name" title="${esc8(v.d.name)}">${esc8(v.d.name)}</span>
95076
+ <span class="myio-col-summary__val">${esc8(fmt2(Number(v.d.value) || 0))}</span>
94650
95077
  <span class="myio-col-summary__pct">${fmtPct2(Number(v.d.value) || 0, total, pd)}</span>
94651
95078
  </div>`;
94652
95079
  const group = (label, list) => list.length ? `<div class="myio-col-summary__group">
@@ -94669,7 +95096,7 @@ function buildInner() {
94669
95096
  </div>
94670
95097
  <div class="myio-col-summary__footer">
94671
95098
  <span class="myio-col-summary__footer-label">Consumo Total \xB7 ${count} dispositivos</span>
94672
- <span class="myio-col-summary__footer-value">${esc7(fmt2(total))}</span>
95099
+ <span class="myio-col-summary__footer-value">${esc8(fmt2(total))}</span>
94673
95100
  </div>`;
94674
95101
  }
94675
95102
  function setHighlight(idx) {
@@ -101609,7 +102036,7 @@ function createConsumptionChartWidget(config2) {
101609
102036
  </div>
101610
102037
  `;
101611
102038
  }
101612
- function injectStyles26() {
102039
+ function injectStyles27() {
101613
102040
  if (styleElement) return;
101614
102041
  styleElement = document.createElement("style");
101615
102042
  styleElement.id = `${widgetId}-styles`;
@@ -102123,7 +102550,7 @@ function createConsumptionChartWidget(config2) {
102123
102550
  console.error(`[ConsumptionWidget] Container #${config2.containerId} not found`);
102124
102551
  return;
102125
102552
  }
102126
- injectStyles26();
102553
+ injectStyles27();
102127
102554
  containerElement.innerHTML = renderHTML();
102128
102555
  setupListeners();
102129
102556
  applyCollapseState();
@@ -102259,7 +102686,7 @@ function createConsumptionChartWidget(config2) {
102259
102686
  // src/components/tooltips/goals-bar-tooltip/createGoalsBarTooltip.ts
102260
102687
  var STYLE_ID10 = "myio-goals-bar-tooltip-styles";
102261
102688
  var DEFAULT_ACCENT = "#6c5ce7";
102262
- function injectStyles12(doc) {
102689
+ function injectStyles13(doc) {
102263
102690
  if (doc.getElementById(STYLE_ID10)) return;
102264
102691
  const s = doc.createElement("style");
102265
102692
  s.id = STYLE_ID10;
@@ -102449,7 +102876,7 @@ function injectStyles12(doc) {
102449
102876
  `;
102450
102877
  (doc.head || doc.documentElement).appendChild(s);
102451
102878
  }
102452
- function esc8(v) {
102879
+ function esc9(v) {
102453
102880
  return String(v ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
102454
102881
  }
102455
102882
  function fmtPct3(pct) {
@@ -102470,8 +102897,8 @@ function renderDeltaChip(delta) {
102470
102897
  const tone = delta.tone === "good" ? "good" : delta.tone === "bad" ? "bad" : "neutral";
102471
102898
  const arrow = delta.arrow === "up" ? "\u2191" : delta.arrow === "down" ? "\u2193" : "\u2248";
102472
102899
  const pctTxt = fmtPct3(Math.abs(Number(delta.pct)));
102473
- const txt = delta.text ? ` ${esc8(delta.text)}` : "";
102474
- return `<span class="myio-gbt__chip myio-gbt__chip--${tone}">${arrow} ${esc8(pctTxt)}${txt}</span>`;
102900
+ const txt = delta.text ? ` ${esc9(delta.text)}` : "";
102901
+ return `<span class="myio-gbt__chip myio-gbt__chip--${tone}">${arrow} ${esc9(pctTxt)}${txt}</span>`;
102475
102902
  }
102476
102903
  function renderRow(row, level) {
102477
102904
  const hasChildren = Array.isArray(row.children) && row.children.length > 0;
@@ -102479,12 +102906,12 @@ function renderRow(row, level) {
102479
102906
  const id = `gbtr-${++_rowSeq}`;
102480
102907
  const pct = row.pct;
102481
102908
  const caret = hasChildren ? `<button class="myio-gbt__caret${open ? " is-open" : ""}" data-caret="${id}" title="Expandir/recolher">\u25B8</button>` : `<span class="myio-gbt__caret-spacer"></span>`;
102482
- const swatch = row.color ? `<span class="myio-gbt__swatch" style="background:${esc8(row.color)}"></span>` : "";
102483
- const icon2 = row.icon ? `<span class="myio-gbt__icon">${esc8(row.icon)}</span>` : "";
102909
+ const swatch = row.color ? `<span class="myio-gbt__swatch" style="background:${esc9(row.color)}"></span>` : "";
102910
+ const icon2 = row.icon ? `<span class="myio-gbt__icon">${esc9(row.icon)}</span>` : "";
102484
102911
  const chipHtml = row.delta ? renderDeltaChip(row.delta) : "";
102485
- const pctHtml = !row.delta && pct != null && isFinite(pct) ? `<span class="myio-gbt__pct">${esc8(fmtPct3(pct))}</span>` : "";
102912
+ const pctHtml = !row.delta && pct != null && isFinite(pct) ? `<span class="myio-gbt__pct">${esc9(fmtPct3(pct))}</span>` : "";
102486
102913
  const rowClass = level > 0 ? "myio-gbt__row myio-gbt__row--child" : "myio-gbt__row";
102487
- let html = `<div class="${rowClass}">` + caret + swatch + icon2 + `<span class="myio-gbt__label">${esc8(row.label)}</span><span class="myio-gbt__value">${esc8(row.valueText)}</span>` + chipHtml + pctHtml + `</div>`;
102914
+ let html = `<div class="${rowClass}">` + caret + swatch + icon2 + `<span class="myio-gbt__label">${esc9(row.label)}</span><span class="myio-gbt__value">${esc9(row.valueText)}</span>` + chipHtml + pctHtml + `</div>`;
102488
102915
  if (hasChildren) {
102489
102916
  const childHtml = row.children.map((c) => renderRow(c, level + 1)).join("");
102490
102917
  html += `<div class="myio-gbt__children${open ? " is-open" : ""}" data-children="${id}">${childHtml}</div>`;
@@ -102499,7 +102926,7 @@ function createGoalsBarTooltip(opts) {
102499
102926
  return document;
102500
102927
  }
102501
102928
  })();
102502
- injectStyles12(doc);
102929
+ injectStyles13(doc);
102503
102930
  const el2 = doc.createElement("div");
102504
102931
  el2.className = "myio-gbt";
102505
102932
  el2.style.setProperty("--myio-gbt-accent", resolveAccent3(opts?.accentColor, doc));
@@ -102567,8 +102994,8 @@ function createGoalsBarTooltip(opts) {
102567
102994
  <div class="myio-gbt__card">
102568
102995
  <div class="myio-gbt__header">
102569
102996
  <div class="myio-gbt__title-wrap">
102570
- <div class="myio-gbt__title">${esc8(data.title)}</div>
102571
- ${data.subtitle ? `<div class="myio-gbt__subtitle">${esc8(data.subtitle)}</div>` : ""}
102997
+ <div class="myio-gbt__title">${esc9(data.title)}</div>
102998
+ ${data.subtitle ? `<div class="myio-gbt__subtitle">${esc9(data.subtitle)}</div>` : ""}
102572
102999
  </div>
102573
103000
  <button class="myio-gbt__btn myio-gbt__btn--pin${pinned ? " is-pinned" : ""}" data-action="pin" title="${pinned ? "Desafixar" : "Fixar na tela"}">\u{1F4CC}</button>
102574
103001
  <button class="myio-gbt__btn myio-gbt__btn--close" data-action="close" title="Fechar">\u2715</button>
@@ -103577,19 +104004,19 @@ function _updateCoverageHint(topDoc) {
103577
104004
  const deviceCount = data.granularity === "DEVICE" ? data.devices?.length ?? 0 : 0;
103578
104005
  hint.textContent = `\u26A0 Meta incompleta para este dom\xEDnio/ano` + (deviceCount > 0 ? ` \xB7 Por medidor (${deviceCount})` : "") + ` \u2014 passe o mouse para detalhes`;
103579
104006
  tabs.insertAdjacentElement("afterend", hint);
103580
- const esc11 = (s) => String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
104007
+ const esc12 = (s) => String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
103581
104008
  try {
103582
104009
  _coverageDetach = InfoTooltip.attach(hint, () => {
103583
104010
  const d = _getGoalsData(_currentDomain);
103584
104011
  const parts = [];
103585
104012
  if (hasCoverageGaps(d?.coverageGaps)) {
103586
- parts.push(`<p style="margin:0 0 8px;">${esc11(buildCoverageWarningTextPtBR(d?.coverageGaps, "GERAL"))}</p>`);
104013
+ parts.push(`<p style="margin:0 0 8px;">${esc12(buildCoverageWarningTextPtBR(d?.coverageGaps, "GERAL"))}</p>`);
103587
104014
  }
103588
104015
  (d?.devices || []).forEach((dev) => {
103589
104016
  if (!hasCoverageGaps(dev?.coverageGaps)) return;
103590
104017
  const label = dev.label || dev.code || "medidor";
103591
104018
  parts.push(
103592
- `<p style="margin:0 0 8px;">${esc11(buildCoverageWarningTextPtBR(dev.coverageGaps, `do medidor ${label}`))}</p>`
104019
+ `<p style="margin:0 0 8px;">${esc12(buildCoverageWarningTextPtBR(dev.coverageGaps, `do medidor ${label}`))}</p>`
103593
104020
  );
103594
104021
  });
103595
104022
  return {
@@ -109111,11 +109538,11 @@ function deviceCategoryToPanelTerm(cat) {
109111
109538
  function panelTermToDeviceCategory(term) {
109112
109539
  return term == null ? null : panelCategoryToWire(term);
109113
109540
  }
109114
- function esc9(s) {
109541
+ function esc10(s) {
109115
109542
  return String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
109116
109543
  }
109117
109544
  function categoryOptionsHTML(selected) {
109118
- const opt = (value, label, isSel) => `<option value="${value}"${isSel ? " selected" : ""}>${esc9(label)}</option>`;
109545
+ const opt = (value, label, isSel) => `<option value="${value}"${isSel ? " selected" : ""}>${esc10(label)}</option>`;
109119
109546
  return opt("", NONE_LABEL, selected == null) + opt("COMMON_AREA", deviceCategoryLabel("COMMON_AREA"), selected === "COMMON_AREA") + opt("SPECIFIC", deviceCategoryLabel("SPECIFIC"), selected === "SPECIFIC");
109120
109547
  }
109121
109548
  function openDeviceCategoryPanel(params) {
@@ -109152,8 +109579,8 @@ function openDeviceCategoryPanel(params) {
109152
109579
  <select class="myio-devcat__filter" data-devcat-filter="1" aria-label="Filtrar por categoria">
109153
109580
  <option value="all">Todas as categorias</option>
109154
109581
  <option value="uncategorized">Sem categoria</option>
109155
- <option value="COMMON_AREA">${esc9(deviceCategoryLabel("COMMON_AREA"))}</option>
109156
- <option value="SPECIFIC">${esc9(deviceCategoryLabel("SPECIFIC"))}</option>
109582
+ <option value="COMMON_AREA">${esc10(deviceCategoryLabel("COMMON_AREA"))}</option>
109583
+ <option value="SPECIFIC">${esc10(deviceCategoryLabel("SPECIFIC"))}</option>
109157
109584
  </select>
109158
109585
  <label class="myio-devcat__filter" style="display:flex;align-items:center;gap:6px;cursor:pointer;">
109159
109586
  <input type="checkbox" data-devcat-selectall="1" /> Selecionar vis\xEDveis
@@ -109162,9 +109589,9 @@ function openDeviceCategoryPanel(params) {
109162
109589
  <div class="myio-devcat__bulkbar" data-devcat-bulkbar="1">
109163
109590
  <span data-devcat-bulkcount="1">0 selecionados</span>
109164
109591
  <select data-devcat-bulkcat="1" aria-label="Categoria para os selecionados">
109165
- <option value="">${esc9(NONE_LABEL)}</option>
109166
- <option value="COMMON_AREA">${esc9(deviceCategoryLabel("COMMON_AREA"))}</option>
109167
- <option value="SPECIFIC">${esc9(deviceCategoryLabel("SPECIFIC"))}</option>
109592
+ <option value="">${esc10(NONE_LABEL)}</option>
109593
+ <option value="COMMON_AREA">${esc10(deviceCategoryLabel("COMMON_AREA"))}</option>
109594
+ <option value="SPECIFIC">${esc10(deviceCategoryLabel("SPECIFIC"))}</option>
109168
109595
  </select>
109169
109596
  <button type="button" class="myio-devcat__bulk-apply" data-devcat-bulkapply="1">Aplicar a selecionados</button>
109170
109597
  </div>
@@ -109194,16 +109621,16 @@ function openDeviceCategoryPanel(params) {
109194
109621
  return rows.filter((r) => matchesFilter(r) && matchesSearch(r));
109195
109622
  }
109196
109623
  function rowHTML(r) {
109197
- const name = esc9(r.label || r.code || r.deviceId);
109198
- const code = r.code ? `<span class="myio-devcat__row-code">${esc9(r.code)}</span>` : "";
109624
+ const name = esc10(r.label || r.code || r.deviceId);
109625
+ const code = r.code ? `<span class="myio-devcat__row-code">${esc10(r.code)}</span>` : "";
109199
109626
  const checked = selected.has(r.deviceId) ? " checked" : "";
109200
109627
  const focused = r.deviceId === params.focusDeviceId ? ' data-focused="1"' : "";
109201
109628
  const catAttr = r.tariffCategory == null ? "null" : r.tariffCategory;
109202
- return `<div class="myio-devcat__row" data-devcat-row="${esc9(r.deviceId)}" data-cat="${catAttr}"${focused}><input type="checkbox" class="myio-devcat__row-check" data-devcat-rowcheck="${esc9(
109629
+ return `<div class="myio-devcat__row" data-devcat-row="${esc10(r.deviceId)}" data-cat="${catAttr}"${focused}><input type="checkbox" class="myio-devcat__row-check" data-devcat-rowcheck="${esc10(
109203
109630
  r.deviceId
109204
- )}"${checked} aria-label="Selecionar ${name}" /><div class="myio-devcat__row-main"><span class="myio-devcat__row-label" title="${name}">${name}</span>` + code + `</div><select class="myio-devcat__row-select" data-devcat-rowselect="${esc9(
109631
+ )}"${checked} aria-label="Selecionar ${name}" /><div class="myio-devcat__row-main"><span class="myio-devcat__row-label" title="${name}">${name}</span>` + code + `</div><select class="myio-devcat__row-select" data-devcat-rowselect="${esc10(
109205
109632
  r.deviceId
109206
- )}" aria-label="Categoria de ${name}">${categoryOptionsHTML(r.tariffCategory)}</select><div class="myio-devcat__row-conflict" data-devcat-conflict="${esc9(r.deviceId)}"></div></div>`;
109633
+ )}" aria-label="Categoria de ${name}">${categoryOptionsHTML(r.tariffCategory)}</select><div class="myio-devcat__row-conflict" data-devcat-conflict="${esc10(r.deviceId)}"></div></div>`;
109207
109634
  }
109208
109635
  function render3() {
109209
109636
  const vis = visibleRows();
@@ -109363,7 +109790,7 @@ function openDeviceCategoryPanel(params) {
109363
109790
  rows = await port.listDevices({ customerId, domain: params.domain });
109364
109791
  } catch (err) {
109365
109792
  rows = [];
109366
- body.innerHTML = `<div class="myio-devcat__empty">N\xE3o foi poss\xEDvel carregar os dispositivos: ${esc9(
109793
+ body.innerHTML = `<div class="myio-devcat__empty">N\xE3o foi poss\xEDvel carregar os dispositivos: ${esc10(
109367
109794
  err?.message || "erro"
109368
109795
  )}</div>`;
109369
109796
  countEl.textContent = "";
@@ -116755,7 +117182,7 @@ var openCount3 = 0;
116755
117182
  function escapeHtml15(v) {
116756
117183
  return String(v).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
116757
117184
  }
116758
- function injectStyles13() {
117185
+ function injectStyles14() {
116759
117186
  if (!document.getElementById(FONT_LINK_ID3)) {
116760
117187
  const link = document.createElement("link");
116761
117188
  link.id = FONT_LINK_ID3;
@@ -116797,7 +117224,7 @@ function injectStyles13() {
116797
117224
  }
116798
117225
  var FOCUSABLE2 = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
116799
117226
  function openStandardModal(params) {
116800
- injectStyles13();
117227
+ injectStyles14();
116801
117228
  const dismissible = params.dismissible ?? true;
116802
117229
  const buttons = params.buttons ?? [];
116803
117230
  const modalId = `myio-stdmodal-${++openCount3}`;
@@ -116932,14 +117359,14 @@ function buildTemplateCsv(domain, devices, start, end, now = Date.now()) {
116932
117359
  if (domain === "energy") header.push("value_reactive_kvarh");
116933
117360
  const today = nowSaoPaulo(now);
116934
117361
  const lines = [header.join(";")];
116935
- const esc11 = (v) => /[;"\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
117362
+ const esc12 = (v) => /[;"\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
116936
117363
  const { ok } = splitImportableDevices(devices);
116937
117364
  for (const dev of ok) {
116938
117365
  for (const date of daysBetween(start, end)) {
116939
117366
  if (date > today.date) break;
116940
117367
  for (let h3 = 0; h3 < 24; h3++) {
116941
117368
  if (date === today.date && h3 >= today.hour) break;
116942
- const cols = [String(dev.centralId), String(Number(dev.slaveId)), esc11(dev.label || ""), date, `${pad25(h3)}:00`, ""];
117369
+ const cols = [String(dev.centralId), String(Number(dev.slaveId)), esc12(dev.label || ""), date, `${pad25(h3)}:00`, ""];
116943
117370
  if (domain === "energy") cols.push("");
116944
117371
  lines.push(cols.join(";"));
116945
117372
  }
@@ -117200,10 +117627,10 @@ function accumulatedRows(domain, entries, profile = DEFAULT_DISTRIBUTION_PROFILE
117200
117627
  }
117201
117628
  function buildAccumulatedTemplateCsv(domain, devices, start, end) {
117202
117629
  const lines = [["gateway_id", "slave_id", "device_name", "start_date", "end_date", TOTAL_COLUMN[domain]].join(";")];
117203
- const esc11 = (v) => /[;"\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
117630
+ const esc12 = (v) => /[;"\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
117204
117631
  for (const dev of devices || []) {
117205
117632
  if (!isImportableKey(dev)) continue;
117206
- lines.push([String(dev.centralId), String(Number(dev.slaveId)), esc11(dev.label || ""), start, end, ""].join(";"));
117633
+ lines.push([String(dev.centralId), String(Number(dev.slaveId)), esc12(dev.label || ""), start, end, ""].join(";"));
117207
117634
  }
117208
117635
  return { csv: "\uFEFF" + lines.join("\r\n") + "\r\n", rows: lines.length - 1 };
117209
117636
  }
@@ -117393,11 +117820,11 @@ function fmtSaoPaulo(iso) {
117393
117820
  return `${p(d.getUTCDate())}/${p(d.getUTCMonth() + 1)}/${d.getUTCFullYear()} ${p(d.getUTCHours())}:00`;
117394
117821
  }
117395
117822
  var STYLE_ID15 = "myio-tlmimport-styles";
117396
- function esc10(v) {
117823
+ function esc11(v) {
117397
117824
  return String(v ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
117398
117825
  }
117399
117826
  var fmtNum = (n, d = 0) => Number.isFinite(Number(n)) ? Number(n).toLocaleString("pt-BR", { minimumFractionDigits: d, maximumFractionDigits: d }) : "\u2014";
117400
- function injectStyles14() {
117827
+ function injectStyles15() {
117401
117828
  if (document.getElementById(STYLE_ID15)) return;
117402
117829
  const style = document.createElement("style");
117403
117830
  style.id = STYLE_ID15;
@@ -117456,7 +117883,7 @@ function injectStyles14() {
117456
117883
  document.head.appendChild(style);
117457
117884
  }
117458
117885
  function issuesTable(errors, limit = 100) {
117459
- const rows = errors.slice(0, limit).map((e) => `<tr><td>${esc10(e.line)}</td><td>${esc10(e.reason)}</td></tr>`).join("");
117886
+ const rows = errors.slice(0, limit).map((e) => `<tr><td>${esc11(e.line)}</td><td>${esc11(e.reason)}</td></tr>`).join("");
117460
117887
  const more = errors.length > limit ? `<p class="tlmi-muted">\u2026 e mais ${errors.length - limit} erro(s).</p>` : "";
117461
117888
  return `<div class="tlmi-errors"><table><thead><tr><th>Linha</th><th>Problema</th></tr></thead><tbody>${rows}</tbody></table></div>${more}`;
117462
117889
  }
@@ -117468,7 +117895,7 @@ function defaultPeriod(now) {
117468
117895
  return { start: ymd(start), end: ymd(end) };
117469
117896
  }
117470
117897
  function openTelemetryImportModal(params) {
117471
- injectStyles14();
117898
+ injectStyles15();
117472
117899
  const domain = params.domain;
117473
117900
  const txt = DOMAIN_TEXT[domain];
117474
117901
  const now = params.now ?? (() => Date.now());
@@ -117534,10 +117961,10 @@ function openTelemetryImportModal(params) {
117534
117961
  }
117535
117962
  function apiErrorBanner() {
117536
117963
  if (!s.apiError) return "";
117537
- return `<div class="tlmi-banner err" role="alert">${esc10(s.apiError)}${s.apiDetail ? `<div class="tlmi-tech">${esc10(s.apiDetail)}</div>` : ""}</div>`;
117964
+ return `<div class="tlmi-banner err" role="alert">${esc11(s.apiError)}${s.apiDetail ? `<div class="tlmi-tech">${esc11(s.apiDetail)}</div>` : ""}</div>`;
117538
117965
  }
117539
117966
  function step1() {
117540
- const warn = missingKey.length ? `<div class="tlmi-banner warn">${missingKey.length} dispositivo(s) sem central/endere\xE7o cadastrados ficam fora do modelo: ${esc10(
117967
+ const warn = missingKey.length ? `<div class="tlmi-banner warn">${missingKey.length} dispositivo(s) sem central/endere\xE7o cadastrados ficam fora do modelo: ${esc11(
117541
117968
  missingKey.slice(0, 5).map((d) => d.label).join(", ")
117542
117969
  )}${missingKey.length > 5 ? "\u2026" : ""}</div>` : "";
117543
117970
  const model = (value, title, hint) => `
@@ -117564,16 +117991,16 @@ function openTelemetryImportModal(params) {
117564
117991
  ${warn}
117565
117992
  <div class="tlmi-card"><h3>${s.model === "accumulated" ? "Per\xEDodo" : "Modelo da planilha"}</h3>
117566
117993
  <div class="tlmi-row">
117567
- <label class="tlmi-field">In\xEDcio<input type="date" data-field="start" value="${esc10(s.period.start)}" /></label>
117568
- <label class="tlmi-field">Fim<input type="date" data-field="end" value="${esc10(s.period.end)}" /></label>
117994
+ <label class="tlmi-field">In\xEDcio<input type="date" data-field="start" value="${esc11(s.period.start)}" /></label>
117995
+ <label class="tlmi-field">Fim<input type="date" data-field="end" value="${esc11(s.period.end)}" /></label>
117569
117996
  <button class="tlmi-btn" type="button" data-action="template" ${importable.length ? "" : "disabled"}>\u2B07 Baixar modelo (CSV)</button>
117570
117997
  </div>
117571
117998
  <p class="tlmi-muted" style="margin-top:8px">${importable.length} dispositivo(s) no modelo. ${s.model === "accumulated" ? "Para digitar na tela, clique em <strong>Avan\xE7ar</strong>." : "J\xE1 tem a planilha preenchida? Clique em <strong>Avan\xE7ar</strong>."}</p>
117572
117999
  </div>`;
117573
118000
  }
117574
118001
  function step2() {
117575
- const summary = s.fileName ? s.parseError ? `<div class="tlmi-banner err">${esc10(s.parseError)}</div>` : `<div class="tlmi-kpis">
117576
- <div class="tlmi-kpi"><span>Arquivo</span><strong style="font-size:13px">${esc10(s.fileName)}</strong></div>
118002
+ const summary = s.fileName ? s.parseError ? `<div class="tlmi-banner err">${esc11(s.parseError)}</div>` : `<div class="tlmi-kpis">
118003
+ <div class="tlmi-kpi"><span>Arquivo</span><strong style="font-size:13px">${esc11(s.fileName)}</strong></div>
117577
118004
  <div class="tlmi-kpi"><span>Linhas para importar</span><strong>${fmtNum(s.rows.length)}</strong></div>
117578
118005
  <div class="tlmi-kpi"><span>Em branco (ignoradas)</span><strong>${fmtNum(s.skippedEmpty)}</strong></div>
117579
118006
  <div class="tlmi-kpi"><span>Com erro</span><strong style="color:${s.localErrors.length ? "#dc2626" : "#16a34a"}">${fmtNum(s.localErrors.length)}</strong></div>
@@ -117613,12 +118040,12 @@ function openTelemetryImportModal(params) {
117613
118040
  }
117614
118041
  function step2Accumulated() {
117615
118042
  const fromFile = !!s.fileName && !s.parseError;
117616
- const form = fromFile ? `<p class="tlmi-muted">Usando <strong>${esc10(s.fileName)}</strong>.
117617
- <button class="tlmi-btn" type="button" data-action="use-form">Preencher na tela</button></p>` : `<p class="tlmi-muted" style="margin-bottom:8px">Per\xEDodo: ${esc10(s.period.start)} a ${esc10(s.period.end)}. Deixe em branco o que n\xE3o quer importar.</p>
118043
+ const form = fromFile ? `<p class="tlmi-muted">Usando <strong>${esc11(s.fileName)}</strong>.
118044
+ <button class="tlmi-btn" type="button" data-action="use-form">Preencher na tela</button></p>` : `<p class="tlmi-muted" style="margin-bottom:8px">Per\xEDodo: ${esc11(s.period.start)} a ${esc11(s.period.end)}. Deixe em branco o que n\xE3o quer importar.</p>
117618
118045
  <div class="tlmi-acc"><table><thead><tr><th>Dispositivo</th><th>Total (${txt.unit})</th></tr></thead><tbody>
117619
118046
  ${importable.map(
117620
- (d, i) => `<tr><td>${esc10(d.label)}</td>
117621
- <td><input inputmode="decimal" data-total="${i}" aria-label="Total de ${esc10(d.label)}" value="${esc10(s.formTotals[i] ?? "")}" /></td></tr>`
118047
+ (d, i) => `<tr><td>${esc11(d.label)}</td>
118048
+ <td><input inputmode="decimal" data-total="${i}" aria-label="Total de ${esc11(d.label)}" value="${esc11(s.formTotals[i] ?? "")}" /></td></tr>`
117622
118049
  ).join("")}
117623
118050
  </tbody></table></div>`;
117624
118051
  return `
@@ -117631,7 +118058,7 @@ function openTelemetryImportModal(params) {
117631
118058
  <input type="file" accept=".xlsx,.xls,.csv" data-field="file" hidden />
117632
118059
  \u{1F4C4} Clique ou arraste a planilha aqui (.xlsx ou .csv)
117633
118060
  </label>
117634
- ${s.parseError ? `<div class="tlmi-banner err" style="margin-top:10px">${esc10(s.parseError)}</div>` : ""}
118061
+ ${s.parseError ? `<div class="tlmi-banner err" style="margin-top:10px">${esc11(s.parseError)}</div>` : ""}
117635
118062
  </div>
117636
118063
  <div data-role="acc-summary" style="display:flex;flex-direction:column;gap:12px">${accSummaryHtml()}</div>`;
117637
118064
  }
@@ -117657,7 +118084,7 @@ function openTelemetryImportModal(params) {
117657
118084
  <div class="tlmi-kpi"><span>Total (${txt.unit})</span><strong>${fmtNum(p.totalValue, 2)}</strong></div>
117658
118085
  <div class="tlmi-kpi"><span>Leituras substitu\xEDdas</span><strong>${fmtNum(p.existingReadingsInTarget)}</strong></div>
117659
118086
  </div>
117660
- <p class="tlmi-muted">Per\xEDodo (hor\xE1rio de Bras\xEDlia): ${esc10(period)}</p>
118087
+ <p class="tlmi-muted">Per\xEDodo (hor\xE1rio de Bras\xEDlia): ${esc11(period)}</p>
117661
118088
  ${reactiveWarn}
117662
118089
  ${real > 0 ? `<div class="tlmi-banner warn"><strong>${fmtNum(real)} leitura(s) reais do medidor</strong> ser\xE3o substitu\xEDdas pelos valores da planilha.
117663
118090
  <label class="tlmi-check" style="margin-top:6px"><input type="checkbox" data-field="confirmReal" ${s.confirmReal ? "checked" : ""} />
@@ -117676,7 +118103,7 @@ function openTelemetryImportModal(params) {
117676
118103
  <div class="tlmi-muted" style="margin-top:4px">Dispositivos manuais continuam aparecendo sem comunica\xE7\xE3o no status:
117677
118104
  o status conta s\xF3 leitura medida. Os totais e os cards usam os dados importados.</div></div>`;
117678
118105
  } else if (j.status === "failed") {
117679
- banner = `<div class="tlmi-banner err">A importa\xE7\xE3o falhou${j.error ? `: ${esc10(j.error)}` : "."}</div>`;
118106
+ banner = `<div class="tlmi-banner err">A importa\xE7\xE3o falhou${j.error ? `: ${esc11(j.error)}` : "."}</div>`;
117680
118107
  } else if (j.status === "cancelled") {
117681
118108
  banner = '<div class="tlmi-banner warn">Importa\xE7\xE3o cancelada. As leituras anteriores foram mantidas.</div>';
117682
118109
  } else if (j.status === "reverted") {
@@ -117688,14 +118115,14 @@ function openTelemetryImportModal(params) {
117688
118115
  <span class="tlmi-muted">${s.confirmRevert ? "Remove as horas importadas e devolve as leituras apagadas. Clique de novo para confirmar." : "Use para remover uma importa\xE7\xE3o errada ou de teste."}</span>
117689
118116
  </div>` : "";
117690
118117
  return `
117691
- <div class="tlmi-card"><h3>Importa\xE7\xE3o <span style="font-weight:600;color:#64748b">${esc10(statusText)}</span></h3>
118118
+ <div class="tlmi-card"><h3>Importa\xE7\xE3o <span style="font-weight:600;color:#64748b">${esc11(statusText)}</span></h3>
117692
118119
  <div class="tlmi-progress" role="progressbar" aria-valuenow="${pct}" aria-valuemin="0" aria-valuemax="100"><i style="width:${pct}%"></i></div>
117693
118120
  <div class="tlmi-kpis" style="margin-top:12px">
117694
118121
  <div class="tlmi-kpi"><span>Progresso</span><strong>${fmtNum(pct)}%</strong></div>
117695
118122
  <div class="tlmi-kpi"><span>Leituras removidas</span><strong>${fmtNum(j.deleted)}</strong></div>
117696
118123
  <div class="tlmi-kpi"><span>Leituras gravadas</span><strong>${fmtNum(j.inserted)}</strong></div>
117697
118124
  </div>
117698
- ${j.phase && !terminal ? `<p class="tlmi-muted" style="margin-top:8px">Etapa: ${esc10(j.phase)}</p>` : ""}
118125
+ ${j.phase && !terminal ? `<p class="tlmi-muted" style="margin-top:8px">Etapa: ${esc11(j.phase)}</p>` : ""}
117699
118126
  ${!terminal && j.status !== "reverting" ? `<div style="margin-top:12px"><button class="tlmi-btn" type="button" data-action="cancel" ${s.busy ? "disabled" : ""}>Cancelar importa\xE7\xE3o</button>
117700
118127
  <span class="tlmi-muted" style="margin-left:8px">Voc\xEA pode fechar esta janela; a importa\xE7\xE3o continua.</span></div>` : ""}
117701
118128
  ${revert}
@@ -118005,8 +118432,8 @@ function siglaFromManualAsset(assetName) {
118005
118432
  return /^[A-Z0-9_]+$/.test(sigla) ? sigla : null;
118006
118433
  }
118007
118434
  function nextManualSeq(domain, sigla, existingNames) {
118008
- const esc11 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
118009
- const re = new RegExp(`^${esc11(NAME_PREFIX[domain])}${esc11(sigla)}_LOJA_(\\d+)_MANUAL$`, "i");
118435
+ const esc12 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
118436
+ const re = new RegExp(`^${esc12(NAME_PREFIX[domain])}${esc12(sigla)}_LOJA_(\\d+)_MANUAL$`, "i");
118010
118437
  const max = existingNames.reduce((acc, n) => {
118011
118438
  const m = re.exec(String(n || "").trim());
118012
118439
  return m ? Math.max(acc, Number(m[1])) : acc;
@@ -118155,7 +118582,7 @@ var STYLE_ID16 = "myio-manualdev-styles";
118155
118582
  function escapeHtml16(v) {
118156
118583
  return String(v ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
118157
118584
  }
118158
- function injectStyles15() {
118585
+ function injectStyles16() {
118159
118586
  if (document.getElementById(STYLE_ID16)) return;
118160
118587
  const style = document.createElement("style");
118161
118588
  style.id = STYLE_ID16;
@@ -118295,7 +118722,7 @@ function progressHtml(steps, message, ok, open = false) {
118295
118722
  function openManualDeviceModal(params) {
118296
118723
  const domain = params.domain;
118297
118724
  if (!MANUAL_DEVICE_PROFILES[domain]) throw new Error(`[openManualDeviceModal] dom\xEDnio inv\xE1lido: ${domain}`);
118298
- injectStyles15();
118725
+ injectStyles16();
118299
118726
  if (params.provisioner) return openProvisionedModal(params, params.provisioner);
118300
118727
  const values = { label: "", identifier: "" };
118301
118728
  let busy = false;
@@ -120565,7 +120992,7 @@ var FONT_LINK_ID4 = "myio-dialog-font-nunito";
120565
120992
  function escapeHtml17(value) {
120566
120993
  return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
120567
120994
  }
120568
- function injectStyles16() {
120995
+ function injectStyles17() {
120569
120996
  if (!document.getElementById(FONT_LINK_ID4)) {
120570
120997
  const link = document.createElement("link");
120571
120998
  link.id = FONT_LINK_ID4;
@@ -120650,7 +121077,7 @@ function createScrollableTabs(options) {
120650
121077
  if (typeof document === "undefined") {
120651
121078
  throw new Error("[createScrollableTabs] requires a browser environment");
120652
121079
  }
120653
- injectStyles16();
121080
+ injectStyles17();
120654
121081
  const theme = options.theme ?? "light";
120655
121082
  const accent = options.accent ?? "#7C3AED";
120656
121083
  const showArrows = options.showArrows ?? "auto";
@@ -120789,7 +121216,7 @@ function escapeHtml18(value) {
120789
121216
  return String(value == null ? "" : value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
120790
121217
  }
120791
121218
  var PRM = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
120792
- function injectStyles17() {
121219
+ function injectStyles18() {
120793
121220
  if (!document.getElementById(FONT_LINK_ID5)) {
120794
121221
  const link = document.createElement("link");
120795
121222
  link.id = FONT_LINK_ID5;
@@ -120958,7 +121385,7 @@ function createImgGallery(options) {
120958
121385
  if (typeof document === "undefined") {
120959
121386
  throw new Error("[createImgGallery] requires a browser environment");
120960
121387
  }
120961
- injectStyles17();
121388
+ injectStyles18();
120962
121389
  const locale = options.locale === "en-US" ? "en-US" : "pt-BR";
120963
121390
  const theme = options.theme ?? "light";
120964
121391
  const accent = options.accent ?? "#7C3AED";
@@ -134597,7 +135024,7 @@ var MODAL_CSS2 = `
134597
135024
  background: rgba(255, 255, 255, 0.2);
134598
135025
  }
134599
135026
  `;
134600
- function injectStyles18() {
135027
+ function injectStyles19() {
134601
135028
  if (document.getElementById(CSS_ID5)) return;
134602
135029
  const style = document.createElement("style");
134603
135030
  style.id = CSS_ID5;
@@ -134614,7 +135041,7 @@ var FilterModalComponent = class {
134614
135041
  showDeviceGrid;
134615
135042
  deviceSearchQuery = "";
134616
135043
  constructor(options) {
134617
- injectStyles18();
135044
+ injectStyles19();
134618
135045
  this.options = options;
134619
135046
  this.themeMode = options.themeMode || "light";
134620
135047
  this.selectedCategories = new Set(
@@ -138764,7 +139191,7 @@ function buildSections(ctx) {
138764
139191
  }
138765
139192
  ];
138766
139193
  }
138767
- function injectStyles19() {
139194
+ function injectStyles20() {
138768
139195
  if (document.getElementById(STYLE_ID20)) return;
138769
139196
  const style = document.createElement("style");
138770
139197
  style.id = STYLE_ID20;
@@ -138866,7 +139293,7 @@ function openMetasGuide(options = {}) {
138866
139293
  const sections = buildSections({ energy, water, curY, prevY });
138867
139294
  const total = sections.length;
138868
139295
  document.getElementById(ROOT_ID)?.remove();
138869
- injectStyles19();
139296
+ injectStyles20();
138870
139297
  const previouslyFocused = document.activeElement;
138871
139298
  let index = 0;
138872
139299
  let closed = false;
@@ -142711,7 +143138,7 @@ var TELEMETRY_GRID_SHOPPING_STYLES = `
142711
143138
  text-overflow: ellipsis;
142712
143139
  }
142713
143140
  `;
142714
- function injectStyles20(_container) {
143141
+ function injectStyles21(_container) {
142715
143142
  const styleId = "telemetry-grid-shopping-styles";
142716
143143
  if (document.getElementById(styleId)) {
142717
143144
  return;
@@ -142759,7 +143186,7 @@ var TelemetryGridShoppingView = class {
142759
143186
  // Render
142760
143187
  // =========================================================================
142761
143188
  render() {
142762
- injectStyles20(this.root);
143189
+ injectStyles21(this.root);
142763
143190
  this.root.innerHTML = this.buildHTML();
142764
143191
  this.cacheElements();
142765
143192
  this.bindEvents();
@@ -144430,7 +144857,7 @@ var TELEMETRY_INFO_SHOPPING_STYLES = `
144430
144857
  }
144431
144858
  }
144432
144859
  `;
144433
- function injectStyles21(_container) {
144860
+ function injectStyles22(_container) {
144434
144861
  const styleId = "telemetry-info-shopping-styles-v2";
144435
144862
  if (document.getElementById(styleId)) {
144436
144863
  return;
@@ -144490,7 +144917,7 @@ var TelemetryInfoShoppingView = class _TelemetryInfoShoppingView {
144490
144917
  // Render
144491
144918
  // =========================================================================
144492
144919
  render() {
144493
- injectStyles21(this.root);
144920
+ injectStyles22(this.root);
144494
144921
  this.root.innerHTML = this.buildHTML();
144495
144922
  this.cacheElements();
144496
144923
  this.bindEvents();
@@ -152871,10 +153298,10 @@ var AlarmsNotificationsPanelView = class {
152871
153298
  const renderListPanel = (group, items, sel) => {
152872
153299
  if (items.length === 0) return '<div class="afm-empty">Nenhum item encontrado</div>';
152873
153300
  return items.map((item) => {
152874
- const esc11 = this.esc(item);
153301
+ const esc12 = this.esc(item);
152875
153302
  return `<label class="afm-check-item">
152876
- <input type="checkbox" class="afm-checkbox" data-group="${group}" data-value="${esc11}"${sel.has(item) ? " checked" : ""}>
152877
- <span class="afm-check-label">${esc11}</span>
153303
+ <input type="checkbox" class="afm-checkbox" data-group="${group}" data-value="${esc12}"${sel.has(item) ? " checked" : ""}>
153304
+ <span class="afm-check-label">${esc12}</span>
152878
153305
  </label>`;
152879
153306
  }).join("");
152880
153307
  };
@@ -163343,7 +163770,7 @@ var STYLES = `
163343
163770
  color: var(--dgv6-ink-2);
163344
163771
  }
163345
163772
  `;
163346
- function injectStyles22() {
163773
+ function injectStyles23() {
163347
163774
  if (document.getElementById(CSS_ID6)) return;
163348
163775
  const style = document.createElement("style");
163349
163776
  style.id = CSS_ID6;
@@ -163382,7 +163809,7 @@ var DeviceGridV6View = class {
163382
163809
  // Render
163383
163810
  // =========================================================================
163384
163811
  render() {
163385
- injectStyles22();
163812
+ injectStyles23();
163386
163813
  this.root.innerHTML = this.buildHTML();
163387
163814
  this.cacheElements();
163388
163815
  this.bindEvents();
@@ -165752,7 +166179,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
165752
166179
  const docTitle = buildActivationReportTitle(deviceName, opts.customerName);
165753
166180
  const issuedAt = formatIssuedAt(/* @__PURE__ */ new Date(), locale);
165754
166181
  const utilization = data.totalHours > 0 ? (data.totalOnMinutes / (data.totalHours * 60) * 100).toFixed(1) : "0.0";
165755
- const esc11 = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
166182
+ const esc12 = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
165756
166183
  const htmlContent = `
165757
166184
  <!DOCTYPE html>
165758
166185
  <html lang="pt-BR">
@@ -165804,14 +166231,14 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
165804
166231
  <div class="brand">MyIO BAS</div>
165805
166232
  <h1>Relat\xF3rio de Acionamentos</h1>
165806
166233
  <div class="meta">
165807
- <div><b>Dispositivo:</b> ${esc11(deviceName)}</div>
166234
+ <div><b>Dispositivo:</b> ${esc12(deviceName)}</div>
165808
166235
  <div><b>Per\xEDodo:</b> ${periodStart} \u2014 ${periodEnd}</div>
165809
166236
  </div>
165810
166237
  </div>
165811
166238
  ${customerName ? `
165812
166239
  <div class="customer-badge">
165813
166240
  <div class="label">Cliente</div>
165814
- <div class="value">${esc11(customerName)}</div>
166241
+ <div class="value">${esc12(customerName)}</div>
165815
166242
  </div>` : ""}
165816
166243
  </div>
165817
166244
 
@@ -165822,7 +166249,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
165822
166249
  </div>
165823
166250
  <div class="summary-card accent-green">
165824
166251
  <div class="summary-value">${formatDurationMinutes(data.totalOnMinutes)}</div>
165825
- <div class="summary-label">Tempo ${esc11(labelOn)}</div>
166252
+ <div class="summary-label">Tempo ${esc12(labelOn)}</div>
165826
166253
  </div>
165827
166254
  <div class="summary-card accent-amber">
165828
166255
  <div class="summary-value">${utilization}%</div>
@@ -165850,7 +166277,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
165850
166277
  <tr>
165851
166278
  <td>${formatDateForExport(seg.startTime, locale)}</td>
165852
166279
  <td>${formatDateForExport(seg.endTime, locale)}</td>
165853
- <td><span class="pill ${seg.state === "on" ? "pill-on" : "pill-off"}">${seg.state === "on" ? esc11(labelOn) : esc11(labelOff)}</span></td>
166280
+ <td><span class="pill ${seg.state === "on" ? "pill-on" : "pill-off"}">${seg.state === "on" ? esc12(labelOn) : esc12(labelOff)}</span></td>
165854
166281
  <td>${formatDurationMinutes(seg.durationMinutes)}</td>
165855
166282
  <td>${seg.source === "manual" ? "Manual" : seg.source === "schedule" ? "Agendamento" : seg.source === "automation" ? "Automa\xE7\xE3o" : "Desconhecido"}</td>
165856
166283
  </tr>
@@ -165859,7 +166286,7 @@ function exportTimelineToPDF(data, labels = {}, locale = "pt-BR", opts = {}) {
165859
166286
  </table>
165860
166287
 
165861
166288
  <div class="footer">
165862
- <span class="issued">Emitido em ${issuedAt}</span>${customerName ? ` &middot; ${esc11(customerName)}` : ""} &middot; <span class="brand">MyIO BAS</span>
166289
+ <span class="issued">Emitido em ${issuedAt}</span>${customerName ? ` &middot; ${esc12(customerName)}` : ""} &middot; <span class="brand">MyIO BAS</span>
165863
166290
  </div>
165864
166291
  </body>
165865
166292
  </html>
@@ -171849,7 +172276,7 @@ var STYLES2 = `
171849
172276
  }
171850
172277
  #${MODAL_ID6} .gcdr-fail-item:last-child { border-bottom: none; }
171851
172278
  `;
171852
- function injectStyles23() {
172279
+ function injectStyles24() {
171853
172280
  if (document.getElementById(`${MODAL_ID6}-styles`)) return;
171854
172281
  const style = document.createElement("style");
171855
172282
  style.id = `${MODAL_ID6}-styles`;
@@ -171958,7 +172385,7 @@ function escHtml4(str) {
171958
172385
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
171959
172386
  }
171960
172387
  async function openGCDRSyncModal(params) {
171961
- injectStyles23();
172388
+ injectStyles24();
171962
172389
  removeExistingModal();
171963
172390
  if (!params.thingsboardToken) {
171964
172391
  alert("Token ThingsBoard n\xE3o encontrado. Fa\xE7a login novamente.");
@@ -172531,7 +172958,7 @@ var STYLES3 = `
172531
172958
  .abm-confirm-btn--confirm { background: #e67e22; color: #fff; }
172532
172959
  .abm-confirm-btn--confirm:hover { background: #cf6d17; }
172533
172960
  `;
172534
- function injectStyles24() {
172961
+ function injectStyles25() {
172535
172962
  if (document.getElementById(`${MODAL_ID7}-styles`)) return;
172536
172963
  const style = document.createElement("style");
172537
172964
  style.id = `${MODAL_ID7}-styles`;
@@ -173210,7 +173637,7 @@ async function fetchBundle(customerTB_ID, gcdrTenantId, baseUrl) {
173210
173637
  return json.data;
173211
173638
  }
173212
173639
  async function openAlarmBundleMapModal(params) {
173213
- injectStyles24();
173640
+ injectStyles25();
173214
173641
  removeExistingModal2();
173215
173642
  if (!params.customerTB_ID) {
173216
173643
  alert("Customer TB ID n\xE3o informado. N\xE3o \xE9 poss\xEDvel carregar o mapa de alarmes.");
@@ -177272,7 +177699,7 @@ var VirtualList = class {
177272
177699
 
177273
177700
  // src/components/header-annotations-panel/ExportModal.ts
177274
177701
  var MODAL_DOM_ID = "myio-annotations-export-modal";
177275
- var STYLES_ID4 = "myio-annotations-export-modal-styles";
177702
+ var STYLES_ID5 = "myio-annotations-export-modal-styles";
177276
177703
  var STYLES4 = `
177277
177704
  .${MODAL_DOM_ID}-backdrop {
177278
177705
  position: fixed; inset: 0; z-index: 99999;
@@ -177347,17 +177774,17 @@ var STYLES4 = `
177347
177774
  background: #cbd5e1; border-color: #cbd5e1; cursor: not-allowed;
177348
177775
  }
177349
177776
  `;
177350
- function injectStyles25() {
177777
+ function injectStyles26() {
177351
177778
  if (typeof document === "undefined") return;
177352
- if (document.getElementById(STYLES_ID4)) return;
177779
+ if (document.getElementById(STYLES_ID5)) return;
177353
177780
  const el2 = document.createElement("style");
177354
- el2.id = STYLES_ID4;
177781
+ el2.id = STYLES_ID5;
177355
177782
  el2.textContent = STYLES4;
177356
177783
  document.head.appendChild(el2);
177357
177784
  }
177358
177785
  var _activeBackdrop = null;
177359
177786
  function openExportModal(options) {
177360
- injectStyles25();
177787
+ injectStyles26();
177361
177788
  closeExportModal();
177362
177789
  const backdrop = document.createElement("div");
177363
177790
  backdrop.className = `${MODAL_DOM_ID}-backdrop`;