Added Alexa Music
This commit is contained in:
1 parent
92c5268dc8
commit
28a8cb98f6
757 files changed
+151171
-85450
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
/** Unit tests for formatDate/formatDateTime honouring HA's per-user profile
|
||||
* date/time format (issue #97 — dates followed only the UI language, so an
|
||||
* English UI always showed mm/dd/yyyy even with dd/mm/yyyy configured). */
|
||||
|
||||
import { expect } from "@open-wc/testing";
|
||||
import { formatDate, formatDateTime, setDateTimePrefs } from "../styles";
|
||||
|
||||
const reset = () => setDateTimePrefs({ date_format: undefined, time_format: undefined });
|
||||
|
||||
describe("formatDate with HA profile date_format (#97)", () => {
|
||||
afterEach(reset);
|
||||
|
||||
it("DMY renders dd/mm/yyyy regardless of language", () => {
|
||||
setDateTimePrefs({ date_format: "DMY" });
|
||||
expect(formatDate("2026-08-10", "en")).to.equal("10/08/2026");
|
||||
expect(formatDate("2026-08-10", "de")).to.equal("10/08/2026");
|
||||
});
|
||||
|
||||
it("MDY renders mm/dd/yyyy regardless of language", () => {
|
||||
setDateTimePrefs({ date_format: "MDY" });
|
||||
expect(formatDate("2026-08-10", "de")).to.equal("08/10/2026");
|
||||
});
|
||||
|
||||
it("YMD renders yyyy-mm-dd", () => {
|
||||
setDateTimePrefs({ date_format: "YMD" });
|
||||
expect(formatDate("2026-08-10", "en")).to.equal("2026-08-10");
|
||||
});
|
||||
|
||||
it('"language" / unset keeps the language-derived format (backwards compatible)', () => {
|
||||
setDateTimePrefs({ date_format: "language" });
|
||||
expect(formatDate("2026-08-10", "en")).to.equal("08/10/2026"); // en → en-US
|
||||
expect(formatDate("2026-08-10", "de")).to.equal("10.08.2026"); // de → de-DE
|
||||
reset();
|
||||
expect(formatDate("2026-08-10", "de")).to.equal("10.08.2026");
|
||||
});
|
||||
|
||||
it("null/invalid input unchanged by prefs", () => {
|
||||
setDateTimePrefs({ date_format: "DMY" });
|
||||
expect(formatDate(null, "en")).to.equal("—");
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatDateTime with HA profile time_format (#97)", () => {
|
||||
afterEach(reset);
|
||||
|
||||
it("24 forces 24h clock even for en", () => {
|
||||
setDateTimePrefs({ date_format: "DMY", time_format: "24" });
|
||||
expect(formatDateTime("2026-08-10T14:30:00", "en")).to.equal("10/08/2026 14:30");
|
||||
});
|
||||
|
||||
it("12 forces a 12h clock even for de", () => {
|
||||
setDateTimePrefs({ date_format: "DMY", time_format: "12" });
|
||||
const out = formatDateTime("2026-08-10T14:30:00", "de");
|
||||
expect(out.startsWith("10/08/2026 ")).to.be.true;
|
||||
expect(out).to.match(/2:30/);
|
||||
expect(out.toLowerCase()).to.match(/pm|nachm/);
|
||||
});
|
||||
});
|
||||
@@ -259,13 +259,13 @@ export class MaintenanceSettingsView extends LitElement {
|
||||
${this._renderPanelAccess(L)}
|
||||
${this._renderGeneral(L)}
|
||||
${this._renderObjectsColumns(L)}
|
||||
${this._renderTemplateToggles(L)}
|
||||
${this._settings.general.notifications_enabled ? this._renderNotifications(L) : nothing}
|
||||
${this.features.budget ? this._renderBudget(L) : nothing}
|
||||
${this._renderArchive(L)}
|
||||
${this._renderVacation(L)}
|
||||
${this._renderPrintQr(L)}
|
||||
${this._renderImportExport(L)}
|
||||
${this._renderTemplateToggles(L)}
|
||||
${this._toast ? html`<div class="settings-toast">${this._toast}</div>` : nothing}
|
||||
`;
|
||||
}
|
||||
@@ -400,23 +400,52 @@ export class MaintenanceSettingsView extends LitElement {
|
||||
private _renderTemplateToggles(L: string) {
|
||||
this._loadTemplates();
|
||||
const hidden = new Set(this._settings!.disabled_template_ids || []);
|
||||
// v2.27: cluster by category (declaration order = display order) so the
|
||||
// growing catalog stays scannable — each group gets a header with its
|
||||
// icon, an enabled/total count and a toggle-all checkbox.
|
||||
const byCat = new Map<string, typeof this._allTemplates>();
|
||||
for (const catId of Object.keys(this._templateCategories)) byCat.set(catId, []);
|
||||
for (const tpl of this._allTemplates) {
|
||||
if (!byCat.has(tpl.category)) byCat.set(tpl.category, []);
|
||||
byCat.get(tpl.category)!.push(tpl);
|
||||
}
|
||||
const catName = (catId: string) =>
|
||||
(this._templateCategories[catId]?.["name_" + L] as string)
|
||||
|| (this._templateCategories[catId]?.name_en as string)
|
||||
|| catId;
|
||||
return html`
|
||||
<div class="settings-section" data-section="templates">
|
||||
<h3>${t("settings_templates_label", L)}</h3>
|
||||
<p class="section-desc">${t("settings_templates_hint", L)}</p>
|
||||
${this._allTemplates.map((tpl) => html`
|
||||
<label class="setting-row">
|
||||
<span>
|
||||
<span class="setting-label">${tpl.name}</span>
|
||||
<span class="setting-desc">${this._templateCategories[tpl.category]?.["name_" + L] || this._templateCategories[tpl.category]?.name_en || tpl.category}</span>
|
||||
</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${!hidden.has(tpl.id)}
|
||||
@change=${(e: Event) => this._toggleTemplate(tpl.id, (e.target as HTMLInputElement).checked)}
|
||||
/>
|
||||
</label>
|
||||
`)}
|
||||
${[...byCat.entries()].filter(([, tpls]) => tpls.length > 0).map(([catId, tpls]) => {
|
||||
const enabled = tpls.filter((tpl) => !hidden.has(tpl.id)).length;
|
||||
return html`
|
||||
<div class="tpl-group">
|
||||
<label class="tpl-group-head">
|
||||
<ha-icon icon=${(this._templateCategories[catId]?.icon as string) || "mdi:folder-outline"}></ha-icon>
|
||||
<span class="tpl-group-name">${catName(catId)}</span>
|
||||
<span class="tpl-group-count">${enabled}/${tpls.length}</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
title=${t("settings_templates_toggle_group", L)}
|
||||
.checked=${enabled === tpls.length}
|
||||
@change=${(e: Event) =>
|
||||
this._toggleTemplateGroup(tpls.map((tpl) => tpl.id), (e.target as HTMLInputElement).checked)}
|
||||
/>
|
||||
</label>
|
||||
${tpls.map((tpl) => html`
|
||||
<label class="setting-row tpl-row">
|
||||
<span class="setting-label">${tpl.name}</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${!hidden.has(tpl.id)}
|
||||
@change=${(e: Event) => this._toggleTemplate(tpl.id, (e.target as HTMLInputElement).checked)}
|
||||
/>
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
`;
|
||||
})}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -428,6 +457,16 @@ export class MaintenanceSettingsView extends LitElement {
|
||||
this._updateSetting("disabled_template_ids", [...hidden]);
|
||||
}
|
||||
|
||||
/** Toggle-all for one category group in the template gallery. */
|
||||
private _toggleTemplateGroup(ids: string[], visible: boolean): void {
|
||||
const hidden = new Set(this._settings!.disabled_template_ids || []);
|
||||
for (const id of ids) {
|
||||
if (visible) hidden.delete(id);
|
||||
else hidden.add(id);
|
||||
}
|
||||
this._updateSetting("disabled_template_ids", [...hidden]);
|
||||
}
|
||||
|
||||
private _renderObjectsColumns(L: string) {
|
||||
const selected = sanitizeColumns(this._settings!.objects_table_columns);
|
||||
return html`
|
||||
@@ -1539,6 +1578,25 @@ export class MaintenanceSettingsView extends LitElement {
|
||||
cursor: pointer;
|
||||
gap: 12px;
|
||||
}
|
||||
/* v2.27: template gallery clustered by category */
|
||||
.tpl-group { margin-top: 14px; }
|
||||
.tpl-group-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 0 6px;
|
||||
border-bottom: 2px solid var(--divider-color, #e0e0e0);
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tpl-group-head ha-icon { --mdc-icon-size: 18px; color: var(--primary-color); }
|
||||
.tpl-group-name { flex: 1; }
|
||||
.tpl-group-count {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
font-weight: 400;
|
||||
}
|
||||
.tpl-row { padding-left: 26px; }
|
||||
.setting-row:last-child { border-bottom: none; }
|
||||
.setting-row.sub-row {
|
||||
padding-left: 16px;
|
||||
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Uložené zobrazení",
|
||||
"card_saved_view_none": "Žádné",
|
||||
"card_saved_view_help": "Použije filtry stavu, uživatele a štítku zobrazení navíc k výše uvedeným filtrům. Řazení a seskupení zobrazení jsou nastavení panelu a na kartě se nepoužijí.",
|
||||
"doc_part_none": "K tomuto dílu nejsou připojeny žádné dokumenty."
|
||||
"doc_part_none": "K tomuto dílu nejsou připojeny žádné dokumenty.",
|
||||
"settings_templates_toggle_group": "Zapnout nebo vypnout všechny šablony v této skupině"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Gemt visning",
|
||||
"card_saved_view_none": "Ingen",
|
||||
"card_saved_view_help": "Anvender visningens status-, bruger- og etiketfiltre oven på filtrene ovenfor. Visningens sortering og gruppering er panelvisningsindstillinger og anvendes ikke på kortet.",
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne del."
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne del.",
|
||||
"settings_templates_toggle_group": "Slå alle skabeloner i denne gruppe til eller fra"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Gespeicherte Ansicht",
|
||||
"card_saved_view_none": "Keine",
|
||||
"card_saved_view_help": "Wendet die Status-, Nutzer- und Label-Filter der Ansicht zusätzlich zu den obigen Filtern an. Sortierung und Gruppierung der Ansicht sind Panel-Darstellung und werden auf der Karte nicht angewendet.",
|
||||
"doc_part_none": "Keine Dokumente mit diesem Ersatzteil verknüpft."
|
||||
"doc_part_none": "Keine Dokumente mit diesem Ersatzteil verknüpft.",
|
||||
"settings_templates_toggle_group": "Alle Vorlagen dieser Gruppe ein- oder ausschalten"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Saved view",
|
||||
"card_saved_view_none": "None",
|
||||
"card_saved_view_help": "Applies the view's status, user and label filters on top of the filters above. The view's sorting and grouping are panel display settings and are not applied on the card.",
|
||||
"doc_part_none": "No documents linked to this part."
|
||||
"doc_part_none": "No documents linked to this part.",
|
||||
"settings_templates_toggle_group": "Enable or disable all templates in this group"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vista guardada",
|
||||
"card_saved_view_none": "Ninguna",
|
||||
"card_saved_view_help": "Aplica los filtros de estado, usuario y etiqueta de la vista además de los filtros anteriores. El orden y la agrupación de la vista son ajustes de visualización del panel y no se aplican en la tarjeta.",
|
||||
"doc_part_none": "No hay documentos vinculados a esta pieza."
|
||||
"doc_part_none": "No hay documentos vinculados a esta pieza.",
|
||||
"settings_templates_toggle_group": "Activar o desactivar todas las plantillas de este grupo"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Tallennettu näkymä",
|
||||
"card_saved_view_none": "Ei mitään",
|
||||
"card_saved_view_help": "Soveltaa näkymän tila-, käyttäjä- ja tunnistesuodattimet yllä olevien suodattimien lisäksi. Näkymän lajittelu ja ryhmittely ovat paneelin näyttöasetuksia eivätkä vaikuta korttiin.",
|
||||
"doc_part_none": "Tähän osaan ei ole linkitetty asiakirjoja."
|
||||
"doc_part_none": "Tähän osaan ei ole linkitetty asiakirjoja.",
|
||||
"settings_templates_toggle_group": "Ota kaikki tämän ryhmän mallit käyttöön tai pois"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vue enregistrée",
|
||||
"card_saved_view_none": "Aucune",
|
||||
"card_saved_view_help": "Applique les filtres statut, utilisateur et étiquette de la vue en plus des filtres ci-dessus. Le tri et le regroupement de la vue sont des réglages d'affichage du panneau et ne s'appliquent pas à la carte.",
|
||||
"doc_part_none": "Aucun document lié à cette pièce."
|
||||
"doc_part_none": "Aucun document lié à cette pièce.",
|
||||
"settings_templates_toggle_group": "Activer ou désactiver tous les modèles de ce groupe"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "सहेजा गया व्यू",
|
||||
"card_saved_view_none": "कोई नहीं",
|
||||
"card_saved_view_help": "ऊपर दिए फ़िल्टरों के अतिरिक्त व्यू के स्थिति, उपयोगकर्ता और लेबल फ़िल्टर लागू करता है। व्यू का क्रम और समूहन पैनल की प्रदर्शन सेटिंग हैं और कार्ड पर लागू नहीं होते।",
|
||||
"doc_part_none": "इस पुर्ज़े से कोई दस्तावेज़ जुड़ा नहीं है।"
|
||||
"doc_part_none": "इस पुर्ज़े से कोई दस्तावेज़ जुड़ा नहीं है।",
|
||||
"settings_templates_toggle_group": "इस समूह के सभी टेम्पलेट चालू या बंद करें"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vista salvata",
|
||||
"card_saved_view_none": "Nessuna",
|
||||
"card_saved_view_help": "Applica i filtri stato, utente ed etichetta della vista in aggiunta ai filtri sopra. Ordinamento e raggruppamento della vista sono impostazioni di visualizzazione del pannello e non si applicano alla scheda.",
|
||||
"doc_part_none": "Nessun documento collegato a questo ricambio."
|
||||
"doc_part_none": "Nessun documento collegato a questo ricambio.",
|
||||
"settings_templates_toggle_group": "Attiva o disattiva tutti i modelli di questo gruppo"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "保存済みビュー",
|
||||
"card_saved_view_none": "なし",
|
||||
"card_saved_view_help": "上記のフィルターに加えて、ビューのステータス・ユーザー・ラベルのフィルターを適用します。ビューの並び順とグループ化はパネルの表示設定であり、カードには適用されません。",
|
||||
"doc_part_none": "この部品にリンクされた文書はありません。"
|
||||
"doc_part_none": "この部品にリンクされた文書はありません。",
|
||||
"settings_templates_toggle_group": "このグループのテンプレートをすべて有効/無効にする"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Lagret visning",
|
||||
"card_saved_view_none": "Ingen",
|
||||
"card_saved_view_help": "Bruker visningens status-, bruker- og etikettfiltre i tillegg til filtrene over. Visningens sortering og gruppering er panelvisningsinnstillinger og brukes ikke på kortet.",
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne delen."
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne delen.",
|
||||
"settings_templates_toggle_group": "Slå alle maler i denne gruppen på eller av"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Opgeslagen weergave",
|
||||
"card_saved_view_none": "Geen",
|
||||
"card_saved_view_help": "Past de status-, gebruikers- en labelfilters van de weergave toe bovenop de bovenstaande filters. Sortering en groepering van de weergave zijn paneelweergave-instellingen en gelden niet voor de kaart.",
|
||||
"doc_part_none": "Geen documenten gekoppeld aan dit onderdeel."
|
||||
"doc_part_none": "Geen documenten gekoppeld aan dit onderdeel.",
|
||||
"settings_templates_toggle_group": "Alle sjablonen in deze groep in- of uitschakelen"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Zapisany widok",
|
||||
"card_saved_view_none": "Brak",
|
||||
"card_saved_view_help": "Stosuje filtry statusu, użytkownika i etykiety widoku oprócz powyższych filtrów. Sortowanie i grupowanie widoku to ustawienia wyświetlania panelu i nie są stosowane na karcie.",
|
||||
"doc_part_none": "Brak dokumentów powiązanych z tą częścią."
|
||||
"doc_part_none": "Brak dokumentów powiązanych z tą częścią.",
|
||||
"settings_templates_toggle_group": "Włącz lub wyłącz wszystkie szablony w tej grupie"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vista guardada",
|
||||
"card_saved_view_none": "Nenhuma",
|
||||
"card_saved_view_help": "Aplica os filtros de estado, utilizador e etiqueta da vista além dos filtros acima. A ordenação e o agrupamento da vista são definições de apresentação do painel e não se aplicam ao cartão.",
|
||||
"doc_part_none": "Nenhum documento associado a esta peça."
|
||||
"doc_part_none": "Nenhum documento associado a esta peça.",
|
||||
"settings_templates_toggle_group": "Ativar ou desativar todos os modelos deste grupo"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Сохранённое представление",
|
||||
"card_saved_view_none": "Нет",
|
||||
"card_saved_view_help": "Применяет фильтры статуса, пользователя и метки представления в дополнение к фильтрам выше. Сортировка и группировка представления — настройки отображения панели и на карточке не применяются.",
|
||||
"doc_part_none": "К этой запчасти не привязаны документы."
|
||||
"doc_part_none": "К этой запчасти не привязаны документы.",
|
||||
"settings_templates_toggle_group": "Включить или выключить все шаблоны этой группы"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Sparad vy",
|
||||
"card_saved_view_none": "Ingen",
|
||||
"card_saved_view_help": "Tillämpar vyns status-, användar- och etikettfilter utöver filtren ovan. Vyns sortering och gruppering är panelvisningsinställningar och tillämpas inte på kortet.",
|
||||
"doc_part_none": "Inga dokument länkade till denna del."
|
||||
"doc_part_none": "Inga dokument länkade till denna del.",
|
||||
"settings_templates_toggle_group": "Aktivera eller inaktivera alla mallar i denna grupp"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Збережене подання",
|
||||
"card_saved_view_none": "Немає",
|
||||
"card_saved_view_help": "Застосовує фільтри статусу, користувача та мітки подання додатково до фільтрів вище. Сортування та групування подання — налаштування відображення панелі й на картці не застосовуються.",
|
||||
"doc_part_none": "До цієї запчастини не прив'язано документів."
|
||||
"doc_part_none": "До цієї запчастини не прив'язано документів.",
|
||||
"settings_templates_toggle_group": "Увімкнути або вимкнути всі шаблони цієї групи"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "已保存的视图",
|
||||
"card_saved_view_none": "无",
|
||||
"card_saved_view_help": "在上述筛选之外再应用该视图的状态、用户和标签筛选。视图的排序和分组属于面板显示设置,不会应用到卡片上。",
|
||||
"doc_part_none": "此部件没有关联的文档。"
|
||||
"doc_part_none": "此部件没有关联的文档。",
|
||||
"settings_templates_toggle_group": "启用或禁用此组中的所有模板"
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
type CalendarEvent,
|
||||
} from "./helpers/calendar-bucket";
|
||||
import { calendarStyles } from "./calendar-styles";
|
||||
import { sharedStyles, DEFAULT_CURRENCY_SYMBOL, t, ensureLocale, isLocaleLoaded } from "./styles";
|
||||
import { sharedStyles, DEFAULT_CURRENCY_SYMBOL, t, ensureLocale, isLocaleLoaded, setDateTimePrefs } from "./styles";
|
||||
import type {
|
||||
HomeAssistant,
|
||||
MaintenanceObjectResponse,
|
||||
@@ -114,6 +114,8 @@ export class MaintenanceCalendarCard extends LitElement {
|
||||
|
||||
updated(changedProps: Map<string, unknown>): void {
|
||||
super.updated(changedProps);
|
||||
// Dates/times follow the HA profile format, not just the language (#97).
|
||||
if (changedProps.has("hass")) setDateTimePrefs(this.hass?.locale);
|
||||
const lang = this.hass?.language;
|
||||
if (lang && !isLocaleLoaded(lang)) {
|
||||
ensureLocale(lang).then(() => this.requestUpdate());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { LitElement, html, css, nothing } from "lit";
|
||||
import { property, state } from "lit/decorators.js";
|
||||
import { sharedStyles, STATUS_COLORS, t, ensureLocale, isLocaleLoaded } from "./styles";
|
||||
import { sharedStyles, STATUS_COLORS, t, ensureLocale, isLocaleLoaded, setDateTimePrefs } from "./styles";
|
||||
import type {
|
||||
HomeAssistant,
|
||||
MaintenanceObjectResponse,
|
||||
@@ -89,6 +89,8 @@ export class MaintenanceSupporterCard extends LitElement {
|
||||
|
||||
updated(changedProps: Map<string, unknown>): void {
|
||||
super.updated(changedProps);
|
||||
// Dates/times follow the HA profile format, not just the language (#97).
|
||||
if (changedProps.has("hass")) setDateTimePrefs(this.hass?.locale);
|
||||
const lang = this.hass?.language;
|
||||
if (lang && !isLocaleLoaded(lang)) {
|
||||
ensureLocale(lang).then(() => this.requestUpdate());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { LitElement, html, nothing } from "lit";
|
||||
import { isSafeHttpUrl } from "./helpers/url";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { sharedStyles, STATUS_COLORS, STATUS_ICONS, DEFAULT_CURRENCY_SYMBOL, t, ensureLocale, isLocaleLoaded, formatDate, formatDueDays, formatInterval, formatRecurrence } from "./styles";
|
||||
import { sharedStyles, STATUS_COLORS, STATUS_ICONS, DEFAULT_CURRENCY_SYMBOL, t, ensureLocale, isLocaleLoaded, formatDate, formatDueDays, formatInterval, formatRecurrence, setDateTimePrefs } from "./styles";
|
||||
import { LS_KEYS } from "./helpers/storage-keys";
|
||||
import { daysProgress } from "./helpers/interval";
|
||||
import { buildObjectReportHtml, type ReportLabels } from "./helpers/report";
|
||||
@@ -269,6 +269,8 @@ export class MaintenanceSupporterPanel extends LitElement {
|
||||
|
||||
updated(changedProps: Map<string, unknown>): void {
|
||||
super.updated(changedProps);
|
||||
// Dates/times follow the HA profile format, not just the language (#97).
|
||||
if (changedProps.has("hass")) setDateTimePrefs(this.hass?.locale);
|
||||
// Lazy-load the user's UI language (non-EN tables aren't bundled) and
|
||||
// re-render once it arrives. EN is bundled, so strings read in English
|
||||
// until then rather than as raw keys.
|
||||
|
||||
@@ -45,6 +45,10 @@ export const panelStyles = css`
|
||||
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
/* Wrap at EVERY width: with six filter dropdowns + action buttons the
|
||||
bar doesn't fit one line even on wide tablets, and unwrapped flex
|
||||
compressed the selects into unreadable stubs ("— No v", "Al"). */
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
padding: 8px 0;
|
||||
@@ -72,6 +76,9 @@ export const panelStyles = css`
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color, #fff);
|
||||
color: var(--primary-text-color);
|
||||
/* Readability floor — selects wrap to the next line instead of
|
||||
shrinking their selected value into ellipsis. */
|
||||
min-width: 96px;
|
||||
}
|
||||
|
||||
/* Desktop: the LIST owns the 7-column grid and every row is a subgrid
|
||||
|
||||
@@ -127,29 +127,72 @@ function langToLocale(lang?: string): string {
|
||||
return map[l] ?? "en-US";
|
||||
}
|
||||
|
||||
/** Format a date string (ISO) in the user's locale.
|
||||
/** HA per-user date/time format prefs (issue #97).
|
||||
*
|
||||
* hass.locale.date_format ("language"|"system"|"DMY"|"MDY"|"YMD") and
|
||||
* time_format ("language"|"system"|"12"|"24") are frontend PROFILE settings —
|
||||
* deriving the format from the UI language alone showed en users mm/dd/yyyy
|
||||
* even with dd/mm/yyyy configured. Stored on a window singleton because each
|
||||
* bundle (panel / cards / dialog-mount) gets its own module scope; every
|
||||
* surface calls setDateTimePrefs() on hass updates and whichever runs first
|
||||
* wins for all of them.
|
||||
*/
|
||||
interface DateTimePrefs {
|
||||
date?: string;
|
||||
time?: string;
|
||||
}
|
||||
const _w = window as unknown as { __msDateTimePrefs?: DateTimePrefs };
|
||||
const DT_PREFS: DateTimePrefs = (_w.__msDateTimePrefs ??= {});
|
||||
|
||||
/** Feed HA's per-user date/time format into formatDate/formatDateTime. */
|
||||
export function setDateTimePrefs(locale?: { date_format?: string; time_format?: string }): void {
|
||||
if (!locale) return;
|
||||
DT_PREFS.date = locale.date_format;
|
||||
DT_PREFS.time = locale.time_format;
|
||||
}
|
||||
|
||||
function _formatDateObj(d: Date, lang?: string): string {
|
||||
const dd = String(d.getDate()).padStart(2, "0");
|
||||
const mm = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const yyyy = String(d.getFullYear());
|
||||
switch (DT_PREFS.date) {
|
||||
case "DMY": return `${dd}/${mm}/${yyyy}`;
|
||||
case "MDY": return `${mm}/${dd}/${yyyy}`;
|
||||
case "YMD": return `${yyyy}-${mm}-${dd}`;
|
||||
case "system":
|
||||
return d.toLocaleDateString(undefined, { day: "2-digit", month: "2-digit", year: "numeric" });
|
||||
default: // "language" or unset — derive from the UI language (pre-#97 behaviour)
|
||||
return d.toLocaleDateString(langToLocale(lang), { day: "2-digit", month: "2-digit", year: "numeric" });
|
||||
}
|
||||
}
|
||||
|
||||
function _formatTimeObj(d: Date, lang?: string): string {
|
||||
switch (DT_PREFS.time) {
|
||||
case "12": return d.toLocaleTimeString(langToLocale(lang), { hour: "2-digit", minute: "2-digit", hour12: true });
|
||||
case "24": return d.toLocaleTimeString(langToLocale(lang), { hour: "2-digit", minute: "2-digit", hour12: false });
|
||||
case "system": return d.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });
|
||||
default: return d.toLocaleTimeString(langToLocale(lang), { hour: "2-digit", minute: "2-digit" });
|
||||
}
|
||||
}
|
||||
|
||||
/** Format a date string (ISO) honouring the HA profile date format.
|
||||
* Appends T00:00:00 to date-only strings so JS parses them as local time, not UTC. */
|
||||
export function formatDate(iso: string | null | undefined, lang?: string): string {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
const local = iso.includes("T") ? iso : iso + "T00:00:00";
|
||||
return new Date(local).toLocaleDateString(langToLocale(lang), { day: "2-digit", month: "2-digit", year: "numeric" });
|
||||
return _formatDateObj(new Date(local), lang);
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
|
||||
/** Format a datetime string (ISO) in the user's locale. */
|
||||
/** Format a datetime string (ISO) honouring the HA profile date/time formats. */
|
||||
export function formatDateTime(iso: string | null | undefined, lang?: string): string {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
const locale = langToLocale(lang);
|
||||
const d = new Date(iso);
|
||||
return (
|
||||
d.toLocaleDateString(locale, { day: "2-digit", month: "2-digit", year: "numeric" }) +
|
||||
" " +
|
||||
d.toLocaleTimeString(locale, { hour: "2-digit", minute: "2-digit" })
|
||||
);
|
||||
return _formatDateObj(d, lang) + " " + _formatTimeObj(d, lang);
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
@@ -1392,7 +1435,14 @@ export const sharedStyles = css`
|
||||
.sparkline-svg { height: 100px; }
|
||||
|
||||
.stats-bar { gap: 8px; padding: 12px; }
|
||||
.stat-item { min-width: 60px; }
|
||||
/* min-width: 0 (NOT a fixed floor) — a fixed min-width re-enables the
|
||||
grid's auto minimum, so the 5 KPI tracks couldn't shrink below their
|
||||
label text and the last KPI clipped off-screen on phones (the header
|
||||
only *looked* cut — .content scrolls sideways, but nothing hints so).
|
||||
With 0 the tracks compress and the labels wrap to a second line. */
|
||||
.stat-item { min-width: 0; }
|
||||
.stat-item.clickable { padding: 4px 4px; }
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;
|
||||
@@ -464,7 +464,10 @@ export interface HomeAssistant {
|
||||
}>;
|
||||
}>>;
|
||||
language: string;
|
||||
locale?: { language: string; number_format?: string };
|
||||
// date_format/time_format are HA's per-user PROFILE settings ("language" |
|
||||
// "system" | "DMY" | "MDY" | "YMD" resp. "language" | "system" | "12" | "24")
|
||||
// — issue #97: dates must follow them, not just the UI language.
|
||||
locale?: { language: string; number_format?: string; date_format?: string; time_format?: string };
|
||||
localize(key: string, ...args: unknown[]): string;
|
||||
user?: { id: string; name: string; is_admin: boolean; is_owner: boolean };
|
||||
/** Current access token — used for authenticated `fetch()` to our HTTP
|
||||
|
||||
Binary file not shown.
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Uložené zobrazení",
|
||||
"card_saved_view_none": "Žádné",
|
||||
"card_saved_view_help": "Použije filtry stavu, uživatele a štítku zobrazení navíc k výše uvedeným filtrům. Řazení a seskupení zobrazení jsou nastavení panelu a na kartě se nepoužijí.",
|
||||
"doc_part_none": "K tomuto dílu nejsou připojeny žádné dokumenty."
|
||||
"doc_part_none": "K tomuto dílu nejsou připojeny žádné dokumenty.",
|
||||
"settings_templates_toggle_group": "Zapnout nebo vypnout všechny šablony v této skupině"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Gemt visning",
|
||||
"card_saved_view_none": "Ingen",
|
||||
"card_saved_view_help": "Anvender visningens status-, bruger- og etiketfiltre oven på filtrene ovenfor. Visningens sortering og gruppering er panelvisningsindstillinger og anvendes ikke på kortet.",
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne del."
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne del.",
|
||||
"settings_templates_toggle_group": "Slå alle skabeloner i denne gruppe til eller fra"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Gespeicherte Ansicht",
|
||||
"card_saved_view_none": "Keine",
|
||||
"card_saved_view_help": "Wendet die Status-, Nutzer- und Label-Filter der Ansicht zusätzlich zu den obigen Filtern an. Sortierung und Gruppierung der Ansicht sind Panel-Darstellung und werden auf der Karte nicht angewendet.",
|
||||
"doc_part_none": "Keine Dokumente mit diesem Ersatzteil verknüpft."
|
||||
"doc_part_none": "Keine Dokumente mit diesem Ersatzteil verknüpft.",
|
||||
"settings_templates_toggle_group": "Alle Vorlagen dieser Gruppe ein- oder ausschalten"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Saved view",
|
||||
"card_saved_view_none": "None",
|
||||
"card_saved_view_help": "Applies the view's status, user and label filters on top of the filters above. The view's sorting and grouping are panel display settings and are not applied on the card.",
|
||||
"doc_part_none": "No documents linked to this part."
|
||||
"doc_part_none": "No documents linked to this part.",
|
||||
"settings_templates_toggle_group": "Enable or disable all templates in this group"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vista guardada",
|
||||
"card_saved_view_none": "Ninguna",
|
||||
"card_saved_view_help": "Aplica los filtros de estado, usuario y etiqueta de la vista además de los filtros anteriores. El orden y la agrupación de la vista son ajustes de visualización del panel y no se aplican en la tarjeta.",
|
||||
"doc_part_none": "No hay documentos vinculados a esta pieza."
|
||||
"doc_part_none": "No hay documentos vinculados a esta pieza.",
|
||||
"settings_templates_toggle_group": "Activar o desactivar todas las plantillas de este grupo"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Tallennettu näkymä",
|
||||
"card_saved_view_none": "Ei mitään",
|
||||
"card_saved_view_help": "Soveltaa näkymän tila-, käyttäjä- ja tunnistesuodattimet yllä olevien suodattimien lisäksi. Näkymän lajittelu ja ryhmittely ovat paneelin näyttöasetuksia eivätkä vaikuta korttiin.",
|
||||
"doc_part_none": "Tähän osaan ei ole linkitetty asiakirjoja."
|
||||
"doc_part_none": "Tähän osaan ei ole linkitetty asiakirjoja.",
|
||||
"settings_templates_toggle_group": "Ota kaikki tämän ryhmän mallit käyttöön tai pois"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vue enregistrée",
|
||||
"card_saved_view_none": "Aucune",
|
||||
"card_saved_view_help": "Applique les filtres statut, utilisateur et étiquette de la vue en plus des filtres ci-dessus. Le tri et le regroupement de la vue sont des réglages d'affichage du panneau et ne s'appliquent pas à la carte.",
|
||||
"doc_part_none": "Aucun document lié à cette pièce."
|
||||
"doc_part_none": "Aucun document lié à cette pièce.",
|
||||
"settings_templates_toggle_group": "Activer ou désactiver tous les modèles de ce groupe"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "सहेजा गया व्यू",
|
||||
"card_saved_view_none": "कोई नहीं",
|
||||
"card_saved_view_help": "ऊपर दिए फ़िल्टरों के अतिरिक्त व्यू के स्थिति, उपयोगकर्ता और लेबल फ़िल्टर लागू करता है। व्यू का क्रम और समूहन पैनल की प्रदर्शन सेटिंग हैं और कार्ड पर लागू नहीं होते।",
|
||||
"doc_part_none": "इस पुर्ज़े से कोई दस्तावेज़ जुड़ा नहीं है।"
|
||||
"doc_part_none": "इस पुर्ज़े से कोई दस्तावेज़ जुड़ा नहीं है।",
|
||||
"settings_templates_toggle_group": "इस समूह के सभी टेम्पलेट चालू या बंद करें"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vista salvata",
|
||||
"card_saved_view_none": "Nessuna",
|
||||
"card_saved_view_help": "Applica i filtri stato, utente ed etichetta della vista in aggiunta ai filtri sopra. Ordinamento e raggruppamento della vista sono impostazioni di visualizzazione del pannello e non si applicano alla scheda.",
|
||||
"doc_part_none": "Nessun documento collegato a questo ricambio."
|
||||
"doc_part_none": "Nessun documento collegato a questo ricambio.",
|
||||
"settings_templates_toggle_group": "Attiva o disattiva tutti i modelli di questo gruppo"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "保存済みビュー",
|
||||
"card_saved_view_none": "なし",
|
||||
"card_saved_view_help": "上記のフィルターに加えて、ビューのステータス・ユーザー・ラベルのフィルターを適用します。ビューの並び順とグループ化はパネルの表示設定であり、カードには適用されません。",
|
||||
"doc_part_none": "この部品にリンクされた文書はありません。"
|
||||
"doc_part_none": "この部品にリンクされた文書はありません。",
|
||||
"settings_templates_toggle_group": "このグループのテンプレートをすべて有効/無効にする"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Lagret visning",
|
||||
"card_saved_view_none": "Ingen",
|
||||
"card_saved_view_help": "Bruker visningens status-, bruker- og etikettfiltre i tillegg til filtrene over. Visningens sortering og gruppering er panelvisningsinnstillinger og brukes ikke på kortet.",
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne delen."
|
||||
"doc_part_none": "Ingen dokumenter knyttet til denne delen.",
|
||||
"settings_templates_toggle_group": "Slå alle maler i denne gruppen på eller av"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Opgeslagen weergave",
|
||||
"card_saved_view_none": "Geen",
|
||||
"card_saved_view_help": "Past de status-, gebruikers- en labelfilters van de weergave toe bovenop de bovenstaande filters. Sortering en groepering van de weergave zijn paneelweergave-instellingen en gelden niet voor de kaart.",
|
||||
"doc_part_none": "Geen documenten gekoppeld aan dit onderdeel."
|
||||
"doc_part_none": "Geen documenten gekoppeld aan dit onderdeel.",
|
||||
"settings_templates_toggle_group": "Alle sjablonen in deze groep in- of uitschakelen"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Zapisany widok",
|
||||
"card_saved_view_none": "Brak",
|
||||
"card_saved_view_help": "Stosuje filtry statusu, użytkownika i etykiety widoku oprócz powyższych filtrów. Sortowanie i grupowanie widoku to ustawienia wyświetlania panelu i nie są stosowane na karcie.",
|
||||
"doc_part_none": "Brak dokumentów powiązanych z tą częścią."
|
||||
"doc_part_none": "Brak dokumentów powiązanych z tą częścią.",
|
||||
"settings_templates_toggle_group": "Włącz lub wyłącz wszystkie szablony w tej grupie"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Vista guardada",
|
||||
"card_saved_view_none": "Nenhuma",
|
||||
"card_saved_view_help": "Aplica os filtros de estado, utilizador e etiqueta da vista além dos filtros acima. A ordenação e o agrupamento da vista são definições de apresentação do painel e não se aplicam ao cartão.",
|
||||
"doc_part_none": "Nenhum documento associado a esta peça."
|
||||
"doc_part_none": "Nenhum documento associado a esta peça.",
|
||||
"settings_templates_toggle_group": "Ativar ou desativar todos os modelos deste grupo"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Сохранённое представление",
|
||||
"card_saved_view_none": "Нет",
|
||||
"card_saved_view_help": "Применяет фильтры статуса, пользователя и метки представления в дополнение к фильтрам выше. Сортировка и группировка представления — настройки отображения панели и на карточке не применяются.",
|
||||
"doc_part_none": "К этой запчасти не привязаны документы."
|
||||
"doc_part_none": "К этой запчасти не привязаны документы.",
|
||||
"settings_templates_toggle_group": "Включить или выключить все шаблоны этой группы"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Sparad vy",
|
||||
"card_saved_view_none": "Ingen",
|
||||
"card_saved_view_help": "Tillämpar vyns status-, användar- och etikettfilter utöver filtren ovan. Vyns sortering och gruppering är panelvisningsinställningar och tillämpas inte på kortet.",
|
||||
"doc_part_none": "Inga dokument länkade till denna del."
|
||||
"doc_part_none": "Inga dokument länkade till denna del.",
|
||||
"settings_templates_toggle_group": "Aktivera eller inaktivera alla mallar i denna grupp"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "Збережене подання",
|
||||
"card_saved_view_none": "Немає",
|
||||
"card_saved_view_help": "Застосовує фільтри статусу, користувача та мітки подання додатково до фільтрів вище. Сортування та групування подання — налаштування відображення панелі й на картці не застосовуються.",
|
||||
"doc_part_none": "До цієї запчастини не прив'язано документів."
|
||||
"doc_part_none": "До цієї запчастини не прив'язано документів.",
|
||||
"settings_templates_toggle_group": "Увімкнути або вимкнути всі шаблони цієї групи"
|
||||
}
|
||||
@@ -766,5 +766,6 @@
|
||||
"card_saved_view": "已保存的视图",
|
||||
"card_saved_view_none": "无",
|
||||
"card_saved_view_help": "在上述筛选之外再应用该视图的状态、用户和标签筛选。视图的排序和分组属于面板显示设置,不会应用到卡片上。",
|
||||
"doc_part_none": "此部件没有关联的文档。"
|
||||
"doc_part_none": "此部件没有关联的文档。",
|
||||
"settings_templates_toggle_group": "启用或禁用此组中的所有模板"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
var Ze=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var v=(n,e,t,o)=>{for(var r=o>1?void 0:o?Xe(e,t):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(r=(o?s(e,t,r):s(r))||r);return o&&r&&Ze(e,t,r),r};var K=globalThis,J=K.ShadowRoot&&(K.ShadyCSS===void 0||K.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,se=Symbol(),ve=new WeakMap,U=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==se)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(J&&e===void 0){let o=t!==void 0&&t.length===1;o&&(e=ve.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&ve.set(t,e))}return e}toString(){return this.cssText}},xe=n=>new U(typeof n=="string"?n:n+"",void 0,se),x=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((o,r,a)=>o+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+n[a+1],n[0]);return new U(t,n,se)},we=(n,e)=>{if(J)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let o=document.createElement("style"),r=K.litNonce;r!==void 0&&o.setAttribute("nonce",r),o.textContent=t.cssText,n.appendChild(o)}},ie=J?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let o of e.cssRules)t+=o.cssText;return xe(t)})(n):n;var{is:et,defineProperty:tt,getOwnPropertyDescriptor:ot,getOwnPropertyNames:rt,getOwnPropertySymbols:nt,getPrototypeOf:at}=Object,Z=globalThis,ke=Z.trustedTypes,st=ke?ke.emptyScript:"",it=Z.reactiveElementPolyfillSupport,q=(n,e)=>n,H={toAttribute(n,e){switch(e){case Boolean:n=n?st:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},X=(n,e)=>!et(n,e),Se={attribute:!0,type:String,converter:H,reflect:!1,useDefault:!1,hasChanged:X};Symbol.metadata??=Symbol("metadata"),Z.litPropertyMetadata??=new WeakMap;var w=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let o=Symbol(),r=this.getPropertyDescriptor(e,o,t);r!==void 0&&tt(this.prototype,e,r)}}static getPropertyDescriptor(e,t,o){let{get:r,set:a}=ot(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:r,set(s){let i=r?.call(this);a?.call(this,s),this.requestUpdate(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Se}static _$Ei(){if(this.hasOwnProperty(q("elementProperties")))return;let e=at(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(q("properties"))){let t=this.properties,o=[...rt(t),...nt(t)];for(let r of o)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[o,r]of t)this.elementProperties.set(o,r)}this._$Eh=new Map;for(let[t,o]of this.elementProperties){let r=this._$Eu(t,o);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let o=new Set(e.flat(1/0).reverse());for(let r of o)t.unshift(ie(r))}else e!==void 0&&t.push(ie(e));return t}static _$Eu(e,t){let o=t.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return we(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,o){this._$AK(e,o)}_$ET(e,t){let o=this.constructor.elementProperties.getLine truncated
|
||||
var et=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var v=(n,e,t,o)=>{for(var r=o>1?void 0:o?tt(e,t):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(r=(o?s(e,t,r):s(r))||r);return o&&r&&et(e,t,r),r};var Q=globalThis,J=Q.ShadowRoot&&(Q.ShadyCSS===void 0||Q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,se=Symbol(),ve=new WeakMap,U=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==se)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(J&&e===void 0){let o=t!==void 0&&t.length===1;o&&(e=ve.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&ve.set(t,e))}return e}toString(){return this.cssText}},xe=n=>new U(typeof n=="string"?n:n+"",void 0,se),x=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((o,r,a)=>o+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+n[a+1],n[0]);return new U(t,n,se)},we=(n,e)=>{if(J)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let o=document.createElement("style"),r=Q.litNonce;r!==void 0&&o.setAttribute("nonce",r),o.textContent=t.cssText,n.appendChild(o)}},ie=J?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let o of e.cssRules)t+=o.cssText;return xe(t)})(n):n;var{is:ot,defineProperty:rt,getOwnPropertyDescriptor:nt,getOwnPropertyNames:at,getOwnPropertySymbols:st,getPrototypeOf:it}=Object,Z=globalThis,ke=Z.trustedTypes,lt=ke?ke.emptyScript:"",ct=Z.reactiveElementPolyfillSupport,q=(n,e)=>n,H={toAttribute(n,e){switch(e){case Boolean:n=n?lt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},X=(n,e)=>!ot(n,e),Se={attribute:!0,type:String,converter:H,reflect:!1,useDefault:!1,hasChanged:X};Symbol.metadata??=Symbol("metadata"),Z.litPropertyMetadata??=new WeakMap;var w=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let o=Symbol(),r=this.getPropertyDescriptor(e,o,t);r!==void 0&&rt(this.prototype,e,r)}}static getPropertyDescriptor(e,t,o){let{get:r,set:a}=nt(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:r,set(s){let i=r?.call(this);a?.call(this,s),this.requestUpdate(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Se}static _$Ei(){if(this.hasOwnProperty(q("elementProperties")))return;let e=it(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(q("properties"))){let t=this.properties,o=[...at(t),...st(t)];for(let r of o)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[o,r]of t)this.elementProperties.set(o,r)}this._$Eh=new Map;for(let[t,o]of this.elementProperties){let r=this._$Eu(t,o);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let o=new Set(e.flat(1/0).reverse());for(let r of o)t.unshift(ie(r))}else e!==void 0&&t.push(ie(e));return t}static _$Eu(e,t){let o=t.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return we(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,o){this._$AK(e,o)}_$ET(e,t){let o=this.constructor.elementProperties.getLine truncated
|
||||
\f\r]`,I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ce=/-->/g,Ee=/>/g,C=RegExp(`>|${le}(?:([^\\s"'>=/]+)(${le}*=${le}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),je=/'/g,Te=/"/g,Pe=/^(?:script|style|textarea|title)$/i,me=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),m=me(1),Dt=me(2),Nt=me(3),T=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),De=new WeakMap,E=j.createTreeWalker(j,129);function ze(n,e){if(!ge(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ae!==void 0?Ae.createHTML(e):e}var dt=(n,e)=>{let t=n.length-1,o=[],r,a=e===2?"<svg>":e===3?"<math>":"",s=I;for(let i=0;i<t;i++){let c=n[i],p,u,d=-1,_=0;for(;_<c.length&&(s.lastIndex=_,u=s.exec(c),u!==null);)_=s.lastIndex,s===I?u[1]==="!--"?s=Ce:u[1]!==void 0?s=Ee:u[2]!==void 0?(Pe.test(u[2])&&(r=RegExp("</"+u[2],"g")),s=C):u[3]!==void 0&&(s=C):s===C?u[0]===">"?(s=r??I,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,p=u[1],s=u[3]===void 0?C:u[3]==='"'?Te:je):s===Te||s===je?s=C:s===Ce||s===Ee?s=I:(s=C,r=void 0);let h=s===C&&n[i+1].startsWith("/>")?" ":"";a+=s===I?c+lt:d>=0?(o.push(p),c.slice(0,d)+Ne+c.slice(d)+A+h):c+A+(d===-2?i:h)}return[ze(n,a+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),o]},W=class n{constructor({strings:e,_$litType$:t},o){let r;this.parts=[];let a=0,s=0,i=e.length-1,c=this.parts,[p,u]=dt(e,t);if(this.el=n.createElement(p,o),E.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=E.nextNode())!==null&&c.length<i;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Ne)){let _=u[s++],h=r.getAttribute(d).split(A),y=/([.?@])?(.*)/.exec(_);c.push({type:1,index:a,name:y[2],strings:h,ctor:y[1]==="."?de:y[1]==="?"?pe:y[1]==="@"?ue:z}),r.removeAttribute(d)}else d.startsWith(A)&&(c.push({type:6,index:a}),r.removeAttribute(d));if(Pe.test(r.tagName)){let d=r.textContent.split(A),_=d.length-1;if(_>0){r.textContent=ee?ee.emptyScript:"";for(let h=0;h<_;h++)r.append(d[h],F()),E.nextNode(),c.push({type:2,index:++a});r.append(d[_],F())}}}else if(r.nodeType===8)if(r.data===Re)c.push({type:2,index:a});else{let d=-1;for(;(d=r.data.indexOf(A,d+1))!==-1;)c.push({type:7,index:a}),d+=A.length-1}a++}}static createElement(e,t){let o=j.createElement("template");return o.innerHTML=e,o}};function P(n,e,t=n,o){if(e===T)return e;let r=o!==void 0?t._$Co?.[o]:t._$Cl,a=B(e)?void 0:e._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),a===void 0?r=void 0:(r=new a(n),r._$AT(n,t,o)),o!==void 0?(t._$Co??=[])[o]=r:t._$Cl=r),r!==void 0&&(e=P(n,r._$AS(n,e.values),r,o)),e}var ce=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:o}=this._$AD,r=(e?.creationScope??j).importNode(t,!0);E.currentNode=r;let a=E.nextNode(),s=0,i=0,c=o[0];for(;c!==void 0;){if(s===c.index){let p;c.type===2?p=new G(a,a.nextSibling,this,e):c.type===1?p=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(p=new _e(a,this,e)),this._$AV.push(p),c=o[++i]}s!==c?.index&&(a=E.nextNode(),s++)}return E.currentNode=j,r}p(e){let t=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}},G=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,r){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=P(this,e,t),B(e)?e===g||e==null||e===""?(this._$AH!==g&&this._$AR(),this._$AH=g):e!==this._$AH&&e!==T&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ct(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==g&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(j.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:o}=e,r=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=W.createElement(ze(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===r)this._$AH.p(t);else{let a=new ce(r,this),s=a.u(this.options);a.p(t),this.T(s),this._$AH=a}}_$AC(e){let t=De.get(e.strings);return t===void 0&&De.set(e.strings,t=new W(e)),t}k(e){ge(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,o,r=0;for(let a of e)r===t.length?t.push(o=new n(this.O(F()),this.O(F()),this,this.options)):o=t[r],o._$AI(a),r++;r<t.length&&(this._$AR(o&&o._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let o=$e(e).nextSibling;$e(e).remove(),e=o}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,o,r,a){this.type=1,this._$AH=g,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=a,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=Line truncated
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),je=/'/g,Te=/"/g,Pe=/^(?:script|style|textarea|title)$/i,me=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),m=me(1),Pt=me(2),zt=me(3),T=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),De=new WeakMap,E=j.createTreeWalker(j,129);function ze(n,e){if(!ge(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ae!==void 0?Ae.createHTML(e):e}var ut=(n,e)=>{let t=n.length-1,o=[],r,a=e===2?"<svg>":e===3?"<math>":"",s=I;for(let i=0;i<t;i++){let c=n[i],p,u,d=-1,_=0;for(;_<c.length&&(s.lastIndex=_,u=s.exec(c),u!==null);)_=s.lastIndex,s===I?u[1]==="!--"?s=Ce:u[1]!==void 0?s=Ee:u[2]!==void 0?(Pe.test(u[2])&&(r=RegExp("</"+u[2],"g")),s=C):u[3]!==void 0&&(s=C):s===C?u[0]===">"?(s=r??I,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,p=u[1],s=u[3]===void 0?C:u[3]==='"'?Te:je):s===Te||s===je?s=C:s===Ce||s===Ee?s=I:(s=C,r=void 0);let h=s===C&&n[i+1].startsWith("/>")?" ":"";a+=s===I?c+dt:d>=0?(o.push(p),c.slice(0,d)+Ne+c.slice(d)+A+h):c+A+(d===-2?i:h)}return[ze(n,a+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),o]},W=class n{constructor({strings:e,_$litType$:t},o){let r;this.parts=[];let a=0,s=0,i=e.length-1,c=this.parts,[p,u]=ut(e,t);if(this.el=n.createElement(p,o),E.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=E.nextNode())!==null&&c.length<i;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Ne)){let _=u[s++],h=r.getAttribute(d).split(A),y=/([.?@])?(.*)/.exec(_);c.push({type:1,index:a,name:y[2],strings:h,ctor:y[1]==="."?de:y[1]==="?"?pe:y[1]==="@"?ue:z}),r.removeAttribute(d)}else d.startsWith(A)&&(c.push({type:6,index:a}),r.removeAttribute(d));if(Pe.test(r.tagName)){let d=r.textContent.split(A),_=d.length-1;if(_>0){r.textContent=ee?ee.emptyScript:"";for(let h=0;h<_;h++)r.append(d[h],F()),E.nextNode(),c.push({type:2,index:++a});r.append(d[_],F())}}}else if(r.nodeType===8)if(r.data===Re)c.push({type:2,index:a});else{let d=-1;for(;(d=r.data.indexOf(A,d+1))!==-1;)c.push({type:7,index:a}),d+=A.length-1}a++}}static createElement(e,t){let o=j.createElement("template");return o.innerHTML=e,o}};function P(n,e,t=n,o){if(e===T)return e;let r=o!==void 0?t._$Co?.[o]:t._$Cl,a=B(e)?void 0:e._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),a===void 0?r=void 0:(r=new a(n),r._$AT(n,t,o)),o!==void 0?(t._$Co??=[])[o]=r:t._$Cl=r),r!==void 0&&(e=P(n,r._$AS(n,e.values),r,o)),e}var ce=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:o}=this._$AD,r=(e?.creationScope??j).importNode(t,!0);E.currentNode=r;let a=E.nextNode(),s=0,i=0,c=o[0];for(;c!==void 0;){if(s===c.index){let p;c.type===2?p=new Y(a,a.nextSibling,this,e):c.type===1?p=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(p=new _e(a,this,e)),this._$AV.push(p),c=o[++i]}s!==c?.index&&(a=E.nextNode(),s++)}return E.currentNode=j,r}p(e){let t=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}},Y=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,r){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=P(this,e,t),B(e)?e===g||e==null||e===""?(this._$AH!==g&&this._$AR(),this._$AH=g):e!==this._$AH&&e!==T&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):pt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==g&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(j.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:o}=e,r=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=W.createElement(ze(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===r)this._$AH.p(t);else{let a=new ce(r,this),s=a.u(this.options);a.p(t),this.T(s),this._$AH=a}}_$AC(e){let t=De.get(e.strings);return t===void 0&&De.set(e.strings,t=new W(e)),t}k(e){ge(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,o,r=0;for(let a of e)r===t.length?t.push(o=new n(this.O(F()),this.O(F()),this,this.options)):o=t[r],o._$AI(a),r++;r<t.length&&(this._$AR(o&&o._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let o=$e(e).nextSibling;$e(e).remove(),e=o}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,o,r,a){this.type=1,this._$AH=g,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=a,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=Line truncated
|
||||
.cal-controls {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
@@ -199,7 +199,7 @@ var Ze=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var v=(n,e,t
|
||||
}
|
||||
`;var Fe={maintenance:"Maintenance",objects:"Objects",tasks:"Tasks",overdue:"Overdue",due_soon:"Due Soon",triggered:"Triggered",trigger_replaced:"Trigger replaced",ok:"OK",all:"All",new_object:"+ New Object",templates_from:"From template",templates_title:"Start from a template",templates_task_count:"{n} tasks",template_created:"Created from template",onboard_hint:"Add your first object to start tracking maintenance.",edit:"Edit",duplicate:"Duplicate",task_duplicated:"Task duplicated",object_duplicated:"Object duplicated",delete:"Delete",add_task:"+ Add Task",complete:"Complete",completed:"Completed",skip:"Skip",skipped:"Skipped",missed:"Missed",reset:"Reset",snooze:"Snooze",snoozed:"Snoozed",cancel:"Cancel",bulk_select:"Select",bulk_select_all:"Select all",bulk_n_selected:"{n} selected",bulk_completed:"{n} tasks completed",bulk_archived:"{n} tasks archived",completing:"Completing\u2026",interval:"Interval",warning:"Warning",last_performed:"Last performed",next_due:"Next due",days_until_due:"Days until due",avg_duration:"Avg duration",trigger:"Trigger",trigger_type:"Trigger type",threshold_above:"Upper limit",threshold_below:"Lower limit",threshold:"Threshold",counter:"Counter",state_change:"State change",runtime:"Runtime",runtime_hours:"Target runtime (hours)",target_value:"Target value",baseline:"Baseline",target_changes:"Target changes",for_minutes:"For (minutes)",time_based:"Time-based",sensor_based:"Sensor-based",manual:"Manual",one_time:"One-time",weekdays:"Weekdays",nth_weekday:"Nth weekday of month",day_of_month:"Day of month",recurrence_on_days:"Repeat on",recurrence_occurrence:"Occurrence",recurrence_weekday:"Weekday",recurrence_day:"Day of month (1\u201331)",recurrence_last_day:"Last day of the month",recurrence_business_day:"Business days only (roll back from weekend)",recurrence_offset:"Offset (days, \xB1)",recurrence_offset_help:"Shift the date by \xB1N days, e.g. -2 = two days before.",last_day_month:"Last day of month",last_business_day_month:"Last business day",ord_1:"1st",ord_2:"2nd",ord_3:"3rd",ord_4:"4th",ord_5:"5th",ord_last:"Last",day_word:"Day",interval_value:"Interval",interval_unit:"Unit",unit_days:"Days",unit_weeks:"Weeks",unit_months:"Months",unit_years:"Years",due_date:"Due date",cleaning:"Cleaning",inspection:"Inspection",replacement:"Replacement",calibration:"Calibration",service:"Service",reading:"Reading",custom:"Custom",history:"History",cost:"Cost",report_button:"Report",report_title:"Maintenance report",report_generated:"Generated",report_times_done:"Done",report_total_cost:"Total cost",report_every:"every {n} {unit}",report_notes:"Notes",report_col_type:"Type",report_col_status:"Status",report_col_schedule:"Schedule",duration:"Duration",both:"Both",trigger_val:"Trigger value",complete_title:"Complete: ",checklist:"Checklist",checklist_steps_optional:"Checklist steps (optional)",checklist_placeholder:`Clean filter
|
||||
Replace seal
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -210,7 +210,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-family: inherit; width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
||||
`,Ye=x`
|
||||
`,Qe=x`
|
||||
:host {
|
||||
--maint-ok-color: var(--success-color, #4caf50);
|
||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||
@@ -1340,25 +1340,32 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.sparkline-svg { height: 100px; }
|
||||
|
||||
.stats-bar { gap: 8px; padding: 12px; }
|
||||
.stat-item { min-width: 60px; }
|
||||
/* min-width: 0 (NOT a fixed floor) — a fixed min-width re-enables the
|
||||
grid's auto minimum, so the 5 KPI tracks couldn't shrink below their
|
||||
label text and the last KPI clipped off-screen on phones (the header
|
||||
only *looked* cut — .content scrolls sideways, but nothing hints so).
|
||||
With 0 the tracks compress and the labels wrap to a second line. */
|
||||
.stat-item { min-width: 0; }
|
||||
.stat-item.clickable { padding: 4px 4px; }
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var b=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(t){this._config={...t},t.past_days&&[30,90].includes(t.past_days)?this._pastDays=t.past_days:t.window_days&&[7,14,30,365].includes(t.window_days)&&(this._windowDays=t.window_days,this._pastDays=0),typeof t.user_filter=="string"&&(this._userFilter=t.user_filter)}getCardSize(){return 6}get _lang(){return this.hass?.language||"en"}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(t){super.updated(t);let o=this.hass?.language;if(o&&!Ge(o)&&Ve(o).then(()=>this.requestUpdate()),t.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[t,o]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=t.objects,this._stats=o}catch{}}async _subscribe(){try{let t=await this.hass.connection.subscribeMessage(o=>{let r=o;this._objects=r.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){t();return}this._unsub=t}catch{}}_onEventClick(t){if(t.history_timestamp){this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:t.entry_id,task_id:t.task_id,original_timestamp:t.history_timestamp},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:t.entry_id,task_id:t.task_id},bubbles:!0,composed:!0}))}render(){if(!this.hass)return g;let t=this._lang,o=this._config.show_window_chips!==!1,r=this._config.show_user_filter!==!1,a=this._config.title,s=null;this._userFilter&&(s=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let i=new Date;i.setHours(0,0,0,0);let c=this._pastDays>0,p=c?He(this._objects,i,this._pastDays,s):qe(this._objects,i,this._windowDays,s),u=Y(i),d=this._windowDays===365||c,_=d?p.filter(l=>l.events.length>0):p,h=l=>{let $=`cal-status-${l.status}`,N=l.projected?"cal-event-projected":"",R=l.status==="overdue"&&l.days_until_due!=null?` (${Math.abs(l.days_until_due)}d ${f("overdue",t).toLowerCase()})`:"",L=l.projected&&l.interval_days?m`<span class="cal-event-recur">${l.interval_unit&&l.interval_unit!=="days"?`${l.interval_days} ${f("unit_"+l.interval_unit,t)}`:f("cal_every_n_days",t).replace("{n}",String(l.interval_days))}</span>`:g,M=l.schedule_type==="sensor_based",ne=M?m`<ha-icon class="cal-event-icon cal-source-sensor"
|
||||
`;var b=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(t){this._config={...t},t.past_days&&[30,90].includes(t.past_days)?this._pastDays=t.past_days:t.window_days&&[7,14,30,365].includes(t.window_days)&&(this._windowDays=t.window_days,this._pastDays=0),typeof t.user_filter=="string"&&(this._userFilter=t.user_filter)}getCardSize(){return 6}get _lang(){return this.hass?.language||"en"}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(t){super.updated(t),t.has("hass")&&Ke(this.hass?.locale);let o=this.hass?.language;if(o&&!Ge(o)&&Ve(o).then(()=>this.requestUpdate()),t.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[t,o]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=t.objects,this._stats=o}catch{}}async _subscribe(){try{let t=await this.hass.connection.subscribeMessage(o=>{let r=o;this._objects=r.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){t();return}this._unsub=t}catch{}}_onEventClick(t){if(t.history_timestamp){this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:t.entry_id,task_id:t.task_id,original_timestamp:t.history_timestamp},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:t.entry_id,task_id:t.task_id},bubbles:!0,composed:!0}))}render(){if(!this.hass)return g;let t=this._lang,o=this._config.show_window_chips!==!1,r=this._config.show_user_filter!==!1,a=this._config.title,s=null;this._userFilter&&(s=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let i=new Date;i.setHours(0,0,0,0);let c=this._pastDays>0,p=c?He(this._objects,i,this._pastDays,s):qe(this._objects,i,this._windowDays,s),u=V(i),d=this._windowDays===365||c,_=d?p.filter(l=>l.events.length>0):p,h=l=>{let $=`cal-status-${l.status}`,N=l.projected?"cal-event-projected":"",R=l.status==="overdue"&&l.days_until_due!=null?` (${Math.abs(l.days_until_due)}d ${f("overdue",t).toLowerCase()})`:"",L=l.projected&&l.interval_days?m`<span class="cal-event-recur">${l.interval_unit&&l.interval_unit!=="days"?`${l.interval_days} ${f("unit_"+l.interval_unit,t)}`:f("cal_every_n_days",t).replace("{n}",String(l.interval_days))}</span>`:g,M=l.schedule_type==="sensor_based",ne=M?m`<ha-icon class="cal-event-icon cal-source-sensor"
|
||||
title="${f("cal_source_sensor",t)}" icon="mdi:trending-up"></ha-icon>`:m`<ha-icon class="cal-event-icon cal-source-time"
|
||||
title="${l.adaptive_enabled?f("cal_source_time_adaptive",t):f("cal_source_time",t)}"
|
||||
icon="${l.adaptive_enabled?"mdi:clock-time-four-outline":"mdi:clock-outline"}"></ha-icon>`,ae=M&&l.prediction_confidence&&l.status!=="triggered"&&!l.projected?m`<span class="cal-event-prediction cal-conf-${l.prediction_confidence}">
|
||||
${f("cal_predicted",t)} · ${f(`cal_confidence_${l.prediction_confidence}`,t)}
|
||||
</span>`:g,Ke=this._stats?.budget?.currency_symbol||Be,Je=l.history_type?f(l.history_type,t):f(l.status,t);return m`
|
||||
</span>`:g,Ze=this._stats?.budget?.currency_symbol||We,Xe=l.history_type?f(l.history_type,t):f(l.status,t);return m`
|
||||
<div class="cal-event ${N}"
|
||||
@click=${()=>this._onEventClick(l)}>
|
||||
${ne}
|
||||
<span class="cal-status-pill ${$}">${Je}</span>
|
||||
<span class="cal-status-pill ${$}">${Xe}</span>
|
||||
<div class="cal-event-body">
|
||||
<div class="cal-event-title">${l.object_name} · ${l.task_name}${R}</div>
|
||||
${ae}
|
||||
${L}
|
||||
</div>
|
||||
${l.avg_cost!=null&&l.avg_cost>0?m`<span class="cal-event-cost">${l.avg_cost.toFixed(0)} ${Ke}</span>`:g}
|
||||
${l.avg_cost!=null&&l.avg_cost>0?m`<span class="cal-event-cost">${l.avg_cost.toFixed(0)} ${Ze}</span>`:g}
|
||||
</div>
|
||||
`},y=l=>{let[$,N,R]=l.date.split("-").map(Number),L=new Date($,N-1,R),M=l.date===u,ne=L.toLocaleDateString(t,{weekday:"short"}),ae=L.toLocaleDateString(t,{month:"long"});return m`
|
||||
<div class="cal-day-row">
|
||||
@@ -1411,10 +1418,10 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
${_.length===0&&d?m`<div class="cal-empty">${f("cal_no_events",t)}</div>`:_.map(y)}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};b.styles=[Ye,Ie,x`
|
||||
`}};b.styles=[Qe,Ie,x`
|
||||
:host { display: block; }
|
||||
ha-card { padding: 0; overflow: hidden; }
|
||||
`],v([V({attribute:!1})],b.prototype,"hass",2),v([S()],b.prototype,"_config",2),v([S()],b.prototype,"_objects",2),v([S()],b.prototype,"_stats",2),v([S()],b.prototype,"_windowDays",2),v([S()],b.prototype,"_pastDays",2),v([S()],b.prototype,"_userFilter",2),v([S()],b.prototype,"_unsub",2);var St=[{value:7,label:"Week (7 days)"},{value:14,label:"Fortnight (14 days)"},{value:30,label:"Month (30 days, default)"},{value:365,label:"Year (365 days, empty days collapsed)"}],O=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}setConfig(t){this._config={...t}}_valueChanged(t,o){let r={...this._config,[t]:o};t==="show_window_chips"&&o===!0&&delete r.show_window_chips,t==="show_user_filter"&&o===!0&&delete r.show_user_filter,t==="title"&&(!o||typeof o=="string"&&o.trim()==="")&&delete r.title,t==="user_filter"&&o===""&&delete r.user_filter,this._config=r,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:r},bubbles:!0,composed:!0}))}render(){let t=this._config.window_days??30,o=this._config.show_window_chips!==!1,r=this._config.show_user_filter!==!1,a=this._config.user_filter??"",s=this._config.title??"";return m`
|
||||
`],v([G({attribute:!1})],b.prototype,"hass",2),v([S()],b.prototype,"_config",2),v([S()],b.prototype,"_objects",2),v([S()],b.prototype,"_stats",2),v([S()],b.prototype,"_windowDays",2),v([S()],b.prototype,"_pastDays",2),v([S()],b.prototype,"_userFilter",2),v([S()],b.prototype,"_unsub",2);var Ct=[{value:7,label:"Week (7 days)"},{value:14,label:"Fortnight (14 days)"},{value:30,label:"Month (30 days, default)"},{value:365,label:"Year (365 days, empty days collapsed)"}],O=class extends k{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}setConfig(t){this._config={...t}}_valueChanged(t,o){let r={...this._config,[t]:o};t==="show_window_chips"&&o===!0&&delete r.show_window_chips,t==="show_user_filter"&&o===!0&&delete r.show_user_filter,t==="title"&&(!o||typeof o=="string"&&o.trim()==="")&&delete r.title,t==="user_filter"&&o===""&&delete r.user_filter,this._config=r,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:r},bubbles:!0,composed:!0}))}render(){let t=this._config.window_days??30,o=this._config.show_window_chips!==!1,r=this._config.show_user_filter!==!1,a=this._config.user_filter??"",s=this._config.title??"";return m`
|
||||
<div class="editor">
|
||||
<div class="row">
|
||||
<label for="title">Title (optional)</label>
|
||||
@@ -1431,7 +1438,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
id="window"
|
||||
@change=${i=>this._valueChanged("window_days",Number(i.target.value))}
|
||||
>
|
||||
${St.map(i=>m`<option value="${i.value}" ?selected=${i.value===t}>${i.label}</option>`)}
|
||||
${Ct.map(i=>m`<option value="${i.value}" ?selected=${i.value===t}>${i.label}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="row toggle">
|
||||
@@ -1493,7 +1500,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color, #666);
|
||||
}
|
||||
`,v([V({attribute:!1})],O.prototype,"hass",2),v([S()],O.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",b);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",O);var re=window;re.customCards=re.customCards||[];var Qe="maintenance-supporter-calendar-card",$t=re.customCards.some(n=>n.type===Qe);$t||re.customCards.push({type:Qe,name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{b as MaintenanceCalendarCard};
|
||||
`,v([G({attribute:!1})],O.prototype,"hass",2),v([S()],O.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",b);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",O);var re=window;re.customCards=re.customCards||[];var Je="maintenance-supporter-calendar-card",Et=re.customCards.some(n=>n.type===Je);Et||re.customCards.push({type:Je,name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{b as MaintenanceCalendarCard};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var st=Object.defineProperty;var fi=Object.getOwnPropertyDescriptor;var x=(a,s,e)=>()=>{if(e)throw e[0];try{return a&&(s=a(a=0)),s}catch(t){throw e=[t],t}};var bi=(a,s)=>{for(var e in s)st(a,e,{get:s[e],enumerable:!0})};var l=(a,s,e,t)=>{for(var i=t>1?void 0:t?fi(s,e):s,n=a.length-1,d;n>=0;n--)(d=a[n])&&(i=(t?d(s,e,i):d(i))||i);return t&&i&&st(s,e,i),i};var ye,xe,Pe,rt,le,at,E,nt,Ne,ze=x(()=>{ye=globalThis,xe=ye.ShadowRoot&&(ye.ShadyCSS===void 0||ye.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pe=Symbol(),rt=new WeakMap,le=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Pe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(xe&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=rt.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&rt.set(e,s))}return s}toString(){return this.cssText}},at=a=>new le(typeof a=="string"?a:a+"",void 0,Pe),E=(a,...s)=>{let e=a.length===1?a[0]:s.reduce((t,i,n)=>t+(d=>{if(d._$cssResult$===!0)return d.cssText;if(typeof d=="number")return d;throw Error("Value passed to 'css' function must be a 'css' function result: "+d+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new le(e,a,Pe)},nt=(a,s)=>{if(xe)a.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=ye.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},Ne=xe?a=>a:a=>a instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return at(e)})(a):a});var yi,xi,$i,wi,ki,Ei,$e,ot,Ai,Si,ce,de,we,lt,O,pe=x(()=>{ze();ze();({is:yi,defineProperty:xi,getOwnPropertyDescriptor:$i,getOwnPropertyNames:wi,getOwnPropertySymbols:ki,getPrototypeOf:Ei}=Object),$e=globalThis,ot=$e.trustedTypes,Ai=ot?ot.emptyScript:"",Si=$e.reactiveElementPolyfillSupport,ce=(a,s)=>a,de={toAttribute(a,s){switch(s){case Boolean:a=a?Ai:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,s){let e=a;switch(s){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},we=(a,s)=>!yi(a,s),lt={attribute:!0,type:String,converter:de,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),$e.litPropertyMetadata??=new WeakMap;O=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=lt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&xi(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:n}=$i(this.prototype,s)??{get(){return this[e]},set(d){this[e]=d}};return{get:i,set(d){let c=i?.call(this);n?.call(this,d),this.requestUpdate(s,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??lt}static _$Ei(){if(this.hasOwnProperty(ce("elementProperties")))return;let s=Ei(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(ce("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ce("properties"))){let e=this.properties,t=[...wi(e),...ki(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(Ne(i))}else s!==void 0&&e.push(Ne(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return nt(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=thiLine truncated
|
||||
\f\r]`,he=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pt=/-->/g,ht=/>/g,K=RegExp(`>|${Me}(?:([^\\s"'>=/]+)(${Me}*=${Me}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),_t=/'/g,ut=/"/g,ft=/^(?:script|style|textarea|title)$/i,Be=a=>(s,...e)=>({_$litType$:a,strings:s,values:e}),o=Be(1),ae=Be(2),bs=Be(3),Z=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),gt=new WeakMap,Y=J.createTreeWalker(J,129);Ii=(a,s)=>{let e=a.length-1,t=[],i,n=s===2?"<svg>":s===3?"<math>":"",d=he;for(let c=0;c<e;c++){let _=a[c],u,v,m=-1,y=0;for(;y<_.length&&(d.lastIndex=y,v=d.exec(_),v!==null);)y=d.lastIndex,d===he?v[1]==="!--"?d=pt:v[1]!==void 0?d=ht:v[2]!==void 0?(ft.test(v[2])&&(i=RegExp("</"+v[2],"g")),d=K):v[3]!==void 0&&(d=K):d===K?v[0]===">"?(d=i??he,m=-1):v[1]===void 0?m=-2:(m=d.lastIndex-v[2].length,u=v[1],d=v[3]===void 0?K:v[3]==='"'?ut:_t):d===ut||d===_t?d=K:d===pt||d===ht?d=he:(d=K,i=void 0);let b=d===K&&a[c+1].startsWith("/>")?" ":"";n+=d===he?_+Ti:m>=0?(t.push(u),_.slice(0,m)+mt+_.slice(m)+G+b):_+G+(m===-2?c:b)}return[bt(a,n+(a[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},ge=class a{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let n=0,d=0,c=s.length-1,_=this.parts,[u,v]=Ii(s,e);if(this.el=a.createElement(u,t),Y.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Y.nextNode())!==null&&_.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(mt)){let y=v[d++],b=i.getAttribute(m).split(G),A=/([.?@])?(.*)/.exec(y);_.push({type:1,index:n,name:A[2],strings:b,ctor:A[1]==="."?Ue:A[1]==="?"?Fe:A[1]==="@"?Oe:re}),i.removeAttribute(m)}else m.startsWith(G)&&(_.push({type:6,index:n}),i.removeAttribute(m));if(ft.test(i.tagName)){let m=i.textContent.split(G),y=m.length-1;if(y>0){i.textContent=ke?ke.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],_e()),Y.nextNode(),_.push({type:2,index:++n});i.append(m[y],_e())}}}else if(i.nodeType===8)if(i.data===vt)_.push({type:2,index:n});else{let m=-1;for(;(m=i.data.indexOf(G,m+1))!==-1;)_.push({type:7,index:n}),m+=G.length-1}n++}}static createElement(s,e){let t=J.createElement("template");return t.innerHTML=s,t}};qe=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??J).importNode(e,!0);Y.currentNode=i;let n=Y.nextNode(),d=0,c=0,_=t[0];for(;_!==void 0;){if(d===_.index){let u;_.type===2?u=new me(n,n.nextSibling,this,s):_.type===1?u=new _.ctor(n,_.name,_.strings,this,s):_.type===6&&(u=new De(n,this,s)),this._$AV.push(u),_=t[++c]}d!==_?.index&&(n=Y.nextNode(),d++)}return Y.currentNode=J,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},me=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=se(this,s,e),ue(s)?s===h||s==null||s===""?(this._$AH!==h&&this._$AR(),this._$AH=h):s!==this._$AH&&s!==Z&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):Ci(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==h&&ue(this._$AH)?this._$AA.nextSibling.data=s:this.T(J.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=ge.createElement(bt(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new qe(i,this),d=n.u(this.options);n.p(e),this.T(d),this._$AH=n}}_$AC(s){let e=gt.get(s.strings);return e===void 0&>.set(s.strings,e=new ge(s)),e}k(s){We(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of s)i===e.length?e.push(t=new a(this.O(_e()),this.O(_e()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=ct(s).nextSibling;ct(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},re=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=s,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(s,e=this,t,i){let n=this.strings,d=!1;if(n===void 0)s=se(this,s,e,0),d=!ue(s)||s!==this._$AH&&s!==Z,d&&(this._$AH=s);else{let c=s,_,u;for(s=n[0],_=0;_<n.length-1;_++)u=se(this,c[t+_],e,_),u===Z&&(u=this._$AH[_]),d||=!ue(u)||u!==this._$AH[_],u===h?s=h:s!==h&&(s+=(u??"")+n[_+1]),this._$AH[_]=u}d&&!i&&this.j(s)}j(s){s===h?this.element.removeAttribute(this.name):this.element.setAttribute(thLine truncated
|
||||
var at=Object.defineProperty;var xi=Object.getOwnPropertyDescriptor;var x=(a,s,e)=>()=>{if(e)throw e[0];try{return a&&(s=a(a=0)),s}catch(t){throw e=[t],t}};var $i=(a,s)=>{for(var e in s)at(a,e,{get:s[e],enumerable:!0})};var l=(a,s,e,t)=>{for(var i=t>1?void 0:t?xi(s,e):s,n=a.length-1,d;n>=0;n--)(d=a[n])&&(i=(t?d(s,e,i):d(i))||i);return t&&i&&at(s,e,i),i};var ye,xe,ze,nt,le,ot,E,lt,Me,qe=x(()=>{ye=globalThis,xe=ye.ShadowRoot&&(ye.ShadyCSS===void 0||ye.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ze=Symbol(),nt=new WeakMap,le=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==ze)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o,e=this.t;if(xe&&s===void 0){let t=e!==void 0&&e.length===1;t&&(s=nt.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&nt.set(e,s))}return s}toString(){return this.cssText}},ot=a=>new le(typeof a=="string"?a:a+"",void 0,ze),E=(a,...s)=>{let e=a.length===1?a[0]:s.reduce((t,i,n)=>t+(d=>{if(d._$cssResult$===!0)return d.cssText;if(typeof d=="number")return d;throw Error("Value passed to 'css' function must be a 'css' function result: "+d+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+a[n+1],a[0]);return new le(e,a,ze)},lt=(a,s)=>{if(xe)a.adoptedStyleSheets=s.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of s){let t=document.createElement("style"),i=ye.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,a.appendChild(t)}},Me=xe?a=>a:a=>a instanceof CSSStyleSheet?(s=>{let e="";for(let t of s.cssRules)e+=t.cssText;return ot(e)})(a):a});var wi,ki,Ei,Ai,Si,Ti,$e,ct,Ci,Ii,ce,de,we,dt,F,pe=x(()=>{qe();qe();({is:wi,defineProperty:ki,getOwnPropertyDescriptor:Ei,getOwnPropertyNames:Ai,getOwnPropertySymbols:Si,getPrototypeOf:Ti}=Object),$e=globalThis,ct=$e.trustedTypes,Ci=ct?ct.emptyScript:"",Ii=$e.reactiveElementPolyfillSupport,ce=(a,s)=>a,de={toAttribute(a,s){switch(s){case Boolean:a=a?Ci:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,s){let e=a;switch(s){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},we=(a,s)=>!wi(a,s),dt={attribute:!0,type:String,converter:de,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),$e.litPropertyMetadata??=new WeakMap;F=class extends HTMLElement{static addInitializer(s){this._$Ei(),(this.l??=[]).push(s)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(s,e=dt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(s)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(s,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(s,t,e);i!==void 0&&ki(this.prototype,s,i)}}static getPropertyDescriptor(s,e,t){let{get:i,set:n}=Ei(this.prototype,s)??{get(){return this[e]},set(d){this[e]=d}};return{get:i,set(d){let c=i?.call(this);n?.call(this,d),this.requestUpdate(s,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(s){return this.elementProperties.get(s)??dt}static _$Ei(){if(this.hasOwnProperty(ce("elementProperties")))return;let s=Ti(this);s.finalize(),s.l!==void 0&&(this.l=[...s.l]),this.elementProperties=new Map(s.elementProperties)}static finalize(){if(this.hasOwnProperty(ce("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ce("properties"))){let e=this.properties,t=[...Ai(e),...Si(e)];for(let i of t)this.createProperty(i,e[i])}let s=this[Symbol.metadata];if(s!==null){let e=litPropertyMetadata.get(s);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){let e=[];if(Array.isArray(s)){let t=new Set(s.flat(1/0).reverse());for(let i of t)e.unshift(Me(i))}else s!==void 0&&e.push(Me(s));return e}static _$Eu(s,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof s=="string"?s.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(s=>this.enableUpdating=s),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(s=>s(this))}addController(s){(this._$EO??=new Set).add(s),this.renderRoot!==void 0&&this.isConnected&&s.hostConnected?.()}removeController(s){this._$EO?.delete(s)}_$E_(){let s=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(s.set(t,this[t]),delete this[t]);s.size>0&&(this._$Ep=s)}createRenderRoot(){let s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return lt(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=thiLine truncated
|
||||
\f\r]`,he=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_t=/-->/g,ut=/>/g,Y=RegExp(`>|${Ue}(?:([^\\s"'>=/]+)(${Ue}*=${Ue}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),gt=/'/g,mt=/"/g,yt=/^(?:script|style|textarea|title)$/i,Ye=a=>(s,...e)=>({_$litType$:a,strings:s,values:e}),o=Ye(1),ae=Ye(2),ks=Ye(3),Z=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),ft=new WeakMap,K=J.createTreeWalker(J,129);Ri=(a,s)=>{let e=a.length-1,t=[],i,n=s===2?"<svg>":s===3?"<math>":"",d=he;for(let c=0;c<e;c++){let _=a[c],u,f,m=-1,y=0;for(;y<_.length&&(d.lastIndex=y,f=d.exec(_),f!==null);)y=d.lastIndex,d===he?f[1]==="!--"?d=_t:f[1]!==void 0?d=ut:f[2]!==void 0?(yt.test(f[2])&&(i=RegExp("</"+f[2],"g")),d=Y):f[3]!==void 0&&(d=Y):d===Y?f[0]===">"?(d=i??he,m=-1):f[1]===void 0?m=-2:(m=d.lastIndex-f[2].length,u=f[1],d=f[3]===void 0?Y:f[3]==='"'?mt:gt):d===mt||d===gt?d=Y:d===_t||d===ut?d=he:(d=Y,i=void 0);let b=d===Y&&a[c+1].startsWith("/>")?" ":"";n+=d===he?_+Li:m>=0?(t.push(u),_.slice(0,m)+vt+_.slice(m)+G+b):_+G+(m===-2?c:b)}return[xt(a,n+(a[e]||"<?>")+(s===2?"</svg>":s===3?"</math>":"")),t]},ge=class a{constructor({strings:s,_$litType$:e},t){let i;this.parts=[];let n=0,d=0,c=s.length-1,_=this.parts,[u,f]=Ri(s,e);if(this.el=a.createElement(u,t),K.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=K.nextNode())!==null&&_.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(vt)){let y=f[d++],b=i.getAttribute(m).split(G),A=/([.?@])?(.*)/.exec(y);_.push({type:1,index:n,name:A[2],strings:b,ctor:A[1]==="."?Fe:A[1]==="?"?Oe:A[1]==="@"?Ve:re}),i.removeAttribute(m)}else m.startsWith(G)&&(_.push({type:6,index:n}),i.removeAttribute(m));if(yt.test(i.tagName)){let m=i.textContent.split(G),y=m.length-1;if(y>0){i.textContent=ke?ke.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],_e()),K.nextNode(),_.push({type:2,index:++n});i.append(m[y],_e())}}}else if(i.nodeType===8)if(i.data===bt)_.push({type:2,index:n});else{let m=-1;for(;(m=i.data.indexOf(G,m+1))!==-1;)_.push({type:7,index:n}),m+=G.length-1}n++}}static createElement(s,e){let t=J.createElement("template");return t.innerHTML=s,t}};De=class{constructor(s,e){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:e},parts:t}=this._$AD,i=(s?.creationScope??J).importNode(e,!0);K.currentNode=i;let n=K.nextNode(),d=0,c=0,_=t[0];for(;_!==void 0;){if(d===_.index){let u;_.type===2?u=new me(n,n.nextSibling,this,s):_.type===1?u=new _.ctor(n,_.name,_.strings,this,s):_.type===6&&(u=new We(n,this,s)),this._$AV.push(u),_=t[++c]}d!==_?.index&&(n=K.nextNode(),d++)}return K.currentNode=J,i}p(s){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(s,t,e),e+=t.strings.length-2):t._$AI(s[e])),e++}},me=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(s,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=s,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let s=this._$AA.parentNode,e=this._$AM;return e!==void 0&&s?.nodeType===11&&(s=e.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,e=this){s=se(this,s,e),ue(s)?s===h||s==null||s===""?(this._$AH!==h&&this._$AR(),this._$AH=h):s!==this._$AH&&s!==Z&&this._(s):s._$litType$!==void 0?this.$(s):s.nodeType!==void 0?this.T(s):Hi(s)?this.k(s):this._(s)}O(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}T(s){this._$AH!==s&&(this._$AR(),this._$AH=this.O(s))}_(s){this._$AH!==h&&ue(this._$AH)?this._$AA.nextSibling.data=s:this.T(J.createTextNode(s)),this._$AH=s}$(s){let{values:e,_$litType$:t}=s,i=typeof t=="number"?this._$AC(s):(t.el===void 0&&(t.el=ge.createElement(xt(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new De(i,this),d=n.u(this.options);n.p(e),this.T(d),this._$AH=n}}_$AC(s){let e=ft.get(s.strings);return e===void 0&&ft.set(s.strings,e=new ge(s)),e}k(s){Ge(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let n of s)i===e.length?e.push(t=new a(this.O(_e()),this.O(_e()),this,this.options)):t=e[i],t._$AI(n),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(s=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);s!==this._$AB;){let t=pt(s).nextSibling;pt(s).remove(),s=t}}setConnected(s){this._$AM===void 0&&(this._$Cv=s,this._$AP?.(s))}},re=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,e,t,i,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=s,this.name=e,this._$AM=i,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(s,e=this,t,i){let n=this.strings,d=!1;if(n===void 0)s=se(this,s,e,0),d=!ue(s)||s!==this._$AH&&s!==Z,d&&(this._$AH=s);else{let c=s,_,u;for(s=n[0],_=0;_<n.length-1;_++)u=se(this,c[t+_],e,_),u===Z&&(u=this._$AH[_]),d||=!ue(u)||u!==this._$AH[_],u===h?s=h:s!==h&&(s+=(u??"")+n[_+1]),this._$AH[_]=u}d&&!i&&this.j(s)}j(s){s===h?this.element.removeAttribute(this.name):this.element.setAttribute(thLine truncated
|
||||
Replace seal
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -13,7 +13,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-family: inherit; width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
||||
`,Ie=E`
|
||||
`,He=E`
|
||||
:host {
|
||||
--maint-ok-color: var(--success-color, #4caf50);
|
||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||
@@ -1143,10 +1143,17 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.sparkline-svg { height: 100px; }
|
||||
|
||||
.stats-bar { gap: 8px; padding: 12px; }
|
||||
.stat-item { min-width: 60px; }
|
||||
/* min-width: 0 (NOT a fixed floor) — a fixed min-width re-enables the
|
||||
grid's auto minimum, so the 5 KPI tracks couldn't shrink below their
|
||||
label text and the last KPI clipped off-screen on phones (the header
|
||||
only *looked* cut — .content scrolls sideways, but nothing hints so).
|
||||
With 0 the tracks compress and the labels wrap to a second line. */
|
||||
.stat-item { min-width: 0; }
|
||||
.stat-item.clickable { padding: 4px 4px; }
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`});function Ui(a,s){let e=qi[a];if(!e)return a;let t=r(e,s);return t&&t!==e?t:a}function Fi(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function L(a,s,e){if(e=e??r("action_error",s),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=Fi(i),d=n.field?Ui(n.field,s):"",c=_=>r(_,s).replace("{field}",d).replace("{n}",n.param??"");switch(n.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var qi,te=x(()=>{"use strict";I();qi={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"}});var $,Ze=x(()=>{"use strict";C();N();I();te();$=class extends w{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDefault=null;this.consumesInfo=[];this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photoDocId="";this._photoPreview="";this._photoUploading=!1;this._readingValue="";this._restockQty=""}open(){this._open||(this._open=!0,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState={},this._feedback="needed",this._photoDocId="",this._photoPreview="",this._photoUploading=!1,this._readingValue="",this._restockQty=this.restockDefault!==null?String(this.restockDefault):"")}_toggleCheck(e){let t=String(e);this._checklistState={...this._checklistState,[t]:!this._checklistState[t]}}_setFeedback(e){this._feedback=e}async _onPhotoInput(e){let t=e.target,i=t.files?.[0];if(t.value="",!!i){this._photoUploading=!0,this._error="";try{let n=new FormData;n.append("entry_id",this.entryId),n.append("tags","photo"),n.append("file",i,i.name);let d=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:n});if(!d.ok){this._error=d.status===413?r("doc_too_large",this.lang):r("doc_upload_failed",this.lang);return}let c=await d.json();c.id&&(this._photoDocId=c.id,this._photoPreview=URL.createObjectURL(i))}catch{this._error=r("doc_upload_failed",this.lang)}finally{this._photoUploading=!1}}}_removePhoto(){this._photoPreview&&URL.revokeObjectURL(this._photoPreview),this._photoDocId="",this._photoPreview=""}async _complete(){this._loading=!0,this._error="";try{let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId};if(this._notes&&(e.notes=this._notes),this._cost){let t=parseFloat(this._cost);!isNaN(t)&&t>=0&&(e.cost=t)}if(this._duration){let t=parseInt(this._duration,10);!isNaN(t)&&t>=0&&(e.duration=t)}if(this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photoDocId&&(e.photo_doc_id=this._photoDocId),this._readingValue!==""){let t=parseFloat(this._readingValue);isNaN(t)||(e.reading_value=t)}if(this.restockDefault!==null&&this._restockQty!=
Line truncated
|
||||
`});function Wi(a,s){let e=Vi[a];if(!e)return a;let t=r(e,s);return t&&t!==e?t:a}function Bi(a){let e=a.match(/data\['([^']+)'\]/)?.[1],t;return(t=a.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=a.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=a.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=a.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(a)?{field:e,rule:"required"}:(t=a.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(a)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(a)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function L(a,s,e){if(e=e??r("action_error",s),typeof a=="string")return a;if(typeof a!="object"||a===null)return e;let t=a,i=t.message||t.error?.message||"";if(!i)return e;let n=Bi(i),d=n.field?Wi(n.field,s):"",c=_=>r(_,s).replace("{field}",d).replace("{n}",n.param??"");switch(n.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",n.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var Vi,te=x(()=>{"use strict";I();Vi={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"}});var $,Xe=x(()=>{"use strict";C();N();I();te();$=class extends w{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.restockDefault=null;this.consumesInfo=[];this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photoDocId="";this._photoPreview="";this._photoUploading=!1;this._readingValue="";this._restockQty=""}open(){this._open||(this._open=!0,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState={},this._feedback="needed",this._photoDocId="",this._photoPreview="",this._photoUploading=!1,this._readingValue="",this._restockQty=this.restockDefault!==null?String(this.restockDefault):"")}_toggleCheck(e){let t=String(e);this._checklistState={...this._checklistState,[t]:!this._checklistState[t]}}_setFeedback(e){this._feedback=e}async _onPhotoInput(e){let t=e.target,i=t.files?.[0];if(t.value="",!!i){this._photoUploading=!0,this._error="";try{let n=new FormData;n.append("entry_id",this.entryId),n.append("tags","photo"),n.append("file",i,i.name);let d=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:n});if(!d.ok){this._error=d.status===413?r("doc_too_large",this.lang):r("doc_upload_failed",this.lang);return}let c=await d.json();c.id&&(this._photoDocId=c.id,this._photoPreview=URL.createObjectURL(i))}catch{this._error=r("doc_upload_failed",this.lang)}finally{this._photoUploading=!1}}}_removePhoto(){this._photoPreview&&URL.revokeObjectURL(this._photoPreview),this._photoDocId="",this._photoPreview=""}async _complete(){this._loading=!0,this._error="";try{let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId};if(this._notes&&(e.notes=this._notes),this._cost){let t=parseFloat(this._cost);!isNaN(t)&&t>=0&&(e.cost=t)}if(this._duration){let t=parseInt(this._duration,10);!isNaN(t)&&t>=0&&(e.duration=t)}if(this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photoDocId&&(e.photo_doc_id=this._photoDocId),this._readingValue!==""){let t=parseFloat(this._readingValue);isNaN(t)||(e.reading_value=t)}if(this.restockDefault!==null&&this._restockQty!=
Line truncated
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${r("complete_title",e)}${this.taskName}</div>
|
||||
<div class="content">
|
||||
@@ -1251,7 +1258,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};$.styles=[Ut,E`
|
||||
`}};$.styles=[Ot,E`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -1381,7 +1388,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`],l([f({attribute:!1})],$.prototype,"hass",2),l([f()],$.prototype,"entryId",2),l([f()],$.prototype,"taskId",2),l([f()],$.prototype,"taskName",2),l([f()],$.prototype,"lang",2),l([f({type:Array})],$.prototype,"checklist",2),l([f({type:Boolean})],$.prototype,"adaptiveEnabled",2),l([f()],$.prototype,"taskType",2),l([f()],$.prototype,"readingUnit",2),l([f({attribute:!1})],$.prototype,"restockDefault",2),l([f({type:Array})],$.prototype,"consumesInfo",2),l([p()],$.prototype,"_open",2),l([p()],$.prototype,"_notes",2),l([p()],$.prototype,"_cost",2),l([p()],$.prototype,"_duration",2),l([p()],$.prototype,"_loading",2),l([p()],$.prototype,"_error",2),l([p()],$.prototype,"_checklistState",2),l([p()],$.prototype,"_feedback",2),l([p()],$.prototype,"_photoDocId",2),l([p()],$.prototype,"_photoPreview",2),l([p()],$.prototype,"_photoUploading",2),l([p()],$.prototype,"_readingValue",2),l([p()],$.prototype,"_restockQty",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});var H,Qe=x(()=>{"use strict";C();N();H=class extends w{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||
`],l([v({attribute:!1})],$.prototype,"hass",2),l([v()],$.prototype,"entryId",2),l([v()],$.prototype,"taskId",2),l([v()],$.prototype,"taskName",2),l([v()],$.prototype,"lang",2),l([v({type:Array})],$.prototype,"checklist",2),l([v({type:Boolean})],$.prototype,"adaptiveEnabled",2),l([v()],$.prototype,"taskType",2),l([v()],$.prototype,"readingUnit",2),l([v({attribute:!1})],$.prototype,"restockDefault",2),l([v({type:Array})],$.prototype,"consumesInfo",2),l([p()],$.prototype,"_open",2),l([p()],$.prototype,"_notes",2),l([p()],$.prototype,"_cost",2),l([p()],$.prototype,"_duration",2),l([p()],$.prototype,"_loading",2),l([p()],$.prototype,"_error",2),l([p()],$.prototype,"_checklistState",2),l([p()],$.prototype,"_feedback",2),l([p()],$.prototype,"_photoDocId",2),l([p()],$.prototype,"_photoPreview",2),l([p()],$.prototype,"_photoUploading",2),l([p()],$.prototype,"_readingValue",2),l([p()],$.prototype,"_restockQty",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",$)});var H,et=x(()=>{"use strict";C();N();H=class extends w{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||
<label class="field">
|
||||
${this.label?o`<span class="label">${this.label}${this.required?o`<span class="req">*</span>`:h}</span>`:h}
|
||||
<input
|
||||
@@ -1433,7 +1440,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
`,l([f()],H.prototype,"label",2),l([f()],H.prototype,"value",2),l([f()],H.prototype,"placeholder",2),l([f()],H.prototype,"type",2),l([f({type:Boolean})],H.prototype,"required",2),l([f({type:Boolean})],H.prototype,"disabled",2),l([f()],H.prototype,"step",2),l([f()],H.prototype,"min",2),l([f()],H.prototype,"max",2),l([f()],H.prototype,"pattern",2),l([f()],H.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",H)});var S,Ft=x(()=>{"use strict";C();N();I();te();Qe();S=class extends w{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return o``;let e=this._lang,t=this._entryId?r("edit_object",e):r("new_object",e);return o`
|
||||
`,l([v()],H.prototype,"label",2),l([v()],H.prototype,"value",2),l([v()],H.prototype,"placeholder",2),l([v()],H.prototype,"type",2),l([v({type:Boolean})],H.prototype,"required",2),l([v({type:Boolean})],H.prototype,"disabled",2),l([v()],H.prototype,"step",2),l([v()],H.prototype,"min",2),l([v()],H.prototype,"max",2),l([v()],H.prototype,"pattern",2),l([v()],H.prototype,"helper",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",H)});var S,Vt=x(()=>{"use strict";C();N();I();te();et();S=class extends w{constructor(){super(...arguments);this.objects=[];this._open=!1;this._loading=!1;this._error="";this._name="";this._manufacturer="";this._model="";this._serialNumber="";this._areaId="";this._installationDate="";this._warrantyExpiry="";this._documentationUrl="";this._notes="";this._haDeviceId="";this._parentEntryId="";this._entryId=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}openCreate(){this._entryId=null,this._name="",this._manufacturer="",this._model="",this._serialNumber="",this._areaId="",this._installationDate="",this._warrantyExpiry="",this._documentationUrl="",this._notes="",this._haDeviceId="",this._parentEntryId="",this._error="",this._open=!0}openEdit(e,t){this._entryId=e,this._name=t.name||"",this._manufacturer=t.manufacturer||"",this._model=t.model||"",this._serialNumber=t.serial_number||"",this._areaId=t.area_id||"",this._installationDate=t.installation_date||"",this._warrantyExpiry=t.warranty_expiry||"",this._documentationUrl=t.documentation_url||"",this._notes=t.notes||"",this._haDeviceId=t.ha_device_id||"",this._parentEntryId=t.parent_entry_id||"",this._error="",this._open=!0}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{this._entryId?await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/update",entry_id:this._entryId,name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}):await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/create",name:this._name,manufacturer:this._manufacturer||null,model:this._model||null,serial_number:this._serialNumber||null,area_id:this._areaId||null,installation_date:this._installationDate||null,warranty_expiry:this._warrantyExpiry||null,documentation_url:this._documentationUrl.trim()||null,notes:this._notes.trim()||null,ha_device_id:this._haDeviceId||null,parent_entry_id:this._parentEntryId||null}),this._open=!1,this.dispatchEvent(new CustomEvent("object-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_parentChoices(){return(this.objects||[]).filter(e=>e.entry_id!==this._entryId)}_close(){this._open=!1}render(){if(!this._open)return o``;let e=this._lang,t=this._entryId?r("edit_object",e):r("new_object",e);return o`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${t}</div>
|
||||
<div class="content">
|
||||
@@ -1574,8 +1581,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
`,l([f({attribute:!1})],S.prototype,"hass",2),l([f({attribute:!1})],S.prototype,"objects",2),l([p()],S.prototype,"_open",2),l([p()],S.prototype,"_loading",2),l([p()],S.prototype,"_error",2),l([p()],S.prototype,"_name",2),l([p()],S.prototype,"_manufacturer",2),l([p()],S.prototype,"_model",2),l([p()],S.prototype,"_serialNumber",2),l([p()],S.prototype,"_areaId",2),l([p()],S.prototype,"_installationDate",2),l([p()],S.prototype,"_warrantyExpiry",2),l([p()],S.prototype,"_documentationUrl",2),l([p()],S.prototype,"_notes",2),l([p()],S.prototype,"_haDeviceId",2),l([p()],S.prototype,"_parentEntryId",2),l([p()],S.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",S)});var Le,Ot=x(()=>{"use strict";Le=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function Bi(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:""}}function Gi(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??""}}function Ki(a){let s=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={entity_id:s[0],entity_ids:s,type:a.type};if(a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseInt(a.forMinutes,10);isNaN(n)||(e.trigger_for_minutes=n)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t)}return e}function Yi(a){return Array.from({length:7},(s,e)=>Se(e,a,"short"))}function Ji(a){let s=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>s.format(new Date(2021,t,1)))}var Oi,Di,Vi,Dt,Vt,Wi,g,Wt=x(()=>{"use strict";C();N();I();Ot();te();Qe();Oi=["cleaning","inspection","replacement","calibration","service","reading","custom"],Di=["low","normal","high"],Vi=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],Dt=["weekdays","nth_weekday","day_of_month"],Vt=["threshold","counter","state_change","runtime"],Wi=[...Vt,"compound"];g=class extends w{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._tri
Line truncated
|
||||
`),this._scheduleTime=t.schedule_time||"";let d=t.on_complete_action;if(d&&d.service){this._actionService=d.service;let u=d.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=d.data&&typeof d.data=="object"?{...d.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.feedback||"";let _=t.adaptive_config||{};if(this._environmentalEntity=_.environmental_entity||"",this._environmentalAttribute=_.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(Gi)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new Le(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}let n=this._actionTargetEntity.trim();if(n){let d=n.split(".")[0];if(d!==t&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(t)){this._actionTestResult="error",this._actionTestError=`Service "${e}" only works on ${t}.Line truncated
|
||||
`,l([v({attribute:!1})],S.prototype,"hass",2),l([v({attribute:!1})],S.prototype,"objects",2),l([p()],S.prototype,"_open",2),l([p()],S.prototype,"_loading",2),l([p()],S.prototype,"_error",2),l([p()],S.prototype,"_name",2),l([p()],S.prototype,"_manufacturer",2),l([p()],S.prototype,"_model",2),l([p()],S.prototype,"_serialNumber",2),l([p()],S.prototype,"_areaId",2),l([p()],S.prototype,"_installationDate",2),l([p()],S.prototype,"_warrantyExpiry",2),l([p()],S.prototype,"_documentationUrl",2),l([p()],S.prototype,"_notes",2),l([p()],S.prototype,"_haDeviceId",2),l([p()],S.prototype,"_parentEntryId",2),l([p()],S.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",S)});var Re,Wt=x(()=>{"use strict";Re=class{constructor(s){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=s}updateHass(s){this.hass=s}async getUsers(s=!1){let e=Date.now();if(!s&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(s,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:s,task_id:e,user_id:t})}async getTasksByUser(s){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:s})).tasks}getUserName(s){return!s||!this.usersCache?null:this.usersCache.find(t=>t.id===s)?.name||null}getUser(s){return!s||!this.usersCache?null:this.usersCache.find(e=>e.id===s)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(s){return s?s===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function Zi(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:""}}function Qi(a){return{entityIds:(a.entity_ids||(a.entity_id?[a.entity_id]:[])).join(", "),type:a.type||"threshold",above:a.trigger_above?.toString()??"",below:a.trigger_below?.toString()??"",forMinutes:a.trigger_for_minutes?.toString()??"0",targetValue:a.trigger_target_value?.toString()??"",deltaMode:a.trigger_delta_mode||!1,fromState:a.trigger_from_state||"",toState:a.trigger_to_state||"",targetChanges:a.trigger_target_changes?.toString()??"",runtimeHours:a.trigger_runtime_hours?.toString()??""}}function Xi(a){let s=a.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(s.length===0)return null;let e={entity_id:s[0],entity_ids:s,type:a.type};if(a.type==="threshold"){let t=parseFloat(a.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(a.below);isNaN(i)||(e.trigger_below=i);let n=parseInt(a.forMinutes,10);isNaN(n)||(e.trigger_for_minutes=n)}else if(a.type==="counter"){let t=parseFloat(a.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(e.trigger_from_state=a.fromState),a.toState&&(e.trigger_to_state=a.toState);let t=parseInt(a.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(a.type==="runtime"){let t=parseFloat(a.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t)}return e}function es(a){return Array.from({length:7},(s,e)=>Ce(e,a,"short"))}function ts(a){let s=new Intl.DateTimeFormat(a||"en",{month:"short"});return Array.from({length:12},(e,t)=>s.format(new Date(2021,t,1)))}var Gi,Yi,Ki,Bt,Gt,Ji,g,Yt=x(()=>{"use strict";C();N();I();Wt();te();et();Gi=["cleaning","inspection","replacement","calibration","service","reading","custom"],Yi=["low","normal","high"],Ki=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],Bt=["weekdays","nth_weekday","day_of_month"],Gt=["threshold","counter","state_change","runtime"],Ji=[...Gt,"compound"];g=class extends w{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._tri
Line truncated
|
||||
`),this._scheduleTime=t.schedule_time||"";let d=t.on_complete_action;if(d&&d.service){this._actionService=d.service;let u=d.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=d.data&&typeof d.data=="object"?{...d.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.feedback||"";let _=t.adaptive_config||{};if(this._environmentalEntity=_.environmental_entity||"",this._environmentalAttribute=_.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(Qi)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new Re(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}let n=this._actionTargetEntity.trim();if(n){let d=n.split(".")[0];if(d!==t&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(t)){this._actionTestResult="error",this._actionTestError=`Service "${e}" only works on ${t}.Line truncated
|
||||
<details class="ca-section">
|
||||
<summary>${r("on_complete_action_title",e)}</summary>
|
||||
<p class="field-help">${r("on_complete_action_desc",e)}</p>
|
||||
@@ -1651,8 +1658,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
<option value="not_needed">${r("quick_complete_defaults_feedback_not_needed",e)}</option>
|
||||
</select>
|
||||
</details>
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:parseInt(this._warningDays,10)||7},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):Dt.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(e.consumes_parts=Object.entries(this._consumesParts).map(([c,_])=>({part_id:c,quantity:_}))),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map(Ki).filter(_=>_!==null);if(c.length>0){let _={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(_.auto_complete_on_recovery=!0),e.trigger_config=_}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],_={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(_.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(_.auto_complete_on_recovery=!0),c.length>1&&(_.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(_.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(_.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(_.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(_.trigger_target_value=u)}_.trigger_delta_mode=this._triggerDeltaMode}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(_.trigger_from_state=this._triggerFromState),this._triggerToState&&(_.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(_.trigger_target_changes=u)}}else if(this._triggerType==="runtime"&&this._triggerRuntimeHours){let u=parseFloat(this._triggerRuntimeHours);isNaN(u)||(_.trigger_runtime_hours=u)}e.trigger_config=_}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||
`).map(_=>_.trim()).filter(Boolean).slice(0,100);e.checklist=c.length?c:null}if(this.completionActionsEnabled){let c=this._actionService.trim();if(c&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(c)){let m={service:c},y=this._actionTargetEntity.trim();y&&(m.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let _={};this._qcNotes.trim()&&(_.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(_.cost=u);let v=parseInt(this._qcDuration,10);!isNaN(v)&&v>=0&&(_.duration=v),this._qcFeedback&&(_.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(_).length?_:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,d=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&d)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,t=this._triggerType==="compound";return o`
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:parseInt(this._warningDays,10)||7},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):Bt.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(e.consumes_parts=Object.entries(this._consumesParts).map(([c,_])=>({part_id:c,quantity:_}))),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map(Xi).filter(_=>_!==null);if(c.length>0){let _={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(_.auto_complete_on_recovery=!0),e.trigger_config=_}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],_={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(_.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(_.auto_complete_on_recovery=!0),c.length>1&&(_.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(_.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(_.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(_.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(_.trigger_target_value=u)}_.trigger_delta_mode=this._triggerDeltaMode}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(_.trigger_from_state=this._triggerFromState),this._triggerToState&&(_.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(_.trigger_target_changes=u)}}else if(this._triggerType==="runtime"&&this._triggerRuntimeHours){let u=parseFloat(this._triggerRuntimeHours);isNaN(u)||(_.trigger_runtime_hours=u)}e.trigger_config=_}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||
`).map(_=>_.trim()).filter(Boolean).slice(0,100);e.checklist=c.length?c:null}if(this.completionActionsEnabled){let c=this._actionService.trim();if(c&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(c)){let m={service:c},y=this._actionTargetEntity.trim();y&&(m.target={entity_id:y});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let _={};this._qcNotes.trim()&&(_.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(_.cost=u);let f=parseInt(this._qcDuration,10);!isNaN(f)&&f>=0&&(_.duration=f),this._qcFeedback&&(_.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(_).length?_:null}let i=await this.hass.connection.sendMessagePromise(e),n=this._taskId||i?.task_id,d=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(n&&this._scheduleType==="sensor_based"&&d)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:n,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=L(e,this._lang,r("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,t=this._triggerType==="compound";return o`
|
||||
<h3>${r("trigger_configuration",e)}</h3>
|
||||
<div class="select-row">
|
||||
<label>${r("trigger_type",e)}</label>
|
||||
@@ -1660,7 +1667,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${this._triggerType}
|
||||
@change=${i=>this._triggerType=i.target.value}
|
||||
>
|
||||
${Wi.map(i=>o`<option value=${i} ?selected=${i===this._triggerType}>${r(i,e)}</option>`)}
|
||||
${Ji.map(i=>o`<option value=${i} ?selected=${i===this._triggerType}>${r(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${t?this._renderCompoundEditor():o`
|
||||
@@ -1719,7 +1726,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
@input=${i=>this._intervalDays=i.target.value}
|
||||
></ms-textfield>
|
||||
${this._intervalDays?this._renderUnitSelect():h}
|
||||
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Bi()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return o`
|
||||
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,n)=>n===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Zi()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return o`
|
||||
<div class="select-row">
|
||||
<label>${r("compound_logic",e)}</label>
|
||||
<select
|
||||
@@ -1757,7 +1764,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${e.type}
|
||||
@change=${d=>this._patchCondition(t,{type:d.target.value})}
|
||||
>
|
||||
${Vt.map(d=>o`<option value=${d} ?selected=${d===e.type}>${r(d,i)}</option>`)}
|
||||
${Gt.map(d=>o`<option value=${d} ?selected=${d===e.type}>${r(d,i)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(e,t)}
|
||||
@@ -1796,7 +1803,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
>
|
||||
${["days","weeks","months","years"].map(t=>o`<option value=${t} ?selected=${t===this._intervalUnit}>${r("unit_"+t,e)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||Dt.includes(this._scheduleType)))return h;let i=Ji(e);return o`
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_buildSchedule(){let e=i=>{let n=parseInt(this._calOffset,10)||0;return n&&(i.offset=Math.max(-15,Math.min(n,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,n)=>i-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||Bt.includes(this._scheduleType)))return h;let i=ts(e);return o`
|
||||
<label class="field-label">${r("season_window_label",e)}</label>
|
||||
<div class="field-help">${r("season_window_hint",e)}</div>
|
||||
<div class="weekday-chips season-chips">
|
||||
@@ -1831,7 +1838,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${this._endsUntil}
|
||||
@input=${n=>this._endsUntil=n.target.value}
|
||||
></ms-textfield>`:h}
|
||||
`}_renderCalendarFields(){let e=this._lang,t=Yi(e);if(this._scheduleType==="weekdays")return o`
|
||||
`}_renderCalendarFields(){let e=this._lang,t=es(e);if(this._scheduleType==="weekdays")return o`
|
||||
<label class="field-label">${r("recurrence_on_days",e)}</label>
|
||||
<div class="weekday-chips">
|
||||
${t.map((i,n)=>o`
|
||||
@@ -1883,7 +1890,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
max="15"
|
||||
.value=${this._calOffset}
|
||||
@input=${t=>this._calOffset=t.target.value}
|
||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerEntityId||this._triggerEntityIds[0];if(!e||!this.hass?.states)return h;let t=this.hass.states[e];if(!t)return h;let i=this._lang,n=t.attributes?.unit_of_measurement,d=typeof n=="string"&&n?` ${n}`:"",c=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,_=typeof c=="number"?c:parseFloat(String(c)),u=c!=="unknown"&&c!=="unavailable"&&c!=null&&!isNaN(_),v=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),m=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return h;u&&m.push(r("trigger_hint_now",i).replace("{value}",v(_)+d)),isNaN(y)||m.push(r("trigger_hint_above",i).replace("{target}",v(y)+d)),isNaN(b)||m.push(r("trigger_hint_below",i).replace("{target}",v(b)+d))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return h;this._triggerDeltaMode?this._taskId?m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",v(y)+d)):u?m.push(r("trigger_hint_counter_delta",i).replace("{value}",v(_)+d).replace("{due}",v(_+y)+d).replace("{target}",v(y)+d)):m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",v(y)+d)):(u&&m.push(r("trigger_hint_now",i).replace("{value}",v(_)+d)),m.push(r("trigger_hint_counter_abs",i).replace("{target}",v(y)+d)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return h;m.push(r("trigger_hint_runtime",i).replace("{hours}",v(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();m.push((b?r("trigger_hint_state_change_to",i).replace("{state}",b):r("trigger_hint_state_change",i)).replace("{count}",String(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}return m.length?o`<div class="trigger-live-hint">${m.join(" ")}</div>`:h}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?o`
|
||||
></ms-textfield>`}_renderTriggerLiveHint(){if(this._triggerType==="compound")return h;let e=this._triggerEntityId||this._triggerEntityIds[0];if(!e||!this.hass?.states)return h;let t=this.hass.states[e];if(!t)return h;let i=this._lang,n=t.attributes?.unit_of_measurement,d=typeof n=="string"&&n?` ${n}`:"",c=this._triggerAttribute?t.attributes?.[this._triggerAttribute]:t.state,_=typeof c=="number"?c:parseFloat(String(c)),u=c!=="unknown"&&c!=="unavailable"&&c!=null&&!isNaN(_),f=y=>Number.isInteger(y)?String(y):String(Math.round(y*10)/10),m=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),b=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN(b))return h;u&&m.push(r("trigger_hint_now",i).replace("{value}",f(_)+d)),isNaN(y)||m.push(r("trigger_hint_above",i).replace("{target}",f(y)+d)),isNaN(b)||m.push(r("trigger_hint_below",i).replace("{target}",f(b)+d))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return h;this._triggerDeltaMode?this._taskId?m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+d)):u?m.push(r("trigger_hint_counter_delta",i).replace("{value}",f(_)+d).replace("{due}",f(_+y)+d).replace("{target}",f(y)+d)):m.push(r("trigger_hint_counter_delta_edit",i).replace("{target}",f(y)+d)):(u&&m.push(r("trigger_hint_now",i).replace("{value}",f(_)+d)),m.push(r("trigger_hint_counter_abs",i).replace("{target}",f(y)+d)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return h;m.push(r("trigger_hint_runtime",i).replace("{hours}",f(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,b=this._triggerToState.trim();m.push((b?r("trigger_hint_state_change_to",i).replace("{state}",b):r("trigger_hint_state_change",i)).replace("{count}",String(y))),m.push(r("trigger_hint_state_now",i).replace("{value}",String(t.state)))}return m.length?o`<div class="trigger-live-hint">${m.join(" ")}</div>`:h}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?o`
|
||||
<ms-textfield
|
||||
label="${r("trigger_above",e)}"
|
||||
type="number"
|
||||
@@ -1976,7 +1983,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${this._type}
|
||||
@change=${i=>this._type=i.target.value}
|
||||
>
|
||||
${Oi.map(i=>o`<option value=${i} ?selected=${i===this._type}>${r(i,e)}</option>`)}
|
||||
${Gi.map(i=>o`<option value=${i} ?selected=${i===this._type}>${r(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?o`
|
||||
@@ -2019,7 +2026,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${this._priority}
|
||||
@change=${i=>this._priority=i.target.value}
|
||||
>
|
||||
${Di.map(i=>o`<option value=${i} ?selected=${i===this._priority}>${r("priority_"+i,e)}</option>`)}
|
||||
${Yi.map(i=>o`<option value=${i} ?selected=${i===this._priority}>${r("priority_"+i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -2038,7 +2045,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.value=${this._scheduleType}
|
||||
@change=${i=>this._scheduleType=i.target.value}
|
||||
>
|
||||
${Vi.map(i=>o`<option value=${i} ?selected=${i===this._scheduleType}>${r(i,e)}</option>`)}
|
||||
${Ki.map(i=>o`<option value=${i} ?selected=${i===this._scheduleType}>${r(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?o`
|
||||
@@ -2476,7 +2483,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,l([f({attribute:!1})],g.prototype,"hass",2),l([f({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),l([f({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),l([f({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),l([f({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),l([p()],g.prototype,"parts",2),l([p()],g.prototype,"_open",2),l([p()],g.prototype,"_loading",2),l([p()],g.prototype,"_error",2),l([p()],g.prototype,"_entryId",2),l([p()],g.prototype,"_taskId",2),l([p()],g.prototype,"_objectChoices",2),l([p()],g.prototype,"_name",2),l([p()],g.prototype,"_type",2),l([p()],g.prototype,"_scheduleType",2),l([p()],g.prototype,"_intervalDays",2),l([p()],g.prototype,"_intervalUnit",2),l([p()],g.prototype,"_dueDate",2),l([p()],g.prototype,"_warningDays",2),l([p()],g.prototype,"_earliestCompletionDays",2),l([p()],g.prototype,"_intervalAnchor",2),l([p()],g.prototype,"_weekdays",2),l([p()],g.prototype,"_nth",2),l([p()],g.prototype,"_nthWeekday",2),l([p()],g.prototype,"_domDay",2),l([p()],g.prototype,"_domLastDay",2),l([p()],g.prototype,"_domBusiness",2),l([p()],g.prototype,"_calOffset",2),l([p()],g.prototype,"_seasonMonths",2),l([p()],g.prototype,"_endsMode",2),l([p()],g.prototype,"_endsCount",2),l([p()],g.prototype,"_endsUntil",2),l([p()],g.prototype,"_notes",2),l([p()],g.prototype,"_documentationUrl",2),l([p()],g.prototype,"_customIcon",2),l([p()],g.prototype,"_priority",2),l([p()],g.prototype,"_labels",2),l([p()],g.prototype,"_enabled",2),l([p()],g.prototype,"_triggerEntityId",2),l([p()],g.prototype,"_triggerEntityIds",2),l([p()],g.prototype,"_triggerEntityLogic",2),l([p()],g.prototype,"_triggerAttribute",2),l([p()],g.prototype,"_triggerType",2),l([p()],g.prototype,"_triggerAbove",2),l([p()],g.prototype,"_triggerBelow",2),l([p()],g.prototype,"_triggerForMinutes",2),l([p()],g.prototype,"_triggerTargetValue",2),l([p()],g.prototype,"_triggerDeltaMode",2),l([p()],g.prototype,"_autoCompleteOnRecovery",2),l([p()],g.prototype,"_triggerFromState",2),l([p()],g.prototype,"_triggerToState",2),l([p()],g.prototype,"_triggerTargetChanges",2),l([p()],g.prototype,"_triggerRuntimeHours",2),l([p()],g.prototype,"_compoundLogic",2),l([p()],g.prototype,"_compoundConditions",2),l([p()],g.prototype,"_suggestedAttributes",2),l([p()],g.prototype,"_availableAttributes",2),l([p()],g.prototype,"_entityDomain",2),l([p()],g.prototype,"_lastPerformed",2),l([p()],g.prototype,"_nfcTagId",2),l([p()],g.prototype,"_readingUnit",2),l([p()],g.prototype,"_consumesParts",2),l([p()],g.prototype,"_partsLoadFailed",2),l([p()],g.prototype,"_availableTags",2),l([p()],g.prototype,"_responsibleUserId",2),l([p()],g.prototype,"_assigneePool",2),l([p()],g.prototype,"_rotationStrategy",2),l([p()],g.prototype,"_availableUsers",2),l([p()],g.prototype,"_checklistText",2),l([p()],g.prototype,"_scheduleTime",2),l([p()],g.prototype,"_actionService",2),l([p()],g.prototype,"_actionTargetEntity",2),l([p()],g.prototype,"_actionData",2),l([p()],g.prototype,"_actionDataJsonFallback",2),l([p()],g.prototype,"_actionTesting",2),l([p()],g.prototype,"_actionTestResult",2),l([p()],g.prototype,"_actionTestError",2),l([p()],g.prototype,"_qcNotes",2),l([p()],g.prototype,"_qcCost",2),l([p()],g.prototype,"_qcDuration",2),l([p()],g.prototype,"_qcFeedback",2),l([p()],g.prototype,"_environmentalEntity",2),l([p()],g.prototype,"_environmentalAttribute",2);customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",g)});var D,Bt=x(()=>{"use strict";C();N();I();te();D=class extends w{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),Object.keys(e).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(e),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{en
Line truncated
|
||||
`,l([v({attribute:!1})],g.prototype,"hass",2),l([v({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),l([v({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),l([v({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),l([v({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),l([p()],g.prototype,"parts",2),l([p()],g.prototype,"_open",2),l([p()],g.prototype,"_loading",2),l([p()],g.prototype,"_error",2),l([p()],g.prototype,"_entryId",2),l([p()],g.prototype,"_taskId",2),l([p()],g.prototype,"_objectChoices",2),l([p()],g.prototype,"_name",2),l([p()],g.prototype,"_type",2),l([p()],g.prototype,"_scheduleType",2),l([p()],g.prototype,"_intervalDays",2),l([p()],g.prototype,"_intervalUnit",2),l([p()],g.prototype,"_dueDate",2),l([p()],g.prototype,"_warningDays",2),l([p()],g.prototype,"_earliestCompletionDays",2),l([p()],g.prototype,"_intervalAnchor",2),l([p()],g.prototype,"_weekdays",2),l([p()],g.prototype,"_nth",2),l([p()],g.prototype,"_nthWeekday",2),l([p()],g.prototype,"_domDay",2),l([p()],g.prototype,"_domLastDay",2),l([p()],g.prototype,"_domBusiness",2),l([p()],g.prototype,"_calOffset",2),l([p()],g.prototype,"_seasonMonths",2),l([p()],g.prototype,"_endsMode",2),l([p()],g.prototype,"_endsCount",2),l([p()],g.prototype,"_endsUntil",2),l([p()],g.prototype,"_notes",2),l([p()],g.prototype,"_documentationUrl",2),l([p()],g.prototype,"_customIcon",2),l([p()],g.prototype,"_priority",2),l([p()],g.prototype,"_labels",2),l([p()],g.prototype,"_enabled",2),l([p()],g.prototype,"_triggerEntityId",2),l([p()],g.prototype,"_triggerEntityIds",2),l([p()],g.prototype,"_triggerEntityLogic",2),l([p()],g.prototype,"_triggerAttribute",2),l([p()],g.prototype,"_triggerType",2),l([p()],g.prototype,"_triggerAbove",2),l([p()],g.prototype,"_triggerBelow",2),l([p()],g.prototype,"_triggerForMinutes",2),l([p()],g.prototype,"_triggerTargetValue",2),l([p()],g.prototype,"_triggerDeltaMode",2),l([p()],g.prototype,"_autoCompleteOnRecovery",2),l([p()],g.prototype,"_triggerFromState",2),l([p()],g.prototype,"_triggerToState",2),l([p()],g.prototype,"_triggerTargetChanges",2),l([p()],g.prototype,"_triggerRuntimeHours",2),l([p()],g.prototype,"_compoundLogic",2),l([p()],g.prototype,"_compoundConditions",2),l([p()],g.prototype,"_suggestedAttributes",2),l([p()],g.prototype,"_availableAttributes",2),l([p()],g.prototype,"_entityDomain",2),l([p()],g.prototype,"_lastPerformed",2),l([p()],g.prototype,"_nfcTagId",2),l([p()],g.prototype,"_readingUnit",2),l([p()],g.prototype,"_consumesParts",2),l([p()],g.prototype,"_partsLoadFailed",2),l([p()],g.prototype,"_availableTags",2),l([p()],g.prototype,"_responsibleUserId",2),l([p()],g.prototype,"_assigneePool",2),l([p()],g.prototype,"_rotationStrategy",2),l([p()],g.prototype,"_availableUsers",2),l([p()],g.prototype,"_checklistText",2),l([p()],g.prototype,"_scheduleTime",2),l([p()],g.prototype,"_actionService",2),l([p()],g.prototype,"_actionTargetEntity",2),l([p()],g.prototype,"_actionData",2),l([p()],g.prototype,"_actionDataJsonFallback",2),l([p()],g.prototype,"_actionTesting",2),l([p()],g.prototype,"_actionTestResult",2),l([p()],g.prototype,"_actionTestError",2),l([p()],g.prototype,"_qcNotes",2),l([p()],g.prototype,"_qcCost",2),l([p()],g.prototype,"_qcDuration",2),l([p()],g.prototype,"_qcFeedback",2),l([p()],g.prototype,"_environmentalEntity",2),l([p()],g.prototype,"_environmentalAttribute",2);customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",g)});var O,Kt=x(()=>{"use strict";C();N();I();te();O=class extends w{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),Object.keys(e).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(e),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{en
Line truncated
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
<h2>${r("history_edit_title",e)||"Edit history entry"}</h2>
|
||||
@@ -2521,7 +2528,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`}};D.styles=E`
|
||||
`}};O.styles=E`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0;
|
||||
@@ -2583,7 +2590,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
background: rgba(211,47,47,0.1);
|
||||
border-radius: 6px;
|
||||
}
|
||||
`,l([f({attribute:!1})],D.prototype,"hass",2),l([p()],D.prototype,"_open",2),l([p()],D.prototype,"_saving",2),l([p()],D.prototype,"_error",2),l([p()],D.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",D)});function oe(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Gt(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":oe(a)}function Zi(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var j,Kt=x(()=>{"use strict";C();N();I();j=class extends w{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?r("qr_error_no_url",this.lang):r("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let d=this.lang||"en",c=oe(t),_=oe(i),u=!!this._completeResult,v=oe(r("qr_action_view",d)),m=oe(r("qr_action_complete",d));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`,l([v({attribute:!1})],O.prototype,"hass",2),l([p()],O.prototype,"_open",2),l([p()],O.prototype,"_saving",2),l([p()],O.prototype,"_error",2),l([p()],O.prototype,"_draft",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",O)});function oe(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Jt(a){return!a.startsWith("data:image/svg+xml,")&&!a.startsWith("data:image/png;base64,")?"":oe(a)}function is(a){return a.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var P,Zt=x(()=>{"use strict";C();N();I();P=class extends w{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,n){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let n=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,n=t?.message;this._error=i==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?r("qr_error_no_url",this.lang):r("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let d=this.lang||"en",c=oe(t),_=oe(i),u=!!this._completeResult,f=oe(r("qr_action_view",d)),m=oe(r("qr_action_complete",d));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<title>${c}</title>
|
||||
<style>
|
||||
body{font-family:sans-serif;text-align:center;padding:20px}
|
||||
@@ -2599,17 +2606,17 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
${_?`<div class="sub">${_}</div>`:""}
|
||||
<div class="qr-row">
|
||||
<div class="qr-col">
|
||||
<img src="${Gt(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${v}</div>
|
||||
<img src="${Jt(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${f}</div>
|
||||
</div>
|
||||
${u?`<div class="qr-col">
|
||||
<img src="${Gt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<img src="${Jt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${m}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${oe(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),d=URL.createObjectURL(n),c=document.createElement("a");c.href=d;let _=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${Zi(_)}-${t}.svg`,c.click(),URL.revokeObjectURL(d)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${r("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${r("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=new Blob([i],{type:"image/svg+xml"}),d=URL.createObjectURL(n),c=document.createElement("a");c.href=d;let _=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${is(_)}-${t}.svg`,c.click(),URL.revokeObjectURL(d)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${r("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${r("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${t}</div>
|
||||
<div class="content">
|
||||
@@ -2670,7 +2677,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};j.styles=E`
|
||||
`}};P.styles=E`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -2788,37 +2795,37 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,l([f({attribute:!1})],j.prototype,"hass",2),l([f()],j.prototype,"lang",2),l([p()],j.prototype,"_open",2),l([p()],j.prototype,"_loading",2),l([p()],j.prototype,"_error",2),l([p()],j.prototype,"_viewResult",2),l([p()],j.prototype,"_completeResult",2),l([p()],j.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",j)});function Yt(a,s){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return h;let n=a.interval_days??0,d=a.suggested_interval??n;return o`
|
||||
`,l([v({attribute:!1})],P.prototype,"hass",2),l([v()],P.prototype,"lang",2),l([p()],P.prototype,"_open",2),l([p()],P.prototype,"_loading",2),l([p()],P.prototype,"_error",2),l([p()],P.prototype,"_viewResult",2),l([p()],P.prototype,"_completeResult",2),l([p()],P.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",P)});function Qt(a,s){let e=a.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return h;let n=a.interval_days??0,d=a.suggested_interval??n;return o`
|
||||
<div class="weibull-section">
|
||||
<div class="weibull-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M3,14L3.5,14.07L8.07,9.5C7.89,8.85 8.06,8.11 8.59,7.59C9.37,6.8 10.63,6.8 11.41,7.59C11.94,8.11 12.11,8.85 11.93,9.5L14.5,12.07L15,12C15.18,12 15.35,12 15.5,12.07L19.07,8.5C19,8.35 19,8.18 19,8A2,2 0 0,1 21,6A2,2 0 0,1 23,8A2,2 0 0,1 21,10C20.82,10 20.65,10 20.5,9.93L16.93,13.5C17,13.65 17,13.82 17,14A2,2 0 0,1 15,16A2,2 0 0,1 13,14L13.07,13.5L10.5,10.93C10.18,11 9.82,11 9.5,10.93L4.93,15.5L5,16A2,2 0 0,1 3,18A2,2 0 0,1 1,16A2,2 0 0,1 3,14Z"></ha-svg-icon>
|
||||
${r("weibull_reliability_curve",s)}
|
||||
${Qi(t,s)}
|
||||
${ss(t,s)}
|
||||
</div>
|
||||
${Xi(t,i,n,d,s)}
|
||||
${es(e,s)}
|
||||
${e?.confidence_interval_low!=null?ts(e,a,s):h}
|
||||
${rs(t,i,n,d,s)}
|
||||
${as(e,s)}
|
||||
${e?.confidence_interval_low!=null?ns(e,a,s):h}
|
||||
</div>
|
||||
`}function Qi(a,s){let e,t,i;return a<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):a<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):a<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),o`
|
||||
`}function ss(a,s){let e,t,i;return a<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):a<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):a<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),o`
|
||||
<span class="beta-badge ${e}">
|
||||
<ha-svg-icon path="${t}"></ha-svg-icon>
|
||||
${r(i,s)} (\u03B2=${a.toFixed(2)})
|
||||
</span>
|
||||
`}function Xi(a,s,e,t,i){let b=Math.max(e,t,s,1)*1.3,A=50,k=[];for(let P=0;P<=A;P++){let z=P/A*b,gi=1-Math.exp(-Math.pow(z/s,a)),mi=32+z/b*260,vi=136-gi*128;k.push([mi,vi])}let R=k.map(([P,z])=>`${P.toFixed(1)},${z.toFixed(1)}`).join(" "),je="M32,136 "+k.map(([P,z])=>`L${P.toFixed(1)},${z.toFixed(1)}`).join(" ")+` L${k[A][0].toFixed(1)},136 Z`,ie=32+e/b*260,fe=1-Math.exp(-Math.pow(e/s,a)),be=136-fe*128,_i=((1-fe)*100).toFixed(0),it=32+t/b*260,ui=[0,.25,.5,.75,1];return o`
|
||||
`}function rs(a,s,e,t,i){let b=Math.max(e,t,s,1)*1.3,A=50,k=[];for(let j=0;j<=A;j++){let z=j/A*b,vi=1-Math.exp(-Math.pow(z/s,a)),bi=32+z/b*260,yi=136-vi*128;k.push([bi,yi])}let R=k.map(([j,z])=>`${j.toFixed(1)},${z.toFixed(1)}`).join(" "),Ne="M32,136 "+k.map(([j,z])=>`L${j.toFixed(1)},${z.toFixed(1)}`).join(" ")+` L${k[A][0].toFixed(1)},136 Z`,ie=32+e/b*260,ve=1-Math.exp(-Math.pow(e/s,a)),be=136-ve*128,mi=((1-ve)*100).toFixed(0),rt=32+t/b*260,fi=[0,.25,.5,.75,1];return o`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_weibull",i)}">
|
||||
${ui.map(P=>{let z=136-P*128;return ae`
|
||||
${fi.map(j=>{let z=136-j*128;return ae`
|
||||
<line x1="${32}" y1="${z.toFixed(1)}" x2="${292}" y2="${z.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${P===.5?"4,3":h}" />
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${j===.5?"4,3":h}" />
|
||||
<text x="${28}" y="${(z+3).toFixed(1)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${(P*100).toFixed(0)}%</text>
|
||||
font-size="8" text-anchor="end">${(j*100).toFixed(0)}%</text>
|
||||
`})}
|
||||
|
||||
<text x="${32}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">0</text>
|
||||
<text x="${324/2}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">${Math.round(b/2)}</text>
|
||||
<text x="${292}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">${Math.round(b)}</text>
|
||||
|
||||
<path d="${je}" fill="var(--primary-color, #03a9f4)" opacity="0.08" />
|
||||
<path d="${Ne}" fill="var(--primary-color, #03a9f4)" opacity="0.08" />
|
||||
<polyline points="${R}" fill="none"
|
||||
stroke="var(--primary-color, #03a9f4)" stroke-width="2" />
|
||||
|
||||
@@ -2828,11 +2835,11 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<circle cx="${ie.toFixed(1)}" cy="${be.toFixed(1)}" r="3"
|
||||
fill="var(--primary-color, #03a9f4)" />
|
||||
<text x="${(ie+4).toFixed(1)}" y="${(be-6).toFixed(1)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${_i}%</text>
|
||||
font-size="9" font-weight="600">R=${mi}%</text>
|
||||
`:h}
|
||||
|
||||
${t>0&&t!==e?ae`
|
||||
<line x1="${it.toFixed(1)}" y1="${8}" x2="${it.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
<line x1="${rt.toFixed(1)}" y1="${8}" x2="${rt.toFixed(1)}" y2="${136 .toFixed(1)}"
|
||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
`:h}
|
||||
|
||||
@@ -2847,7 +2854,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
${e>0?o`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${r("current_interval_marker",i)}</span>`:h}
|
||||
${t>0&&t!==e?o`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${r("recommended_marker",i)}</span>`:h}
|
||||
</div>
|
||||
`}function es(a,s){return o`
|
||||
`}function as(a,s){return o`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${r("characteristic_life",s)}</span>
|
||||
@@ -2860,13 +2867,13 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
</div>
|
||||
`:h}
|
||||
</div>
|
||||
`}function ts(a,s,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=s.suggested_interval??s.interval_days??0,d=s.interval_days??0,c=Math.max(0,t-5),u=i+5-c,v=(t-c)/u*100,m=(i-t)/u*100,y=(n-c)/u*100,b=d>0?(d-c)/u*100:-1;return o`
|
||||
`}function ns(a,s,e){let t=a.confidence_interval_low,i=a.confidence_interval_high,n=s.suggested_interval??s.interval_days??0,d=s.interval_days??0,c=Math.max(0,t-5),u=i+5-c,f=(t-c)/u*100,m=(i-t)/u*100,y=(n-c)/u*100,b=d>0?(d-c)/u*100:-1;return o`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${r("confidence_interval",e)}: ${n} ${r("days",e)} (${t}\u2013${i})
|
||||
</div>
|
||||
<div class="confidence-bar">
|
||||
<div class="confidence-fill" style="left:${v.toFixed(1)}%;width:${m.toFixed(1)}%"></div>
|
||||
<div class="confidence-fill" style="left:${f.toFixed(1)}%;width:${m.toFixed(1)}%"></div>
|
||||
${b>=0?o`<div class="confidence-marker current" style="left:${b.toFixed(1)}%"></div>`:h}
|
||||
<div class="confidence-marker recommended" style="left:${y.toFixed(1)}%"></div>
|
||||
</div>
|
||||
@@ -2875,7 +2882,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<span class="confidence-text high">${r("confidence_aggressive",e)} (${i}${r("days",e).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}var Jt=x(()=>{"use strict";C();I()});function Zt(a,s,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return h;let d=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||
`}var Xt=x(()=>{"use strict";C();I()});function ei(a,s,e){let t=a.degradation_trend!=null&&a.degradation_trend!=="insufficient_data",i=a.days_until_threshold!=null,n=a.environmental_factor!=null&&a.environmental_factor!==1;if(!t&&!i&&!n)return h;let d=a.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":a.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||
<div class="prediction-section">
|
||||
${a.sensor_prediction_urgency?o`
|
||||
<div class="prediction-urgency-banner">
|
||||
@@ -2910,12 +2917,12 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<ha-svg-icon path="M15,13V5A3,3 0 0,0 12,2A3,3 0 0,0 9,5V13A5,5 0 0,0 7,17A5,5 0 0,0 12,22A5,5 0 0,0 17,17A5,5 0 0,0 15,13M12,4A1,1 0 0,1 13,5V8H11V5A1,1 0 0,1 12,4Z"></ha-svg-icon>
|
||||
<span class="prediction-label">${r("environmental_adjustment",s)}</span>
|
||||
<span class="prediction-value">${a.environmental_factor.toFixed(2)}x</span>
|
||||
${a.environmental_entity?o`<span class="prediction-entity entity-link" @click=${c=>qt(c,a.environmental_entity)}>${a.environmental_entity}</span>`:h}
|
||||
${a.environmental_entity?o`<span class="prediction-entity entity-link" @click=${c=>Ft(c,a.environmental_entity)}>${a.environmental_entity}</span>`:h}
|
||||
</div>
|
||||
`:h}
|
||||
</div>
|
||||
</div>
|
||||
`}var Qt=x(()=>{"use strict";C();I()});function Xt(a,s,e,t){let i=Math.max(a||1,s);return o`
|
||||
`}var ti=x(()=>{"use strict";C();I()});function ii(a,s,e,t){let i=Math.max(a||1,s);return o`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -2933,12 +2940,12 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
style="width: ${Math.min(s/i*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var ei=x(()=>{"use strict";C();I()});function ii(a,s,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return h;let t=ti.map(c=>r(c,s)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,d=n&&n.length===12?n:t.map((c,_)=>{let u=a.seasonal_factor||1,v=Math.sin((_-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+v))});return o`
|
||||
`}var si=x(()=>{"use strict";C();I()});function ai(a,s,e){if(!e.seasonal||!a.seasonal_factor||a.seasonal_factor===1)return h;let t=ri.map(c=>r(c,s)),i=new Date().getMonth(),n=a.seasonal_factors||a.interval_analysis?.seasonal_factors||null,d=n&&n.length===12?n:t.map((c,_)=>{let u=a.seasonal_factor||1,f=Math.sin((_-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+f))});return o`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${r("seasonal_awareness",s)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
${d.map((c,_)=>{let u=c*40,v=c<.9?"low":c>1.1?"high":"normal";return o`
|
||||
<div class="seasonal-bar ${v} ${_===i?"current":""}"
|
||||
${d.map((c,_)=>{let u=c*40,f=c<.9?"low":c>1.1?"high":"normal";return o`
|
||||
<div class="seasonal-bar ${f} ${_===i?"current":""}"
|
||||
style="height: ${u}px"
|
||||
title="${t[_]}: ${c.toFixed(2)}x">
|
||||
</div>
|
||||
@@ -2950,7 +2957,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${r("longer",s)||"L\xE4nger"}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function si(a,s){return is(a,s)}function is(a,s){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,d=100,c=8,u=d-c-4,v=Math.max(...e,1.5),m=n/12,y=m*.65,b=c+u-1/v*u;return o`
|
||||
`}function ni(a,s){return os(a,s)}function os(a,s){let e=a.seasonal_factors??a.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let t=a.interval_analysis?.seasonal_reason,i=new Date().getMonth(),n=300,d=100,c=8,u=d-c-4,f=Math.max(...e,1.5),m=n/12,y=m*.65,b=c+u-1/f*u;return o`
|
||||
<div class="seasonal-chart">
|
||||
<div class="seasonal-chart-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M17.75 4.09L15.22 6.03L16.13 9.09L13.5 7.28L10.87 9.09L11.78 6.03L9.25 4.09L12.44 4L13.5 1L14.56 4L17.75 4.09M21.25 11L19.61 12.25L20.2 14.23L18.5 13.06L16.8 14.23L17.39 12.25L15.75 11L17.81 10.95L18.5 9L19.19 10.95L21.25 11M18.97 15.95C19.8 15.87 20.69 17.05 20.16 17.8C19.84 18.25 19.5 18.67 19.08 19.07C15.17 23 8.84 23 4.94 19.07C1.03 15.17 1.03 8.83 4.94 4.93C5.34 4.53 5.76 4.17 6.21 3.85C6.96 3.32 8.14 4.21 8.06 5.04C7.79 7.9 8.75 10.87 10.95 13.06C13.14 15.26 16.1 16.22 18.97 15.95Z"></ha-svg-icon>
|
||||
@@ -2960,20 +2967,20 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<svg viewBox="0 0 ${n} ${d}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${r("chart_seasonal",s)}">
|
||||
<line x1="0" y1="${b.toFixed(1)}" x2="${n}" y2="${b.toFixed(1)}"
|
||||
stroke="var(--divider-color)" stroke-width="1" stroke-dasharray="4,3" />
|
||||
${e.map((A,k)=>{let R=A/v*u,je=k*m+(m-y)/2,ie=c+u-R,fe=k===i,be=A<1?"var(--success-color, #4caf50)":A>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return ae`
|
||||
<rect x="${je.toFixed(1)}" y="${ie.toFixed(1)}"
|
||||
${e.map((A,k)=>{let R=A/f*u,Ne=k*m+(m-y)/2,ie=c+u-R,ve=k===i,be=A<1?"var(--success-color, #4caf50)":A>1?"var(--warning-color, #ff9800)":"var(--secondary-text-color)";return ae`
|
||||
<rect x="${Ne.toFixed(1)}" y="${ie.toFixed(1)}"
|
||||
width="${y.toFixed(1)}" height="${R.toFixed(1)}"
|
||||
fill="${be}" opacity="${fe?1:.5}" rx="2" />
|
||||
fill="${be}" opacity="${ve?1:.5}" rx="2" />
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${ti.map((A,k)=>o`<span class="seasonal-label ${k===i?"active-month":""}">${r(A,s)}</span>`)}
|
||||
${ri.map((A,k)=>o`<span class="seasonal-label ${k===i?"active-month":""}">${r(A,s)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var ti,ri=x(()=>{"use strict";C();I();ti=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var T,ai=x(()=>{"use strict";C();N();I();te();Jt();Qt();ei();ri();T=class extends w{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=L(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=L(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),V)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(q(),V)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),V)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=r("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=r("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${r("reanalyze_result",this._lang)||"Recomputed"}: ${e.recoLine truncated
|
||||
`}var ri,oi=x(()=>{"use strict";C();I();ri=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var T,li=x(()=>{"use strict";C();N();I();te();Xt();ti();si();oi();T=class extends w{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null}catch(e){this._error=L(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=L(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),V)).then(({openCompleteDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(q(),V)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(q(),V)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=r("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=r("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${r("reanalyze_result",this._lang)||"Recomputed"}: ${e.recoLine truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${r("suggested_interval",t)}</h4>
|
||||
${Xt(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
|
||||
${ii(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)}
|
||||
<div class="recommendation-actions">
|
||||
<button class="btn primary"
|
||||
@click=${this._applySuggestion} ?disabled=${this._busy}>
|
||||
@@ -2993,14 +3000,14 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<div class="adaptive-stack">
|
||||
${this._toast?o`<div class="toast">${this._toast}</div>`:h}
|
||||
${i?this._renderRecommendation(e):h}
|
||||
${n?Zt(e,t,this._features):h}
|
||||
${d?Yt(e,t):h}
|
||||
${n?ei(e,t,this._features):h}
|
||||
${d?Qt(e,t):h}
|
||||
${c?o`
|
||||
${ii(e,t,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?si(e,t):h}
|
||||
${ai(e,t,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?ni(e,t):h}
|
||||
`:h}
|
||||
</div>
|
||||
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(_=>_.type==="completed"),d=n.reduce((_,u)=>_+(typeof u.cost=="number"?u.cost:0),0),c=(()=>{let _=n.map(u=>typeof u.duration=="number"?u.duration:null).filter(u=>u!=null);return _.length?Math.round(_.reduce((u,v)=>u+v,0)/_.length):null})();return o`
|
||||
`}_renderDetails(e){let t=this._lang,i=e.history||[],n=i.filter(_=>_.type==="completed"),d=n.reduce((_,u)=>_+(typeof u.cost=="number"?u.cost:0),0),c=(()=>{let _=n.map(u=>typeof u.duration=="number"?u.duration:null).filter(u=>u!=null);return _.length?Math.round(_.reduce((u,f)=>u+f,0)/_.length):null})();return o`
|
||||
<div class="details">
|
||||
<div class="stats-grid">
|
||||
<div class="stat">
|
||||
@@ -3026,7 +3033,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<div class="history-entry">
|
||||
<div class="history-line">
|
||||
<span class="history-type type-${_.type}">${r(_.type,t)}</span>
|
||||
<span class="history-date">${zt(_.timestamp,t)}</span>
|
||||
<span class="history-date">${Ut(_.timestamp,t)}</span>
|
||||
${u?o`<button class="history-edit"
|
||||
title="${r("history_edit_button",t)||"Edit"}"
|
||||
@click=${()=>this._onEditHistoryEntry(_)}>
|
||||
@@ -3059,7 +3066,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<div class="quick-info">
|
||||
${t.next_due?o`<span><strong>${r("next_due",e)||"Next due"}:</strong> ${ee(t.next_due,e)}</span>`:h}
|
||||
${t.last_performed?o`<span><strong>${r("last_performed",e)||"Last"}:</strong> ${ee(t.last_performed,e)}</span>`:h}
|
||||
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`<span><strong>${r("interval",e)||"Interval"}:</strong> ${Mt(t,e)}</span>`:h}
|
||||
${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`<span><strong>${r("interval",e)||"Interval"}:</strong> ${Dt(t,e)}</span>`:h}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3151,7 +3158,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
`}
|
||||
`:o`<div class="loading">${r("loading",e)||"Loading\u2026"}</div>`}
|
||||
</div>
|
||||
`}};T.styles=[Ie,E`
|
||||
`}};T.styles=[He,E`
|
||||
:host { display: contents; }
|
||||
.backdrop {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
@@ -3331,7 +3338,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||
`],l([f({attribute:!1})],T.prototype,"hass",2),l([p()],T.prototype,"_open",2),l([p()],T.prototype,"_entryId",2),l([p()],T.prototype,"_taskId",2),l([p()],T.prototype,"_task",2),l([p()],T.prototype,"_objectName",2),l([p()],T.prototype,"_busy",2),l([p()],T.prototype,"_error",2),l([p()],T.prototype,"_showSkip",2),l([p()],T.prototype,"_showReset",2),l([p()],T.prototype,"_showDetails",2),l([p()],T.prototype,"_showAdaptive",2),l([p()],T.prototype,"_skipReason",2),l([p()],T.prototype,"_resetDate",2),l([p()],T.prototype,"_features",2),l([p()],T.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T)});function ni(a){return!!a&&/^https?:\/\//i.test(a)}var oi=x(()=>{"use strict"});var U,li=x(()=>{"use strict";C();oi();N();I();te();U=class extends w{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=L(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(q(),V)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(q(),V)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=r("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=r("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(q(),V)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],d=this.hass?.user?.is_admin??!0;return o`
|
||||
`],l([v({attribute:!1})],T.prototype,"hass",2),l([p()],T.prototype,"_open",2),l([p()],T.prototype,"_entryId",2),l([p()],T.prototype,"_taskId",2),l([p()],T.prototype,"_task",2),l([p()],T.prototype,"_objectName",2),l([p()],T.prototype,"_busy",2),l([p()],T.prototype,"_error",2),l([p()],T.prototype,"_showSkip",2),l([p()],T.prototype,"_showReset",2),l([p()],T.prototype,"_showDetails",2),l([p()],T.prototype,"_showAdaptive",2),l([p()],T.prototype,"_skipReason",2),l([p()],T.prototype,"_resetDate",2),l([p()],T.prototype,"_features",2),l([p()],T.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T)});function ci(a){return!!a&&/^https?:\/\//i.test(a)}var di=x(()=>{"use strict"});var U,pi=x(()=>{"use strict";C();di();N();I();te();U=class extends w{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=L(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(q(),V)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(q(),V)).then(({openCreateTaskDialog:e})=>{e(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=r("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=r("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=L(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(q(),V)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,t=this._data,i=t?.object,n=t?.tasks||[],d=this.hass?.user?.is_admin??!0;return o`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
${t&&i?o`
|
||||
@@ -3394,7 +3401,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
${i.map(([n,d])=>o`
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">${n}</span>
|
||||
<span class="meta-value">${ni(d)?o`<a href="${d}" target="_blank" rel="noopener noreferrer">${d}</a>`:d}</span>
|
||||
<span class="meta-value">${ci(d)?o`<a href="${d}" target="_blank" rel="noopener noreferrer">${d}</a>`:d}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
@@ -3457,7 +3464,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
.btn ha-icon { --mdc-icon-size: 16px; }
|
||||
.loading { padding: 24px; text-align: center; color: var(--secondary-text-color); }
|
||||
.error { padding: 8px; border-radius: 6px; background: rgba(211,47,47,0.1); color: var(--error-color); font-size: 13px; }
|
||||
`,l([f({attribute:!1})],U.prototype,"hass",2),l([p()],U.prototype,"_open",2),l([p()],U.prototype,"_entryId",2),l([p()],U.prototype,"_data",2),l([p()],U.prototype,"_busy",2),l([p()],U.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",U)});var V={};bi(V,{openCompleteDialog:()=>ps,openCreateObjectDialog:()=>Xe,openCreateTaskDialog:()=>et,openEditObjectDialog:()=>ls,openEditTaskDialog:()=>cs,openHistoryEditDialog:()=>ds,openObjectQuickActions:()=>_s,openQrDialog:()=>hs,openTaskQuickActions:()=>tt});function Re(){return document.querySelector("home-assistant")?.hass}function W(a){let s=document.body.querySelector(a);return s||(s=document.createElement(a),document.body.appendChild(s)),s}function B(a){let s=Re();if(!s)return!1;a.hass=s;let e=s.language||"en";return Te(e)||Ce(e).then(()=>{a.requestUpdate?.()}),!0}function hi(a){return He||(He=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>({features:s.features??ci.features,defaultWarningDays:s.general?.default_warning_days??7})).catch(()=>ci),He)}function Xe(){let a=W(di);return B(a)?(a.openCreate(),!0):!1}function ls(a,s){let e=W(di);return B(e)?(e.openEdit(a,s),!0):!1}function et(){let a=W(pi);if(!B(a))return!1;let s=Re();return s?((async()=>{let e=await hi(s),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function cs(a,s){let e=W(pi);if(!B(e))return!1;let t=Re();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),hi(t)]),d=(i.tasks||[]).find(_=>_.id===s);if(!d){console.warn(`openEditTaskDialog: task ${s} not found in entry ${a}`);return}let c=e;c.checklistsEnabled=n.features.checklists,c.scheduleTimeEnabled=n.features.schedule_time,c.completionActionsEnabled=n.features.completion_actions,c.defaultWarningDays=n.defaultWarningDays,await c.openEdit(a,d)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function ds(a){let s=W(ss);return B(s)?(s.openEdit(a),!0):!1}function ps(a){let s=W(rs);return B(s)?(s.entryId=a.entry_id,s.taskId=a.task_id,s.taskName=a.task_name,s.checklist=a.checklist??[],s.adaptiveEnabled=!!a.adaptive_enabled,s.lang=Re()?.language||"en",s.open(),!0):!1}function hs(a){let s=W(as);return B(s)?(s.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function tt(a,s){let e=W(ns);return B(e)?(e.openFor(a,s),!0):!1}function _s(a){let s=W(os);return B(s)?(s.openFor(a),!0):!1}var di,pi,ss,rs,as,ns,os,ci,He,q=x(()=>{"use strict";Ft();Wt();Ze();Bt();Kt();ai();li();I();di="maintenance-object-dialog",pi="maintenance-task-dialog",ss="maintenance-history-edit-dialog",rs="maintenance-complete-dialog",as="maintenance-qr-dialog",ns="maintenance-task-quick-actions-dialog",os="maintenance-object-quick-actions-dialog";ci={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},He=null});C();N();I();C();N();I();var Mi=["overdue","triggered","due_soon","ok"],M=class extends w{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._loadingObjects=!0;this._loadError=!1;this._views=[];this._objectsLoaded=!1;this._onEntitiesChanged=e=>{this._valueChanged("entity_ids",e.detail.value||[])}}get _lang(){return this.hass?.language||"en"}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._objectsLoaded&&(this._objectsLoaded=!0,this._loadObjects())}async _loadObjects(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._objects=e.objects||[],this._loadError=!1}catch{this._objects=[],this._loadError=!0}this._loadingObjects=!1;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._views=e.views||[]}catch{this._views=[]}}_valueChanged(e,t){let i={...this._config,[e]:t};(Array.isArray(t)&&t.length===0||t==="")&&delete i[e],this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i}}))}_toggleStatus(e,t){let i=new Set(this._config.filter_status||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_status",[...i])}_toggleObject(e,t){let i=new Set(this._config.filter_objects||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_objects",[...i])}render(){let e=this._lang,t=new Set(this._config.filter_status||[]),i=new Set(this._config.filter_objects||[]),n=[...this._objects].map(c=>c.object.name).sort((c,_)=>c.localeCompare(_)),d=[];for(let c of this._objects)for(let _ of c.tasks)_.sensor_entity_id&&d.push(_.sensor_entity_id),_.binary_sensor_entity_id&&d.push(_.binary_sensor_entity_id);return o`
|
||||
`,l([v({attribute:!1})],U.prototype,"hass",2),l([p()],U.prototype,"_open",2),l([p()],U.prototype,"_entryId",2),l([p()],U.prototype,"_data",2),l([p()],U.prototype,"_busy",2),l([p()],U.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",U)});var V={};$i(V,{openCompleteDialog:()=>ms,openCreateObjectDialog:()=>tt,openCreateTaskDialog:()=>it,openEditObjectDialog:()=>_s,openEditTaskDialog:()=>us,openHistoryEditDialog:()=>gs,openObjectQuickActions:()=>vs,openQrDialog:()=>fs,openTaskQuickActions:()=>st});function je(){return document.querySelector("home-assistant")?.hass}function W(a){let s=document.body.querySelector(a);return s||(s=document.createElement(a),document.body.appendChild(s)),s}function B(a){let s=je();if(!s)return!1;a.hass=s;let e=s.language||"en";return Ie(e)||Le(e).then(()=>{a.requestUpdate?.()}),!0}function gi(a){return Pe||(Pe=a.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>({features:s.features??hi.features,defaultWarningDays:s.general?.default_warning_days??7})).catch(()=>hi),Pe)}function tt(){let a=W(_i);return B(a)?(a.openCreate(),!0):!1}function _s(a,s){let e=W(_i);return B(e)?(e.openEdit(a,s),!0):!1}function it(){let a=W(ui);if(!B(a))return!1;let s=je();return s?((async()=>{let e=await gi(s),t=a;t.checklistsEnabled=e.features.checklists,t.scheduleTimeEnabled=e.features.schedule_time,t.completionActionsEnabled=e.features.completion_actions,t.defaultWarningDays=e.defaultWarningDays,t.openCreate()})(),!0):!1}function us(a,s){let e=W(ui);if(!B(e))return!1;let t=je();return t?((async()=>{try{let[i,n]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:a}),gi(t)]),d=(i.tasks||[]).find(_=>_.id===s);if(!d){console.warn(`openEditTaskDialog: task ${s} not found in entry ${a}`);return}let c=e;c.checklistsEnabled=n.features.checklists,c.scheduleTimeEnabled=n.features.schedule_time,c.completionActionsEnabled=n.features.completion_actions,c.defaultWarningDays=n.defaultWarningDays,await c.openEdit(a,d)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function gs(a){let s=W(ls);return B(s)?(s.openEdit(a),!0):!1}function ms(a){let s=W(cs);return B(s)?(s.entryId=a.entry_id,s.taskId=a.task_id,s.taskName=a.task_name,s.checklist=a.checklist??[],s.adaptiveEnabled=!!a.adaptive_enabled,s.lang=je()?.language||"en",s.open(),!0):!1}function fs(a){let s=W(ds);return B(s)?(s.openForTask(a.entry_id,a.task_id,a.object_name,a.task_name),!0):!1}function st(a,s){let e=W(ps);return B(e)?(e.openFor(a,s),!0):!1}function vs(a){let s=W(hs);return B(s)?(s.openFor(a),!0):!1}var _i,ui,ls,cs,ds,ps,hs,hi,Pe,q=x(()=>{"use strict";Vt();Yt();Xe();Kt();Zt();li();pi();I();_i="maintenance-object-dialog",ui="maintenance-task-dialog",ls="maintenance-history-edit-dialog",cs="maintenance-complete-dialog",ds="maintenance-qr-dialog",ps="maintenance-task-quick-actions-dialog",hs="maintenance-object-quick-actions-dialog";hi={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7},Pe=null});C();N();I();C();N();I();var Oi=["overdue","triggered","due_soon","ok"],M=class extends w{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._loadingObjects=!0;this._loadError=!1;this._views=[];this._objectsLoaded=!1;this._onEntitiesChanged=e=>{this._valueChanged("entity_ids",e.detail.value||[])}}get _lang(){return this.hass?.language||"en"}setConfig(e){this._config={...e}}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._objectsLoaded&&(this._objectsLoaded=!0,this._loadObjects())}async _loadObjects(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"});this._objects=e.objects||[],this._loadError=!1}catch{this._objects=[],this._loadError=!0}this._loadingObjects=!1;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._views=e.views||[]}catch{this._views=[]}}_valueChanged(e,t){let i={...this._config,[e]:t};(Array.isArray(t)&&t.length===0||t==="")&&delete i[e],this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i}}))}_toggleStatus(e,t){let i=new Set(this._config.filter_status||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_status",[...i])}_toggleObject(e,t){let i=new Set(this._config.filter_objects||[]);t?i.add(e):i.delete(e),this._valueChanged("filter_objects",[...i])}render(){let e=this._lang,t=new Set(this._config.filter_status||[]),i=new Set(this._config.filter_objects||[]),n=[...this._objects].map(c=>c.object.name).sort((c,_)=>c.localeCompare(_)),d=[];for(let c of this._objects)for(let _ of c.tasks)_.sensor_entity_id&&d.push(_.sensor_entity_id),_.binary_sensor_entity_id&&d.push(_.binary_sensor_entity_id);return o`
|
||||
<div class="editor">
|
||||
<ha-textfield
|
||||
label="${r("card_title",e)}"
|
||||
@@ -3469,7 +3476,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<div class="field">
|
||||
<div class="field-label">${r("card_filter_status",e)}</div>
|
||||
<div class="chip-row">
|
||||
${Mi.map(c=>o`
|
||||
${Oi.map(c=>o`
|
||||
<label class="chip ${t.has(c)?"active":""}">
|
||||
<input type="checkbox"
|
||||
.checked=${t.has(c)}
|
||||
@@ -3644,7 +3651,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
font-size: 14px;
|
||||
max-width: 320px;
|
||||
}
|
||||
`,l([f({attribute:!1})],M.prototype,"hass",2),l([p()],M.prototype,"_config",2),l([p()],M.prototype,"_objects",2),l([p()],M.prototype,"_loadingObjects",2),l([p()],M.prototype,"_loadError",2),l([p()],M.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",M);Ze();q();var F=class extends w{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:["overdue","triggered","due_soon"],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e);let t=this.hass?.language;if(t&&!Te(t)&&Ce(t).then(()=>this.requestUpdate()),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}await this._loadViewFilters()}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _flatTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:n,filter_due_min_days:d,filter_due_max_days:c,max_items:_}=this._config,u=n?.length?new Set(n):null,v=d!==void 0||c!==void 0,m=this._viewFilters,y=m?.user_id==="current_user"?this.hass.user?.id??null:m?.user_id??null;for(let A of this._objects)if(!(i?.length&&!i.includes(A.object.name))){for(let k of A.tasks)if(!k.is_done&&!(k.archived||A.object.archived)&&!(t?.length&&!t.includes(k.status))&&!(u&&!(k.sensor_entity_id&&u.has(k.sensor_entity_id)||k.binary_sensor_entity_id&&u.has(k.binary_sensor_entity_id)))){if(v){let R=k.days_until_due;if(R==null||d!==void 0&&R<d||c!==void 0&&R>c)continue}m&&(m.status&&k.status!==m.status||m.label&&!(k.labels||[]).includes(m.label)||y&&k.responsible_user_id!==y)||e.push({entry_id:A.entry_id,object_name:A.object.name,task:k})}}let b={overdue:0,triggered:1,due_soon:2,ok:3};return e.sort((A,k)=>{let R=(b[A.task.status]??9)-(b[k.task.status]??9);return R!==0?R:(A.task.days_until_due??1/0)-(k.task.days_until_due??1/0)}),_&&_>0?e.slice(0,_):e}_openTaskDetail(e,t){tt(e,t)}render(){let e=this._lang,t=this._config.title||r("maintenance",e),i=this._config.show_header!==!1,n=this._config.show_actions!==!1,d=this._config.compact||!1,c=this._flatTasks,_=this._stats;return o`
|
||||
`,l([v({attribute:!1})],M.prototype,"hass",2),l([p()],M.prototype,"_config",2),l([p()],M.prototype,"_objects",2),l([p()],M.prototype,"_loadingObjects",2),l([p()],M.prototype,"_loadError",2),l([p()],M.prototype,"_views",2);customElements.get("maintenance-supporter-card-editor")||customElements.define("maintenance-supporter-card-editor",M);Xe();q();var D=class extends w{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-card"};this._objects=[];this._stats=null;this._unsub=null;this._viewFilters=null;this._dataLoaded=!1;this._lastConnection=null;this._onCompleted=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}static getConfigElement(){return document.createElement("maintenance-supporter-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-card",show_header:!0,show_actions:!0,filter_status:["overdue","triggered","due_soon"],max_items:10}}setConfig(e){let t=e.view_id!==this._config.view_id;this._config=e,t&&this._dataLoaded&&this.hass&&this._loadViewFilters()}getCardSize(){return 3}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&Mt(this.hass?.locale);let t=this.hass?.language;if(t&&!Ie(t)&&Le(t).then(()=>this.requestUpdate()),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}await this._loadViewFilters()}async _loadViewFilters(){if(!this._config.view_id){this._viewFilters=null;return}try{let t=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"})).views||[]).find(i=>i.id===this._config.view_id);this._viewFilters=t?t.filters:null}catch{this._viewFilters=null}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}get _flatTasks(){let e=[],{filter_status:t,filter_objects:i,entity_ids:n,filter_due_min_days:d,filter_due_max_days:c,max_items:_}=this._config,u=n?.length?new Set(n):null,f=d!==void 0||c!==void 0,m=this._viewFilters,y=m?.user_id==="current_user"?this.hass.user?.id??null:m?.user_id??null;for(let A of this._objects)if(!(i?.length&&!i.includes(A.object.name))){for(let k of A.tasks)if(!k.is_done&&!(k.archived||A.object.archived)&&!(t?.length&&!t.includes(k.status))&&!(u&&!(k.sensor_entity_id&&u.has(k.sensor_entity_id)||k.binary_sensor_entity_id&&u.has(k.binary_sensor_entity_id)))){if(f){let R=k.days_until_due;if(R==null||d!==void 0&&R<d||c!==void 0&&R>c)continue}m&&(m.status&&k.status!==m.status||m.label&&!(k.labels||[]).includes(m.label)||y&&k.responsible_user_id!==y)||e.push({entry_id:A.entry_id,object_name:A.object.name,task:k})}}let b={overdue:0,triggered:1,due_soon:2,ok:3};return e.sort((A,k)=>{let R=(b[A.task.status]??9)-(b[k.task.status]??9);return R!==0?R:(A.task.days_until_due??1/0)-(k.task.days_until_due??1/0)}),_&&_>0?e.slice(0,_):e}_openTaskDetail(e,t){st(e,t)}render(){let e=this._lang,t=this._config.title||r("maintenance",e),i=this._config.show_header!==!1,n=this._config.show_actions!==!1,d=this._config.compact||!1,c=this._flatTasks,_=this._stats;return o`
|
||||
<ha-card>
|
||||
<div class="card-header">
|
||||
<h1>${t}</h1>
|
||||
@@ -3660,14 +3667,14 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<mwc-icon-button
|
||||
class="hdr-add"
|
||||
title="${r("new_object",e)}"
|
||||
@click=${()=>Xe()}
|
||||
@click=${()=>tt()}
|
||||
>
|
||||
<ha-icon icon="mdi:plus-box"></ha-icon>
|
||||
</mwc-icon-button>
|
||||
<mwc-icon-button
|
||||
class="hdr-add"
|
||||
title="${r("add_task",e)}"
|
||||
@click=${()=>et()}
|
||||
@click=${()=>it()}
|
||||
>
|
||||
<ha-icon icon="mdi:playlist-plus"></ha-icon>
|
||||
</mwc-icon-button>
|
||||
@@ -3683,7 +3690,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
<a class="empty-link" href="/maintenance-supporter">${r("card_no_tasks_cta",e)}</a>
|
||||
</div>`:o`
|
||||
<div class="task-list ${d?"compact":""}">
|
||||
${c.map(({entry_id:u,object_name:v,task:m})=>o`
|
||||
${c.map(({entry_id:u,object_name:f,task:m})=>o`
|
||||
<div class="task-item clickable"
|
||||
@click=${()=>this._openTaskDetail(u,m.id)}
|
||||
title="${r("open_task",e)||"Open task"}">
|
||||
@@ -3697,7 +3704,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
title="${r("postponed",e)||"Postponed"}"
|
||||
></ha-icon>`:h}
|
||||
</div>
|
||||
${d?h:o`<div class="task-meta">${v} · ${r(m.type,e)}</div>`}
|
||||
${d?h:o`<div class="task-meta">${f} · ${r(m.type,e)}</div>`}
|
||||
</div>
|
||||
<div class="task-due">
|
||||
${m.days_until_due!==null&&m.days_until_due!==void 0?m.days_until_due<0?o`<span class="overdue-text">${Math.abs(m.days_until_due)}${e.startsWith("de")?"T":"d"}</span>`:m.days_until_due===0?r("today",e):`${m.days_until_due}${e.startsWith("de")?"T":"d"}`:m.trigger_active?"\u26A1":"\u2014"}
|
||||
@@ -3720,7 +3727,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
.hass=${this.hass}
|
||||
@task-completed=${this._onCompleted}
|
||||
></maintenance-complete-dialog>
|
||||
`}};F.styles=[Ie,E`
|
||||
`}};D.styles=[He,E`
|
||||
ha-card { overflow: hidden; }
|
||||
|
||||
.card-header {
|
||||
@@ -3804,7 +3811,7 @@ ${_?`<div class="sub">${_}</div>`:""}
|
||||
--mdc-icon-size: 18px;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
`],l([f({attribute:!1})],F.prototype,"hass",2),l([p()],F.prototype,"_config",2),l([p()],F.prototype,"_objects",2),l([p()],F.prototype,"_stats",2),l([p()],F.prototype,"_unsub",2),l([p()],F.prototype,"_viewFilters",2);customElements.get("maintenance-supporter-card")||customElements.define("maintenance-supporter-card",F);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-supporter-card",name:"Maintenance Supporter",description:"Overview of your maintenance tasks with quick actions.",preview:!0});export{F as MaintenanceSupporterCard};
|
||||
`],l([v({attribute:!1})],D.prototype,"hass",2),l([p()],D.prototype,"_config",2),l([p()],D.prototype,"_objects",2),l([p()],D.prototype,"_stats",2),l([p()],D.prototype,"_unsub",2),l([p()],D.prototype,"_viewFilters",2);customElements.get("maintenance-supporter-card")||customElements.define("maintenance-supporter-card",D);window.customCards=window.customCards||[];window.customCards.push({type:"maintenance-supporter-card",name:"Maintenance Supporter",description:"Overview of your maintenance tasks with quick actions.",preview:!0});export{D as MaintenanceSupporterCard};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
var Gi=Object.defineProperty;var Qi=Object.getOwnPropertyDescriptor;var d=(n,r,e,t)=>{for(var i=t>1?void 0:t?Qi(r,e):r,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=(t?l(r,e,i):l(i))||i);return t&&i&&Gi(r,e,i),i};var st=globalThis,at=st.ShadowRoot&&(st.ShadyCSS===void 0||st.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,St=Symbol(),Yt=new WeakMap,Oe=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==St)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(at&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Yt.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Yt.set(e,r))}return r}toString(){return this.cssText}},Gt=n=>new Oe(typeof n=="string"?n:n+"",void 0,St),A=(n,...r)=>{let e=n.length===1?n[0]:r.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[a+1],n[0]);return new Oe(e,n,St)},Qt=(n,r)=>{if(at)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=st.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,n.appendChild(t)}},At=at?n=>n:n=>n instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Gt(e)})(n):n;var{is:Zi,defineProperty:Ji,getOwnPropertyDescriptor:Xi,getOwnPropertyNames:es,getOwnPropertySymbols:ts,getPrototypeOf:is}=Object,rt=globalThis,Zt=rt.trustedTypes,ss=Zt?Zt.emptyScript:"",as=rt.reactiveElementPolyfillSupport,qe=(n,r)=>n,Ne={toAttribute(n,r){switch(r){case Boolean:n=n?ss:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,r){let e=n;switch(r){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},nt=(n,r)=>!Zi(n,r),Jt={attribute:!0,type:String,converter:Ne,reflect:!1,useDefault:!1,hasChanged:nt};Symbol.metadata??=Symbol("metadata"),rt.litPropertyMetadata??=new WeakMap;var ue=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Jt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Ji(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:a}=Xi(this.prototype,r)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let c=i?.call(this);a?.call(this,l),this.requestUpdate(r,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Jt}static _$Ei(){if(this.hasOwnProperty(qe("elementProperties")))return;let r=is(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(qe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qe("properties"))){let e=this.properties,t=[...es(e),...ts(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(At(i))}else r!==void 0&&e.push(At(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qt(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.construcLine truncated
|
||||
\f\r]`,Fe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ti=/-->/g,ii=/>/g,we=RegExp(`>|${jt}(?:([^\\s"'>=/]+)(${jt}*=${jt}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),si=/'/g,ai=/"/g,li=/^(?:script|style|textarea|title)$/i,Ht=n=>(r,...e)=>({_$litType$:n,strings:r,values:e}),o=Ht(1),D=Ht(2),wa=Ht(3),_e=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ri=new WeakMap,ke=Ee.createTreeWalker(Ee,129);function ci(n,r){if(!zt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return ei!==void 0?ei.createHTML(r):r}var os=(n,r)=>{let e=n.length-1,t=[],i,a=r===2?"<svg>":r===3?"<math>":"",l=Fe;for(let c=0;c<e;c++){let h=n[c],u,g,m=-1,v=0;for(;v<h.length&&(l.lastIndex=v,g=l.exec(h),g!==null);)v=l.lastIndex,l===Fe?g[1]==="!--"?l=ti:g[1]!==void 0?l=ii:g[2]!==void 0?(li.test(g[2])&&(i=RegExp("</"+g[2],"g")),l=we):g[3]!==void 0&&(l=we):l===we?g[0]===">"?(l=i??Fe,m=-1):g[1]===void 0?m=-2:(m=l.lastIndex-g[2].length,u=g[1],l=g[3]===void 0?we:g[3]==='"'?ai:si):l===ai||l===si?l=we:l===ti||l===ii?l=Fe:(l=we,i=void 0);let b=l===we&&n[c+1].startsWith("/>")?" ":"";a+=l===Fe?h+rs:m>=0?(t.push(u),h.slice(0,m)+ni+h.slice(m)+fe+b):h+fe+(m===-2?c:b)}return[ci(n,a+(n[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ve=class n{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,c=r.length-1,h=this.parts,[u,g]=os(r,e);if(this.el=n.createElement(u,t),ke.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=ke.nextNode())!==null&&h.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(ni)){let v=g[l++],b=i.getAttribute(m).split(fe),$=/([.?@])?(.*)/.exec(v);h.push({type:1,index:a,name:$[2],strings:b,ctor:$[1]==="."?It:$[1]==="?"?Mt:$[1]==="@"?Rt:Me}),i.removeAttribute(m)}else m.startsWith(fe)&&(h.push({type:6,index:a}),i.removeAttribute(m));if(li.test(i.tagName)){let m=i.textContent.split(fe),v=m.length-1;if(v>0){i.textContent=ot?ot.emptyScript:"";for(let b=0;b<v;b++)i.append(m[b],Ue()),ke.nextNode(),h.push({type:2,index:++a});i.append(m[v],Ue())}}}else if(i.nodeType===8)if(i.data===oi)h.push({type:2,index:a});else{let m=-1;for(;(m=i.data.indexOf(fe,m+1))!==-1;)h.push({type:7,index:a}),m+=fe.length-1}a++}}static createElement(r,e){let t=Ee.createElement("template");return t.innerHTML=r,t}};function Ie(n,r,e=n,t){if(r===_e)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Be(r)?void 0:r._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(n),i._$AT(n,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ie(n,i._$AS(n,r.values),i,t)),r}var Ct=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Ee).importNode(e,!0);ke.currentNode=i;let a=ke.nextNode(),l=0,c=0,h=t[0];for(;h!==void 0;){if(l===h.index){let u;h.type===2?u=new We(a,a.nextSibling,this,r):h.type===1?u=new h.ctor(a,h.name,h.strings,this,r):h.type===6&&(u=new Lt(a,this,r)),this._$AV.push(u),h=t[++c]}l!==h?.index&&(a=ke.nextNode(),l++)}return ke.currentNode=Ee,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},We=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ie(this,r,e),Be(r)?r===p||r==null||r===""?(this._$AH!==p&&this._$AR(),this._$AH=p):r!==this._$AH&&r!==_e&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):ns(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==p&&Be(this._$AH)?this._$AA.nextSibling.data=r:this.T(Ee.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ve.createElement(ci(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new Ct(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(r){let e=ri.get(r.strings);return e===void 0&&ri.set(r.strings,e=new Ve(r)),e}k(r){zt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of r)i===e.length?e.push(t=new n(this.O(Ue()),this.O(Ue()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=Xt(r).nextSibling;Xt(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Me=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._Line truncated
|
||||
var Ji=Object.defineProperty;var Xi=Object.getOwnPropertyDescriptor;var d=(n,r,e,t)=>{for(var i=t>1?void 0:t?Xi(r,e):r,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=(t?l(r,e,i):l(i))||i);return t&&i&&Ji(r,e,i),i};var st=globalThis,at=st.ShadowRoot&&(st.ShadyCSS===void 0||st.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ct=Symbol(),Zt=new WeakMap,Oe=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ct)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(at&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Zt.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Zt.set(e,r))}return r}toString(){return this.cssText}},Jt=n=>new Oe(typeof n=="string"?n:n+"",void 0,Ct),A=(n,...r)=>{let e=n.length===1?n[0]:r.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[a+1],n[0]);return new Oe(e,n,Ct)},Xt=(n,r)=>{if(at)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=st.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,n.appendChild(t)}},It=at?n=>n:n=>n instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Jt(e)})(n):n;var{is:es,defineProperty:ts,getOwnPropertyDescriptor:is,getOwnPropertyNames:ss,getOwnPropertySymbols:as,getPrototypeOf:rs}=Object,rt=globalThis,ei=rt.trustedTypes,ns=ei?ei.emptyScript:"",os=rt.reactiveElementPolyfillSupport,qe=(n,r)=>n,Ne={toAttribute(n,r){switch(r){case Boolean:n=n?ns:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,r){let e=n;switch(r){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},nt=(n,r)=>!es(n,r),ti={attribute:!0,type:String,converter:Ne,reflect:!1,useDefault:!1,hasChanged:nt};Symbol.metadata??=Symbol("metadata"),rt.litPropertyMetadata??=new WeakMap;var ue=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=ti){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&ts(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:a}=is(this.prototype,r)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let c=i?.call(this);a?.call(this,l),this.requestUpdate(r,c,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??ti}static _$Ei(){if(this.hasOwnProperty(qe("elementProperties")))return;let r=rs(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(qe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qe("properties"))){let e=this.properties,t=[...ss(e),...as(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(It(i))}else r!==void 0&&e.push(It(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Xt(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.construcLine truncated
|
||||
\f\r]`,Fe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ai=/-->/g,ri=/>/g,we=RegExp(`>|${Mt}(?:([^\\s"'>=/]+)(${Mt}*=${Mt}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ni=/'/g,oi=/"/g,pi=/^(?:script|style|textarea|title)$/i,qt=n=>(r,...e)=>({_$litType$:n,strings:r,values:e}),o=qt(1),D=qt(2),Aa=qt(3),_e=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),li=new WeakMap,ke=Ee.createTreeWalker(Ee,129);function hi(n,r){if(!Ot(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return si!==void 0?si.createHTML(r):r}var ds=(n,r)=>{let e=n.length-1,t=[],i,a=r===2?"<svg>":r===3?"<math>":"",l=Fe;for(let c=0;c<e;c++){let h=n[c],u,g,m=-1,v=0;for(;v<h.length&&(l.lastIndex=v,g=l.exec(h),g!==null);)v=l.lastIndex,l===Fe?g[1]==="!--"?l=ai:g[1]!==void 0?l=ri:g[2]!==void 0?(pi.test(g[2])&&(i=RegExp("</"+g[2],"g")),l=we):g[3]!==void 0&&(l=we):l===we?g[0]===">"?(l=i??Fe,m=-1):g[1]===void 0?m=-2:(m=l.lastIndex-g[2].length,u=g[1],l=g[3]===void 0?we:g[3]==='"'?oi:ni):l===oi||l===ni?l=we:l===ai||l===ri?l=Fe:(l=we,i=void 0);let b=l===we&&n[c+1].startsWith("/>")?" ":"";a+=l===Fe?h+ls:m>=0?(t.push(u),h.slice(0,m)+ci+h.slice(m)+fe+b):h+fe+(m===-2?c:b)}return[hi(n,a+(n[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ve=class n{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,c=r.length-1,h=this.parts,[u,g]=ds(r,e);if(this.el=n.createElement(u,t),ke.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=ke.nextNode())!==null&&h.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(ci)){let v=g[l++],b=i.getAttribute(m).split(fe),$=/([.?@])?(.*)/.exec(v);h.push({type:1,index:a,name:$[2],strings:b,ctor:$[1]==="."?Lt:$[1]==="?"?Pt:$[1]==="@"?zt:Me}),i.removeAttribute(m)}else m.startsWith(fe)&&(h.push({type:6,index:a}),i.removeAttribute(m));if(pi.test(i.tagName)){let m=i.textContent.split(fe),v=m.length-1;if(v>0){i.textContent=ot?ot.emptyScript:"";for(let b=0;b<v;b++)i.append(m[b],Ue()),ke.nextNode(),h.push({type:2,index:++a});i.append(m[v],Ue())}}}else if(i.nodeType===8)if(i.data===di)h.push({type:2,index:a});else{let m=-1;for(;(m=i.data.indexOf(fe,m+1))!==-1;)h.push({type:7,index:a}),m+=fe.length-1}a++}}static createElement(r,e){let t=Ee.createElement("template");return t.innerHTML=r,t}};function Ie(n,r,e=n,t){if(r===_e)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Be(r)?void 0:r._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(n),i._$AT(n,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ie(n,i._$AS(n,r.values),i,t)),r}var Rt=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Ee).importNode(e,!0);ke.currentNode=i;let a=ke.nextNode(),l=0,c=0,h=t[0];for(;h!==void 0;){if(l===h.index){let u;h.type===2?u=new We(a,a.nextSibling,this,r):h.type===1?u=new h.ctor(a,h.name,h.strings,this,r):h.type===6&&(u=new Ht(a,this,r)),this._$AV.push(u),h=t[++c]}l!==h?.index&&(a=ke.nextNode(),l++)}return ke.currentNode=Ee,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},We=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ie(this,r,e),Be(r)?r===p||r==null||r===""?(this._$AH!==p&&this._$AR(),this._$AH=p):r!==this._$AH&&r!==_e&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):cs(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==p&&Be(this._$AH)?this._$AA.nextSibling.data=r:this.T(Ee.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ve.createElement(hi(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new Rt(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(r){let e=li.get(r.strings);return e===void 0&&li.set(r.strings,e=new Ve(r)),e}k(r){Ot(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of r)i===e.length?e.push(t=new n(this.O(Ue()),this.O(Ue()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=ii(r).nextSibling;ii(r).remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Me=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._Line truncated
|
||||
Replace seal
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -13,7 +13,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-family: inherit; width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
||||
`,ut=A`
|
||||
`,mt=A`
|
||||
:host {
|
||||
--maint-ok-color: var(--success-color, #4caf50);
|
||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||
@@ -1143,10 +1143,17 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.sparkline-svg { height: 100px; }
|
||||
|
||||
.stats-bar { gap: 8px; padding: 12px; }
|
||||
.stat-item { min-width: 60px; }
|
||||
/* min-width: 0 (NOT a fixed floor) — a fixed min-width re-enables the
|
||||
grid's auto minimum, so the 5 KPI tracks couldn't shrink below their
|
||||
label text and the last KPI clipped off-screen on phones (the header
|
||||
only *looked* cut — .content scrolls sideways, but nothing hints so).
|
||||
With 0 the tracks compress and the labels wrap to a second line. */
|
||||
.stat-item { min-width: 0; }
|
||||
.stat-item.clickable { padding: 4px 4px; }
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var B={overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view"};var gs={days:1,weeks:7,months:30.4368,years:365.25};function Nt(n,r){return!n||n<=0?0:n*(gs[r||"days"]??1)}function _t(n,r,e){let t=Nt(n,e);if(t<=0||r==null)return{pct:0,overflow:!1};let i=(t-r)/t*100;return{pct:Math.max(0,Math.min(100,i)),overflow:i>100}}function z(n){return String(n??"").replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r])}function mi(n,r,e,t,i,a){let l=[[e.manufacturer,n.manufacturer],[e.model,n.model],[e.serial,n.serial_number],[e.installed,n.installation_date?t(n.installation_date):null],[e.warranty,n.warranty_expiry?t(n.warranty_expiry):null]].filter(([,u])=>!!u),c=r.map(u=>{let g=e.scheduleLabel(u);return`<tr>
|
||||
`;var B={overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view"};var ys={days:1,weeks:7,months:30.4368,years:365.25};function Bt(n,r){return!n||n<=0?0:n*(ys[r||"days"]??1)}function vt(n,r,e){let t=Bt(n,e);if(t<=0||r==null)return{pct:0,overflow:!1};let i=(t-r)/t*100;return{pct:Math.max(0,Math.min(100,i)),overflow:i>100}}function z(n){return String(n??"").replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r])}function fi(n,r,e,t,i,a){let l=[[e.manufacturer,n.manufacturer],[e.model,n.model],[e.serial,n.serial_number],[e.installed,n.installation_date?t(n.installation_date):null],[e.warranty,n.warranty_expiry?t(n.warranty_expiry):null]].filter(([,u])=>!!u),c=r.map(u=>{let g=e.scheduleLabel(u);return`<tr>
|
||||
<td>${z(u.name)}</td>
|
||||
<td>${z(e.typeLabel(u.type))}</td>
|
||||
<td>${z(e.statusLabel(u.status))}</td>
|
||||
@@ -1189,7 +1196,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
</table>
|
||||
${n.notes?`<div class="notes"><strong>${z(e.notes)}:</strong>
|
||||
${z(n.notes)}</div>`:""}
|
||||
</body></html>`}function Ft(n,r=new Date){if(!n)return{kind:"none",days:null,date:null};let e=new Date(`${n}T00:00:00`);if(isNaN(e.getTime()))return{kind:"none",days:null,date:null};let t=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),i=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),a=Math.round((i-t)/864e5);return a<0?{kind:"expired",days:a,date:n}:a<=60?{kind:"expiring",days:a,date:n}:{kind:"valid",days:a,date:n}}var Le=[{key:"name",labelKey:"name",required:!0},{key:"manufacturer",labelKey:"manufacturer"},{key:"model",labelKey:"model"},{key:"serial_number",labelKey:"serial_number_label"},{key:"installation_date",labelKey:"installed"},{key:"warranty_expiry",labelKey:"warranty"},{key:"area_id",labelKey:"area"},{key:"documentation_url",labelKey:"documentation_url_label"},{key:"notes",labelKey:"object_notes_label"},{key:"task_count",labelKey:"tasks"},{key:"actions",labelKey:"actions"}],ms=Le.map(n=>n.key),gt=["name","manufacturer","model","serial_number","installation_date","warranty_expiry","area_id","task_count","actions"];function Ze(n){if(!Array.isArray(n))return[...gt];let r=new Set,e=[];for(let t of n)typeof t=="string"&&ms.includes(t)&&!r.has(t)&&(r.add(t),e.push(t));return e.length?(e.includes("name")||e.unshift("name"),e):[...gt]}function mt(n,r,e){let t=new Blob([n],{type:e}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=r,a.target="_blank",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(i),6e4)}function vt(n,r){let e=document.createElement("a");e.href=n,e.download=r,e.target="_blank",e.rel="noopener",e.style.display="none",document.body.appendChild(e),e.dispatchEvent(new MouseEvent("click")),document.body.removeChild(e)}var O=n=>String(n??"").replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]);function vi(n,r,e,t,i,a,l,c,h,u=[]){let g=[[e.object,O(r)],[e.type,O(e.typeLabel(n.type))],[e.interval,O(i(n))],[e.nextDue,n.next_due?O(t(n.next_due)):"\u2014"],[e.lastDone,n.last_performed?O(t(n.last_performed)):O(e.never)]];n.priority&&n.priority!=="normal"&&g.push([e.priority,O(n.priority)]);let m=(n.checklist||[]).map(b=>`<li><span class="box"></span>${O(b)}</li>`).join(""),v=(b,$)=>b?`<figure class="qr"><img src="${b}" alt="" /><figcaption>${O($)}</figcaption></figure>`:"";return`<!DOCTYPE html>
|
||||
</body></html>`}function Vt(n,r=new Date){if(!n)return{kind:"none",days:null,date:null};let e=new Date(`${n}T00:00:00`);if(isNaN(e.getTime()))return{kind:"none",days:null,date:null};let t=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),i=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),a=Math.round((i-t)/864e5);return a<0?{kind:"expired",days:a,date:n}:a<=60?{kind:"expiring",days:a,date:n}:{kind:"valid",days:a,date:n}}var Le=[{key:"name",labelKey:"name",required:!0},{key:"manufacturer",labelKey:"manufacturer"},{key:"model",labelKey:"model"},{key:"serial_number",labelKey:"serial_number_label"},{key:"installation_date",labelKey:"installed"},{key:"warranty_expiry",labelKey:"warranty"},{key:"area_id",labelKey:"area"},{key:"documentation_url",labelKey:"documentation_url_label"},{key:"notes",labelKey:"object_notes_label"},{key:"task_count",labelKey:"tasks"},{key:"actions",labelKey:"actions"}],xs=Le.map(n=>n.key),bt=["name","manufacturer","model","serial_number","installation_date","warranty_expiry","area_id","task_count","actions"];function Ze(n){if(!Array.isArray(n))return[...bt];let r=new Set,e=[];for(let t of n)typeof t=="string"&&xs.includes(t)&&!r.has(t)&&(r.add(t),e.push(t));return e.length?(e.includes("name")||e.unshift("name"),e):[...bt]}function ft(n,r,e){let t=new Blob([n],{type:e}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=r,a.target="_blank",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(i),6e4)}function yt(n,r){let e=document.createElement("a");e.href=n,e.download=r,e.target="_blank",e.rel="noopener",e.style.display="none",document.body.appendChild(e),e.dispatchEvent(new MouseEvent("click")),document.body.removeChild(e)}var O=n=>String(n??"").replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]);function yi(n,r,e,t,i,a,l,c,h,u=[]){let g=[[e.object,O(r)],[e.type,O(e.typeLabel(n.type))],[e.interval,O(i(n))],[e.nextDue,n.next_due?O(t(n.next_due)):"\u2014"],[e.lastDone,n.last_performed?O(t(n.last_performed)):O(e.never)]];n.priority&&n.priority!=="normal"&&g.push([e.priority,O(n.priority)]);let m=(n.checklist||[]).map(b=>`<li><span class="box"></span>${O(b)}</li>`).join(""),v=(b,$)=>b?`<figure class="qr"><img src="${b}" alt="" /><figcaption>${O($)}</figcaption></figure>`:"";return`<!DOCTYPE html>
|
||||
<html><head><meta charset="utf-8"><title>${O(n.name)} \u2014 ${O(e.title)}</title>
|
||||
<style>
|
||||
@page { size: A4; margin: 14mm; }
|
||||
@@ -1263,7 +1270,7 @@ ${z(n.notes)}</div>`:""}
|
||||
} catch (e) { console.warn("excerpt inline render failed", e); }
|
||||
<\/script>`:""}`:""}
|
||||
<footer>${O(r)} \xB7 ${O(n.name)} \xB7 ${O(e.printedOn)} ${O(h.slice(0,10))}</footer>
|
||||
</body></html>`}var vs={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"};function bs(n,r){let e=vs[n];if(!e)return n;let t=s(e,r);return t&&t!==e?t:n}function fs(n){let e=n.match(/data\['([^']+)'\]/)?.[1],t;return(t=n.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=n.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=n.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=n.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(n)?{field:e,rule:"required"}:(t=n.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(n)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(n)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function I(n,r,e){if(e=e??s("action_error",r),typeof n=="string")return n;if(typeof n!="object"||n===null)return e;let t=n,i=t.message||t.error?.message||"";if(!i)return e;let a=fs(i),l=a.field?bs(a.field,r):"",c=h=>s(h,r).replace("{field}",l).replace("{n}",a.param??"");switch(a.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",a.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var bi=A`
|
||||
</body></html>`}var $s={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"};function ws(n,r){let e=$s[n];if(!e)return n;let t=s(e,r);return t&&t!==e?t:n}function ks(n){let e=n.match(/data\['([^']+)'\]/)?.[1],t;return(t=n.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=n.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=n.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=n.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(n)?{field:e,rule:"required"}:(t=n.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(n)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(n)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function I(n,r,e){if(e=e??s("action_error",r),typeof n=="string")return n;if(typeof n!="object"||n===null)return e;let t=n,i=t.message||t.error?.message||"";if(!i)return e;let a=ks(i),l=a.field?ws(a.field,r):"",c=h=>s(h,r).replace("{field}",l).replace("{n}",a.param??"");switch(a.rule){case"too_long":return c("err_too_long");case"too_short":return c("err_too_short");case"value_too_high":return c("err_value_too_high");case"value_too_low":return c("err_value_too_low");case"required":return c("err_required");case"wrong_type":return c("err_wrong_type").replace("{type}",a.param??"");case"invalid_choice":return c("err_invalid_choice");case"invalid_value":return c("err_invalid_value");default:return i||e}}var xi=A`
|
||||
:host {
|
||||
display: block;
|
||||
height: 100%;
|
||||
@@ -1306,6 +1313,10 @@ ${z(n.notes)}</div>`:""}
|
||||
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
/* Wrap at EVERY width: with six filter dropdowns + action buttons the
|
||||
bar doesn't fit one line even on wide tablets, and unwrapped flex
|
||||
compressed the selects into unreadable stubs ("— No v", "Al"). */
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
padding: 8px 0;
|
||||
@@ -1333,6 +1344,9 @@ ${z(n.notes)}</div>`:""}
|
||||
border-radius: 4px;
|
||||
background: var(--card-background-color, #fff);
|
||||
color: var(--primary-text-color);
|
||||
/* Readability floor — selects wrap to the next line instead of
|
||||
shrinking their selected value into ellipsis. */
|
||||
min-width: 96px;
|
||||
}
|
||||
|
||||
/* Desktop: the LIST owns the 7-column grid and every row is a subgrid
|
||||
@@ -2692,7 +2706,7 @@ ${z(n.notes)}</div>`:""}
|
||||
from { opacity: 0; transform: translateX(-50%) translateY(16px); }
|
||||
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
||||
}
|
||||
`;var bt=class{constructor(r){this._cache=new Map;this._pending=new Map;this._hass=r}updateHass(r){this._hass=r}async getDetailStats(r,e,t=30){return this._getStats(r,t<=35?"hour":"day",t,e)}async getMiniStats(r,e){return this._getStats(r,"day",14,e)}async getBatchMiniStats(r){let e=new Map,t=[];for(let h of r){let u=`${h.entityId}:day:14`,g=this._cache.get(u);g&&Date.now()-g.fetchedAt<3e5?e.set(h.entityId,g.points):t.push(h)}if(t.length===0)return e;let i=t.filter(h=>h.isCounter).map(h=>h.entityId),a=t.filter(h=>!h.isCounter).map(h=>h.entityId),l=new Date(Date.now()-336*60*60*1e3).toISOString(),c=[];return i.length>0&&c.push(this._fetchBatch(i,"day",l,["state","sum","change"],!0,e)),a.length>0&&c.push(this._fetchBatch(a,"day",l,["mean","min","max"],!1,e)),await Promise.all(c),e}clearCache(){this._cache.clear(),this._pending.clear()}async _getStats(r,e,t,i){let a=`${r}:${e}:${t}`,l=this._cache.get(a);if(l&&Date.now()-l.fetchedAt<3e5)return l.points;if(this._pending.has(a))return this._pending.get(a);let c=this._fetchAndNormalize(r,e,t,i,a);this._pending.set(a,c);try{return await c}finally{this._pending.delete(a)}}async _fetchAndNormalize(r,e,t,i,a){let l=new Date(Date.now()-t*24*60*60*1e3).toISOString(),c=i?["state","sum","change"]:["mean","min","max"];try{let u=(await this._hass.connection.sendMessagePromise({type:"recorder/statistics_during_period",start_time:l,statistic_ids:[r],period:e,types:c}))[r]||[],g=this._normalizeRows(u,i);return this._cache.set(a,{entityId:r,fetchedAt:Date.now(),period:e,points:g}),g}catch(h){return console.warn(`[maintenance-supporter] Failed to fetch statistics for ${r}:`,h),[]}}async _fetchBatch(r,e,t,i,a,l){try{let c=await this._hass.connection.sendMessagePromise({type:"recorder/statistics_during_period",start_time:t,statistic_ids:r,period:e,types:i});for(let h of r){let u=c[h]||[],g=this._normalizeRows(u,a);l.set(h,g),this._cache.set(`${h}:${e}:14`,{entityId:h,fetchedAt:Date.now(),period:e,points:g})}}catch(c){console.warn("[maintenance-supporter] Batch statistics fetch failed:",c)}}_normalizeRows(r,e){let t=[];for(let i of r){let a=null;if(e?a=i.state??null:a=i.mean??null,a===null)continue;let l={ts:i.start,val:a};e||(i.min!=null&&(l.min=i.min),i.max!=null&&(l.max=i.max)),t.push(l)}return t.sort((i,a)=>i.ts-a.ts),t}};var ye=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(r,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:r,task_id:e,user_id:t})}async getTasksByUser(r){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:r})).tasks}getUserName(r){return!r||!this.usersCache?null:this.usersCache.find(t=>t.id===r)?.name||null}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};var G=class extends S{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||
`;var xt=class{constructor(r){this._cache=new Map;this._pending=new Map;this._hass=r}updateHass(r){this._hass=r}async getDetailStats(r,e,t=30){return this._getStats(r,t<=35?"hour":"day",t,e)}async getMiniStats(r,e){return this._getStats(r,"day",14,e)}async getBatchMiniStats(r){let e=new Map,t=[];for(let h of r){let u=`${h.entityId}:day:14`,g=this._cache.get(u);g&&Date.now()-g.fetchedAt<3e5?e.set(h.entityId,g.points):t.push(h)}if(t.length===0)return e;let i=t.filter(h=>h.isCounter).map(h=>h.entityId),a=t.filter(h=>!h.isCounter).map(h=>h.entityId),l=new Date(Date.now()-336*60*60*1e3).toISOString(),c=[];return i.length>0&&c.push(this._fetchBatch(i,"day",l,["state","sum","change"],!0,e)),a.length>0&&c.push(this._fetchBatch(a,"day",l,["mean","min","max"],!1,e)),await Promise.all(c),e}clearCache(){this._cache.clear(),this._pending.clear()}async _getStats(r,e,t,i){let a=`${r}:${e}:${t}`,l=this._cache.get(a);if(l&&Date.now()-l.fetchedAt<3e5)return l.points;if(this._pending.has(a))return this._pending.get(a);let c=this._fetchAndNormalize(r,e,t,i,a);this._pending.set(a,c);try{return await c}finally{this._pending.delete(a)}}async _fetchAndNormalize(r,e,t,i,a){let l=new Date(Date.now()-t*24*60*60*1e3).toISOString(),c=i?["state","sum","change"]:["mean","min","max"];try{let u=(await this._hass.connection.sendMessagePromise({type:"recorder/statistics_during_period",start_time:l,statistic_ids:[r],period:e,types:c}))[r]||[],g=this._normalizeRows(u,i);return this._cache.set(a,{entityId:r,fetchedAt:Date.now(),period:e,points:g}),g}catch(h){return console.warn(`[maintenance-supporter] Failed to fetch statistics for ${r}:`,h),[]}}async _fetchBatch(r,e,t,i,a,l){try{let c=await this._hass.connection.sendMessagePromise({type:"recorder/statistics_during_period",start_time:t,statistic_ids:r,period:e,types:i});for(let h of r){let u=c[h]||[],g=this._normalizeRows(u,a);l.set(h,g),this._cache.set(`${h}:${e}:14`,{entityId:h,fetchedAt:Date.now(),period:e,points:g})}}catch(c){console.warn("[maintenance-supporter] Batch statistics fetch failed:",c)}}_normalizeRows(r,e){let t=[];for(let i of r){let a=null;if(e?a=i.state??null:a=i.mean??null,a===null)continue;let l={ts:i.start,val:a};e||(i.min!=null&&(l.min=i.min),i.max!=null&&(l.max=i.max)),t.push(l)}return t.sort((i,a)=>i.ts-a.ts),t}};var ye=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=t.users,this.cacheTimestamp=e,this.usersCache}catch(t){return console.error("Failed to fetch users:",t),this.usersCache||[]}}async assignUser(r,e,t){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:r,task_id:e,user_id:t})}async getTasksByUser(r){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:r})).tasks}getUserName(r){return!r||!this.usersCache?null:this.usersCache.find(t=>t.id===r)?.name||null}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};var G=class extends S{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(e){let t=e.target.value;this.value=t,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:t}}))}render(){return o`
|
||||
<label class="field">
|
||||
${this.label?o`<span class="label">${this.label}${this.required?o`<span class="req">*</span>`:p}</span>`:p}
|
||||
<input
|
||||
@@ -2885,7 +2899,7 @@ ${z(n.notes)}</div>`:""}
|
||||
color: var(--error-color, #f44336);
|
||||
font-size: 13px;
|
||||
}
|
||||
`,d([y({attribute:!1})],F.prototype,"hass",2),d([y({attribute:!1})],F.prototype,"objects",2),d([_()],F.prototype,"_open",2),d([_()],F.prototype,"_loading",2),d([_()],F.prototype,"_error",2),d([_()],F.prototype,"_name",2),d([_()],F.prototype,"_manufacturer",2),d([_()],F.prototype,"_model",2),d([_()],F.prototype,"_serialNumber",2),d([_()],F.prototype,"_areaId",2),d([_()],F.prototype,"_installationDate",2),d([_()],F.prototype,"_warrantyExpiry",2),d([_()],F.prototype,"_documentationUrl",2),d([_()],F.prototype,"_notes",2),d([_()],F.prototype,"_haDeviceId",2),d([_()],F.prototype,"_parentEntryId",2),d([_()],F.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",F);function de(n){let r=n??0;return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}var ft=["manual","warranty","invoice","spare_parts","photo","other"],ys={manual:"mdi:book-open-variant",warranty:"mdi:shield-check",invoice:"mdi:receipt-text-outline",spare_parts:"mdi:cog-outline",photo:"mdi:image-outline",other:"mdi:file-document-outline"},q=class extends S{constructor(){super(...arguments);this.canWrite=!1;this._docs=[];this._loaded=!1;this._busy=!1;this._error="";this._hint="";this._addingLink=!1;this._linkUrl="";this._linkTitle="";this._category="manual";this._thumbs={};this._lightboxUrl="";this._editingId="";this._editTitle="";this._editCategory="manual";this._dragOver=!1;this._loadedFor=null;this._localeReady=!1}_isImage(e){return e.kind==="file"&&(e.mime||"").startsWith("image/")}async _sign(e){return(await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:300})).path}get _lang(){return this.hass?.language||"en"}updated(e){super.updated(e),this.hass&&!this._localeReady&&(this._localeReady=!0,Y(this._lang).then(()=>this.requestUpdate())),this.hass&&this.entryId&&this._loadedFor!==this.entryId&&(this._loadedFor=this.entryId,this._load())}async _load(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:this.entryId});this._docs=e.documents||[],this._loaded=!0,this._error="",this._thumbs={},this._loadThumbs()}catch(e){this._error=I(e,this._lang),this._loaded=!0}}async _loadThumbs(){await Promise.all(this._docs.filter(e=>this._isImage(e)).map(async e=>{try{let t=await this._sign(e);this._thumbs={...this._thumbs,[e.id]:t}}catch{}}))}_category_of(e){return(e.tags||[]).find(i=>ft.includes(i))||"other"}_labelKeydown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.currentTarget.querySelector("input")?.click())}_onFileInput(e){let t=e.target,i=Array.from(t.files??[]);i.length&&this._uploadFiles(i),t.value=""}_onCameraInput(e){let t=e.target,i=Array.from(t.files??[]);i.length&&this._uploadFiles(i,"photo"),t.value=""}_onDrop(e){if(e.preventDefault(),this._dragOver=!1,!this.canWrite||this._busy)return;let t=Array.from(e.dataTransfer?.files??[]);t.length&&this._uploadFiles(t)}_onDragOver(e){this.canWrite&&(e.preventDefault(),this._dragOver=!0)}_onDragLeave(e){let t=e.relatedTarget;(!t||!e.currentTarget.contains(t))&&(this._dragOver=!1)}async _uploadFiles(e,t){let i=t??this._category;this._busy=!0,this._error="",this._hint="";let a=0,l=0;try{for(let c of e){let h=new FormData;h.append("entry_id",this.entryId),h.append("tags",i),h.append("file",c,c.name);let u=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:h});if(!u.ok){this._error=u.status===413?s("doc_too_large",this._lang):s("doc_upload_failed",this._lang);continue}let g=await u.json();g.duplicate_in_object?l++:g.deduped&&a++}l?this._hint=s("doc_dup_in_object",this._lang):a&&(this._hint=s("doc_deduped",this._lang)),await this._load()}catch{this._error=s("doc_upload_failed",this._lang)}finally{this._busy=!1}}async _download(e){try{let t=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:30});vt(t.path,e.filename||e.title||"document")}catch(t){this._error=I(t,this._lang)}}async _preview(e){if(this._isImage(e)){this._lightboxUrl=this._thumbs[e.id]||await this._sign(e);return}let t=window.open("about:blank","_blank");try{let i=await this._sign(e);t&&(t.location.href=new URL(i,window.location.origin).href)}catch(i){t&&t.close(),this._error=I(i,this._lang)}}_openDoc(e){e.kind==="file"?this._preview(e):ne(e.url)&&window.open(e.url,"_blank","noopener")}_startEdit(e){this._editingId=e.id,this._editTitle=e.title||"",this._editCategory=this._category_of(e),this._addingLink=!1,this._error=""}_cancelEdit(){this._editingId=""}async _saveEdit(e){let t=(e.tags||[]).filter(a=>!ft.includes(a)),i=e.kind==="file"?[this._editCategory,...t]:e.tags??[];this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/update",doc_id:e.id,title:this._editTitl
Line truncated
|
||||
`,d([y({attribute:!1})],F.prototype,"hass",2),d([y({attribute:!1})],F.prototype,"objects",2),d([_()],F.prototype,"_open",2),d([_()],F.prototype,"_loading",2),d([_()],F.prototype,"_error",2),d([_()],F.prototype,"_name",2),d([_()],F.prototype,"_manufacturer",2),d([_()],F.prototype,"_model",2),d([_()],F.prototype,"_serialNumber",2),d([_()],F.prototype,"_areaId",2),d([_()],F.prototype,"_installationDate",2),d([_()],F.prototype,"_warrantyExpiry",2),d([_()],F.prototype,"_documentationUrl",2),d([_()],F.prototype,"_notes",2),d([_()],F.prototype,"_haDeviceId",2),d([_()],F.prototype,"_parentEntryId",2),d([_()],F.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",F);function de(n){let r=n??0;return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}var $t=["manual","warranty","invoice","spare_parts","photo","other"],Es={manual:"mdi:book-open-variant",warranty:"mdi:shield-check",invoice:"mdi:receipt-text-outline",spare_parts:"mdi:cog-outline",photo:"mdi:image-outline",other:"mdi:file-document-outline"},q=class extends S{constructor(){super(...arguments);this.canWrite=!1;this._docs=[];this._loaded=!1;this._busy=!1;this._error="";this._hint="";this._addingLink=!1;this._linkUrl="";this._linkTitle="";this._category="manual";this._thumbs={};this._lightboxUrl="";this._editingId="";this._editTitle="";this._editCategory="manual";this._dragOver=!1;this._loadedFor=null;this._localeReady=!1}_isImage(e){return e.kind==="file"&&(e.mime||"").startsWith("image/")}async _sign(e){return(await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:300})).path}get _lang(){return this.hass?.language||"en"}updated(e){super.updated(e),this.hass&&!this._localeReady&&(this._localeReady=!0,Y(this._lang).then(()=>this.requestUpdate())),this.hass&&this.entryId&&this._loadedFor!==this.entryId&&(this._loadedFor=this.entryId,this._load())}async _load(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:this.entryId});this._docs=e.documents||[],this._loaded=!0,this._error="",this._thumbs={},this._loadThumbs()}catch(e){this._error=I(e,this._lang),this._loaded=!0}}async _loadThumbs(){await Promise.all(this._docs.filter(e=>this._isImage(e)).map(async e=>{try{let t=await this._sign(e);this._thumbs={...this._thumbs,[e.id]:t}}catch{}}))}_category_of(e){return(e.tags||[]).find(i=>$t.includes(i))||"other"}_labelKeydown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.currentTarget.querySelector("input")?.click())}_onFileInput(e){let t=e.target,i=Array.from(t.files??[]);i.length&&this._uploadFiles(i),t.value=""}_onCameraInput(e){let t=e.target,i=Array.from(t.files??[]);i.length&&this._uploadFiles(i,"photo"),t.value=""}_onDrop(e){if(e.preventDefault(),this._dragOver=!1,!this.canWrite||this._busy)return;let t=Array.from(e.dataTransfer?.files??[]);t.length&&this._uploadFiles(t)}_onDragOver(e){this.canWrite&&(e.preventDefault(),this._dragOver=!0)}_onDragLeave(e){let t=e.relatedTarget;(!t||!e.currentTarget.contains(t))&&(this._dragOver=!1)}async _uploadFiles(e,t){let i=t??this._category;this._busy=!0,this._error="",this._hint="";let a=0,l=0;try{for(let c of e){let h=new FormData;h.append("entry_id",this.entryId),h.append("tags",i),h.append("file",c,c.name);let u=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${this.hass.auth?.data?.access_token??""}`},body:h});if(!u.ok){this._error=u.status===413?s("doc_too_large",this._lang):s("doc_upload_failed",this._lang);continue}let g=await u.json();g.duplicate_in_object?l++:g.deduped&&a++}l?this._hint=s("doc_dup_in_object",this._lang):a&&(this._hint=s("doc_deduped",this._lang)),await this._load()}catch{this._error=s("doc_upload_failed",this._lang)}finally{this._busy=!1}}async _download(e){try{let t=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:30});yt(t.path,e.filename||e.title||"document")}catch(t){this._error=I(t,this._lang)}}async _preview(e){if(this._isImage(e)){this._lightboxUrl=this._thumbs[e.id]||await this._sign(e);return}let t=window.open("about:blank","_blank");try{let i=await this._sign(e);t&&(t.location.href=new URL(i,window.location.origin).href)}catch(i){t&&t.close(),this._error=I(i,this._lang)}}_openDoc(e){e.kind==="file"?this._preview(e):ne(e.url)&&window.open(e.url,"_blank","noopener")}_startEdit(e){this._editingId=e.id,this._editTitle=e.title||"",this._editCategory=this._category_of(e),this._addingLink=!1,this._error=""}_cancelEdit(){this._editingId=""}async _saveEdit(e){let t=(e.tags||[]).filter(a=>!$t.includes(a)),i=e.kind==="file"?[this._editCategory,...t]:e.tags??[];this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/update",doc_id:e.id,title:this._editTitl
Line truncated
|
||||
<div
|
||||
class="doc-zone ${this._dragOver?"drag-over":""}"
|
||||
@dragover=${this._onDragOver}
|
||||
@@ -2905,7 +2919,7 @@ ${z(n.notes)}</div>`:""}
|
||||
?disabled=${this._busy}
|
||||
@change=${t=>this._category=t.target.value}
|
||||
>
|
||||
${ft.map(t=>o`<option value=${t}>${s(`doc_cat_${t}`,e)}</option>`)}
|
||||
${$t.map(t=>o`<option value=${t}>${s(`doc_cat_${t}`,e)}</option>`)}
|
||||
</select>
|
||||
<label
|
||||
class="btn primary ${this._busy?"disabled":""}"
|
||||
@@ -2986,7 +3000,7 @@ ${z(n.notes)}</div>`:""}
|
||||
@click=${()=>this._preview(e)}
|
||||
/>`:o`<ha-icon
|
||||
class="doc-icon ${i?"clickable":""}"
|
||||
icon=${i?ys[a]:"mdi:link-variant"}
|
||||
icon=${i?Es[a]:"mdi:link-variant"}
|
||||
@click=${()=>i&&this._preview(e)}
|
||||
></ha-icon>`}
|
||||
<div
|
||||
@@ -3038,7 +3052,7 @@ ${z(n.notes)}</div>`:""}
|
||||
?disabled=${this._busy}
|
||||
@change=${a=>this._editCategory=a.target.value}
|
||||
>
|
||||
${ft.map(a=>o`<option value=${a} ?selected=${a===this._editCategory}>${s(`doc_cat_${a}`,t)}</option>`)}
|
||||
${$t.map(a=>o`<option value=${a} ?selected=${a===this._editCategory}>${s(`doc_cat_${a}`,t)}</option>`)}
|
||||
</select>`:p}
|
||||
<button class="icon-btn" title=${s("save",t)} ?disabled=${this._busy||!this._editTitle.trim()} @click=${()=>this._saveEdit(e)}>
|
||||
<ha-icon icon="mdi:check"></ha-icon>
|
||||
@@ -3146,7 +3160,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.icon-btn.danger { color: var(--error-color, #f44336); }
|
||||
.icon-btn[disabled] { opacity: 0.4; pointer-events: none; }
|
||||
.icon-btn ha-icon { --mdc-icon-size: 20px; }
|
||||
`,d([y({attribute:!1})],q.prototype,"hass",2),d([y({attribute:!1})],q.prototype,"entryId",2),d([y({type:Boolean})],q.prototype,"canWrite",2),d([_()],q.prototype,"_docs",2),d([_()],q.prototype,"_loaded",2),d([_()],q.prototype,"_busy",2),d([_()],q.prototype,"_error",2),d([_()],q.prototype,"_hint",2),d([_()],q.prototype,"_addingLink",2),d([_()],q.prototype,"_linkUrl",2),d([_()],q.prototype,"_linkTitle",2),d([_()],q.prototype,"_category",2),d([_()],q.prototype,"_thumbs",2),d([_()],q.prototype,"_lightboxUrl",2),d([_()],q.prototype,"_editingId",2),d([_()],q.prototype,"_editTitle",2),d([_()],q.prototype,"_editCategory",2),d([_()],q.prototype,"_dragOver",2);customElements.get("maintenance-documents-section")||customElements.define("maintenance-documents-section",q);var xs=["manual","warranty","invoice","spare_parts","photo","other"],$s={manual:"mdi:book-open-variant",warranty:"mdi:shield-check",invoice:"mdi:receipt-text-outline",spare_parts:"mdi:cog-outline",photo:"mdi:image-outline",other:"mdi:file-document-outline"},J=class extends S{constructor(){super(...arguments);this.canWrite=!1;this._docs=[];this._loaded=!1;this._busy=!1;this._error="";this._attachId="";this._loadedKey="";this._localeReady=!1}get _lang(){return this.hass?.language||"en"}get _refId(){return this.partId||this.taskId||""}get _linkField(){return this.partId?"part_ids":"task_ids"}updated(e){super.updated(e),this.hass&&!this._localeReady&&(this._localeReady=!0,Y(this._lang).then(()=>this.requestUpdate()));let t=`${this.entryId}|${this._refId}`;this.hass&&this.entryId&&this._refId&&this._loadedKey!==t&&(this._loadedKey=t,this._load())}async _load(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:this.entryId});this._docs=e.documents||[],this._loaded=!0,this._error=""}catch(e){this._error=I(e,this._lang),this._loaded=!0}}_links(e){return e[this._linkField]||[]}_linked(){return this._docs.filter(e=>this._links(e).includes(this._refId))}_available(){return this._docs.filter(e=>!this._links(e).includes(this._refId))}async _setLinks(e,t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/update",doc_id:e.id,[this._linkField]:t}),await this._load()}catch(i){this._error=I(i,this._lang)}finally{this._busy=!1}}_link(){let e=this._docs.find(t=>t.id===this._attachId);e&&(this._attachId="",this._setLinks(e,[...this._links(e),this._refId]))}_unlink(e){this._setLinks(e,this._links(e).filter(t=>t!==this._refId))}_isPdf(e){return e.mime==="application/pdf"||(e.filename||"").toLowerCase().endsWith(".pdf")}_pageFor(e){return this._isPdf(e)&&this.taskId?e.task_pages?.[this.taskId]:void 0}async _open(e){if(e.kind==="weblink"){window.open(e.url,"_blank","noopener");return}let t=this._pageFor(e),i=t?`#page=${t}`:"",a=window.open("about:blank","_blank");try{let l=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:300});a&&(a.location.href=new URL(l.path+i,window.location.origin).href)}catch(l){a&&a.close(),this._error=I(l,this._lang)}}async _setPage(e,t){if(this.taskId){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/update",doc_id:e.id,task_pages:{[this.taskId]:t}}),await this._load()}catch(i){this._error=I(i,this._lang)}finally{this._busy=!1}}}async _download(e){try{let t=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:30});vt(t.path,e.filename||e.title||"document")}catch(t){this._error=I(t,this._lang)}}render(){if(!this._loaded||this._docs.length===0)return p;let e=this._lang,t=this._linked(),i=this._available();return o`
|
||||
`,d([y({attribute:!1})],q.prototype,"hass",2),d([y({attribute:!1})],q.prototype,"entryId",2),d([y({type:Boolean})],q.prototype,"canWrite",2),d([_()],q.prototype,"_docs",2),d([_()],q.prototype,"_loaded",2),d([_()],q.prototype,"_busy",2),d([_()],q.prototype,"_error",2),d([_()],q.prototype,"_hint",2),d([_()],q.prototype,"_addingLink",2),d([_()],q.prototype,"_linkUrl",2),d([_()],q.prototype,"_linkTitle",2),d([_()],q.prototype,"_category",2),d([_()],q.prototype,"_thumbs",2),d([_()],q.prototype,"_lightboxUrl",2),d([_()],q.prototype,"_editingId",2),d([_()],q.prototype,"_editTitle",2),d([_()],q.prototype,"_editCategory",2),d([_()],q.prototype,"_dragOver",2);customElements.get("maintenance-documents-section")||customElements.define("maintenance-documents-section",q);var Ts=["manual","warranty","invoice","spare_parts","photo","other"],Ss={manual:"mdi:book-open-variant",warranty:"mdi:shield-check",invoice:"mdi:receipt-text-outline",spare_parts:"mdi:cog-outline",photo:"mdi:image-outline",other:"mdi:file-document-outline"},J=class extends S{constructor(){super(...arguments);this.canWrite=!1;this._docs=[];this._loaded=!1;this._busy=!1;this._error="";this._attachId="";this._loadedKey="";this._localeReady=!1}get _lang(){return this.hass?.language||"en"}get _refId(){return this.partId||this.taskId||""}get _linkField(){return this.partId?"part_ids":"task_ids"}updated(e){super.updated(e),this.hass&&!this._localeReady&&(this._localeReady=!0,Y(this._lang).then(()=>this.requestUpdate()));let t=`${this.entryId}|${this._refId}`;this.hass&&this.entryId&&this._refId&&this._loadedKey!==t&&(this._loadedKey=t,this._load())}async _load(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/list",entry_id:this.entryId});this._docs=e.documents||[],this._loaded=!0,this._error=""}catch(e){this._error=I(e,this._lang),this._loaded=!0}}_links(e){return e[this._linkField]||[]}_linked(){return this._docs.filter(e=>this._links(e).includes(this._refId))}_available(){return this._docs.filter(e=>!this._links(e).includes(this._refId))}async _setLinks(e,t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/update",doc_id:e.id,[this._linkField]:t}),await this._load()}catch(i){this._error=I(i,this._lang)}finally{this._busy=!1}}_link(){let e=this._docs.find(t=>t.id===this._attachId);e&&(this._attachId="",this._setLinks(e,[...this._links(e),this._refId]))}_unlink(e){this._setLinks(e,this._links(e).filter(t=>t!==this._refId))}_isPdf(e){return e.mime==="application/pdf"||(e.filename||"").toLowerCase().endsWith(".pdf")}_pageFor(e){return this._isPdf(e)&&this.taskId?e.task_pages?.[this.taskId]:void 0}async _open(e){if(e.kind==="weblink"){window.open(e.url,"_blank","noopener");return}let t=this._pageFor(e),i=t?`#page=${t}`:"",a=window.open("about:blank","_blank");try{let l=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:300});a&&(a.location.href=new URL(l.path+i,window.location.origin).href)}catch(l){a&&a.close(),this._error=I(l,this._lang)}}async _setPage(e,t){if(this.taskId){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/documents/update",doc_id:e.id,task_pages:{[this.taskId]:t}}),await this._load()}catch(i){this._error=I(i,this._lang)}finally{this._busy=!1}}}async _download(e){try{let t=await this.hass.connection.sendMessagePromise({type:"auth/sign_path",path:`/api/maintenance_supporter/document/${e.id}`,expires:30});yt(t.path,e.filename||e.title||"document")}catch(t){this._error=I(t,this._lang)}}render(){if(!this._loaded||this._docs.length===0)return p;let e=this._lang,t=this._linked(),i=this._available();return o`
|
||||
<div class="task-docs">
|
||||
<h3><ha-icon icon="mdi:paperclip"></ha-icon> ${s("documents",e)} (${t.length})</h3>
|
||||
${this._error?o`<div class="tdoc-error">${this._error}</div>`:p}
|
||||
@@ -3165,9 +3179,9 @@ ${z(n.notes)}</div>`:""}
|
||||
</button>
|
||||
</div>`:p}
|
||||
</div>
|
||||
`}_renderRow(e,t){let i=e.kind==="file",a=this._isPdf(e),l=this._pageFor(e),c=(e.tags||[]).find(u=>xs.includes(u))||"other",h=i?de(e.size):s("doc_link_badge",t);return o`
|
||||
`}_renderRow(e,t){let i=e.kind==="file",a=this._isPdf(e),l=this._pageFor(e),c=(e.tags||[]).find(u=>Ts.includes(u))||"other",h=i?de(e.size):s("doc_link_badge",t);return o`
|
||||
<div class="tdoc-row">
|
||||
<ha-icon class="tdoc-icon" icon=${i?$s[c]:"mdi:link-variant"}></ha-icon>
|
||||
<ha-icon class="tdoc-icon" icon=${i?Ss[c]:"mdi:link-variant"}></ha-icon>
|
||||
<div
|
||||
class="tdoc-info"
|
||||
role="button"
|
||||
@@ -3253,7 +3267,7 @@ ${z(n.notes)}</div>`:""}
|
||||
}
|
||||
.tdoc-btn ha-icon { --mdc-icon-size: 18px; }
|
||||
.tdoc-btn[disabled] { opacity: 0.5; pointer-events: none; }
|
||||
`,d([y({attribute:!1})],J.prototype,"hass",2),d([y({attribute:!1})],J.prototype,"entryId",2),d([y({attribute:!1})],J.prototype,"taskId",2),d([y({attribute:!1})],J.prototype,"partId",2),d([y({type:Boolean})],J.prototype,"canWrite",2),d([_()],J.prototype,"_docs",2),d([_()],J.prototype,"_loaded",2),d([_()],J.prototype,"_busy",2),d([_()],J.prototype,"_error",2),d([_()],J.prototype,"_attachId",2);customElements.get("maintenance-task-documents")||customElements.define("maintenance-task-documents",J);var ws={name:"",vendor:"",mpn:"",gtin:"",storage_location:"",product_url:"",unit:"",cost:"",stock:"",reorder_threshold:"",restock_quantity:"",auto_buy_task:!0,notes:""},Q=class extends S{constructor(){super(...arguments);this.parts=[];this.canWrite=!1;this._editing=null;this._busy=!1;this._error="";this._restockFor=null;this._restockQty="";this._restockInvalid=!1;this._docsFor=null}get _lang(){return this.hass?.locale?.language||this.hass?.language||"en"}connectedCallback(){super.connectedCallback(),Y(this._lang).then(()=>this.requestUpdate())}_notifyChanged(){this.dispatchEvent(new CustomEvent("parts-changed",{bubbles:!0,composed:!0}))}async _send(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e)}catch(t){return this._error=I(t,this._lang),null}finally{this._busy=!1}}_openAdd(){this._editing={...ws}}_openEdit(e){this._editing={id:e.id,name:e.name,vendor:e.vendor||"",mpn:e.mpn||"",gtin:e.gtin||"",storage_location:e.storage_location||"",product_url:e.product_url||"",unit:e.unit||"",cost:e.cost!=null?String(e.cost):"",stock:e.stock!=null?String(e.stock):"",reorder_threshold:e.reorder_threshold!=null?String(e.reorder_threshold):"",restock_quantity:e.restock_quantity!=null?String(e.restock_quantity):"",auto_buy_task:!!e.auto_buy_task,notes:e.notes||""}}_formValue(e){let t=i=>i.trim()===""?null:Number(i);return{entry_id:this.entryId,name:e.name.trim(),vendor:e.vendor.trim()||null,mpn:e.mpn.trim()||null,gtin:e.gtin.trim()||null,storage_location:e.storage_location.trim()||null,product_url:e.product_url.trim()||null,unit:e.unit.trim()||null,cost:t(e.cost),stock:t(e.stock),reorder_threshold:t(e.reorder_threshold),restock_quantity:t(e.restock_quantity),auto_buy_task:e.auto_buy_task,notes:e.notes.trim()||null}}async _save(){let e=this._editing;if(!e||!e.name.trim())return;let t=this._formValue(e),i=e.id?"maintenance_supporter/part/update":"maintenance_supporter/part/create";await this._send(e.id?{type:i,part_id:e.id,...t}:{type:i,...t})!==null&&(this._editing=null,this._notifyChanged())}async _delete(e){await this._send({type:"maintenance_supporter/part/delete",entry_id:this.entryId,part_id:e.id})!==null&&this._notifyChanged()}async _restock(e){let t=parseInt(this._restockQty,10);if(!Number.isFinite(t)||t===0){this._restockInvalid=!0;return}this._restockInvalid=!1;let i=await this._send({type:"maintenance_supporter/part/restock",entry_id:this.entryId,part_id:e.id,delta:t});this._restockFor=null,i!==null&&(e.stock=i.stock,this.requestUpdate(),this._notifyChanged())}_identLine(e){return[e.vendor,e.mpn?`MPN: ${e.mpn}`:"",e.gtin?`GTIN: ${e.gtin}`:""].filter(Boolean).join(" \xB7 ")}_renderRow(e){let t=this._lang,i=e.stock!==null&&e.stock!==void 0,a=this._identLine(e),l=this._docsFor===e.id;return o`
|
||||
`,d([y({attribute:!1})],J.prototype,"hass",2),d([y({attribute:!1})],J.prototype,"entryId",2),d([y({attribute:!1})],J.prototype,"taskId",2),d([y({attribute:!1})],J.prototype,"partId",2),d([y({type:Boolean})],J.prototype,"canWrite",2),d([_()],J.prototype,"_docs",2),d([_()],J.prototype,"_loaded",2),d([_()],J.prototype,"_busy",2),d([_()],J.prototype,"_error",2),d([_()],J.prototype,"_attachId",2);customElements.get("maintenance-task-documents")||customElements.define("maintenance-task-documents",J);var As={name:"",vendor:"",mpn:"",gtin:"",storage_location:"",product_url:"",unit:"",cost:"",stock:"",reorder_threshold:"",restock_quantity:"",auto_buy_task:!0,notes:""},Q=class extends S{constructor(){super(...arguments);this.parts=[];this.canWrite=!1;this._editing=null;this._busy=!1;this._error="";this._restockFor=null;this._restockQty="";this._restockInvalid=!1;this._docsFor=null}get _lang(){return this.hass?.locale?.language||this.hass?.language||"en"}connectedCallback(){super.connectedCallback(),Y(this._lang).then(()=>this.requestUpdate())}_notifyChanged(){this.dispatchEvent(new CustomEvent("parts-changed",{bubbles:!0,composed:!0}))}async _send(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e)}catch(t){return this._error=I(t,this._lang),null}finally{this._busy=!1}}_openAdd(){this._editing={...As}}_openEdit(e){this._editing={id:e.id,name:e.name,vendor:e.vendor||"",mpn:e.mpn||"",gtin:e.gtin||"",storage_location:e.storage_location||"",product_url:e.product_url||"",unit:e.unit||"",cost:e.cost!=null?String(e.cost):"",stock:e.stock!=null?String(e.stock):"",reorder_threshold:e.reorder_threshold!=null?String(e.reorder_threshold):"",restock_quantity:e.restock_quantity!=null?String(e.restock_quantity):"",auto_buy_task:!!e.auto_buy_task,notes:e.notes||""}}_formValue(e){let t=i=>i.trim()===""?null:Number(i);return{entry_id:this.entryId,name:e.name.trim(),vendor:e.vendor.trim()||null,mpn:e.mpn.trim()||null,gtin:e.gtin.trim()||null,storage_location:e.storage_location.trim()||null,product_url:e.product_url.trim()||null,unit:e.unit.trim()||null,cost:t(e.cost),stock:t(e.stock),reorder_threshold:t(e.reorder_threshold),restock_quantity:t(e.restock_quantity),auto_buy_task:e.auto_buy_task,notes:e.notes.trim()||null}}async _save(){let e=this._editing;if(!e||!e.name.trim())return;let t=this._formValue(e),i=e.id?"maintenance_supporter/part/update":"maintenance_supporter/part/create";await this._send(e.id?{type:i,part_id:e.id,...t}:{type:i,...t})!==null&&(this._editing=null,this._notifyChanged())}async _delete(e){await this._send({type:"maintenance_supporter/part/delete",entry_id:this.entryId,part_id:e.id})!==null&&this._notifyChanged()}async _restock(e){let t=parseInt(this._restockQty,10);if(!Number.isFinite(t)||t===0){this._restockInvalid=!0;return}this._restockInvalid=!1;let i=await this._send({type:"maintenance_supporter/part/restock",entry_id:this.entryId,part_id:e.id,delta:t});this._restockFor=null,i!==null&&(e.stock=i.stock,this.requestUpdate(),this._notifyChanged())}_identLine(e){return[e.vendor,e.mpn?`MPN: ${e.mpn}`:"",e.gtin?`GTIN: ${e.gtin}`:""].filter(Boolean).join(" \xB7 ")}_renderRow(e){let t=this._lang,i=e.stock!==null&&e.stock!==void 0,a=this._identLine(e),l=this._docsFor===e.id;return o`
|
||||
<div class="part-row ${e.is_low?"low":""}">
|
||||
<ha-icon class="part-icon" icon=${e.is_low?"mdi:cart-arrow-down":"mdi:package-variant-closed"}></ha-icon>
|
||||
<div class="part-main">
|
||||
@@ -3488,8 +3502,8 @@ ${z(n.notes)}</div>`:""}
|
||||
font-size: 13px;
|
||||
margin: 4px 0;
|
||||
}
|
||||
`,d([y({attribute:!1})],Q.prototype,"hass",2),d([y({attribute:!1})],Q.prototype,"entryId",2),d([y({attribute:!1})],Q.prototype,"parts",2),d([y({type:Boolean})],Q.prototype,"canWrite",2),d([_()],Q.prototype,"_editing",2),d([_()],Q.prototype,"_busy",2),d([_()],Q.prototype,"_error",2),d([_()],Q.prototype,"_restockFor",2),d([_()],Q.prototype,"_restockQty",2),d([_()],Q.prototype,"_restockInvalid",2),d([_()],Q.prototype,"_docsFor",2);customElements.define("maintenance-parts-section",Q);var ks=["cleaning","inspection","replacement","calibration","service","reading","custom"],Es=["low","normal","high"],Ts=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],fi=["weekdays","nth_weekday","day_of_month"],yi=["threshold","counter","state_change","runtime"],Ss=[...yi,"compound"];function As(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:""}}function js(n){return{entityIds:(n.entity_ids||(n.entity_id?[n.entity_id]:[])).join(", "),type:n.type||"threshold",above:n.trigger_above?.toString()??"",below:n.trigger_below?.toString()??"",forMinutes:n.trigger_for_minutes?.toString()??"0",targetValue:n.trigger_target_value?.toString()??"",deltaMode:n.trigger_delta_mode||!1,fromState:n.trigger_from_state||"",toState:n.trigger_to_state||"",targetChanges:n.trigger_target_changes?.toString()??"",runtimeHours:n.trigger_runtime_hours?.toString()??""}}function Cs(n){let r=n.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={entity_id:r[0],entity_ids:r,type:n.type};if(n.type==="threshold"){let t=parseFloat(n.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(n.below);isNaN(i)||(e.trigger_below=i);let a=parseInt(n.forMinutes,10);isNaN(a)||(e.trigger_for_minutes=a)}else if(n.type==="counter"){let t=parseFloat(n.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=n.deltaMode}else if(n.type==="state_change"){n.fromState&&(e.trigger_from_state=n.fromState),n.toState&&(e.trigger_to_state=n.toState);let t=parseInt(n.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(n.type==="runtime"){let t=parseFloat(n.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t)}return e}function Is(n){return Array.from({length:7},(r,e)=>ct(e,n,"short"))}function Ms(n){let r=new Intl.DateTimeFormat(n||"en",{month:"short"});return Array.from({length:12},(e,t)=>r.format(new Date(2021,t,1)))}var x=class extends S{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._autoCompleteOnRecovery=!1;this._triggerFromState="";this._triggerToState="";this._triggerTargetChanges="";this._triggerRuntimeHours="";this._compoundLogic="AND";this._compoundConditions=[];this._suggestedAttributes=[];this._availableAttributes=[];this._entityDomain="";this._lastPerformed="";this._nfcTagId="";this._readingUnit="";this._consumesParts={};this._partsLoadFailed=!1;this._availableTags=[];this._responsibleUserId=null;this._assigneePool=[];this._rotationStrategy="";this._availableUsers=[];this._checklistText="";this._scheduleTime="";this._actionService="";this._actionTargetEntity="";this._actionData={};this._actionDataJsonFallback="";this._actionTesting=!1;this._actionTestResult="";this._actionTestError="";this._qcNotes="";this._qcCost="";this._qcDuration="";this._qcFeedback="";this._environmentalEntity="";this._environmentalAttribute="";this._environmentalInitial="";this._environmentalAttributeInitial="";this._userService=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}async openCreate(e,t){this._entryId=e,this._taskId=null,this._error="",!e&&t&&t.length>0?(this._objectChoices=t.map(i=>({entry_id:i.entry_id,name:i.object.name})).sort((i,a)=>i.name.localeCompare(a.name)),this._entryId=this._objectChoices[0].entry_id):this._objectChoices=[],this._resetFields(),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this
Line truncated
|
||||
`),this._scheduleTime=t.schedule_time||"";let l=t.on_complete_action;if(l&&l.service){this._actionService=l.service;let u=l.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=l.data&&typeof l.data=="object"?{...l.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.feedback||"";let h=t.adaptive_config||{};if(this._environmentalEntity=h.environmental_entity||"",this._environmentalAttribute=h.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(js)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new ye(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}let a=this._actionTargetEntity.trim();if(a){let l=a.split(".")[0];if(l!==t&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(t)){this._actionTestResult="error",this._actionTestError=`Service "${e}" only works on ${t}.Line truncated
|
||||
`,d([y({attribute:!1})],Q.prototype,"hass",2),d([y({attribute:!1})],Q.prototype,"entryId",2),d([y({attribute:!1})],Q.prototype,"parts",2),d([y({type:Boolean})],Q.prototype,"canWrite",2),d([_()],Q.prototype,"_editing",2),d([_()],Q.prototype,"_busy",2),d([_()],Q.prototype,"_error",2),d([_()],Q.prototype,"_restockFor",2),d([_()],Q.prototype,"_restockQty",2),d([_()],Q.prototype,"_restockInvalid",2),d([_()],Q.prototype,"_docsFor",2);customElements.define("maintenance-parts-section",Q);var js=["cleaning","inspection","replacement","calibration","service","reading","custom"],Cs=["low","normal","high"],Is=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],$i=["weekdays","nth_weekday","day_of_month"],wi=["threshold","counter","state_change","runtime"],Ms=[...wi,"compound"];function Rs(){return{entityIds:"",type:"threshold",above:"",below:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:""}}function Ls(n){return{entityIds:(n.entity_ids||(n.entity_id?[n.entity_id]:[])).join(", "),type:n.type||"threshold",above:n.trigger_above?.toString()??"",below:n.trigger_below?.toString()??"",forMinutes:n.trigger_for_minutes?.toString()??"0",targetValue:n.trigger_target_value?.toString()??"",deltaMode:n.trigger_delta_mode||!1,fromState:n.trigger_from_state||"",toState:n.trigger_to_state||"",targetChanges:n.trigger_target_changes?.toString()??"",runtimeHours:n.trigger_runtime_hours?.toString()??""}}function Ps(n){let r=n.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={entity_id:r[0],entity_ids:r,type:n.type};if(n.type==="threshold"){let t=parseFloat(n.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(n.below);isNaN(i)||(e.trigger_below=i);let a=parseInt(n.forMinutes,10);isNaN(a)||(e.trigger_for_minutes=a)}else if(n.type==="counter"){let t=parseFloat(n.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=n.deltaMode}else if(n.type==="state_change"){n.fromState&&(e.trigger_from_state=n.fromState),n.toState&&(e.trigger_to_state=n.toState);let t=parseInt(n.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(n.type==="runtime"){let t=parseFloat(n.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t)}return e}function zs(n){return Array.from({length:7},(r,e)=>pt(e,n,"short"))}function Hs(n){let r=new Intl.DateTimeFormat(n||"en",{month:"short"});return Array.from({length:12},(e,t)=>r.format(new Date(2021,t,1)))}var x=class extends S{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerForMinutes="0";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._autoCompleteOnRecovery=!1;this._triggerFromState="";this._triggerToState="";this._triggerTargetChanges="";this._triggerRuntimeHours="";this._compoundLogic="AND";this._compoundConditions=[];this._suggestedAttributes=[];this._availableAttributes=[];this._entityDomain="";this._lastPerformed="";this._nfcTagId="";this._readingUnit="";this._consumesParts={};this._partsLoadFailed=!1;this._availableTags=[];this._responsibleUserId=null;this._assigneePool=[];this._rotationStrategy="";this._availableUsers=[];this._checklistText="";this._scheduleTime="";this._actionService="";this._actionTargetEntity="";this._actionData={};this._actionDataJsonFallback="";this._actionTesting=!1;this._actionTestResult="";this._actionTestError="";this._qcNotes="";this._qcCost="";this._qcDuration="";this._qcFeedback="";this._environmentalEntity="";this._environmentalAttribute="";this._environmentalInitial="";this._environmentalAttributeInitial="";this._userService=null}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}async openCreate(e,t){this._entryId=e,this._taskId=null,this._error="",!e&&t&&t.length>0?(this._objectChoices=t.map(i=>({entry_id:i.entry_id,name:i.object.name})).sort((i,a)=>i.name.localeCompare(a.name)),this._entryId=this._objectChoices[0].entry_id):this._objectChoices=[],this._resetFields(),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this
Line truncated
|
||||
`),this._scheduleTime=t.schedule_time||"";let l=t.on_complete_action;if(l&&l.service){this._actionService=l.service;let u=l.target?.entity_id;this._actionTargetEntity=Array.isArray(u)?u[0]||"":u||"",this._actionData=l.data&&typeof l.data=="object"?{...l.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let c=t.quick_complete_defaults;this._qcNotes=c?.notes||"",this._qcCost=c?.cost!=null?String(c.cost):"",this._qcDuration=c?.duration!=null?String(c.duration):"",this._qcFeedback=c?.feedback||"";let h=t.adaptive_config||{};if(this._environmentalEntity=h.environmental_entity||"",this._environmentalAttribute=h.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,t.trigger_config){let u=t.trigger_config;this._triggerEntityId=u.entity_id||"",this._triggerEntityIds=u.entity_ids||(u.entity_id?[u.entity_id]:[]),this._triggerEntityLogic=u.entity_logic||"any",this._triggerAttribute=u.attribute||"",this._triggerType=u.type||"threshold",this._triggerAbove=u.trigger_above?.toString()||"",this._triggerBelow=u.trigger_below?.toString()||"",this._triggerForMinutes=u.trigger_for_minutes?.toString()||"0",this._triggerTargetValue=u.trigger_target_value?.toString()||"",this._triggerDeltaMode=u.trigger_delta_mode||!1,this._autoCompleteOnRecovery=u.auto_complete_on_recovery||!1,this._triggerFromState=u.trigger_from_state||"",this._triggerToState=u.trigger_to_state||"",this._triggerTargetChanges=u.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=u.trigger_runtime_hours?.toString()||"",u.type==="compound"?(this._compoundLogic=u.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(u.conditions||[]).map(Ls)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._readingUnit="",this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._scheduleTime="",this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerForMinutes="0",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new ye(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}let a=this._actionTargetEntity.trim();if(a){let l=a.split(".")[0];if(l!==t&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(t)){this._actionTestResult="error",this._actionTestError=`Service "${e}" only works on ${t}.Line truncated
|
||||
<details class="ca-section">
|
||||
<summary>${s("on_complete_action_title",e)}</summary>
|
||||
<p class="field-help">${s("on_complete_action_desc",e)}</p>
|
||||
@@ -3565,7 +3579,7 @@ ${z(n.notes)}</div>`:""}
|
||||
<option value="not_needed">${s("quick_complete_defaults_feedback_not_needed",e)}</option>
|
||||
</select>
|
||||
</details>
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:parseInt(this._warningDays,10)||7},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):fi.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(e.consumes_parts=Object.entries(this._consumesParts).map(([c,h])=>({part_id:c,quantity:h}))),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map(Cs).filter(h=>h!==null);if(c.length>0){let h={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(h.auto_complete_on_recovery=!0),e.trigger_config=h}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],h={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(h.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(h.auto_complete_on_recovery=!0),c.length>1&&(h.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(h.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(h.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(h.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(h.trigger_target_value=u)}h.trigger_delta_mode=this._triggerDeltaMode}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(h.trigger_from_state=this._triggerFromState),this._triggerToState&&(h.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(h.trigger_target_changes=u)}}else if(this._triggerType==="runtime"&&this._triggerRuntimeHours){let u=parseFloat(this._triggerRuntimeHours);isNaN(u)||(h.trigger_runtime_hours=u)}e.trigger_config=h}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||
`}async _loadParts(){if(this.parts=[],!!this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this.parts=e.parts||[],this._partsLoadFailed=!1}catch{this.parts=[],this._partsLoadFailed=!0}}async _loadTags(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tags/list"});this._availableTags=e.tags||[]}catch{this._availableTags=[]}}async _fetchEntityAttributes(e){if(!e||!this.hass){this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="";return}try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/entity/attributes",entity_id:e});this._entityDomain=t.domain||"",this._suggestedAttributes=t.suggested_attributes||[],this._availableAttributes=t.available_attributes||[]}catch{this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain=""}}async _save(){if(!this._loading&&this._name.trim()){this._loading=!0,this._error="";try{let e={type:this._taskId?"maintenance_supporter/task/update":"maintenance_supporter/task/create",entry_id:this._entryId,name:this._name,task_type:this._type,schedule_type:this._scheduleType,warning_days:parseInt(this._warningDays,10)||7},t=this._earliestCompletionDays.trim();if(e.earliest_completion_days=t===""?null:Math.max(0,parseInt(t,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):$i.includes(this._scheduleType)?(e.schedule={...this._buildSchedule(),...this._recurrenceExtras()},e.interval_days=null,this._taskId&&(e.due_date=null)):(this._taskId&&(e.due_date=null),this._scheduleType!=="manual"&&this._intervalDays?(e.interval_days=parseInt(this._intervalDays,10),e.interval_unit=this._intervalUnit,e.interval_anchor=this._intervalAnchor,this._scheduleType==="time_based"&&(e.schedule={kind:"interval",...this._recurrenceExtras()})):this._taskId&&(e.interval_days=null,e.interval_anchor="completion")),e.notes=this._notes||null,e.documentation_url=this._documentationUrl||null,e.custom_icon=this._customIcon||null,e.priority=this._priority,e.labels=this._labels.split(",").map(c=>c.trim()).filter(Boolean),e.enabled=this._enabled,e.last_performed=this._lastPerformed||null,e.nfc_tag_id=this._nfcTagId||null,e.reading_unit=this._readingUnit.trim()||null,this.parts.length&&(e.consumes_parts=Object.entries(this._consumesParts).map(([c,h])=>({part_id:c,quantity:h}))),e.responsible_user_id=this._responsibleUserId,e.assignee_pool=this._assigneePool,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let c=this._compoundConditions.map(Ps).filter(h=>h!==null);if(c.length>0){let h={type:"compound",compound_logic:this._compoundLogic,conditions:c};this._autoCompleteOnRecovery&&(h.auto_complete_on_recovery=!0),e.trigger_config=h}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let c=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],h={entity_id:c[0],entity_ids:c,type:this._triggerType};if(this._triggerAttribute&&(h.attribute=this._triggerAttribute),this._autoCompleteOnRecovery&&(h.auto_complete_on_recovery=!0),c.length>1&&(h.entity_logic=this._triggerEntityLogic),this._triggerType==="threshold"){if(this._triggerAbove){let u=parseFloat(this._triggerAbove);isNaN(u)||(h.trigger_above=u)}if(this._triggerBelow){let u=parseFloat(this._triggerBelow);isNaN(u)||(h.trigger_below=u)}if(this._triggerForMinutes){let u=parseInt(this._triggerForMinutes,10);isNaN(u)||(h.trigger_for_minutes=u)}}else if(this._triggerType==="counter"){if(this._triggerTargetValue){let u=parseFloat(this._triggerTargetValue);isNaN(u)||(h.trigger_target_value=u)}h.trigger_delta_mode=this._triggerDeltaMode}else if(this._triggerType==="state_change"){if(this._triggerFromState&&(h.trigger_from_state=this._triggerFromState),this._triggerToState&&(h.trigger_to_state=this._triggerToState),this._triggerTargetChanges){let u=parseInt(this._triggerTargetChanges,10);isNaN(u)||(h.trigger_target_changes=u)}}else if(this._triggerType==="runtime"&&this._triggerRuntimeHours){let u=parseFloat(this._triggerRuntimeHours);isNaN(u)||(h.trigger_runtime_hours=u)}e.trigger_config=h}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&this._scheduleType==="time_based"){let c=this._scheduleTime.trim();e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(c)?c:null}if(this.checklistsEnabled){let c=this._checklistText.split(`
|
||||
`).map(h=>h.trim()).filter(Boolean).slice(0,100);e.checklist=c.length?c:null}if(this.completionActionsEnabled){let c=this._actionService.trim();if(c&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(c)){let m={service:c},v=this._actionTargetEntity.trim();v&&(m.target={entity_id:v});let b=this._buildActionData();Object.keys(b).length>0&&(m.data=b),e.on_complete_action=m}else e.on_complete_action=null;let h={};this._qcNotes.trim()&&(h.notes=this._qcNotes.trim());let u=parseFloat(this._qcCost);!isNaN(u)&&u>=0&&(h.cost=u);let g=parseInt(this._qcDuration,10);!isNaN(g)&&g>=0&&(h.duration=g),this._qcFeedback&&(h.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(h).length?h:null}let i=await this.hass.connection.sendMessagePromise(e),a=this._taskId||i?.task_id,l=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;if(a&&this._scheduleType==="sensor_based"&&l)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:a,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null}),this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute}catch{}this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}catch(e){this._error=I(e,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}_close(){this._open=!1}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return p;let e=this._lang,t=this._triggerType==="compound";return o`
|
||||
<h3>${s("trigger_configuration",e)}</h3>
|
||||
<div class="select-row">
|
||||
@@ -3574,7 +3588,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.value=${this._triggerType}
|
||||
@change=${i=>this._triggerType=i.target.value}
|
||||
>
|
||||
${Ss.map(i=>o`<option value=${i} ?selected=${i===this._triggerType}>${s(i,e)}</option>`)}
|
||||
${Ms.map(i=>o`<option value=${i} ?selected=${i===this._triggerType}>${s(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${t?this._renderCompoundEditor():o`
|
||||
@@ -3633,7 +3647,7 @@ ${z(n.notes)}</div>`:""}
|
||||
@input=${i=>this._intervalDays=i.target.value}
|
||||
></ms-textfield>
|
||||
${this._intervalDays?this._renderUnitSelect():p}
|
||||
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,a)=>a===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,As()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return o`
|
||||
`}_patchCondition(e,t){this._compoundConditions=this._compoundConditions.map((i,a)=>a===e?{...i,...t}:i)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Rs()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((t,i)=>i!==e)}_renderCompoundEditor(){let e=this._lang;return o`
|
||||
<div class="select-row">
|
||||
<label>${s("compound_logic",e)}</label>
|
||||
<select
|
||||
@@ -3671,7 +3685,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.value=${e.type}
|
||||
@change=${l=>this._patchCondition(t,{type:l.target.value})}
|
||||
>
|
||||
${yi.map(l=>o`<option value=${l} ?selected=${l===e.type}>${s(l,i)}</option>`)}
|
||||
${wi.map(l=>o`<option value=${l} ?selected=${l===e.type}>${s(l,i)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(e,t)}
|
||||
@@ -3710,7 +3724,7 @@ ${z(n.notes)}</div>`:""}
|
||||
>
|
||||
${["days","weeks","months","years"].map(t=>o`<option value=${t} ?selected=${t===this._intervalUnit}>${s("unit_"+t,e)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_buildSchedule(){let e=i=>{let a=parseInt(this._calOffset,10)||0;return a&&(i.offset=Math.max(-15,Math.min(a,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,a)=>i-a)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||fi.includes(this._scheduleType)))return p;let i=Ms(e);return o`
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_buildSchedule(){let e=i=>{let a=parseInt(this._calOffset,10)||0;return a&&(i.offset=Math.max(-15,Math.min(a,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,a)=>i-a)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||$i.includes(this._scheduleType)))return p;let i=Hs(e);return o`
|
||||
<label class="field-label">${s("season_window_label",e)}</label>
|
||||
<div class="field-help">${s("season_window_hint",e)}</div>
|
||||
<div class="weekday-chips season-chips">
|
||||
@@ -3745,7 +3759,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.value=${this._endsUntil}
|
||||
@input=${a=>this._endsUntil=a.target.value}
|
||||
></ms-textfield>`:p}
|
||||
`}_renderCalendarFields(){let e=this._lang,t=Is(e);if(this._scheduleType==="weekdays")return o`
|
||||
`}_renderCalendarFields(){let e=this._lang,t=zs(e);if(this._scheduleType==="weekdays")return o`
|
||||
<label class="field-label">${s("recurrence_on_days",e)}</label>
|
||||
<div class="weekday-chips">
|
||||
${t.map((i,a)=>o`
|
||||
@@ -3890,7 +3904,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.value=${this._type}
|
||||
@change=${i=>this._type=i.target.value}
|
||||
>
|
||||
${ks.map(i=>o`<option value=${i} ?selected=${i===this._type}>${s(i,e)}</option>`)}
|
||||
${js.map(i=>o`<option value=${i} ?selected=${i===this._type}>${s(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?o`
|
||||
@@ -3933,7 +3947,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.value=${this._priority}
|
||||
@change=${i=>this._priority=i.target.value}
|
||||
>
|
||||
${Es.map(i=>o`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,e)}</option>`)}
|
||||
${Cs.map(i=>o`<option value=${i} ?selected=${i===this._priority}>${s("priority_"+i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -3952,7 +3966,7 @@ ${z(n.notes)}</div>`:""}
|
||||
.value=${this._scheduleType}
|
||||
@change=${i=>this._scheduleType=i.target.value}
|
||||
>
|
||||
${Ts.map(i=>o`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,e)}</option>`)}
|
||||
${Is.map(i=>o`<option value=${i} ?selected=${i===this._scheduleType}>${s(i,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?o`
|
||||
@@ -4495,7 +4509,7 @@ ${z(n.notes)}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};H.styles=[ht,A`
|
||||
`}};H.styles=[gt,A`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -4625,7 +4639,7 @@ ${z(n.notes)}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
`],d([y({attribute:!1})],H.prototype,"hass",2),d([y()],H.prototype,"entryId",2),d([y()],H.prototype,"taskId",2),d([y()],H.prototype,"taskName",2),d([y()],H.prototype,"lang",2),d([y({type:Array})],H.prototype,"checklist",2),d([y({type:Boolean})],H.prototype,"adaptiveEnabled",2),d([y()],H.prototype,"taskType",2),d([y()],H.prototype,"readingUnit",2),d([y({attribute:!1})],H.prototype,"restockDefault",2),d([y({type:Array})],H.prototype,"consumesInfo",2),d([_()],H.prototype,"_open",2),d([_()],H.prototype,"_notes",2),d([_()],H.prototype,"_cost",2),d([_()],H.prototype,"_duration",2),d([_()],H.prototype,"_loading",2),d([_()],H.prototype,"_error",2),d([_()],H.prototype,"_checklistState",2),d([_()],H.prototype,"_feedback",2),d([_()],H.prototype,"_photoDocId",2),d([_()],H.prototype,"_photoPreview",2),d([_()],H.prototype,"_photoUploading",2),d([_()],H.prototype,"_readingValue",2),d([_()],H.prototype,"_restockQty",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",H);function Pe(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xi(n){return!n.startsWith("data:image/svg+xml,")&&!n.startsWith("data:image/png;base64,")?"":Pe(n)}function Rs(n){return n.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var ae=class extends S{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,a){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=a,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let a=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=a[0],a.length>1&&(this._completeResult=a[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,a=t?.message;this._error=i==="no_url"||typeof a=="string"&&a.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),a=window.open("","_blank","width=600,height=500");if(!a)return;let l=this.lang||"en",c=Pe(t),h=Pe(i),u=!!this._completeResult,g=Pe(s("qr_action_view",l)),m=Pe(s("qr_action_complete",l));a.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`],d([y({attribute:!1})],H.prototype,"hass",2),d([y()],H.prototype,"entryId",2),d([y()],H.prototype,"taskId",2),d([y()],H.prototype,"taskName",2),d([y()],H.prototype,"lang",2),d([y({type:Array})],H.prototype,"checklist",2),d([y({type:Boolean})],H.prototype,"adaptiveEnabled",2),d([y()],H.prototype,"taskType",2),d([y()],H.prototype,"readingUnit",2),d([y({attribute:!1})],H.prototype,"restockDefault",2),d([y({type:Array})],H.prototype,"consumesInfo",2),d([_()],H.prototype,"_open",2),d([_()],H.prototype,"_notes",2),d([_()],H.prototype,"_cost",2),d([_()],H.prototype,"_duration",2),d([_()],H.prototype,"_loading",2),d([_()],H.prototype,"_error",2),d([_()],H.prototype,"_checklistState",2),d([_()],H.prototype,"_feedback",2),d([_()],H.prototype,"_photoDocId",2),d([_()],H.prototype,"_photoPreview",2),d([_()],H.prototype,"_photoUploading",2),d([_()],H.prototype,"_readingValue",2),d([_()],H.prototype,"_restockQty",2);customElements.get("maintenance-complete-dialog")||customElements.define("maintenance-complete-dialog",H);function Pe(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ki(n){return!n.startsWith("data:image/svg+xml,")&&!n.startsWith("data:image/png;base64,")?"":Pe(n)}function Ds(n){return n.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var ae=class extends S{constructor(){super(...arguments);this.lang="en";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}openForObject(e,t){this._entryId=e,this._taskId=null,this._objectName=t,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}openForTask(e,t,i,a){this._entryId=e,this._taskId=t,this._objectName=i,this._taskName=a,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null;try{let t={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(t.task_id=this._taskId);let i=[this.hass.connection.sendMessagePromise({...t,action:"view"})];this._taskId&&i.push(this.hass.connection.sendMessagePromise({...t,action:"complete"}));let a=await Promise.all(i);if(e!==this._generateSeq)return;this._viewResult=a[0],a.length>1&&(this._completeResult=a[1])}catch(t){if(e!==this._generateSeq)return;let i=t?.code,a=t?.message;this._error=i==="no_url"||typeof a=="string"&&a.includes("No Home Assistant URL")?s("qr_error_no_url",this.lang):s("qr_error",this.lang)}finally{e===this._generateSeq&&(this._loading=!1)}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,t=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,i=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),a=window.open("","_blank","width=600,height=500");if(!a)return;let l=this.lang||"en",c=Pe(t),h=Pe(i),u=!!this._completeResult,g=Pe(s("qr_action_view",l)),m=Pe(s("qr_action_complete",l));a.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<title>${c}</title>
|
||||
<style>
|
||||
body{font-family:sans-serif;text-align:center;padding:20px}
|
||||
@@ -4641,17 +4655,17 @@ ${z(n.notes)}</div>`:""}
|
||||
${h?`<div class="sub">${h}</div>`:""}
|
||||
<div class="qr-row">
|
||||
<div class="qr-col">
|
||||
<img src="${xi(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<img src="${ki(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${g}</div>
|
||||
</div>
|
||||
${u?`<div class="qr-col">
|
||||
<img src="${xi(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<img src="${ki(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${m}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${Pe(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),a.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),a=new Blob([i],{type:"image/svg+xml"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l;let h=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${Rs(h)}-${t}.svg`,c.click(),URL.revokeObjectURL(l)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||
</body></html>`),a.document.close()}_downloadSvg(e,t){let i=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),a=new Blob([i],{type:"image/svg+xml"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l;let h=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;c.download=`qr-${Ds(h)}-${t}.svg`,c.click(),URL.revokeObjectURL(l)}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._error="",this._loading=!1}render(){if(!this._open)return o``;let e=this.lang||this.hass?.language||"en",t=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,i=!!this._viewResult;return o`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${t}</div>
|
||||
<div class="content">
|
||||
@@ -5019,7 +5033,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
gap: 8px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
`,d([y({attribute:!1})],oe.prototype,"hass",2),d([_()],oe.prototype,"_open",2),d([_()],oe.prototype,"_loading",2),d([_()],oe.prototype,"_adopting",2),d([_()],oe.prototype,"_error",2),d([_()],oe.prototype,"_sensors",2),d([_()],oe.prototype,"_selected",2);customElements.get("maintenance-adopt-problem-sensors-dialog")||customElements.define("maintenance-adopt-problem-sensors-dialog",oe);var $i=5;function Je(n){let r=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),t=String(n.getDate()).padStart(2,"0");return`${r}-${e}-${t}`}function Ls(n,r){let e=[];for(let t=0;t<r;t++){let i=new Date(n);i.setDate(i.getDate()+t),i.setHours(0,0,0,0),e.push(Je(i))}return e}function yt(n,r){let[e,t,i]=n.split("-").map(Number),a=new Date(e,t-1,i);return a.setDate(a.getDate()+r),Je(a)}function Ps(n){if(!n||n.length===0)return null;let r=n.map(e=>e.cost).filter(e=>typeof e=="number");return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length}function zs(n){let{windowStart:r,windowEnd:e,task:t,entryId:i,objectName:a}=n,l=[],c=(m,v)=>({date:m,entry_id:i,task_id:t.id,task_name:t.name,object_name:a,status:v&&(t.status==="overdue"||t.status==="triggered")?"ok":t.status,days_until_due:v?null:t.days_until_due??null,projected:v,schedule_type:t.schedule_type,interval_days:t.interval_days??null,interval_unit:t.interval_unit??null,responsible_user_id:t.responsible_user_id??null,avg_cost:Ps(t.history),adaptive_enabled:!!t.adaptive_config?.enabled,prediction_confidence:t.threshold_prediction_confidence??null}),h=Math.max(1,Math.round(Nt(t.interval_days,t.interval_unit)));if(t.status==="overdue"||t.status==="triggered"){if(l.push(c(r,!1)),t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let m=yt(r,h),v=1;for(;m<=e&&v<$i;)l.push(c(m,!0)),v++,m=yt(m,h)}return l}let u=t.next_due;if(typeof u!="string"||!u)return l;let g=u.slice(0,10);if(g>=r&&g<=e)l.push(c(g,!1));else if(g>e)return l;if(t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let m=yt(g,h),v=l.length;for(;m<=e&&v<$i;)m>=r&&(l.push(c(m,!0)),v++),m=yt(m,h)}return l}var wi={overdue:0,triggered:1,due_soon:2,ok:3};function ki(n,r,e,t=null){let i=Ls(r,e),a=i[0],l=i[i.length-1],c=[];for(let u of n){let g=u.object?.name||"",m=u.entry_id,v=u.tasks||[];for(let b of v){if(t&&b.responsible_user_id!==t||b.enabled===!1)continue;let $=zs({windowStart:a,windowEnd:l,task:b,entryId:m,objectName:g});c.push(...$)}}let h=new Map;for(let u of i)h.set(u,[]);for(let u of c){let g=h.get(u.date);g&&g.push(u)}for(let[,u]of h)u.sort((g,m)=>{let v=wi[g.status]??99,b=wi[m.status]??99;if(v!==b)return v-b;if(g.projected!==m.projected)return g.projected?1:-1;let $=g.object_name.localeCompare(m.object_name);return $!==0?$:g.task_name.localeCompare(m.task_name)});return i.map(u=>({date:u,events:h.get(u)??[]}))}var Hs={completed:"ok",reset:"ok",skipped:"due_soon",triggered:"triggered",trigger_replaced:"triggered",trigger_removed:"ok"};function Ds(n,r){let e=[];for(let t=r-1;t>=0;t--){let i=new Date(n);i.setDate(i.getDate()-t),i.setHours(0,0,0,0),e.push(Je(i))}return e}function Ei(n,r,e,t=null){let i=Ds(r,e),a=i[0],l=i[i.length-1],c=new Map;for(let u of i)c.set(u,[]);for(let u of n){let g=u.object?.name||"",m=u.entry_id,v=u.tasks||[];for(let b of v){if(t&&b.responsible_user_id!==t)continue;let $=b.history||[];for(let f of $){if(typeof f?.timestamp!="string")continue;let j=f.timestamp.slice(0,10);if(j<a||j>l)continue;let C=c.get(j);if(!C)continue;let L=f.type??"completed";C.push({date:j,entry_id:m,task_id:b.id,task_name:b.name,object_name:g,status:Hs[L]??"ok",days_until_due:null,projected:!1,schedule_type:b.schedule_type,interval_days:b.interval_days??null,responsible_user_id:b.responsible_user_id??null,avg_cost:typeof f.cost=="number"?f.cost:null,adaptive_enabled:!!b.adaptive_config?.enabled,prediction_confidence:null,history_timestamp:f.timestamp,history_type:L,history_cost:typeof f.cost=="number"?f.cost:null,history_notes:typeof f.notes=="string"?f.notes:null,history_duration:typeof f.duration=="number"?f.duration:null})}}}let h={completed:0,reset:1,skipped:2,triggered:3,trigger_replaced:4};for(let[,u]of c)u.sort((g,m)=>{let v=h[g.history_type??""]??99,b=h[m.history_type??""]??99;if(v!==b)return v-b;let $=g.object_name.localeCompare(m.object_name);return $!==0?$:g.task_name.localeCompare(m.task_name)});return i.map(u=>({date:u,events:c.get(u)??[]}))}var Ti=A`
|
||||
`,d([y({attribute:!1})],oe.prototype,"hass",2),d([_()],oe.prototype,"_open",2),d([_()],oe.prototype,"_loading",2),d([_()],oe.prototype,"_adopting",2),d([_()],oe.prototype,"_error",2),d([_()],oe.prototype,"_sensors",2),d([_()],oe.prototype,"_selected",2);customElements.get("maintenance-adopt-problem-sensors-dialog")||customElements.define("maintenance-adopt-problem-sensors-dialog",oe);var Ei=5;function Je(n){let r=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),t=String(n.getDate()).padStart(2,"0");return`${r}-${e}-${t}`}function Os(n,r){let e=[];for(let t=0;t<r;t++){let i=new Date(n);i.setDate(i.getDate()+t),i.setHours(0,0,0,0),e.push(Je(i))}return e}function wt(n,r){let[e,t,i]=n.split("-").map(Number),a=new Date(e,t-1,i);return a.setDate(a.getDate()+r),Je(a)}function qs(n){if(!n||n.length===0)return null;let r=n.map(e=>e.cost).filter(e=>typeof e=="number");return r.length===0?null:r.reduce((e,t)=>e+t,0)/r.length}function Ns(n){let{windowStart:r,windowEnd:e,task:t,entryId:i,objectName:a}=n,l=[],c=(m,v)=>({date:m,entry_id:i,task_id:t.id,task_name:t.name,object_name:a,status:v&&(t.status==="overdue"||t.status==="triggered")?"ok":t.status,days_until_due:v?null:t.days_until_due??null,projected:v,schedule_type:t.schedule_type,interval_days:t.interval_days??null,interval_unit:t.interval_unit??null,responsible_user_id:t.responsible_user_id??null,avg_cost:qs(t.history),adaptive_enabled:!!t.adaptive_config?.enabled,prediction_confidence:t.threshold_prediction_confidence??null}),h=Math.max(1,Math.round(Bt(t.interval_days,t.interval_unit)));if(t.status==="overdue"||t.status==="triggered"){if(l.push(c(r,!1)),t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let m=wt(r,h),v=1;for(;m<=e&&v<Ei;)l.push(c(m,!0)),v++,m=wt(m,h)}return l}let u=t.next_due;if(typeof u!="string"||!u)return l;let g=u.slice(0,10);if(g>=r&&g<=e)l.push(c(g,!1));else if(g>e)return l;if(t.schedule_type==="time_based"&&t.interval_days&&t.interval_days>0){let m=wt(g,h),v=l.length;for(;m<=e&&v<Ei;)m>=r&&(l.push(c(m,!0)),v++),m=wt(m,h)}return l}var Ti={overdue:0,triggered:1,due_soon:2,ok:3};function Si(n,r,e,t=null){let i=Os(r,e),a=i[0],l=i[i.length-1],c=[];for(let u of n){let g=u.object?.name||"",m=u.entry_id,v=u.tasks||[];for(let b of v){if(t&&b.responsible_user_id!==t||b.enabled===!1)continue;let $=Ns({windowStart:a,windowEnd:l,task:b,entryId:m,objectName:g});c.push(...$)}}let h=new Map;for(let u of i)h.set(u,[]);for(let u of c){let g=h.get(u.date);g&&g.push(u)}for(let[,u]of h)u.sort((g,m)=>{let v=Ti[g.status]??99,b=Ti[m.status]??99;if(v!==b)return v-b;if(g.projected!==m.projected)return g.projected?1:-1;let $=g.object_name.localeCompare(m.object_name);return $!==0?$:g.task_name.localeCompare(m.task_name)});return i.map(u=>({date:u,events:h.get(u)??[]}))}var Fs={completed:"ok",reset:"ok",skipped:"due_soon",triggered:"triggered",trigger_replaced:"triggered",trigger_removed:"ok"};function Us(n,r){let e=[];for(let t=r-1;t>=0;t--){let i=new Date(n);i.setDate(i.getDate()-t),i.setHours(0,0,0,0),e.push(Je(i))}return e}function Ai(n,r,e,t=null){let i=Us(r,e),a=i[0],l=i[i.length-1],c=new Map;for(let u of i)c.set(u,[]);for(let u of n){let g=u.object?.name||"",m=u.entry_id,v=u.tasks||[];for(let b of v){if(t&&b.responsible_user_id!==t)continue;let $=b.history||[];for(let f of $){if(typeof f?.timestamp!="string")continue;let j=f.timestamp.slice(0,10);if(j<a||j>l)continue;let C=c.get(j);if(!C)continue;let L=f.type??"completed";C.push({date:j,entry_id:m,task_id:b.id,task_name:b.name,object_name:g,status:Fs[L]??"ok",days_until_due:null,projected:!1,schedule_type:b.schedule_type,interval_days:b.interval_days??null,responsible_user_id:b.responsible_user_id??null,avg_cost:typeof f.cost=="number"?f.cost:null,adaptive_enabled:!!b.adaptive_config?.enabled,prediction_confidence:null,history_timestamp:f.timestamp,history_type:L,history_cost:typeof f.cost=="number"?f.cost:null,history_notes:typeof f.notes=="string"?f.notes:null,history_duration:typeof f.duration=="number"?f.duration:null})}}}let h={completed:0,reset:1,skipped:2,triggered:3,trigger_replaced:4};for(let[,u]of c)u.sort((g,m)=>{let v=h[g.history_type??""]??99,b=h[m.history_type??""]??99;if(v!==b)return v-b;let $=g.object_name.localeCompare(m.object_name);return $!==0?$:g.task_name.localeCompare(m.task_name)});return i.map(u=>({date:u,events:c.get(u)??[]}))}var ji=A`
|
||||
.cal-controls {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
@@ -5216,7 +5230,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
.cal-pill-day { font-size: 17px; }
|
||||
.cal-user-filter { margin-left: 0; width: 100%; }
|
||||
}
|
||||
`;var re=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){this._config={...e},e.past_days&&[30,90].includes(e.past_days)?this._pastDays=e.past_days:e.window_days&&[7,14,30,365].includes(e.window_days)&&(this._windowDays=e.window_days,this._pastDays=0),typeof e.user_filter=="string"&&(this._userFilter=e.user_filter)}getCardSize(){return 6}get _lang(){return this.hass?.language||"en"}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e);let t=this.hass?.language;if(t&&!dt(t)&&Y(t).then(()=>this.requestUpdate()),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}render(){if(!this.hass)return p;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,a=this._config.title,l=null;this._userFilter&&(l=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let c=new Date;c.setHours(0,0,0,0);let h=this._pastDays>0,u=h?Ei(this._objects,c,this._pastDays,l):ki(this._objects,c,this._windowDays,l),g=Je(c),m=this._windowDays===365||h,v=m?u.filter(f=>f.events.length>0):u,b=f=>{let j=`cal-status-${f.status}`,C=f.projected?"cal-event-projected":"",L=f.status==="overdue"&&f.days_until_due!=null?` (${Math.abs(f.days_until_due)}d ${s("overdue",e).toLowerCase()})`:"",R=f.projected&&f.interval_days?o`<span class="cal-event-recur">${f.interval_unit&&f.interval_unit!=="days"?`${f.interval_days} ${s("unit_"+f.interval_unit,e)}`:s("cal_every_n_days",e).replace("{n}",String(f.interval_days))}</span>`:p,T=f.schedule_type==="sensor_based",X=T?o`<ha-icon class="cal-event-icon cal-source-sensor"
|
||||
`;var re=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){this._config={...e},e.past_days&&[30,90].includes(e.past_days)?this._pastDays=e.past_days:e.window_days&&[7,14,30,365].includes(e.window_days)&&(this._windowDays=e.window_days,this._pastDays=0),typeof e.user_filter=="string"&&(this._userFilter=e.user_filter)}getCardSize(){return 6}get _lang(){return this.hass?.language||"en"}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){super.updated(e),e.has("hass")&&ut(this.hass?.locale);let t=this.hass?.language;if(t&&!ht(t)&&Y(t).then(()=>this.requestUpdate()),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t}catch{}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}render(){if(!this.hass)return p;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,a=this._config.title,l=null;this._userFilter&&(l=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let c=new Date;c.setHours(0,0,0,0);let h=this._pastDays>0,u=h?Ai(this._objects,c,this._pastDays,l):Si(this._objects,c,this._windowDays,l),g=Je(c),m=this._windowDays===365||h,v=m?u.filter(f=>f.events.length>0):u,b=f=>{let j=`cal-status-${f.status}`,C=f.projected?"cal-event-projected":"",L=f.status==="overdue"&&f.days_until_due!=null?` (${Math.abs(f.days_until_due)}d ${s("overdue",e).toLowerCase()})`:"",R=f.projected&&f.interval_days?o`<span class="cal-event-recur">${f.interval_unit&&f.interval_unit!=="days"?`${f.interval_days} ${s("unit_"+f.interval_unit,e)}`:s("cal_every_n_days",e).replace("{n}",String(f.interval_days))}</span>`:p,T=f.schedule_type==="sensor_based",X=T?o`<ha-icon class="cal-event-icon cal-source-sensor"
|
||||
title="${s("cal_source_sensor",e)}" icon="mdi:trending-up"></ha-icon>`:o`<ha-icon class="cal-event-icon cal-source-time"
|
||||
title="${f.adaptive_enabled?s("cal_source_time_adaptive",e):s("cal_source_time",e)}"
|
||||
icon="${f.adaptive_enabled?"mdi:clock-time-four-outline":"mdi:clock-outline"}"></ha-icon>`,ee=T&&f.prediction_confidence&&f.status!=="triggered"&&!f.projected?o`<span class="cal-event-prediction cal-conf-${f.prediction_confidence}">
|
||||
@@ -5284,10 +5298,10 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${v.length===0&&m?o`<div class="cal-empty">${s("cal_no_events",e)}</div>`:v.map($)}
|
||||
</div>
|
||||
</ha-card>
|
||||
`}};re.styles=[ut,Ti,A`
|
||||
`}};re.styles=[mt,ji,A`
|
||||
:host { display: block; }
|
||||
ha-card { padding: 0; overflow: hidden; }
|
||||
`],d([y({attribute:!1})],re.prototype,"hass",2),d([_()],re.prototype,"_config",2),d([_()],re.prototype,"_objects",2),d([_()],re.prototype,"_stats",2),d([_()],re.prototype,"_windowDays",2),d([_()],re.prototype,"_pastDays",2),d([_()],re.prototype,"_userFilter",2),d([_()],re.prototype,"_unsub",2);var Os=[{value:7,label:"Week (7 days)"},{value:14,label:"Fortnight (14 days)"},{value:30,label:"Month (30 days, default)"},{value:365,label:"Year (365 days, empty days collapsed)"}],ze=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}setConfig(e){this._config={...e}}_valueChanged(e,t){let i={...this._config,[e]:t};e==="show_window_chips"&&t===!0&&delete i.show_window_chips,e==="show_user_filter"&&t===!0&&delete i.show_user_filter,e==="title"&&(!t||typeof t=="string"&&t.trim()==="")&&delete i.title,e==="user_filter"&&t===""&&delete i.user_filter,this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i},bubbles:!0,composed:!0}))}render(){let e=this._config.window_days??30,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,a=this._config.user_filter??"",l=this._config.title??"";return o`
|
||||
`],d([y({attribute:!1})],re.prototype,"hass",2),d([_()],re.prototype,"_config",2),d([_()],re.prototype,"_objects",2),d([_()],re.prototype,"_stats",2),d([_()],re.prototype,"_windowDays",2),d([_()],re.prototype,"_pastDays",2),d([_()],re.prototype,"_userFilter",2),d([_()],re.prototype,"_unsub",2);var Bs=[{value:7,label:"Week (7 days)"},{value:14,label:"Fortnight (14 days)"},{value:30,label:"Month (30 days, default)"},{value:365,label:"Year (365 days, empty days collapsed)"}],ze=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"}}setConfig(e){this._config={...e}}_valueChanged(e,t){let i={...this._config,[e]:t};e==="show_window_chips"&&t===!0&&delete i.show_window_chips,e==="show_user_filter"&&t===!0&&delete i.show_user_filter,e==="title"&&(!t||typeof t=="string"&&t.trim()==="")&&delete i.title,e==="user_filter"&&t===""&&delete i.user_filter,this._config=i,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:i},bubbles:!0,composed:!0}))}render(){let e=this._config.window_days??30,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,a=this._config.user_filter??"",l=this._config.title??"";return o`
|
||||
<div class="editor">
|
||||
<div class="row">
|
||||
<label for="title">Title (optional)</label>
|
||||
@@ -5304,7 +5318,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
id="window"
|
||||
@change=${c=>this._valueChanged("window_days",Number(c.target.value))}
|
||||
>
|
||||
${Os.map(c=>o`<option value="${c.value}" ?selected=${c.value===e}>${c.label}</option>`)}
|
||||
${Bs.map(c=>o`<option value="${c.value}" ?selected=${c.value===e}>${c.label}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="row toggle">
|
||||
@@ -5366,7 +5380,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color, #666);
|
||||
}
|
||||
`,d([y({attribute:!1})],ze.prototype,"hass",2),d([_()],ze.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",re);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",ze);var xt=window;xt.customCards=xt.customCards||[];var Si="maintenance-supporter-calendar-card",qs=xt.customCards.some(n=>n.type===Si);qs||xt.customCards.push({type:Si,name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});var ge=class extends S{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),Object.keys(e).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(e),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:this._draft.entry_id,task_id:this._draft.task_id,new_timestamp:this._draft.timestamp},bubbles:!0,composed:!0})),this.close()}catch(e){this._error=I(e,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return p;let e=this._lang,t=this._draft;return o`
|
||||
`,d([y({attribute:!1})],ze.prototype,"hass",2),d([_()],ze.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",re);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",ze);var kt=window;kt.customCards=kt.customCards||[];var Ci="maintenance-supporter-calendar-card",Vs=kt.customCards.some(n=>n.type===Ci);Vs||kt.customCards.push({type:Ci,name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});var ge=class extends S{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null}get _lang(){return this.hass?.language||"en"}openEdit(e){this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0}close(){this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null}_set(e,t){this._draft&&(this._draft={...this._draft,[e]:t})}async _save(){if(!(!this._draft||!this._originalSnapshot)){this._saving=!0,this._error="";try{let e={type:"maintenance_supporter/task/history/update",entry_id:this._draft.entry_id,task_id:this._draft.task_id,original_timestamp:this._originalSnapshot.original_timestamp};if(this._draft.timestamp!==this._originalSnapshot.timestamp&&(e.timestamp=this._draft.timestamp),this._draft.notes!==this._originalSnapshot.notes&&(e.notes=this._draft.notes),this._draft.cost!==this._originalSnapshot.cost&&(e.cost=this._draft.cost),this._draft.duration!==this._originalSnapshot.duration&&(e.duration=this._draft.duration),this._draft.completed_by!==this._originalSnapshot.completed_by&&(e.completed_by=this._draft.completed_by),Object.keys(e).filter(i=>!["type","entry_id","task_id","original_timestamp"].includes(i)).length===0){this.close();return}await this.hass.connection.sendMessagePromise(e),this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:this._draft.entry_id,task_id:this._draft.task_id,new_timestamp:this._draft.timestamp},bubbles:!0,composed:!0})),this.close()}catch(e){this._error=I(e,this._lang)}finally{this._saving=!1}}}render(){if(!this._open||!this._draft)return p;let e=this._lang,t=this._draft;return o`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
<h2>${s("history_edit_title",e)||"Edit history entry"}</h2>
|
||||
@@ -5505,7 +5519,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};te.styles=[ht,A`
|
||||
`}};te.styles=[gt,A`
|
||||
.dialog-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
@@ -5534,18 +5548,18 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
ha-button.danger {
|
||||
--mdc-theme-primary: var(--error-color, #f44336);
|
||||
}
|
||||
`],d([y({attribute:!1})],te.prototype,"hass",2),d([_()],te.prototype,"_open",2),d([_()],te.prototype,"_title",2),d([_()],te.prototype,"_message",2),d([_()],te.prototype,"_confirmText",2),d([_()],te.prototype,"_danger",2),d([_()],te.prototype,"_inputLabel",2),d([_()],te.prototype,"_inputType",2),d([_()],te.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",te);var Ai={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ji=n=>(...r)=>({_$litDirective$:n,values:r}),$t=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var Xe=class extends $t{constructor(r){if(super(r),this.it=p,r.type!==Ai.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===p||r==null)return this._t=void 0,this.it=r;if(r===_e)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Xe.directiveName="unsafeHTML",Xe.resultType=1;var Ci=ji(Xe);var Ns=["EUR","USD","GBP","JPY","CHF","CAD","AUD","NZD","CNY","INR","BRL","CZK","PLN","RUB","SEK","NOK","DKK","UAH"],M=class extends S{constructor(){super(...arguments);this.budget=null;this._settings=null;this._loading=!0;this._importCsv="";this._importLoading=!1;this._includeHistory=!0;this._toast="";this._testingNotification=!1;this._users=[];this._savedViews=[];this._vacEnabled=!1;this._vacStart="";this._vacEnd="";this._vacBuffer=3;this._vacExempt=new Set;this._vacIsActive=!1;this._vacWindowEnd=null;this._vacAllTasks=[];this._vacPreview=[];this._vacPreviewLoading=!1;this._vacSaving=!1;this._qrObjects=[];this._qrSelectedEntries=new Set;this._qrActions=new Set(["view"]);this._qrUrlMode="companion";this._qrBatchLoading=!1;this._qrBatchResults=[];this._qrObjectsLoaded=!1;this._exportObjects=[];this._exportSelectedEntries=new Set;this._exportObjectsLoaded=!1;this._docArchiveLoading=!1;this._loaded=!1;this._userService=null;this._sendTestNotification=async()=>{this._testingNotification=!0;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/test_notification"}),t=e.message||(e.success?s("test_notification_success",this._lang):s("test_notification_failed",this._lang));this._showToast(t)}catch{this._showToast(s("test_notification_failed",this._lang))}finally{this._testingNotification=!1}};this._allTemplates=[];this._templateCategories={};this._templatesRequested=!1}get _lang(){return this.hass?.language||"en"}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._loaded?(this._loaded=!0,this._userService=new ye(this.hass),this._loadSettings(),this._loadUsers()):e.has("hass")&&this.hass&&this._userService&&this._userService.updateHass(this.hass)}async _loadUsers(){if(this._userService)try{this._users=await this._userService.getUsers()}catch{this._users=[]}}async _loadSettings(){this._loading=!0;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});this._settings=e,this._hydrateVacationFromSettings()}catch{}try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._savedViews=e.views||[]}catch{}this._loading=!1}_hydrateVacationFromSettings(){let e=this._settings?.vacation;e&&(this._vacEnabled=e.enabled,this._vacStart=e.start||"",this._vacEnd=e.end||"",this._vacBuffer=e.buffer_days,this._vacExempt=new Set(e.exempt_task_ids||[]),this._vacIsActive=e.is_active,this._vacWindowEnd=e.window_end)}async _updateSetting(e,t){try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:{[e]:t}});this._settings=i,this._showToast(s("settings_saved",this._lang)),this.dispatchEvent(new CustomEvent("settings-changed"))}catch{this._showToast(s("action_error",this._lang))}}_showToast(e){this._toast=e,setTimeout(()=>{this._toast=""},3e3)}_downloadFile(e,t,i){mt(e,t,i)}render(){let e=this._lang;return this._loading||!this._settings?o`<div class="settings-loading">Loading…</div>`:o`
|
||||
`],d([y({attribute:!1})],te.prototype,"hass",2),d([_()],te.prototype,"_open",2),d([_()],te.prototype,"_title",2),d([_()],te.prototype,"_message",2),d([_()],te.prototype,"_confirmText",2),d([_()],te.prototype,"_danger",2),d([_()],te.prototype,"_inputLabel",2),d([_()],te.prototype,"_inputType",2),d([_()],te.prototype,"_inputValue",2);customElements.get("maintenance-confirm-dialog")||customElements.define("maintenance-confirm-dialog",te);var Ii={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Mi=n=>(...r)=>({_$litDirective$:n,values:r}),Et=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var Xe=class extends Et{constructor(r){if(super(r),this.it=p,r.type!==Ii.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===p||r==null)return this._t=void 0,this.it=r;if(r===_e)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Xe.directiveName="unsafeHTML",Xe.resultType=1;var Ri=Mi(Xe);var Ws=["EUR","USD","GBP","JPY","CHF","CAD","AUD","NZD","CNY","INR","BRL","CZK","PLN","RUB","SEK","NOK","DKK","UAH"],M=class extends S{constructor(){super(...arguments);this.budget=null;this._settings=null;this._loading=!0;this._importCsv="";this._importLoading=!1;this._includeHistory=!0;this._toast="";this._testingNotification=!1;this._users=[];this._savedViews=[];this._vacEnabled=!1;this._vacStart="";this._vacEnd="";this._vacBuffer=3;this._vacExempt=new Set;this._vacIsActive=!1;this._vacWindowEnd=null;this._vacAllTasks=[];this._vacPreview=[];this._vacPreviewLoading=!1;this._vacSaving=!1;this._qrObjects=[];this._qrSelectedEntries=new Set;this._qrActions=new Set(["view"]);this._qrUrlMode="companion";this._qrBatchLoading=!1;this._qrBatchResults=[];this._qrObjectsLoaded=!1;this._exportObjects=[];this._exportSelectedEntries=new Set;this._exportObjectsLoaded=!1;this._docArchiveLoading=!1;this._loaded=!1;this._userService=null;this._sendTestNotification=async()=>{this._testingNotification=!0;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/test_notification"}),t=e.message||(e.success?s("test_notification_success",this._lang):s("test_notification_failed",this._lang));this._showToast(t)}catch{this._showToast(s("test_notification_failed",this._lang))}finally{this._testingNotification=!1}};this._allTemplates=[];this._templateCategories={};this._templatesRequested=!1}get _lang(){return this.hass?.language||"en"}updated(e){super.updated(e),e.has("hass")&&this.hass&&!this._loaded?(this._loaded=!0,this._userService=new ye(this.hass),this._loadSettings(),this._loadUsers()):e.has("hass")&&this.hass&&this._userService&&this._userService.updateHass(this.hass)}async _loadUsers(){if(this._userService)try{this._users=await this._userService.getUsers()}catch{this._users=[]}}async _loadSettings(){this._loading=!0;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});this._settings=e,this._hydrateVacationFromSettings()}catch{}try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"});this._savedViews=e.views||[]}catch{}this._loading=!1}_hydrateVacationFromSettings(){let e=this._settings?.vacation;e&&(this._vacEnabled=e.enabled,this._vacStart=e.start||"",this._vacEnd=e.end||"",this._vacBuffer=e.buffer_days,this._vacExempt=new Set(e.exempt_task_ids||[]),this._vacIsActive=e.is_active,this._vacWindowEnd=e.window_end)}async _updateSetting(e,t){try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:{[e]:t}});this._settings=i,this._showToast(s("settings_saved",this._lang)),this.dispatchEvent(new CustomEvent("settings-changed"))}catch{this._showToast(s("action_error",this._lang))}}_showToast(e){this._toast=e,setTimeout(()=>{this._toast=""},3e3)}_downloadFile(e,t,i){ft(e,t,i)}render(){let e=this._lang;return this._loading||!this._settings?o`<div class="settings-loading">Loading…</div>`:o`
|
||||
${this._renderFeatures(e)}
|
||||
${this._renderPanelAccess(e)}
|
||||
${this._renderGeneral(e)}
|
||||
${this._renderObjectsColumns(e)}
|
||||
${this._renderTemplateToggles(e)}
|
||||
${this._settings.general.notifications_enabled?this._renderNotifications(e):p}
|
||||
${this.features.budget?this._renderBudget(e):p}
|
||||
${this._renderArchive(e)}
|
||||
${this._renderVacation(e)}
|
||||
${this._renderPrintQr(e)}
|
||||
${this._renderImportExport(e)}
|
||||
${this._renderTemplateToggles(e)}
|
||||
${this._toast?o`<div class="settings-toast">${this._toast}</div>`:p}
|
||||
`}scrollToSection(e){requestAnimationFrame(()=>{let t=this.shadowRoot;if(!t)return;let i=t.querySelector(`[data-section="${e}"]`)??t.querySelector(`[data-section-alt="${e}"]`);i&&i.scrollIntoView({behavior:"smooth",block:"start"})})}_renderPanelAccess(e){let t=new Set(this._settings.admin_panel_user_ids||[]),i=this._users.filter(c=>!c.is_admin),a=this._settings.operator_write_enabled??!1,l=(c,h)=>{let u=new Set(t);h?u.add(c):u.delete(c),this._updateSetting("admin_panel_user_ids",[...u])};return o`
|
||||
<div class="settings-section">
|
||||
@@ -5587,25 +5601,37 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
`}async _loadTemplates(){if(!this._templatesRequested){this._templatesRequested=!0;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/templates",language:this._lang});this._allTemplates=e.templates||[],this._templateCategories=e.categories||{}}catch{}}}_renderTemplateToggles(e){this._loadTemplates();let t=new Set(this._settings.disabled_template_ids||[]);return o`
|
||||
`}async _loadTemplates(){if(!this._templatesRequested){this._templatesRequested=!0;try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/templates",language:this._lang});this._allTemplates=e.templates||[],this._templateCategories=e.categories||{}}catch{}}}_renderTemplateToggles(e){this._loadTemplates();let t=new Set(this._settings.disabled_template_ids||[]),i=new Map;for(let l of Object.keys(this._templateCategories))i.set(l,[]);for(let l of this._allTemplates)i.has(l.category)||i.set(l.category,[]),i.get(l.category).push(l);let a=l=>this._templateCategories[l]?.["name_"+e]||this._templateCategories[l]?.name_en||l;return o`
|
||||
<div class="settings-section" data-section="templates">
|
||||
<h3>${s("settings_templates_label",e)}</h3>
|
||||
<p class="section-desc">${s("settings_templates_hint",e)}</p>
|
||||
${this._allTemplates.map(i=>o`
|
||||
<label class="setting-row">
|
||||
<span>
|
||||
<span class="setting-label">${i.name}</span>
|
||||
<span class="setting-desc">${this._templateCategories[i.category]?.["name_"+e]||this._templateCategories[i.category]?.name_en||i.category}</span>
|
||||
</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${!t.has(i.id)}
|
||||
@change=${a=>this._toggleTemplate(i.id,a.target.checked)}
|
||||
/>
|
||||
</label>
|
||||
`)}
|
||||
${[...i.entries()].filter(([,l])=>l.length>0).map(([l,c])=>{let h=c.filter(u=>!t.has(u.id)).length;return o`
|
||||
<div class="tpl-group">
|
||||
<label class="tpl-group-head">
|
||||
<ha-icon icon=${this._templateCategories[l]?.icon||"mdi:folder-outline"}></ha-icon>
|
||||
<span class="tpl-group-name">${a(l)}</span>
|
||||
<span class="tpl-group-count">${h}/${c.length}</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
title=${s("settings_templates_toggle_group",e)}
|
||||
.checked=${h===c.length}
|
||||
@change=${u=>this._toggleTemplateGroup(c.map(g=>g.id),u.target.checked)}
|
||||
/>
|
||||
</label>
|
||||
${c.map(u=>o`
|
||||
<label class="setting-row tpl-row">
|
||||
<span class="setting-label">${u.name}</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
.checked=${!t.has(u.id)}
|
||||
@change=${g=>this._toggleTemplate(u.id,g.target.checked)}
|
||||
/>
|
||||
</label>
|
||||
`)}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}_toggleTemplate(e,t){let i=new Set(this._settings.disabled_template_ids||[]);t?i.delete(e):i.add(e),this._updateSetting("disabled_template_ids",[...i])}_renderObjectsColumns(e){let t=Ze(this._settings.objects_table_columns);return o`
|
||||
`}_toggleTemplate(e,t){let i=new Set(this._settings.disabled_template_ids||[]);t?i.delete(e):i.add(e),this._updateSetting("disabled_template_ids",[...i])}_toggleTemplateGroup(e,t){let i=new Set(this._settings.disabled_template_ids||[]);for(let a of e)t?i.delete(a):i.add(a);this._updateSetting("disabled_template_ids",[...i])}_renderObjectsColumns(e){let t=Ze(this._settings.objects_table_columns);return o`
|
||||
<div class="settings-section" data-section="objects_table_columns">
|
||||
<h3>${s("objects_table_columns_label",e)}</h3>
|
||||
<p class="section-desc">${s("objects_table_columns_hint",e)}</p>
|
||||
@@ -5632,7 +5658,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<label class="setting-row">
|
||||
<span class="setting-label">${s("settings_currency",e)}</span>
|
||||
<select @change=${l=>this._updateSetting("budget_currency",l.target.value)}>
|
||||
${Ns.map(l=>o`<option value=${l} ?selected=${a.currency===l}>${l}</option>`)}
|
||||
${Ws.map(l=>o`<option value=${l} ?selected=${a.currency===l}>${l}</option>`)}
|
||||
</select>
|
||||
</label>
|
||||
<label class="setting-row">
|
||||
@@ -6024,7 +6050,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<div class="qr-print-grid">
|
||||
${this._qrBatchResults.map(c=>o`
|
||||
<div class="qr-print-cell">
|
||||
<div class="qr-svg">${Ci(c.svg)}</div>
|
||||
<div class="qr-svg">${Ri(c.svg)}</div>
|
||||
<div class="qr-label">
|
||||
<div class="qr-label-obj">${c.object_name}</div>
|
||||
<div class="qr-label-task">${c.task_name}</div>
|
||||
@@ -6174,6 +6200,25 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
cursor: pointer;
|
||||
gap: 12px;
|
||||
}
|
||||
/* v2.27: template gallery clustered by category */
|
||||
.tpl-group { margin-top: 14px; }
|
||||
.tpl-group-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 0 6px;
|
||||
border-bottom: 2px solid var(--divider-color, #e0e0e0);
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tpl-group-head ha-icon { --mdc-icon-size: 18px; color: var(--primary-color); }
|
||||
.tpl-group-name { flex: 1; }
|
||||
.tpl-group-count {
|
||||
font-size: 12px;
|
||||
color: var(--secondary-text-color);
|
||||
font-weight: 400;
|
||||
}
|
||||
.tpl-row { padding-left: 26px; }
|
||||
.setting-row:last-child { border-bottom: none; }
|
||||
.setting-row.sub-row {
|
||||
padding-left: 16px;
|
||||
@@ -6731,13 +6776,13 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
.icon-btn:hover { background: var(--secondary-background-color, rgba(0,0,0,0.06)); }
|
||||
.icon-btn[disabled] { opacity: 0.4; pointer-events: none; }
|
||||
.error { color: var(--error-color, #f44336); font-size: 13px; margin-top: 6px; }
|
||||
`,d([y({attribute:!1})],ie.prototype,"hass",2),d([y({attribute:!1})],ie.prototype,"objects",2),d([_()],ie.prototype,"_summary",2),d([_()],ie.prototype,"_loaded",2),d([_()],ie.prototype,"_busy",2),d([_()],ie.prototype,"_error",2),d([_()],ie.prototype,"_query",2),d([_()],ie.prototype,"_results",2),d([_()],ie.prototype,"_expanded",2);customElements.get("maintenance-storage-section-card")||customElements.define("maintenance-storage-section-card",ie);var Fs=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"],le=class extends S{constructor(){super(...arguments);this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId="";this._values=new Array(12).fill("");this._save=async()=>{let e=this._buildOverrides();if(e!==null){this._loading=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/seasonal_overrides",entry_id:this._entryId,task_id:this._taskId,overrides:e}),this._open=!1,this.dispatchEvent(new CustomEvent("overrides-saved"))}catch(t){this._error=I(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}};this._clearAll=async()=>{this._loading=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/seasonal_overrides",entry_id:this._entryId,task_id:this._taskId,overrides:{}}),this._values=new Array(12).fill(""),this._open=!1,this.dispatchEvent(new CustomEvent("overrides-saved"))}catch(e){this._error=I(e,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}open(e,t,i){if(this._entryId=e,this._taskId=t,this._values=new Array(12).fill(""),i)for(let[a,l]of Object.entries(i)){let c=parseInt(a,10);c>=1&&c<=12&&typeof l=="number"&&(this._values[c-1]=l.toString())}this._error="",this._open=!0}_close(){this._open=!1}_buildOverrides(){let e={};for(let t=0;t<12;t++){let i=this._values[t].trim();if(!i)continue;let a=parseFloat(i);if(Number.isNaN(a))return this._error=`${s("month_"+["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][t],this._lang)}: ${s("seasonal_override_invalid",this._lang)}`,null;if(a<.1||a>5)return this._error=s("seasonal_override_range",this._lang),null;e[t+1]=a}return e}render(){if(!this._open)return o``;let e=this._lang;return o`
|
||||
`,d([y({attribute:!1})],ie.prototype,"hass",2),d([y({attribute:!1})],ie.prototype,"objects",2),d([_()],ie.prototype,"_summary",2),d([_()],ie.prototype,"_loaded",2),d([_()],ie.prototype,"_busy",2),d([_()],ie.prototype,"_error",2),d([_()],ie.prototype,"_query",2),d([_()],ie.prototype,"_results",2),d([_()],ie.prototype,"_expanded",2);customElements.get("maintenance-storage-section-card")||customElements.define("maintenance-storage-section-card",ie);var Ks=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"],le=class extends S{constructor(){super(...arguments);this._open=!1;this._loading=!1;this._error="";this._entryId="";this._taskId="";this._values=new Array(12).fill("");this._save=async()=>{let e=this._buildOverrides();if(e!==null){this._loading=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/seasonal_overrides",entry_id:this._entryId,task_id:this._taskId,overrides:e}),this._open=!1,this.dispatchEvent(new CustomEvent("overrides-saved"))}catch(t){this._error=I(t,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}};this._clearAll=async()=>{this._loading=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/seasonal_overrides",entry_id:this._entryId,task_id:this._taskId,overrides:{}}),this._values=new Array(12).fill(""),this._open=!1,this.dispatchEvent(new CustomEvent("overrides-saved"))}catch(e){this._error=I(e,this._lang,s("save_error",this._lang))}finally{this._loading=!1}}}get _lang(){return this.hass?.language??navigator.language.split("-")[0]??"en"}open(e,t,i){if(this._entryId=e,this._taskId=t,this._values=new Array(12).fill(""),i)for(let[a,l]of Object.entries(i)){let c=parseInt(a,10);c>=1&&c<=12&&typeof l=="number"&&(this._values[c-1]=l.toString())}this._error="",this._open=!0}_close(){this._open=!1}_buildOverrides(){let e={};for(let t=0;t<12;t++){let i=this._values[t].trim();if(!i)continue;let a=parseFloat(i);if(Number.isNaN(a))return this._error=`${s("month_"+["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][t],this._lang)}: ${s("seasonal_override_invalid",this._lang)}`,null;if(a<.1||a>5)return this._error=s("seasonal_override_range",this._lang),null;e[t+1]=a}return e}render(){if(!this._open)return o``;let e=this._lang;return o`
|
||||
<ha-dialog open @closed=${this._close} heading="${s("seasonal_overrides_title",e)}">
|
||||
<div class="content">
|
||||
<p class="hint">${s("seasonal_overrides_hint",e)}</p>
|
||||
${this._error?o`<div class="error">${this._error}</div>`:p}
|
||||
<div class="months">
|
||||
${Fs.map((t,i)=>o`
|
||||
${Ks.map((t,i)=>o`
|
||||
<label class="month">
|
||||
<span class="mn">${s(t,e)}</span>
|
||||
<input type="number" step="0.1" min="0.1" max="5.0"
|
||||
@@ -7045,18 +7090,18 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
gap: 8px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
`,d([y({attribute:!1})],pe.prototype,"hass",2),d([_()],pe.prototype,"_open",2),d([_()],pe.prototype,"_busy",2),d([_()],pe.prototype,"_error",2),d([_()],pe.prototype,"_name",2),d([_()],pe.prototype,"_views",2);customElements.get("maintenance-saved-views-dialog")||customElements.define("maintenance-saved-views-dialog",pe);var Us=60,Bs=20,Ii=30;function Ut(n){let r=n.trigger_config??null;if(!r)return p;let e=r.type||"threshold",t=n.trigger_entity_info?.unit_of_measurement??"",i=0,a="";if(e==="threshold"){let h=n.trigger_current_value??null;if(h==null)return p;let u=r.trigger_above,g=r.trigger_below;if(u!=null){let m=g??0,v=u-m||1;i=Math.min(100,Math.max(0,(h-m)/v*100)),a=`${h.toFixed(1)} / ${u} ${t}`}else if(g!=null){let v=n.trigger_entity_info?.max??(g*2||100),b=v-g||1;i=Math.min(100,Math.max(0,(v-h)/b*100)),a=`${h.toFixed(1)} / ${g} ${t}`}else return p}else if(e==="counter"){let h=r.trigger_target_value||1,g=n.trigger_current_delta??null??n.trigger_current_value??null;if(g==null)return p;i=Math.min(100,Math.max(0,g/h*100)),a=`${g.toFixed(1)} / ${h} ${t}`}else if(e==="state_change"){let h=r.trigger_target_changes||1,u=n.trigger_current_value??null;if(u==null)return p;i=Math.min(100,Math.max(0,u/h*100)),a=`${Math.round(u)} / ${h}`}else if(e==="runtime"){let h=r.trigger_runtime_hours||100,u=n.trigger_current_value??null;if(u==null)return p;i=Math.min(100,Math.max(0,u/h*100)),a=`${u.toFixed(1)}h / ${h}h`}else if(e==="compound"){let h=r.compound_logic||r.operator||"AND",u=r.conditions?.length||0;a=`${h} (${u})`,i=n.trigger_active?100:0}else return p;let l=i>=100,c=i>90?"var(--error-color, #f44336)":i>70?"var(--warning-color, #ff9800)":"var(--primary-color)";return o`
|
||||
`,d([y({attribute:!1})],pe.prototype,"hass",2),d([_()],pe.prototype,"_open",2),d([_()],pe.prototype,"_busy",2),d([_()],pe.prototype,"_error",2),d([_()],pe.prototype,"_name",2),d([_()],pe.prototype,"_views",2);customElements.get("maintenance-saved-views-dialog")||customElements.define("maintenance-saved-views-dialog",pe);var Ys=60,Gs=20,Li=30;function Wt(n){let r=n.trigger_config??null;if(!r)return p;let e=r.type||"threshold",t=n.trigger_entity_info?.unit_of_measurement??"",i=0,a="";if(e==="threshold"){let h=n.trigger_current_value??null;if(h==null)return p;let u=r.trigger_above,g=r.trigger_below;if(u!=null){let m=g??0,v=u-m||1;i=Math.min(100,Math.max(0,(h-m)/v*100)),a=`${h.toFixed(1)} / ${u} ${t}`}else if(g!=null){let v=n.trigger_entity_info?.max??(g*2||100),b=v-g||1;i=Math.min(100,Math.max(0,(v-h)/b*100)),a=`${h.toFixed(1)} / ${g} ${t}`}else return p}else if(e==="counter"){let h=r.trigger_target_value||1,g=n.trigger_current_delta??null??n.trigger_current_value??null;if(g==null)return p;i=Math.min(100,Math.max(0,g/h*100)),a=`${g.toFixed(1)} / ${h} ${t}`}else if(e==="state_change"){let h=r.trigger_target_changes||1,u=n.trigger_current_value??null;if(u==null)return p;i=Math.min(100,Math.max(0,u/h*100)),a=`${Math.round(u)} / ${h}`}else if(e==="runtime"){let h=r.trigger_runtime_hours||100,u=n.trigger_current_value??null;if(u==null)return p;i=Math.min(100,Math.max(0,u/h*100)),a=`${u.toFixed(1)}h / ${h}h`}else if(e==="compound"){let h=r.compound_logic||r.operator||"AND",u=r.conditions?.length||0;a=`${h} (${u})`,i=n.trigger_active?100:0}else return p;let l=i>=100,c=i>90?"var(--error-color, #f44336)":i>70?"var(--warning-color, #ff9800)":"var(--primary-color)";return o`
|
||||
<div class="trigger-progress">
|
||||
<div class="trigger-progress-bar">
|
||||
<div class="trigger-progress-fill${l?" overflow":""}" style="width:${i}%;background:${c}"></div>
|
||||
</div>
|
||||
<span class="trigger-progress-label">${a}</span>
|
||||
</div>
|
||||
`}function Bt(n,r,e){if(!n.trigger_config?.entity_id)return p;let t=n.trigger_config.entity_id,i=r.get(t)||[],a=[];if(i.length>=2)a=i.map(T=>({ts:T.ts,val:T.val}));else{if(!n.history)return p;for(let T of n.history)T.trigger_value!=null&&a.push({ts:new Date(T.timestamp).getTime(),val:T.trigger_value})}if(n.trigger_current_value!=null&&a.push({ts:Date.now(),val:n.trigger_current_value}),a.length<2)return p;a.sort((T,X)=>T.ts-X.ts);let l=Us,c=Bs,h=a.map(T=>T.val),u=Math.min(...h),g=Math.max(...h),m=g-u||1;u-=m*.1,g+=m*.1;let v=a[0].ts,$=a[a.length-1].ts-v||1,f=T=>(T-v)/$*l,j=T=>2+(1-(T-u)/(g-u))*(c-4),C=a;if(C.length>Ii){let T=Math.ceil(C.length/Ii);C=C.filter((X,ee)=>ee%T===0||ee===C.length-1)}let L=C.map(T=>`${f(T.ts).toFixed(1)},${j(T.val).toFixed(1)}`).join(" "),R=n.trigger_active?"var(--error-color, #f44336)":"var(--primary-color)";return o`
|
||||
`}function Kt(n,r,e){if(!n.trigger_config?.entity_id)return p;let t=n.trigger_config.entity_id,i=r.get(t)||[],a=[];if(i.length>=2)a=i.map(T=>({ts:T.ts,val:T.val}));else{if(!n.history)return p;for(let T of n.history)T.trigger_value!=null&&a.push({ts:new Date(T.timestamp).getTime(),val:T.trigger_value})}if(n.trigger_current_value!=null&&a.push({ts:Date.now(),val:n.trigger_current_value}),a.length<2)return p;a.sort((T,X)=>T.ts-X.ts);let l=Ys,c=Gs,h=a.map(T=>T.val),u=Math.min(...h),g=Math.max(...h),m=g-u||1;u-=m*.1,g+=m*.1;let v=a[0].ts,$=a[a.length-1].ts-v||1,f=T=>(T-v)/$*l,j=T=>2+(1-(T-u)/(g-u))*(c-4),C=a;if(C.length>Li){let T=Math.ceil(C.length/Li);C=C.filter((X,ee)=>ee%T===0||ee===C.length-1)}let L=C.map(T=>`${f(T.ts).toFixed(1)},${j(T.val).toFixed(1)}`).join(" "),R=n.trigger_active?"var(--error-color, #f44336)":"var(--primary-color)";return o`
|
||||
<svg class="mini-sparkline" viewBox="0 0 ${l} ${c}" preserveAspectRatio="none" role="img" aria-label="${s("chart_mini_sparkline",e)}">
|
||||
<polyline points="${L}" fill="none" stroke="${R}" stroke-width="1.5" stroke-linejoin="round" />
|
||||
</svg>
|
||||
`}function Mi(n,r){let e=r;if(n.days_until_due==null||!n.interval_days||n.interval_days<=0)return p;let{pct:t,overflow:i}=_t(n.interval_days,n.days_until_due,n.interval_unit),a="var(--success-color, #4caf50)";return n.status==="overdue"?a="var(--error-color, #f44336)":n.status==="due_soon"&&(a="var(--warning-color, #ff9800)"),o`
|
||||
`}function Pi(n,r){let e=r;if(n.days_until_due==null||!n.interval_days||n.interval_days<=0)return p;let{pct:t,overflow:i}=vt(n.interval_days,n.days_until_due,n.interval_unit),a="var(--success-color, #4caf50)";return n.status==="overdue"?a="var(--error-color, #f44336)":n.status==="due_soon"&&(a="var(--warning-color, #ff9800)"),o`
|
||||
<div class="days-progress">
|
||||
<div class="days-progress-labels">
|
||||
<span>${n.last_performed?`${s("last_performed",e)}: ${W(n.last_performed,e)}`:""}</span>
|
||||
@@ -7067,7 +7112,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
<div class="days-progress-text">${Re(n.days_until_due,e)}</div>
|
||||
</div>
|
||||
`}function et(n,r,e=4){if(!isFinite(n)||!isFinite(r))return{ticks:[],niceMin:0,niceMax:1};if(n===r){let u=Math.abs(n)*.1||1;n-=u,r+=u}let t=r-n,i=Math.pow(10,Math.floor(Math.log10(t/Math.max(1,e)))),a=i;for(let u of[1,2,5,10])if(a=i*u,t/a<=e+.5)break;let l=Math.floor(n/a)*a,c=Math.ceil(r/a)*a,h=[];for(let u=l;u<=c+a*1e-6;u+=a)h.push(Math.abs(u)<a*1e-9?0:u);return{ticks:h,niceMin:l,niceMax:c}}function he(n){let r=Math.abs(n);return r>=1e6?He((n/1e6).toFixed(r>=1e7?0:1))+"M":r>=1e4?He((n/1e3).toFixed(0))+"k":r>=1e3?He((n/1e3).toFixed(1))+"k":r>=100?n.toFixed(0):r>=10||r>=1?He(n.toFixed(1)):r===0?"0":He(n.toFixed(2))}function He(n){return n.replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")}function je(n,r,e){let t=n.toLocaleString(e,{maximumFractionDigits:Math.abs(n)>=100?0:1});return r?`${t} ${r}`:t}function De(n,r,e){let t=new Date(n),i=e?{month:"short",day:"numeric",year:"2-digit"}:{month:"short",day:"numeric"};return t.toLocaleDateString(r,i)}function Vt(n,r){return new Date(n).toLocaleDateString(r,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function wt(n,r){return new Date(n).getFullYear()!==new Date(r).getFullYear()}function kt(n,r,e){if(e<2||r<=n)return[n,r];let t=[];for(let i=0;i<e;i++)t.push(n+(r-n)*i/(e-1));return t}var Et=210,ce=46,me=14,ve=12,Ri=14,Vs=20+Ri,Ws=[{days:7,key:"chart_range_7d"},{days:30,key:"chart_range_30d"},{days:90,key:"chart_range_90d"},{days:365,key:"chart_range_1y"}],V=class extends S{constructor(){super(...arguments);this.points=[];this.events=[];this.unit="";this.lang="en";this.thresholdAbove=null;this.thresholdBelow=null;this.targetValue=null;this.forceZero=!1;this.projection=null;this.rangeDays=30;this.showRange=!0;this.busy=!1;this.hideOutliers=!1;this.showOutlierToggle=!0;this._width=0;this._hover=null;this._ro=null}connectedCallback(){super.connectedCallback(),this._ro=new ResizeObserver(e=>{let t=Math.floor(e[0]?.contentRect?.width||0);t&&Math.abs(t-this._width)>2&&(this._width=t)}),this._ro.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._ro?.disconnect(),this._ro=null}_emitRange(e){e!==this.rangeDays&&this.dispatchEvent(new CustomEvent("range-change",{detail:{days:e},bubbles:!0,composed:!0}))}_toggleOutliers(){this.dispatchEvent(new CustomEvent("outlier-toggle",{detail:{hide:!this.hideOutliers},bubbles:!0,composed:!0}))}render(){let e=this._width||320,t=[...this.points].sort((a,l)=>a.ts-l.ts),i=this.lang;return o`
|
||||
`}function et(n,r,e=4){if(!isFinite(n)||!isFinite(r))return{ticks:[],niceMin:0,niceMax:1};if(n===r){let u=Math.abs(n)*.1||1;n-=u,r+=u}let t=r-n,i=Math.pow(10,Math.floor(Math.log10(t/Math.max(1,e)))),a=i;for(let u of[1,2,5,10])if(a=i*u,t/a<=e+.5)break;let l=Math.floor(n/a)*a,c=Math.ceil(r/a)*a,h=[];for(let u=l;u<=c+a*1e-6;u+=a)h.push(Math.abs(u)<a*1e-9?0:u);return{ticks:h,niceMin:l,niceMax:c}}function he(n){let r=Math.abs(n);return r>=1e6?He((n/1e6).toFixed(r>=1e7?0:1))+"M":r>=1e4?He((n/1e3).toFixed(0))+"k":r>=1e3?He((n/1e3).toFixed(1))+"k":r>=100?n.toFixed(0):r>=10||r>=1?He(n.toFixed(1)):r===0?"0":He(n.toFixed(2))}function He(n){return n.replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")}function je(n,r,e){let t=n.toLocaleString(e,{maximumFractionDigits:Math.abs(n)>=100?0:1});return r?`${t} ${r}`:t}function De(n,r,e){let t=new Date(n),i=e?{month:"short",day:"numeric",year:"2-digit"}:{month:"short",day:"numeric"};return t.toLocaleDateString(r,i)}function Yt(n,r){return new Date(n).toLocaleDateString(r,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Tt(n,r){return new Date(n).getFullYear()!==new Date(r).getFullYear()}function St(n,r,e){if(e<2||r<=n)return[n,r];let t=[];for(let i=0;i<e;i++)t.push(n+(r-n)*i/(e-1));return t}var At=210,ce=46,me=14,ve=12,zi=14,Qs=20+zi,Zs=[{days:7,key:"chart_range_7d"},{days:30,key:"chart_range_30d"},{days:90,key:"chart_range_90d"},{days:365,key:"chart_range_1y"}],V=class extends S{constructor(){super(...arguments);this.points=[];this.events=[];this.unit="";this.lang="en";this.thresholdAbove=null;this.thresholdBelow=null;this.targetValue=null;this.forceZero=!1;this.projection=null;this.rangeDays=30;this.showRange=!0;this.busy=!1;this.hideOutliers=!1;this.showOutlierToggle=!0;this._width=0;this._hover=null;this._ro=null}connectedCallback(){super.connectedCallback(),this._ro=new ResizeObserver(e=>{let t=Math.floor(e[0]?.contentRect?.width||0);t&&Math.abs(t-this._width)>2&&(this._width=t)}),this._ro.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._ro?.disconnect(),this._ro=null}_emitRange(e){e!==this.rangeDays&&this.dispatchEvent(new CustomEvent("range-change",{detail:{days:e},bubbles:!0,composed:!0}))}_toggleOutliers(){this.dispatchEvent(new CustomEvent("outlier-toggle",{detail:{hide:!this.hideOutliers},bubbles:!0,composed:!0}))}render(){let e=this._width||320,t=[...this.points].sort((a,l)=>a.ts-l.ts),i=this.lang;return o`
|
||||
<div class="chart-wrap">
|
||||
${this.showRange?o`<div class="range-chips" role="group">
|
||||
${this.showOutlierToggle?o`<button
|
||||
@@ -7076,7 +7121,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
title=${s("hide_outliers",i)}
|
||||
@click=${()=>this._toggleOutliers()}
|
||||
><ha-icon icon="mdi:filter-variant"></ha-icon></button>`:p}
|
||||
${Ws.map(a=>o`<button
|
||||
${Zs.map(a=>o`<button
|
||||
class="range-chip ${this.rangeDays===a.days?"active":""}"
|
||||
?disabled=${this.busy}
|
||||
@click=${()=>this._emitRange(a.days)}
|
||||
@@ -7086,13 +7131,13 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<ha-icon icon="mdi:chart-line"></ha-icon> ${s("loading_chart",i)}
|
||||
</div>`:this._renderSvg(e,t)}
|
||||
</div>
|
||||
`}_renderSvg(e,t){let i=this.lang,a=e-ce-me,l=Et-Vs,c=l-ve,h=1/0,u=-1/0;for(let k of t)h=Math.min(h,k.min??k.val),u=Math.max(u,k.max??k.val);this.thresholdAbove!=null&&(h=Math.min(h,this.thresholdAbove),u=Math.max(u,this.thresholdAbove)),this.thresholdBelow!=null&&(h=Math.min(h,this.thresholdBelow),u=Math.max(u,this.thresholdBelow)),this.targetValue!=null&&(h=Math.min(h,this.targetValue),u=Math.max(u,this.targetValue)),this.forceZero&&(h=Math.min(h,0));let g=(u-h||1)*.06,m=this.forceZero&&h>=0?0:h-g,{ticks:v,niceMin:b,niceMax:$}=et(m,u+g,4);this.forceZero&&h>=0&&b<0&&(b=0,v=v.filter(k=>k>=0));let f=t[0].ts,j=t[t.length-1].ts,C=j-f||1,L=wt(f,j),R=k=>ce+(k-f)/C*a,T=k=>ve+(1-(k-b)/($-b||1))*c,X=t.map(k=>`${R(k.ts).toFixed(1)},${T(k.val).toFixed(1)}`).join(" "),ee=`M${R(t[0].ts).toFixed(1)},${l} `+t.map(k=>`L${R(k.ts).toFixed(1)},${T(k.val).toFixed(1)}`).join(" ")+` L${R(t[t.length-1].ts).toFixed(1)},${l} Z`,Z="",U=t.filter(k=>k.min!=null&&k.max!=null);if(U.length>=2){let k=U.map(P=>`${R(P.ts).toFixed(1)},${T(P.max).toFixed(1)}`),w=[...U].reverse().map(P=>`${R(P.ts).toFixed(1)},${T(P.min).toFixed(1)}`);Z=`M${k[0]} `+k.slice(1).map(P=>`L${P}`).join(" ")+` L${w.join(" L")} Z`}let N=[];if(this.thresholdBelow!=null){let k=T(this.thresholdBelow);N.push({y:k,h:Math.max(0,l-k),lineY:k,label:`\u25BC ${he(this.thresholdBelow)}`,labelY:Math.min(l-4,k+13)})}if(this.thresholdAbove!=null){let k=T(this.thresholdAbove);N.push({y:ve,h:Math.max(0,k-ve),lineY:k,label:`\u25B2 ${he(this.thresholdAbove)}`,labelY:Math.max(ve+11,k-5)})}let be=t[t.length-1],$e=(this.events||[]).filter(k=>k.ts>=f&&k.ts<=j),Ce=kt(f,j,Math.max(2,Math.min(5,Math.floor(a/110)+1))),K=this._hover;return o`
|
||||
`}_renderSvg(e,t){let i=this.lang,a=e-ce-me,l=At-Qs,c=l-ve,h=1/0,u=-1/0;for(let k of t)h=Math.min(h,k.min??k.val),u=Math.max(u,k.max??k.val);this.thresholdAbove!=null&&(h=Math.min(h,this.thresholdAbove),u=Math.max(u,this.thresholdAbove)),this.thresholdBelow!=null&&(h=Math.min(h,this.thresholdBelow),u=Math.max(u,this.thresholdBelow)),this.targetValue!=null&&(h=Math.min(h,this.targetValue),u=Math.max(u,this.targetValue)),this.forceZero&&(h=Math.min(h,0));let g=(u-h||1)*.06,m=this.forceZero&&h>=0?0:h-g,{ticks:v,niceMin:b,niceMax:$}=et(m,u+g,4);this.forceZero&&h>=0&&b<0&&(b=0,v=v.filter(k=>k>=0));let f=t[0].ts,j=t[t.length-1].ts,C=j-f||1,L=Tt(f,j),R=k=>ce+(k-f)/C*a,T=k=>ve+(1-(k-b)/($-b||1))*c,X=t.map(k=>`${R(k.ts).toFixed(1)},${T(k.val).toFixed(1)}`).join(" "),ee=`M${R(t[0].ts).toFixed(1)},${l} `+t.map(k=>`L${R(k.ts).toFixed(1)},${T(k.val).toFixed(1)}`).join(" ")+` L${R(t[t.length-1].ts).toFixed(1)},${l} Z`,Z="",U=t.filter(k=>k.min!=null&&k.max!=null);if(U.length>=2){let k=U.map(P=>`${R(P.ts).toFixed(1)},${T(P.max).toFixed(1)}`),w=[...U].reverse().map(P=>`${R(P.ts).toFixed(1)},${T(P.min).toFixed(1)}`);Z=`M${k[0]} `+k.slice(1).map(P=>`L${P}`).join(" ")+` L${w.join(" L")} Z`}let N=[];if(this.thresholdBelow!=null){let k=T(this.thresholdBelow);N.push({y:k,h:Math.max(0,l-k),lineY:k,label:`\u25BC ${he(this.thresholdBelow)}`,labelY:Math.min(l-4,k+13)})}if(this.thresholdAbove!=null){let k=T(this.thresholdAbove);N.push({y:ve,h:Math.max(0,k-ve),lineY:k,label:`\u25B2 ${he(this.thresholdAbove)}`,labelY:Math.max(ve+11,k-5)})}let be=t[t.length-1],$e=(this.events||[]).filter(k=>k.ts>=f&&k.ts<=j),Ce=St(f,j,Math.max(2,Math.min(5,Math.floor(a/110)+1))),K=this._hover;return o`
|
||||
<div class="svg-holder">
|
||||
<svg
|
||||
class="chart-svg"
|
||||
viewBox="0 0 ${e} ${Et}"
|
||||
viewBox="0 0 ${e} ${At}"
|
||||
width=${e}
|
||||
height=${Et}
|
||||
height=${At}
|
||||
role="img"
|
||||
aria-label=${s("chart_sparkline",i)}
|
||||
@pointermove=${k=>this._onPointer(k,t,R,T,e)}
|
||||
@@ -7138,14 +7183,14 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
x2="${Math.min(R(this.projection[1].ts),e-me).toFixed(1)}" y2="${T(Math.max(b,Math.min($,this.projection[1].val))).toFixed(1)}"
|
||||
stroke="var(--warning-color, #ff9800)" stroke-width="1.5" stroke-dasharray="4,3" opacity="0.8" />`:p}
|
||||
|
||||
${Ce.map((k,w)=>{let P=R(k),Tt=w===0?"start":w===Ce.length-1?"end":"middle";return D`<text x="${P.toFixed(1)}" y="${Et-5}" text-anchor="${Tt}" class="tick-label">${De(k,i,L)}</text>`})}
|
||||
${Ce.map((k,w)=>{let P=R(k),jt=w===0?"start":w===Ce.length-1?"end":"middle";return D`<text x="${P.toFixed(1)}" y="${At-5}" text-anchor="${jt}" class="tick-label">${De(k,i,L)}</text>`})}
|
||||
|
||||
<line x1="${ce}" y1="${l}" x2="${e-me}" y2="${l}" stroke="var(--divider-color)" stroke-width="1" />
|
||||
|
||||
${$e.map(k=>{let w=R(k.ts),P=k.type==="completed"?"var(--success-color, #4caf50)":k.type==="skipped"?"var(--warning-color, #ff9800)":"var(--info-color, #2196f3)";return D`
|
||||
<line x1="${w.toFixed(1)}" y1="${ve}" x2="${w.toFixed(1)}" y2="${l}" stroke="${P}" stroke-width="1" opacity="0.14" />
|
||||
<rect x="${(w-1.5).toFixed(1)}" y="${l+3}" width="3" height="${Ri-6}" rx="1.5" fill="${P}">
|
||||
<title>${Vt(k.ts,i)}</title>
|
||||
<rect x="${(w-1.5).toFixed(1)}" y="${l+3}" width="3" height="${zi-6}" rx="1.5" fill="${P}">
|
||||
<title>${Yt(k.ts,i)}</title>
|
||||
</rect>`})}
|
||||
|
||||
${K?D`
|
||||
@@ -7159,7 +7204,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
class="hover-chip"
|
||||
style="left:${Math.min(Math.max(K.x,70),e-70)}px"
|
||||
>
|
||||
<div class="hover-date">${Vt(K.p.ts,i)}</div>
|
||||
<div class="hover-date">${Yt(K.p.ts,i)}</div>
|
||||
<div class="hover-val">
|
||||
${je(K.p.val,this.unit,i)}
|
||||
${K.p.min!=null&&K.p.max!=null?o`<span class="hover-range">(${he(K.p.min)}–${he(K.p.max)})</span>`:p}
|
||||
@@ -7201,7 +7246,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
.hover-date { font-size: 10.5px; color: var(--secondary-text-color); }
|
||||
.hover-val { font-size: 12.5px; font-weight: 600; color: var(--primary-text-color); }
|
||||
.hover-range { font-weight: 400; color: var(--secondary-text-color); font-size: 11px; }
|
||||
`,d([y({attribute:!1})],V.prototype,"points",2),d([y({attribute:!1})],V.prototype,"events",2),d([y()],V.prototype,"unit",2),d([y()],V.prototype,"lang",2),d([y({attribute:!1})],V.prototype,"thresholdAbove",2),d([y({attribute:!1})],V.prototype,"thresholdBelow",2),d([y({attribute:!1})],V.prototype,"targetValue",2),d([y({type:Boolean})],V.prototype,"forceZero",2),d([y({attribute:!1})],V.prototype,"projection",2),d([y({attribute:!1})],V.prototype,"rangeDays",2),d([y({type:Boolean})],V.prototype,"showRange",2),d([y({type:Boolean})],V.prototype,"busy",2),d([y({type:Boolean})],V.prototype,"hideOutliers",2),d([y({type:Boolean})],V.prototype,"showOutlierToggle",2),d([_()],V.prototype,"_width",2),d([_()],V.prototype,"_hover",2);customElements.get("maintenance-trigger-chart")||customElements.define("maintenance-trigger-chart",V);function Ks(n){if(n.length<4)return n;let r=n.map(u=>u.val).sort((u,g)=>u-g),e=u=>{let g=(r.length-1)*u,m=Math.floor(g),v=Math.ceil(g);return r[m]+(r[v]-r[m])*(g-m)},t=e(.25),i=e(.75),a=i-t;if(a===0)return n;let l=t-1.5*a,c=i+1.5*a,h=n.filter(u=>u.val>=l&&u.val<=c);return h.length>=2?h:n}function Li(n,r){let e=n.trigger_config;if(!e)return p;let t=r.lang,i=n.trigger_entity_info,a=n.trigger_entity_infos,l=i?.friendly_name||e.entity_id||"\u2014",c=e.entity_id||"",h=e.entity_ids||(c?[c]:[]),u=i?.unit_of_measurement||"",g=n.trigger_current_value,m=e.type||"threshold",v=h.length>1,b=Ys(n,u,r);return o`
|
||||
`,d([y({attribute:!1})],V.prototype,"points",2),d([y({attribute:!1})],V.prototype,"events",2),d([y()],V.prototype,"unit",2),d([y()],V.prototype,"lang",2),d([y({attribute:!1})],V.prototype,"thresholdAbove",2),d([y({attribute:!1})],V.prototype,"thresholdBelow",2),d([y({attribute:!1})],V.prototype,"targetValue",2),d([y({type:Boolean})],V.prototype,"forceZero",2),d([y({attribute:!1})],V.prototype,"projection",2),d([y({attribute:!1})],V.prototype,"rangeDays",2),d([y({type:Boolean})],V.prototype,"showRange",2),d([y({type:Boolean})],V.prototype,"busy",2),d([y({type:Boolean})],V.prototype,"hideOutliers",2),d([y({type:Boolean})],V.prototype,"showOutlierToggle",2),d([_()],V.prototype,"_width",2),d([_()],V.prototype,"_hover",2);customElements.get("maintenance-trigger-chart")||customElements.define("maintenance-trigger-chart",V);function Js(n){if(n.length<4)return n;let r=n.map(u=>u.val).sort((u,g)=>u-g),e=u=>{let g=(r.length-1)*u,m=Math.floor(g),v=Math.ceil(g);return r[m]+(r[v]-r[m])*(g-m)},t=e(.25),i=e(.75),a=i-t;if(a===0)return n;let l=t-1.5*a,c=i+1.5*a,h=n.filter(u=>u.val>=l&&u.val<=c);return h.length>=2?h:n}function Hi(n,r){let e=n.trigger_config;if(!e)return p;let t=r.lang,i=n.trigger_entity_info,a=n.trigger_entity_infos,l=i?.friendly_name||e.entity_id||"\u2014",c=e.entity_id||"",h=e.entity_ids||(c?[c]:[]),u=i?.unit_of_measurement||"",g=n.trigger_current_value,m=e.type||"threshold",v=h.length>1,b=Xs(n,u,r);return o`
|
||||
<h3>${s("trigger",t)}</h3>
|
||||
<div class="trigger-card">
|
||||
<div class="trigger-header">
|
||||
@@ -7220,7 +7265,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
${b?Gs(b,t):g!=null?o`
|
||||
${b?ea(b,t):g!=null?o`
|
||||
<div class="trigger-value-row">
|
||||
<span class="trigger-current ${n.trigger_active?"active":""}">${typeof g=="number"?je(g,"",t):g}</span>
|
||||
${u?o`<span class="trigger-unit">${u}</span>`:p}
|
||||
@@ -7255,9 +7300,9 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
`:p}
|
||||
|
||||
${Qs(n,u,r)}
|
||||
${ta(n,u,r)}
|
||||
</div>
|
||||
`}function Ys(n,r,e){let t=n.trigger_config,i=n.trigger_current_value;if(!t||i==null)return null;switch(t.type||"threshold"){case"counter":{let a=t.trigger_target_value;if(a==null||a<=0)return null;let l=Pi(n,zi(n,e));return{progress:Math.max(0,i-(l?.value??i)),target:a,unit:r,meter:i}}case"state_change":{let a=t.trigger_target_changes;return a==null||a<=0?null:{progress:Math.max(0,i),target:a,unit:"",meter:null}}case"runtime":{let a=t.trigger_runtime_hours;return a==null||a<=0?null:{progress:Math.max(0,i),target:a,unit:"h",meter:null}}}return null}function Pi(n,r){if(n.trigger_baseline_value!=null)return{value:n.trigger_baseline_value,ts:Wt(n)};if(!r.length)return null;let e=Wt(n);if(e==null)return{value:r[0].val,ts:null};let t=r[0],i=Math.abs(r[0].ts-e);for(let a of r){let l=Math.abs(a.ts-e);l<i&&(t=a,i=l)}return{value:t.val,ts:e}}function Wt(n){let r=[...n.history].filter(e=>e.type==="completed"||e.type==="reset").sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime())[0];return r?new Date(r.timestamp).getTime():null}function Gs(n,r){let e=Math.min(999,Math.round(n.progress/n.target*100)),t=e>=100?"over":e>=75?"near":"ok";return o`
|
||||
`}function Xs(n,r,e){let t=n.trigger_config,i=n.trigger_current_value;if(!t||i==null)return null;switch(t.type||"threshold"){case"counter":{let a=t.trigger_target_value;if(a==null||a<=0)return null;let l=Di(n,Oi(n,e));return{progress:Math.max(0,i-(l?.value??i)),target:a,unit:r,meter:i}}case"state_change":{let a=t.trigger_target_changes;return a==null||a<=0?null:{progress:Math.max(0,i),target:a,unit:"",meter:null}}case"runtime":{let a=t.trigger_runtime_hours;return a==null||a<=0?null:{progress:Math.max(0,i),target:a,unit:"h",meter:null}}}return null}function Di(n,r){if(n.trigger_baseline_value!=null)return{value:n.trigger_baseline_value,ts:Gt(n)};if(!r.length)return null;let e=Gt(n);if(e==null)return{value:r[0].val,ts:null};let t=r[0],i=Math.abs(r[0].ts-e);for(let a of r){let l=Math.abs(a.ts-e);l<i&&(t=a,i=l)}return{value:t.val,ts:e}}function Gt(n){let r=[...n.history].filter(e=>e.type==="completed"||e.type==="reset").sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime())[0];return r?new Date(r.timestamp).getTime():null}function ea(n,r){let e=Math.min(999,Math.round(n.progress/n.target*100)),t=e>=100?"over":e>=75?"near":"ok";return o`
|
||||
<div class="counter-progress">
|
||||
<div class="counter-progress-nums">
|
||||
<span class="counter-progress-main">${je(n.progress,"",r)}<span class="counter-progress-target"> / ${je(n.target,n.unit,r)}</span></span>
|
||||
@@ -7270,7 +7315,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${s("chart_since_service",r)}${n.meter!=null?o` · ${s("current",r)}: ${je(n.meter,n.unit,r)}`:p}
|
||||
</div>
|
||||
</div>
|
||||
`}function zi(n,r){let e=n.trigger_config;if(!e)return[];let t=e.type||"threshold",i=e.entity_id||"",a=t==="runtime"?[]:r.detailStatsData.get(i)||[],l=r.isCounterEntity(e),c=[];if(a.length>=2)for(let h of a){let u={ts:h.ts,val:h.val};!l&&h.min!=null&&h.max!=null&&(u.min=h.min,u.max=h.max),c.push(u)}else for(let h of n.history)h.trigger_value!=null&&c.push({ts:new Date(h.timestamp).getTime(),val:h.trigger_value});return n.trigger_current_value!=null&&c.push({ts:Date.now(),val:n.trigger_current_value}),c.sort((h,u)=>h.ts-u.ts),c}function Qs(n,r,e){let t=n.trigger_config;if(!t)return p;let i=t.type||"threshold",a=t.entity_id||"",l=zi(n,e);i==="runtime"&&t.trigger_runtime_hours&&n.trigger_current_value!=null&&(l=[{ts:Wt(n)??l[0]?.ts??Date.now()-864e5,val:0},{ts:Date.now(),val:Math.max(0,n.trigger_current_value)}]),e.hideOutliers&&(l=Ks(l));let c=l.length<2&&!!a&&e.hasStatsService&&!e.detailStatsData.has(a);if(l.length<2&&!c)return p;let h=!!a&&e.detailStatsData.has(a)&&(e.detailStatsData.get(a)?.length??0)<2,u=Date.now()-e.rangeDays*864e5,g=l.filter(f=>f.ts>=u);g.length>=2&&(l=g);let m=null,v=!1;if(i==="counter"&&t.trigger_target_value!=null&&l.length){let f=Pi(n,l);if(f){if(f.ts!=null){let j=l.filter(C=>C.ts>=f.ts);j.length>=2&&(l=j)}l=l.map(j=>({...j,val:Math.max(0,j.val-f.value)}))}m=t.trigger_target_value,v=!0}else i==="state_change"&&t.trigger_target_changes?(m=t.trigger_target_changes,v=!0):i==="runtime"&&t.trigger_runtime_hours&&(m=t.trigger_runtime_hours,v=!0);let b=null;if(m==null&&n.degradation_rate!=null&&(n.degradation_trend!=="stable"||n.days_until_threshold!=null)&&n.degradation_trend!=="insufficient_data"&&l.length>=2){let f=l[l.length-1];b=[f,{ts:f.ts+30*864e5,val:f.val+n.degradation_rate*30}]}let $=n.history.filter(f=>["completed","skipped","reset"].includes(f.type)).map(f=>({ts:new Date(f.timestamp).getTime(),type:f.type}));return o`
|
||||
`}function Oi(n,r){let e=n.trigger_config;if(!e)return[];let t=e.type||"threshold",i=e.entity_id||"",a=t==="runtime"?[]:r.detailStatsData.get(i)||[],l=r.isCounterEntity(e),c=[];if(a.length>=2)for(let h of a){let u={ts:h.ts,val:h.val};!l&&h.min!=null&&h.max!=null&&(u.min=h.min,u.max=h.max),c.push(u)}else for(let h of n.history)h.trigger_value!=null&&c.push({ts:new Date(h.timestamp).getTime(),val:h.trigger_value});return n.trigger_current_value!=null&&c.push({ts:Date.now(),val:n.trigger_current_value}),c.sort((h,u)=>h.ts-u.ts),c}function ta(n,r,e){let t=n.trigger_config;if(!t)return p;let i=t.type||"threshold",a=t.entity_id||"",l=Oi(n,e);i==="runtime"&&t.trigger_runtime_hours&&n.trigger_current_value!=null&&(l=[{ts:Gt(n)??l[0]?.ts??Date.now()-864e5,val:0},{ts:Date.now(),val:Math.max(0,n.trigger_current_value)}]),e.hideOutliers&&(l=Js(l));let c=l.length<2&&!!a&&e.hasStatsService&&!e.detailStatsData.has(a);if(l.length<2&&!c)return p;let h=!!a&&e.detailStatsData.has(a)&&(e.detailStatsData.get(a)?.length??0)<2,u=Date.now()-e.rangeDays*864e5,g=l.filter(f=>f.ts>=u);g.length>=2&&(l=g);let m=null,v=!1;if(i==="counter"&&t.trigger_target_value!=null&&l.length){let f=Di(n,l);if(f){if(f.ts!=null){let j=l.filter(C=>C.ts>=f.ts);j.length>=2&&(l=j)}l=l.map(j=>({...j,val:Math.max(0,j.val-f.value)}))}m=t.trigger_target_value,v=!0}else i==="state_change"&&t.trigger_target_changes?(m=t.trigger_target_changes,v=!0):i==="runtime"&&t.trigger_runtime_hours&&(m=t.trigger_runtime_hours,v=!0);let b=null;if(m==null&&n.degradation_rate!=null&&(n.degradation_trend!=="stable"||n.days_until_threshold!=null)&&n.degradation_trend!=="insufficient_data"&&l.length>=2){let f=l[l.length-1];b=[f,{ts:f.ts+30*864e5,val:f.val+n.degradation_rate*30}]}let $=n.history.filter(f=>["completed","skipped","reset"].includes(f.type)).map(f=>({ts:new Date(f.timestamp).getTime(),type:f.type}));return o`
|
||||
<maintenance-trigger-chart
|
||||
.points=${c?[]:l}
|
||||
.events=${$}
|
||||
@@ -7291,7 +7336,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<ha-icon icon="mdi:information-outline"></ha-icon>
|
||||
${s("chart_no_stats",e.lang)}
|
||||
</div>`:p}
|
||||
`}function Hi(n,r,e){let t=n.degradation_trend!=null&&n.degradation_trend!=="insufficient_data",i=n.days_until_threshold!=null,a=n.environmental_factor!=null&&n.environmental_factor!==1;if(!t&&!i&&!a)return p;let l=n.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":n.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||
`}function qi(n,r,e){let t=n.degradation_trend!=null&&n.degradation_trend!=="insufficient_data",i=n.days_until_threshold!=null,a=n.environmental_factor!=null&&n.environmental_factor!==1;if(!t&&!i&&!a)return p;let l=n.degradation_trend==="rising"?"M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z":n.degradation_trend==="falling"?"M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z":"M22,12L18,8V11H3V13H18V16L22,12Z";return o`
|
||||
<div class="prediction-section">
|
||||
${n.sensor_prediction_urgency?o`
|
||||
<div class="prediction-urgency-banner">
|
||||
@@ -7331,23 +7376,23 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
`:p}
|
||||
</div>
|
||||
</div>
|
||||
`}function Di(n,r){let e=n.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return p;let a=n.interval_days??0,l=n.suggested_interval??a;return o`
|
||||
`}function Ni(n,r){let e=n.interval_analysis,t=e?.weibull_beta,i=e?.weibull_eta;if(t==null||i==null||i<=0)return p;let a=n.interval_days??0,l=n.suggested_interval??a;return o`
|
||||
<div class="weibull-section">
|
||||
<div class="weibull-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M3,14L3.5,14.07L8.07,9.5C7.89,8.85 8.06,8.11 8.59,7.59C9.37,6.8 10.63,6.8 11.41,7.59C11.94,8.11 12.11,8.85 11.93,9.5L14.5,12.07L15,12C15.18,12 15.35,12 15.5,12.07L19.07,8.5C19,8.35 19,8.18 19,8A2,2 0 0,1 21,6A2,2 0 0,1 23,8A2,2 0 0,1 21,10C20.82,10 20.65,10 20.5,9.93L16.93,13.5C17,13.65 17,13.82 17,14A2,2 0 0,1 15,16A2,2 0 0,1 13,14L13.07,13.5L10.5,10.93C10.18,11 9.82,11 9.5,10.93L4.93,15.5L5,16A2,2 0 0,1 3,18A2,2 0 0,1 1,16A2,2 0 0,1 3,14Z"></ha-svg-icon>
|
||||
${s("weibull_reliability_curve",r)}
|
||||
${Zs(t,r)}
|
||||
${ia(t,r)}
|
||||
</div>
|
||||
${Js(t,i,a,l,r)}
|
||||
${Xs(e,r)}
|
||||
${e?.confidence_interval_low!=null?ea(e,n,r):p}
|
||||
${sa(t,i,a,l,r)}
|
||||
${aa(e,r)}
|
||||
${e?.confidence_interval_low!=null?ra(e,n,r):p}
|
||||
</div>
|
||||
`}function Zs(n,r){let e,t,i;return n<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):n<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):n<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),o`
|
||||
`}function ia(n,r){let e,t,i;return n<.8?(e="early_failures",t="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",i="beta_early_failures"):n<=1.2?(e="random_failures",t="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,17H11V15H13V17M13,13H11V7H13V13Z",i="beta_random_failures"):n<=3.5?(e="wear_out",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4M12,6A6,6 0 0,1 18,12H12V6Z",i="beta_wear_out"):(e="highly_predictable",t="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M11,16.5L18,9.5L16.59,8.09L11,13.67L7.91,10.59L6.5,12L11,16.5Z",i="beta_highly_predictable"),o`
|
||||
<span class="beta-badge ${e}">
|
||||
<ha-svg-icon path="${t}"></ha-svg-icon>
|
||||
${s(i,r)} (\u03B2=${n.toFixed(2)})
|
||||
</span>
|
||||
`}function Js(n,r,e,t,i){let b=Math.max(e,t,r,1)*1.3,$=50,f=[];for(let U=0;U<=$;U++){let N=U/$*b,be=1-Math.exp(-Math.pow(N/r,n)),$e=32+N/b*260,Ce=136-be*128;f.push([$e,Ce])}let j=f.map(([U,N])=>`${U.toFixed(1)},${N.toFixed(1)}`).join(" "),C="M32,136 "+f.map(([U,N])=>`L${U.toFixed(1)},${N.toFixed(1)}`).join(" ")+` L${f[$][0].toFixed(1)},136 Z`,L=32+e/b*260,R=1-Math.exp(-Math.pow(e/r,n)),T=136-R*128,X=((1-R)*100).toFixed(0),ee=32+t/b*260,Z=[0,.25,.5,.75,1];return o`
|
||||
`}function sa(n,r,e,t,i){let b=Math.max(e,t,r,1)*1.3,$=50,f=[];for(let U=0;U<=$;U++){let N=U/$*b,be=1-Math.exp(-Math.pow(N/r,n)),$e=32+N/b*260,Ce=136-be*128;f.push([$e,Ce])}let j=f.map(([U,N])=>`${U.toFixed(1)},${N.toFixed(1)}`).join(" "),C="M32,136 "+f.map(([U,N])=>`L${U.toFixed(1)},${N.toFixed(1)}`).join(" ")+` L${f[$][0].toFixed(1)},136 Z`,L=32+e/b*260,R=1-Math.exp(-Math.pow(e/r,n)),T=136-R*128,X=((1-R)*100).toFixed(0),ee=32+t/b*260,Z=[0,.25,.5,.75,1];return o`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",i)}">
|
||||
${Z.map(U=>{let N=136-U*128;return D`
|
||||
@@ -7390,7 +7435,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${e>0?o`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${s("current_interval_marker",i)}</span>`:p}
|
||||
${t>0&&t!==e?o`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${s("recommended_marker",i)}</span>`:p}
|
||||
</div>
|
||||
`}function Xs(n,r){return o`
|
||||
`}function aa(n,r){return o`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("characteristic_life",r)}</span>
|
||||
@@ -7403,7 +7448,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
`:p}
|
||||
</div>
|
||||
`}function ea(n,r,e){let t=n.confidence_interval_low,i=n.confidence_interval_high,a=r.suggested_interval??r.interval_days??0,l=r.interval_days??0,c=Math.max(0,t-5),u=i+5-c,g=(t-c)/u*100,m=(i-t)/u*100,v=(a-c)/u*100,b=l>0?(l-c)/u*100:-1;return o`
|
||||
`}function ra(n,r,e){let t=n.confidence_interval_low,i=n.confidence_interval_high,a=r.suggested_interval??r.interval_days??0,l=r.interval_days??0,c=Math.max(0,t-5),u=i+5-c,g=(t-c)/u*100,m=(i-t)/u*100,v=(a-c)/u*100,b=l>0?(l-c)/u*100:-1;return o`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${s("confidence_interval",e)}: ${a} ${s("days",e)} (${t}\u2013${i})
|
||||
@@ -7418,7 +7463,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<span class="confidence-text high">${s("confidence_aggressive",e)} (${i}${s("days",e).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function Oi(n,r,e,t){let i=Math.max(n||1,r);return o`
|
||||
`}function Fi(n,r,e,t){let i=Math.max(n||1,r);return o`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -7436,7 +7481,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
style="width: ${Math.min(r/i*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var qi=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"];function Ni(n,r,e){if(!e.seasonal||!n.seasonal_factor||n.seasonal_factor===1)return p;let t=qi.map(c=>s(c,r)),i=new Date().getMonth(),a=n.seasonal_factors||n.interval_analysis?.seasonal_factors||null,l=a&&a.length===12?a:t.map((c,h)=>{let u=n.seasonal_factor||1,g=Math.sin((h-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+g))});return o`
|
||||
`}var Ui=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"];function Bi(n,r,e){if(!e.seasonal||!n.seasonal_factor||n.seasonal_factor===1)return p;let t=Ui.map(c=>s(c,r)),i=new Date().getMonth(),a=n.seasonal_factors||n.interval_analysis?.seasonal_factors||null,l=a&&a.length===12?a:t.map((c,h)=>{let u=n.seasonal_factor||1,g=Math.sin((h-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,u+g))});return o`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${s("seasonal_awareness",r)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
@@ -7453,7 +7498,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${s("longer",r)||"L\xE4nger"}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function Fi(n,r){return ta(n,r)}function ta(n,r){let e=n.seasonal_factors??n.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return p;let t=n.interval_analysis?.seasonal_reason,i=new Date().getMonth(),a=300,l=100,c=8,u=l-c-4,g=Math.max(...e,1.5),m=a/12,v=m*.65,b=c+u-1/g*u;return o`
|
||||
`}function Vi(n,r){return na(n,r)}function na(n,r){let e=n.seasonal_factors??n.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return p;let t=n.interval_analysis?.seasonal_reason,i=new Date().getMonth(),a=300,l=100,c=8,u=l-c-4,g=Math.max(...e,1.5),m=a/12,v=m*.65,b=c+u-1/g*u;return o`
|
||||
<div class="seasonal-chart">
|
||||
<div class="seasonal-chart-title">
|
||||
<ha-svg-icon aria-hidden="true" path="M17.75 4.09L15.22 6.03L16.13 9.09L13.5 7.28L10.87 9.09L11.78 6.03L9.25 4.09L12.44 4L13.5 1L14.56 4L17.75 4.09M21.25 11L19.61 12.25L20.2 14.23L18.5 13.06L16.8 14.23L17.39 12.25L15.75 11L17.81 10.95L18.5 9L19.19 10.95L21.25 11M18.97 15.95C19.8 15.87 20.69 17.05 20.16 17.8C19.84 18.25 19.5 18.67 19.08 19.07C15.17 23 8.84 23 4.94 19.07C1.03 15.17 1.03 8.83 4.94 4.93C5.34 4.53 5.76 4.17 6.21 3.85C6.96 3.32 8.14 4.21 8.06 5.04C7.79 7.9 8.75 10.87 10.95 13.06C13.14 15.26 16.1 16.22 18.97 15.95Z"></ha-svg-icon>
|
||||
@@ -7470,10 +7515,10 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${qi.map(($,f)=>o`<span class="seasonal-label ${f===i?"active-month":""}">${s($,r)}</span>`)}
|
||||
${Ui.map(($,f)=>o`<span class="seasonal-label ${f===i?"active-month":""}">${s($,r)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var ia=200,tt=10,sa=22;function Ui(n,r,e,t){let i=n.history.filter(c=>c.type==="completed"&&(c.cost!=null||c.duration!=null));if(i.length<2)return p;let a=i.some(c=>(c.cost??0)>0),l=i.some(c=>(c.duration??0)>0);return!a&&!l?p:o`
|
||||
`}var oa=200,tt=10,la=22;function Wi(n,r,e,t){let i=n.history.filter(c=>c.type==="completed"&&(c.cost!=null||c.duration!=null));if(i.length<2)return p;let a=i.some(c=>(c.cost??0)>0),l=i.some(c=>(c.duration??0)>0);return!a&&!l?p:o`
|
||||
<div class="cost-duration-card">
|
||||
<div class="card-header">
|
||||
<h3>${s("cost_duration_chart",r)}</h3>
|
||||
@@ -7495,9 +7540,9 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</button>`:p}
|
||||
</div>
|
||||
</div>
|
||||
${aa(n,r,e)}
|
||||
${ca(n,r,e)}
|
||||
</div>
|
||||
`}function aa(n,r,e){let t=n.history.filter(w=>w.type==="completed"&&(w.cost!=null||w.duration!=null)).map(w=>({ts:new Date(w.timestamp).getTime(),cost:w.cost??0,duration:w.duration??0})).sort((w,P)=>w.ts-P.ts);if(t.length<2)return p;let i=t.some(w=>w.cost>0),a=t.some(w=>w.duration>0);if(!i&&!a)return p;let l=e!=="duration"&&i,c=e!=="cost"&&a,h=l||!c&&i,u=c||!l&&a,g=640,m=ia,v=h?44:12,b=u?44:12,$=g-v-b,f=m-sa,j=f-tt,C=t[0].ts,L=t[t.length-1].ts,R=(L-C||864e5)*.05,T=C-R,X=L+R,ee=wt(C,L),Z=w=>v+(w-T)/(X-T)*$,U=et(0,Math.max(...t.map(w=>w.cost))||1,3),N=et(0,Math.max(...t.map(w=>w.duration))||1,3),be=w=>tt+(1-w/(U.niceMax||1))*j,$e=w=>tt+(1-w/(N.niceMax||1))*j,Ce=t.length>1?Math.min(...t.slice(1).map((w,P)=>Z(w.ts)-Z(t[P].ts))):$,K=Math.max(6,Math.min(22,Ce*.55)),k=kt(C,L,Math.max(2,Math.min(4,t.length)));return o`
|
||||
`}function ca(n,r,e){let t=n.history.filter(w=>w.type==="completed"&&(w.cost!=null||w.duration!=null)).map(w=>({ts:new Date(w.timestamp).getTime(),cost:w.cost??0,duration:w.duration??0})).sort((w,P)=>w.ts-P.ts);if(t.length<2)return p;let i=t.some(w=>w.cost>0),a=t.some(w=>w.duration>0);if(!i&&!a)return p;let l=e!=="duration"&&i,c=e!=="cost"&&a,h=l||!c&&i,u=c||!l&&a,g=640,m=oa,v=h?44:12,b=u?44:12,$=g-v-b,f=m-la,j=f-tt,C=t[0].ts,L=t[t.length-1].ts,R=(L-C||864e5)*.05,T=C-R,X=L+R,ee=Tt(C,L),Z=w=>v+(w-T)/(X-T)*$,U=et(0,Math.max(...t.map(w=>w.cost))||1,3),N=et(0,Math.max(...t.map(w=>w.duration))||1,3),be=w=>tt+(1-w/(U.niceMax||1))*j,$e=w=>tt+(1-w/(N.niceMax||1))*j,Ce=t.length>1?Math.min(...t.slice(1).map((w,P)=>Z(w.ts)-Z(t[P].ts))):$,K=Math.max(6,Math.min(22,Ce*.55)),k=St(C,L,Math.max(2,Math.min(4,t.length)));return o`
|
||||
<div class="sparkline-container">
|
||||
<svg class="history-chart" viewBox="0 0 ${g} ${m}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_history",r)}">
|
||||
${h?U.ticks.map(w=>{let P=be(w);return P<tt-1||P>f+1?p:D`
|
||||
@@ -7522,7 +7567,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
`:p}
|
||||
|
||||
<line x1="${v}" y1="${f}" x2="${g-b}" y2="${f}" stroke="var(--divider-color)" stroke-width="1" />
|
||||
${k.map((w,P)=>{let Tt=P===0?"start":P===k.length-1?"end":"middle";return D`<text x="${Z(w).toFixed(1)}" y="${m-6}" text-anchor="${Tt}" fill="var(--secondary-text-color)" font-size="10">${De(w,r,ee)}</text>`})}
|
||||
${k.map((w,P)=>{let jt=P===0?"start":P===k.length-1?"end":"middle";return D`<text x="${Z(w).toFixed(1)}" y="${m-6}" text-anchor="${jt}" fill="var(--secondary-text-color)" font-size="10">${De(w,r,ee)}</text>`})}
|
||||
</svg>
|
||||
</div>
|
||||
<div class="chart-legend">
|
||||
@@ -7549,10 +7594,10 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
background: var(--secondary-background-color, rgba(0,0,0,0.06));
|
||||
margin-top: 4px;
|
||||
}
|
||||
`,d([y({attribute:!1})],xe.prototype,"hass",2),d([y()],xe.prototype,"docId",2),d([_()],xe.prototype,"_url",2),d([_()],xe.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",xe);var ra=["completed","skipped","missed","reset","triggered"];function Bi(n,r){let e=r.lang;return o`
|
||||
`,d([y({attribute:!1})],xe.prototype,"hass",2),d([y()],xe.prototype,"docId",2),d([_()],xe.prototype,"_url",2),d([_()],xe.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",xe);var da=["completed","skipped","missed","reset","triggered"];function Ki(n,r){let e=r.lang;return o`
|
||||
<div class="history-filters-new">
|
||||
<div class="filter-chips">
|
||||
${ra.map(t=>{let i=n.history.filter(a=>a.type===t).length;return i===0?p:o`
|
||||
${da.map(t=>{let i=n.history.filter(a=>a.type===t).length;return i===0?p:o`
|
||||
<span class="filter-chip ${r.filter===t?"active":""}"
|
||||
@click=${()=>r.setFilter(r.filter===t?null:t)}>
|
||||
${s(t,e)} (${i})
|
||||
@@ -7564,11 +7609,11 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<input type="text" class="search-input" placeholder="${s("search_notes",e)}..." .value=${r.search} @input=${t=>r.setSearch(t.target.value)} />
|
||||
</div>
|
||||
</div>
|
||||
`}function Vi(n,r){let e=r.lang,t=r.filter?n.history.filter(i=>i.type===r.filter):n.history;if(r.search){let i=r.search.toLowerCase();t=t.filter(a=>a.notes?.toLowerCase().includes(i))}return t.length===0?o`<p class="empty">${s("no_history",e)}</p>`:o`
|
||||
`}function Yi(n,r){let e=r.lang,t=r.filter?n.history.filter(i=>i.type===r.filter):n.history;if(r.search){let i=r.search.toLowerCase();t=t.filter(a=>a.notes?.toLowerCase().includes(i))}return t.length===0?o`<p class="empty">${s("no_history",e)}</p>`:o`
|
||||
<div class="history-timeline">
|
||||
${[...t].reverse().map(i=>na(i,r))}
|
||||
${[...t].reverse().map(i=>pa(i,r))}
|
||||
</div>
|
||||
`}function na(n,r){let e=r.lang,t=["completed","reset","skipped"].includes(n.type);return o`
|
||||
`}function pa(n,r){let e=r.lang,t=["completed","reset","skipped"].includes(n.type);return o`
|
||||
<div class="history-entry">
|
||||
<div class="history-icon ${n.type}">
|
||||
<ha-icon .icon=${Ye[n.type]||"mdi:circle"}></ha-icon>
|
||||
@@ -7582,7 +7627,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<ha-icon icon="mdi:pencil"></ha-icon>
|
||||
</button>`:p}
|
||||
</div>
|
||||
<div class="history-date">${pt(n.timestamp,e)}</div>
|
||||
<div class="history-date">${_t(n.timestamp,e)}</div>
|
||||
${n.notes?o`<div>${n.notes}</div>`:p}
|
||||
${n.photo_doc_id?o`<maintenance-history-photo .hass=${r.hass} .docId=${n.photo_doc_id}></maintenance-history-photo>`:p}
|
||||
<div class="history-details">
|
||||
@@ -7593,12 +7638,12 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`}function Kt(n,r){if(!n.responsible_user_id)return p;let e=r(n.responsible_user_id);return e?o`
|
||||
`}function Qt(n,r){if(!n.responsible_user_id)return p;let e=r(n.responsible_user_id);return e?o`
|
||||
<span class="user-badge">
|
||||
<ha-icon icon="mdi:account"></ha-icon>
|
||||
${e}
|
||||
</span>
|
||||
`:p}function oa(n,r){let e=r.lang,t=r.isOperator,i=n.archived?"archived":n.is_done?"done":n.status==="due_soon"?"warning":n.status||"ok",a=n.archived?s("archived",e):n.is_done?s("completed",e):s(n.status||"ok",e);return o`
|
||||
`:p}function ha(n,r){let e=r.lang,t=r.isOperator,i=n.archived?"archived":n.is_done?"done":n.status==="due_soon"?"warning":n.status||"ok",a=n.archived?s("archived",e):n.is_done?s("completed",e):s(n.status||"ok",e);return o`
|
||||
<div class="task-header">
|
||||
<div class="task-header-title">
|
||||
<span class="task-name-breadcrumb" @click=${()=>r.showTaskView()}>${n.name}</span>
|
||||
@@ -7608,7 +7653,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${n.due_override?o`<span class="postponed-badge" title="${s("postponed_to",e)}">
|
||||
<ha-icon icon="mdi:calendar-arrow-right"></ha-icon>${W(n.due_override,e)}
|
||||
</span>`:p}
|
||||
${Kt(n,r.getUserName)}
|
||||
${Qt(n,r.getUserName)}
|
||||
${n.nfc_tag_id?o`<span class="nfc-badge" title="${s("nfc_tag_id",e)}: ${n.nfc_tag_id}"><ha-icon icon="mdi:nfc-variant"></ha-icon> NFC</span>`:t?p:o`<span class="nfc-badge unlinked" title="${s("nfc_link_hint",e)}"
|
||||
@click=${()=>r.openEdit(n)}>
|
||||
<ha-icon icon="mdi:nfc-variant"></ha-icon>
|
||||
@@ -7643,7 +7688,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
`}
|
||||
</div>
|
||||
</div>
|
||||
`}function la(n){let r=n.lang;return o`
|
||||
`}function ua(n){let r=n.lang;return o`
|
||||
<div class="tab-bar">
|
||||
<div class="tab ${n.activeTab==="overview"?"active":""}" @click=${()=>n.setActiveTab("overview")}>
|
||||
${s("overview",r)}
|
||||
@@ -7652,7 +7697,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${s("history",r)}
|
||||
</div>
|
||||
</div>
|
||||
`}function Wi(n,r,e,t){let i=t.collapsedSections.has(n);return o`
|
||||
`}function Gi(n,r,e,t){let i=t.collapsedSections.has(n);return o`
|
||||
<div class="collapsible ${i?"collapsed":""}">
|
||||
<button class="collapsible-head" @click=${()=>t.toggleSection(n)}
|
||||
aria-expanded=${i?"false":"true"}>
|
||||
@@ -7661,7 +7706,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</button>
|
||||
${i?p:o`<div class="collapsible-body">${e}</div>`}
|
||||
</div>
|
||||
`}function ca(n,r){if(!r.features.checklists)return p;let e=n.checklist||[];if(e.length===0)return p;let t=r.lang;return o`
|
||||
`}function _a(n,r){if(!r.features.checklists)return p;let e=n.checklist||[];if(e.length===0)return p;let t=r.lang;return o`
|
||||
<div class="checklist-preview-card">
|
||||
<div class="checklist-preview-header">
|
||||
<ha-icon icon="mdi:format-list-checks"></ha-icon>
|
||||
@@ -7671,7 +7716,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${e.map(i=>o`<li>${i}</li>`)}
|
||||
</ol>
|
||||
</div>
|
||||
`}function da(n,r){let e=ne(n.documentation_url)?n.documentation_url:null,t=ne(r.objectDocUrl)?r.objectDocUrl:null;if(!n.notes&&!e&&!t)return p;let i=r.lang;return o`
|
||||
`}function ga(n,r){let e=ne(n.documentation_url)?n.documentation_url:null,t=ne(r.objectDocUrl)?r.objectDocUrl:null;if(!n.notes&&!e&&!t)return p;let i=r.lang;return o`
|
||||
<div class="task-meta-card">
|
||||
${n.notes?o`
|
||||
<div class="task-meta-row">
|
||||
@@ -7692,7 +7737,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
`:p}
|
||||
</div>
|
||||
`}function pa(n,r){let e=r.lang,t=n.times_performed>0?n.total_cost/n.times_performed:0,i=n.days_until_due!==null&&n.days_until_due!==void 0?n.days_until_due<0?"overdue":n.days_until_due<=n.warning_days?"warning":"":"";return o`
|
||||
`}function ma(n,r){let e=r.lang,t=n.times_performed>0?n.total_cost/n.times_performed:0,i=n.days_until_due!==null&&n.days_until_due!==void 0?n.days_until_due<0?"overdue":n.days_until_due<=n.warning_days?"warning":"":"";return o`
|
||||
<div class="kpi-bar">
|
||||
<div class="kpi-card">
|
||||
<div class="kpi-label">${s("next_due",e)}</div>
|
||||
@@ -7727,10 +7772,10 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<div class="kpi-value">${n.average_duration?n.average_duration.toFixed(0):"\u2014"} min</div>
|
||||
</div>
|
||||
</div>
|
||||
`}function ha(n,r){let e=r.lang;if(!r.features.adaptive||!n.suggested_interval||n.suggested_interval===n.interval_days)return p;if(r.suggestionDismissed)return p;let t=n.suggested_interval;return o`
|
||||
`}function va(n,r){let e=r.lang;if(!r.features.adaptive||!n.suggested_interval||n.suggested_interval===n.interval_days)return p;if(r.suggestionDismissed)return p;let t=n.suggested_interval;return o`
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",e)}</h4>
|
||||
${Oi(n.interval_days,t,n.interval_confidence||"medium",e)}
|
||||
${Fi(n.interval_days,t,n.interval_confidence||"medium",e)}
|
||||
<div class="recommendation-actions">
|
||||
<ha-button appearance="filled"
|
||||
@click=${()=>r.applySuggestion(t)}>
|
||||
@@ -7746,13 +7791,13 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</ha-button>
|
||||
</div>
|
||||
</div>
|
||||
`}function ua(n,r){let e=r.lang,t=n.history.slice(-3).reverse();if(t.length===0)return p;let i=a=>{switch(a){case"completed":return"\u2713";case"triggered":return"\u2297";case"skipped":return"\u21B7";case"reset":return"\u21BA";default:return"\xB7"}};return o`
|
||||
`}function ba(n,r){let e=r.lang,t=n.history.slice(-3).reverse();if(t.length===0)return p;let i=a=>{switch(a){case"completed":return"\u2713";case"triggered":return"\u2297";case"skipped":return"\u21B7";case"reset":return"\u21BA";default:return"\xB7"}};return o`
|
||||
<div class="recent-activities">
|
||||
<h3>${s("recent_activities",e)}</h3>
|
||||
${t.map(a=>o`
|
||||
<div class="activity-item">
|
||||
<span class="activity-icon">${i(a.type)}</span>
|
||||
<span class="activity-date">${pt(a.timestamp,e)}</span>
|
||||
<span class="activity-date">${_t(a.timestamp,e)}</span>
|
||||
<span class="activity-note">${a.notes||"\u2014"}</span>
|
||||
${a.cost?o`<span class="activity-badge">${a.cost.toFixed(0)}${r.currencySymbol}</span>`:p}
|
||||
${a.duration?o`<span class="activity-badge">${a.duration}min</span>`:p}
|
||||
@@ -7762,46 +7807,46 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<ha-button appearance="plain" @click=${()=>r.setActiveTab("history")}>${s("show_all",e)} →</ha-button>
|
||||
</div>
|
||||
</div>
|
||||
`}function _a(n,r){let e=r.lang,t=r.features.adaptive&&n.suggested_interval&&n.suggested_interval!==n.interval_days,i=r.features.seasonal&&n.seasonal_factor&&n.seasonal_factor!==1,a=t||i,l=r.features.adaptive&&n.interval_analysis?.weibull_beta!=null&&n.interval_analysis?.weibull_eta!=null,c=r.features.seasonal&&(n.seasonal_factors?.length===12||n.interval_analysis?.seasonal_factors?.length===12);return o`
|
||||
`}function fa(n,r){let e=r.lang,t=r.features.adaptive&&n.suggested_interval&&n.suggested_interval!==n.interval_days,i=r.features.seasonal&&n.seasonal_factor&&n.seasonal_factor!==1,a=t||i,l=r.features.adaptive&&n.interval_analysis?.weibull_beta!=null&&n.interval_analysis?.weibull_eta!=null,c=r.features.seasonal&&(n.seasonal_factors?.length===12||n.interval_analysis?.seasonal_factors?.length===12);return o`
|
||||
<div class="tab-content overview-tab">
|
||||
${pa(n,r)}
|
||||
${da(n,r)}
|
||||
${Mi(n,r.lang)}
|
||||
${Li(n,r.sparkline)}
|
||||
${Hi(n,e,r.features)}
|
||||
${ma(n,r)}
|
||||
${ga(n,r)}
|
||||
${Pi(n,r.lang)}
|
||||
${Hi(n,r.sparkline)}
|
||||
${qi(n,e,r.features)}
|
||||
<div class="two-column-layout ${a?"":"single-column"}">
|
||||
${a?o`
|
||||
<div class="left-column">
|
||||
${ha(n,r)}
|
||||
${Ni(n,e,r.features)}
|
||||
${va(n,r)}
|
||||
${Bi(n,e,r.features)}
|
||||
</div>
|
||||
`:p}
|
||||
<div class="right-column">
|
||||
${Ui(n,e,r.costDurationToggle,h=>r.setCostDurationToggle(h))}
|
||||
${Wi(n,e,r.costDurationToggle,h=>r.setCostDurationToggle(h))}
|
||||
</div>
|
||||
</div>
|
||||
${l?Wi("weibull","weibull_reliability_curve",Di(n,e),r):p}
|
||||
${c?Wi("seasonal","seasonal_chart_title",o`
|
||||
${Fi(n,e)}
|
||||
${l?Gi("weibull","weibull_reliability_curve",Ni(n,e),r):p}
|
||||
${c?Gi("seasonal","seasonal_chart_title",o`
|
||||
${Vi(n,e)}
|
||||
<div class="seasonal-actions">
|
||||
<ha-button appearance="plain" @click=${()=>r.openSeasonalOverrides(n)}>
|
||||
${s("edit_seasonal_overrides",e)}
|
||||
</ha-button>
|
||||
</div>
|
||||
`,r):p}
|
||||
${ca(n,r)}
|
||||
${ua(n,r)}
|
||||
${_a(n,r)}
|
||||
${ba(n,r)}
|
||||
</div>
|
||||
`}function ga(n,r){return o`
|
||||
`}function ya(n,r){return o`
|
||||
<div class="tab-content history-tab">
|
||||
${Bi(n,r.history)}
|
||||
${Vi(n,r.history)}
|
||||
${Ki(n,r.history)}
|
||||
${Yi(n,r.history)}
|
||||
</div>
|
||||
`}function ma(n,r){switch(r.activeTab){case"overview":return _a(n,r);case"history":return ga(n,r);default:return p}}function Ki(n,r){return o`
|
||||
`}function xa(n,r){switch(r.activeTab){case"overview":return fa(n,r);case"history":return ya(n,r);default:return p}}function Qi(n,r){return o`
|
||||
<div class="detail-section">
|
||||
${oa(n,r)}
|
||||
${la(r)}
|
||||
${ma(n,r)}
|
||||
${ha(n,r)}
|
||||
${ua(r)}
|
||||
${xa(n,r)}
|
||||
<maintenance-task-documents
|
||||
.hass=${r.hass}
|
||||
.entryId=${r.entryId}
|
||||
@@ -7809,7 +7854,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
.canWrite=${!r.isOperator}
|
||||
></maintenance-task-documents>
|
||||
</div>
|
||||
`}var it=class extends S{createRenderRoot(){return this}render(){return!this.task||!this.ctx?p:o`${Ki(this.task,this.ctx)}`}};d([y({attribute:!1})],it.prototype,"task",2),d([y({attribute:!1})],it.prototype,"ctx",2);customElements.get("maintenance-task-detail-view")||customElements.define("maintenance-task-detail-view",it);function Yi(n){if(n.total<=0)return{start:0,end:0,padTop:0,padBottom:0};let r=n.overscan??12,e=Math.max(1,n.step??6),t=Math.max(1,n.rowHeight),i=Math.floor((n.scrollTop-n.listTop)/t),a=Math.ceil(n.viewportHeight/t)+1,l=Math.max(0,i-r);l=Math.floor(l/e)*e;let c=Math.min(n.total,Math.max(i,0)+a+r);return c=Math.min(n.total,Math.ceil(c/e)*e),l>=c&&(l=Math.min(l,Math.max(0,n.total-1)),c=Math.min(n.total,l+Math.max(a,1))),{start:l,end:c,padTop:l*t,padBottom:(n.total-c)*t}}var E=class extends S{constructor(){super(...arguments);this.narrow=!1;this.panel={};this._objects=[];this._stats=null;this._view="overview";this._selectedEntryId=null;this._selectedTaskId=null;this._filterStatus="";this._filterUser=null;this._filterLabel=null;this._savedViews=[];this._activeViewId="";this._unsub=null;this._chartRangeDays=(()=>{try{let e=parseInt(localStorage.getItem(B.chartRange)||"",10);return[7,30,90,365].includes(e)?e:30}catch{return 30}})();this._hideOutliers=(()=>{try{return localStorage.getItem(B.chartHideOutliers)==="1"}catch{return!1}})();this._historyFilter=null;this._budget=null;this._groups={};this._detailStatsData=new Map;this._miniStatsData=new Map;this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._adminPanelUserIds=[];this._operatorWriteEnabled=!1;this._defaultWarningDays=7;this._actionLoading=!1;this._moreMenuOpen=!1;this._toastMessage="";this._toastUndo=null;this._toastTimer=null;this._dismissedSuggestions=new Set;this._overviewTab=(()=>{try{let e=localStorage.getItem(B.overviewTab);return e==="today"||e==="calendar"?e:"dashboard"}catch{return"dashboard"}})();this._activeTab="overview";this._costDurationToggle="both";this._historySearch="";this._sortMode="due_date";this._objectSortMode="alphabetical";this._groupByMode="none";this._objectViewMode="cards";this._objectsTableColumns=gt;this._showArchived=!1;this._bulkMode=!1;this._bulkSelected=new Set;this._virtStart=0;this._virtEnd=0;this._virtRowHeight=53;this._virtTotalRows=0;this._virtScrollAttached=!1;this._virtRaf=0;this._collapsedSections=(()=>{try{return new Set(JSON.parse(localStorage.getItem(B.collapsedSections)||"[]"))}catch{return new Set}})();this._paletteOpen=!1;this._paletteQuery="";this._paletteActive=0;this._templateGalleryOpen=!1;this._templates=[];this._templateCategories={};this._templateBusy=!1;this._statsService=null;this._userService=null;this._dataLoaded=!1;this._lastConnection=null;this._popstateHandler=e=>this._onPopState(e);this._onVirtualScroll=()=>{this._virtRaf||(this._virtRaf=requestAnimationFrame(()=>{this._virtRaf=0,this._updateVirtualWindow()}))};this._deepLinkHandled=!1;this._paletteKeydown=e=>{if(e.key==="/"&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!this._paletteOpen){let i=e.composedPath()[0];if(i instanceof HTMLElement&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.tagName==="SELECT"||i.isContentEditable))return;e.preventDefault(),this._openPalette();return}if(!this._paletteOpen)return;let t=this._paletteResults;if(e.key==="Escape")e.preventDefault(),this._closePalette();else if(e.key==="ArrowDown")e.preventDefault(),this._paletteActive=Math.min(this._paletteActive+1,t.length-1);else if(e.key==="ArrowUp")e.preventDefault(),this._paletteActive=Math.max(this._paletteActive-1,0);else if(e.key==="Enter"){e.preventDefault();let i=t[this._paletteActive];i&&this._selectPaletteResult(i)}};this._onDialogEvent=async()=>{try{await this._loadData()}catch{}};this._onCalendarLlCustom=e=>{let t=e.detail;t?.type==="maintenance-supporter:open-task"&&t.entry_id&&t.task_id&&(e.stopPropagation(),this._showTask(t.entry_id,t.task_id))};this._onHistoryEntrySaved=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}get _isOperator(){let e=this.hass?.user;return e?e.is_admin?!1:!(this._operatorWriteEnabled&&this._adminPanelUserIds.includes(e.id)):!0}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._popstateHandler),window.addEventListener("keydown",this._paletteKeydown),window.addEventListener("resize",this._onVirtualScroll,{passive:!0});try{let e=localStorage.getItem(B.taskSort);e&&["due_date","object","type","task_name","area","assigned_user","group"].includes(e)&&(this._sortMode=e);let t=localStorage.getItem(B.objectSort);t&&["alphabetical","due_soonest","task_count"].includes(t)&&(this._objectSortMode=t);let i=localStorage.getItem(B.groupBy);i&&["none","area","group","user"].includes(i)&&(this._groupByMode=i);let a=localStorage.getItem(B.objectView);(a==="cards"||a==="table")&&(this._objectViewMode=a)}catch{}}disconnectedCallback(){super.disconnectedCallback(),window.re
Line truncated
|
||||
`}var it=class extends S{createRenderRoot(){return this}render(){return!this.task||!this.ctx?p:o`${Qi(this.task,this.ctx)}`}};d([y({attribute:!1})],it.prototype,"task",2),d([y({attribute:!1})],it.prototype,"ctx",2);customElements.get("maintenance-task-detail-view")||customElements.define("maintenance-task-detail-view",it);function Zi(n){if(n.total<=0)return{start:0,end:0,padTop:0,padBottom:0};let r=n.overscan??12,e=Math.max(1,n.step??6),t=Math.max(1,n.rowHeight),i=Math.floor((n.scrollTop-n.listTop)/t),a=Math.ceil(n.viewportHeight/t)+1,l=Math.max(0,i-r);l=Math.floor(l/e)*e;let c=Math.min(n.total,Math.max(i,0)+a+r);return c=Math.min(n.total,Math.ceil(c/e)*e),l>=c&&(l=Math.min(l,Math.max(0,n.total-1)),c=Math.min(n.total,l+Math.max(a,1))),{start:l,end:c,padTop:l*t,padBottom:(n.total-c)*t}}var E=class extends S{constructor(){super(...arguments);this.narrow=!1;this.panel={};this._objects=[];this._stats=null;this._view="overview";this._selectedEntryId=null;this._selectedTaskId=null;this._filterStatus="";this._filterUser=null;this._filterLabel=null;this._savedViews=[];this._activeViewId="";this._unsub=null;this._chartRangeDays=(()=>{try{let e=parseInt(localStorage.getItem(B.chartRange)||"",10);return[7,30,90,365].includes(e)?e:30}catch{return 30}})();this._hideOutliers=(()=>{try{return localStorage.getItem(B.chartHideOutliers)==="1"}catch{return!1}})();this._historyFilter=null;this._budget=null;this._groups={};this._detailStatsData=new Map;this._miniStatsData=new Map;this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._adminPanelUserIds=[];this._operatorWriteEnabled=!1;this._defaultWarningDays=7;this._actionLoading=!1;this._moreMenuOpen=!1;this._toastMessage="";this._toastUndo=null;this._toastTimer=null;this._dismissedSuggestions=new Set;this._overviewTab=(()=>{try{let e=localStorage.getItem(B.overviewTab);return e==="today"||e==="calendar"?e:"dashboard"}catch{return"dashboard"}})();this._activeTab="overview";this._costDurationToggle="both";this._historySearch="";this._sortMode="due_date";this._objectSortMode="alphabetical";this._groupByMode="none";this._objectViewMode="cards";this._objectsTableColumns=bt;this._showArchived=!1;this._bulkMode=!1;this._bulkSelected=new Set;this._virtStart=0;this._virtEnd=0;this._virtRowHeight=53;this._virtTotalRows=0;this._virtScrollAttached=!1;this._virtRaf=0;this._collapsedSections=(()=>{try{return new Set(JSON.parse(localStorage.getItem(B.collapsedSections)||"[]"))}catch{return new Set}})();this._paletteOpen=!1;this._paletteQuery="";this._paletteActive=0;this._templateGalleryOpen=!1;this._templates=[];this._templateCategories={};this._templateBusy=!1;this._statsService=null;this._userService=null;this._dataLoaded=!1;this._lastConnection=null;this._popstateHandler=e=>this._onPopState(e);this._onVirtualScroll=()=>{this._virtRaf||(this._virtRaf=requestAnimationFrame(()=>{this._virtRaf=0,this._updateVirtualWindow()}))};this._deepLinkHandled=!1;this._paletteKeydown=e=>{if(e.key==="/"&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!this._paletteOpen){let i=e.composedPath()[0];if(i instanceof HTMLElement&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.tagName==="SELECT"||i.isContentEditable))return;e.preventDefault(),this._openPalette();return}if(!this._paletteOpen)return;let t=this._paletteResults;if(e.key==="Escape")e.preventDefault(),this._closePalette();else if(e.key==="ArrowDown")e.preventDefault(),this._paletteActive=Math.min(this._paletteActive+1,t.length-1);else if(e.key==="ArrowUp")e.preventDefault(),this._paletteActive=Math.max(this._paletteActive-1,0);else if(e.key==="Enter"){e.preventDefault();let i=t[this._paletteActive];i&&this._selectPaletteResult(i)}};this._onDialogEvent=async()=>{try{await this._loadData()}catch{}};this._onCalendarLlCustom=e=>{let t=e.detail;t?.type==="maintenance-supporter:open-task"&&t.entry_id&&t.task_id&&(e.stopPropagation(),this._showTask(t.entry_id,t.task_id))};this._onHistoryEntrySaved=async()=>{await this._loadData()}}get _lang(){return this.hass?.language||"en"}get _isOperator(){let e=this.hass?.user;return e?e.is_admin?!1:!(this._operatorWriteEnabled&&this._adminPanelUserIds.includes(e.id)):!0}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._popstateHandler),window.addEventListener("keydown",this._paletteKeydown),window.addEventListener("resize",this._onVirtualScroll,{passive:!0});try{let e=localStorage.getItem(B.taskSort);e&&["due_date","object","type","task_name","area","assigned_user","group"].includes(e)&&(this._sortMode=e);let t=localStorage.getItem(B.objectSort);t&&["alphabetical","due_soonest","task_count"].includes(t)&&(this._objectSortMode=t);let i=localStorage.getItem(B.groupBy);i&&["none","area","group","user"].includes(i)&&(this._groupByMode=i);let a=localStorage.getItem(B.objectView);(a==="cards"||a==="table")&&(this._objectViewMode=a)}catch{}}disconnectedCallback(){super.disconnectedCallback(),window.re
Line truncated
|
||||
<div class="palette-backdrop" @click=${()=>this._closePalette()}>
|
||||
<div class="palette" @click=${i=>i.stopPropagation()}>
|
||||
<input
|
||||
@@ -7862,7 +7907,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`}_bulkKey(e){return`${e.entry_id}:${e.task_id}`}_toggleBulkMode(){this._bulkMode=!this._bulkMode,this._bulkMode||(this._bulkSelected=new Set)}_toggleBulkRow(e){let t=this._bulkKey(e),i=new Set(this._bulkSelected);i.has(t)?i.delete(t):i.add(t),this._bulkSelected=i}_bulkSelectAll(e){let t=e.map(a=>this._bulkKey(a)),i=t.every(a=>this._bulkSelected.has(a));this._bulkSelected=i?new Set:new Set(t)}async _runBulk(e,t,i,a){let l=e.filter(h=>this._bulkSelected.has(this._bulkKey(h)));if(l.length===0)return;this._actionLoading=!0;let c=0;for(let h of l)try{await this.hass.connection.sendMessagePromise(t(h)),c++}catch{}this._actionLoading=!1,this._bulkSelected=new Set,this._bulkMode=!1,await this._loadData(),a&&c>0?this._showUndoToast(i(c),a):this._showToast(i(c))}_bulkComplete(e){this._runBulk(e,t=>({type:"maintenance_supporter/task/complete",entry_id:t.entry_id,task_id:t.task_id}),t=>s("bulk_completed",this._lang).replace("{n}",String(t)))}_bulkArchive(e){let t=e.filter(i=>this._bulkSelected.has(this._bulkKey(i))).map(i=>({entry_id:i.entry_id,task_id:i.task_id}));this._runBulk(e,i=>({type:"maintenance_supporter/task/archive",entry_id:i.entry_id,task_id:i.task_id}),i=>s("bulk_archived",this._lang).replace("{n}",String(i)),async()=>{for(let i of t)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/unarchive",entry_id:i.entry_id,task_id:i.task_id})}catch{}await this._loadData()})}async _deleteObject(e){if(await this.shadowRoot.querySelector("maintenance-confirm-dialog")?.confirm({title:s("delete",this._lang),message:s("confirm_delete_object",this._lang),confirmText:s("delete",this._lang),danger:!0}))try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:e}),this._showOverview(),await this._loadData()}catch{this._showToast(s("action_error",this._lang))}}_printObjectReport(e){let t=this._getObject(e);if(!t)return;let i=this._lang,a={title:s("report_title",i),generated:s("report_generated",i),manufacturer:s("manufacturer",i),model:s("model",i),serial:s("serial_number_label",i),installed:s("installed",i),warranty:s("warranty",i),area:s("area",i),notes:s("report_notes",i),tasksHeading:s("tasks",i),colTask:s("task_name",i),colType:s("report_col_type",i),colStatus:s("report_col_status",i),colSchedule:s("report_col_schedule",i),colLastDone:s("last_performed",i),colNextDue:s("next_due",i),colCost:s("cost",i),colTimes:s("report_times_done",i),totalCost:s("report_total_cost",i),scheduleLabel:h=>Qe(h,i),none:"\u2014",statusLabel:h=>s(h,i),typeLabel:h=>s(h,i)},l=mi(t.object,t.tasks,a,h=>h?W(h,i):"",this._budget?.currency_symbol||Se,new Date().toISOString()),c=URL.createObjectURL(new Blob([l],{type:"text/html"}));window.open(c,"_blank"),setTimeout(()=>URL.revokeObjectURL(c),6e4)}async _duplicateObject(e){this._actionLoading=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/duplicate",entry_id:e});await this._loadData(),this._showToast(s("object_duplicated",this._lang)),t?.entry_id&&this._showObject(t.entry_id)}catch{this._showToast(s("action_error",this._lang))}finally{this._actionLoading=!1}}async _deleteTask(e,t){if(await this.shadowRoot.querySelector("maintenance-confirm-dialog")?.confirm({title:s("delete",this._lang),message:s("confirm_delete_task",this._lang),confirmText:s("delete",this._lang),danger:!0}))try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/delete",entry_id:e,task_id:t}),this._showObject(e),await this._loadData()}catch{this._showToast(s("action_error",this._lang))}}async _duplicateTask(e,t){this._moreMenuOpen=!1,this._actionLoading=!0;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/duplicate",entry_id:e,task_id:t});await this._loadData(),this._showToast(s("task_duplicated",this._lang)),i?.task_id&&this._showTask(e,i.task_id)}catch{this._showToast(s("action_error",this._lang))}finally{this._actionLoading=!1}}async _toggleArchiveTask(e,t,i){this._actionLoading=!0;try{await this.hass.connection.sendMessagePromise({type:i?"maintenance_supporter/task/unarchive":"maintenance_supporter/task/archive",entry_id:e,task_id:t}),await this._loadData(),i||this._showUndoToast(s("task_archived",this._lang),()=>this._toggleArchiveTask(e,t,!0))}catch{this._showToast(s("action_error",this._lang))}finally{this._actionLoading=!1}}async _toggleArchiveObject(e,t){try{await this.hass.connection.sendMessagePromise({type:t?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:e}),await this._loadData(),t||this._showUndoToast(s("object_archived",this._lang),()=>this._toggleArchiveObject(e,!0))}catch{this._showToast(s("action_error",this._lang))}}async _togglePauseObject(e,t){if(!t){let a=await this.shadowRoot.querySelector("maintenance-confirm-dialog")?.prompt({title:s("pause_object",this._lang),message:s("pause_until_prompt",this._lang),confirmText:s("pause_object",this._lang),inputLabel:s("pause_until_
Line truncated
|
||||
`}_bulkKey(e){return`${e.entry_id}:${e.task_id}`}_toggleBulkMode(){this._bulkMode=!this._bulkMode,this._bulkMode||(this._bulkSelected=new Set)}_toggleBulkRow(e){let t=this._bulkKey(e),i=new Set(this._bulkSelected);i.has(t)?i.delete(t):i.add(t),this._bulkSelected=i}_bulkSelectAll(e){let t=e.map(a=>this._bulkKey(a)),i=t.every(a=>this._bulkSelected.has(a));this._bulkSelected=i?new Set:new Set(t)}async _runBulk(e,t,i,a){let l=e.filter(h=>this._bulkSelected.has(this._bulkKey(h)));if(l.length===0)return;this._actionLoading=!0;let c=0;for(let h of l)try{await this.hass.connection.sendMessagePromise(t(h)),c++}catch{}this._actionLoading=!1,this._bulkSelected=new Set,this._bulkMode=!1,await this._loadData(),a&&c>0?this._showUndoToast(i(c),a):this._showToast(i(c))}_bulkComplete(e){this._runBulk(e,t=>({type:"maintenance_supporter/task/complete",entry_id:t.entry_id,task_id:t.task_id}),t=>s("bulk_completed",this._lang).replace("{n}",String(t)))}_bulkArchive(e){let t=e.filter(i=>this._bulkSelected.has(this._bulkKey(i))).map(i=>({entry_id:i.entry_id,task_id:i.task_id}));this._runBulk(e,i=>({type:"maintenance_supporter/task/archive",entry_id:i.entry_id,task_id:i.task_id}),i=>s("bulk_archived",this._lang).replace("{n}",String(i)),async()=>{for(let i of t)try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/unarchive",entry_id:i.entry_id,task_id:i.task_id})}catch{}await this._loadData()})}async _deleteObject(e){if(await this.shadowRoot.querySelector("maintenance-confirm-dialog")?.confirm({title:s("delete",this._lang),message:s("confirm_delete_object",this._lang),confirmText:s("delete",this._lang),danger:!0}))try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:e}),this._showOverview(),await this._loadData()}catch{this._showToast(s("action_error",this._lang))}}_printObjectReport(e){let t=this._getObject(e);if(!t)return;let i=this._lang,a={title:s("report_title",i),generated:s("report_generated",i),manufacturer:s("manufacturer",i),model:s("model",i),serial:s("serial_number_label",i),installed:s("installed",i),warranty:s("warranty",i),area:s("area",i),notes:s("report_notes",i),tasksHeading:s("tasks",i),colTask:s("task_name",i),colType:s("report_col_type",i),colStatus:s("report_col_status",i),colSchedule:s("report_col_schedule",i),colLastDone:s("last_performed",i),colNextDue:s("next_due",i),colCost:s("cost",i),colTimes:s("report_times_done",i),totalCost:s("report_total_cost",i),scheduleLabel:h=>Qe(h,i),none:"\u2014",statusLabel:h=>s(h,i),typeLabel:h=>s(h,i)},l=fi(t.object,t.tasks,a,h=>h?W(h,i):"",this._budget?.currency_symbol||Se,new Date().toISOString()),c=URL.createObjectURL(new Blob([l],{type:"text/html"}));window.open(c,"_blank"),setTimeout(()=>URL.revokeObjectURL(c),6e4)}async _duplicateObject(e){this._actionLoading=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/duplicate",entry_id:e});await this._loadData(),this._showToast(s("object_duplicated",this._lang)),t?.entry_id&&this._showObject(t.entry_id)}catch{this._showToast(s("action_error",this._lang))}finally{this._actionLoading=!1}}async _deleteTask(e,t){if(await this.shadowRoot.querySelector("maintenance-confirm-dialog")?.confirm({title:s("delete",this._lang),message:s("confirm_delete_task",this._lang),confirmText:s("delete",this._lang),danger:!0}))try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/delete",entry_id:e,task_id:t}),this._showObject(e),await this._loadData()}catch{this._showToast(s("action_error",this._lang))}}async _duplicateTask(e,t){this._moreMenuOpen=!1,this._actionLoading=!0;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/duplicate",entry_id:e,task_id:t});await this._loadData(),this._showToast(s("task_duplicated",this._lang)),i?.task_id&&this._showTask(e,i.task_id)}catch{this._showToast(s("action_error",this._lang))}finally{this._actionLoading=!1}}async _toggleArchiveTask(e,t,i){this._actionLoading=!0;try{await this.hass.connection.sendMessagePromise({type:i?"maintenance_supporter/task/unarchive":"maintenance_supporter/task/archive",entry_id:e,task_id:t}),await this._loadData(),i||this._showUndoToast(s("task_archived",this._lang),()=>this._toggleArchiveTask(e,t,!0))}catch{this._showToast(s("action_error",this._lang))}finally{this._actionLoading=!1}}async _toggleArchiveObject(e,t){try{await this.hass.connection.sendMessagePromise({type:t?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:e}),await this._loadData(),t||this._showUndoToast(s("object_archived",this._lang),()=>this._toggleArchiveObject(e,!0))}catch{this._showToast(s("action_error",this._lang))}}async _togglePauseObject(e,t){if(!t){let a=await this.shadowRoot.querySelector("maintenance-confirm-dialog")?.prompt({title:s("pause_object",this._lang),message:s("pause_until_prompt",this._lang),confirmText:s("pause_object",this._lang),inputLabel:s("pause_until_
Line truncated
|
||||
<div class="panel">
|
||||
${this.narrow||this._view!=="overview"?this._renderHeader():p}
|
||||
<div class="content">
|
||||
@@ -8234,7 +8279,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
</details>
|
||||
`)}
|
||||
`}_warrantyLabel(e,t,i){return e.kind==="expired"?s("warranty_expired",i):e.kind==="expiring"?s("warranty_expires_in",i).replace("{days}",String(e.days??0)):s("warranty_valid_until",i).replace("{date}",W(t,i))}_renderWarrantyMeta(e,t){let i=Ft(e);return o`<p class="meta">${s("warranty",t)}:
|
||||
`}_warrantyLabel(e,t,i){return e.kind==="expired"?s("warranty_expired",i):e.kind==="expiring"?s("warranty_expires_in",i).replace("{days}",String(e.days??0)):s("warranty_valid_until",i).replace("{date}",W(t,i))}_renderWarrantyMeta(e,t){let i=Vt(e);return o`<p class="meta">${s("warranty",t)}:
|
||||
<span class="warranty-chip warranty-${i.kind}">${this._warrantyLabel(i,e,t)}</span></p>`}_renderAllObjects(){let e=this._lang,t=this._isOperator,i=this._objectViewMode==="table"&&!this.narrow,a=this._objects.filter(g=>g.object.archived).length,l=g=>{let m=1/0;for(let v of g.tasks){let b=v.days_until_due;b!=null&&b<m&&(m=b)}return m},c=this._objects.filter(g=>this._showArchived||!g.object.archived);this._objectSortMode==="alphabetical"?c.sort((g,m)=>g.object.name.localeCompare(m.object.name)):this._objectSortMode==="task_count"?c.sort((g,m)=>m.tasks.length-g.tasks.length||g.object.name.localeCompare(m.object.name)):c.sort((g,m)=>l(g)-l(m)||g.object.name.localeCompare(m.object.name));let h=()=>{let g=new Map;for(let m of c){let v=m.object.area_id,b=v?this.hass?.areas?.[v]?.name||s("unassigned",e):s("no_area",e);g.has(b)||g.set(b,[]),g.get(b).push(m)}return new Map([...g.entries()].sort(([m],[v])=>m.localeCompare(v)))},u=g=>{let m=g.tasks.some(v=>v.status==="overdue"||v.status==="triggered");return o`
|
||||
<div class="object-card${m?" object-card-overdue":""}" @click=${()=>this._showObject(g.entry_id)}>
|
||||
${m?o`<span class="overdue-dot" title="${s("has_overdue",e)}"></span>`:p}
|
||||
@@ -8328,7 +8373,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</details>
|
||||
`)}
|
||||
`:o`<div class="objects-grid">${c.map(u)}</div>`}
|
||||
`}_setObjectViewMode(e){this._objectViewMode=e,localStorage.setItem(B.objectView,e)}async _exportObjectsCsv(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects/csv"}),t=new Date().toISOString().slice(0,10);mt(e.csv,`maintenance_objects_${t}.csv`,"text/csv;charset=utf-8")}catch{this._showToast(s("action_error",this._lang))}}_renderObjectsTable(e){let t=this._lang,i=this._objectsTableColumns;return o`
|
||||
`}_setObjectViewMode(e){this._objectViewMode=e,localStorage.setItem(B.objectView,e)}async _exportObjectsCsv(){try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects/csv"}),t=new Date().toISOString().slice(0,10);ft(e.csv,`maintenance_objects_${t}.csv`,"text/csv;charset=utf-8")}catch{this._showToast(s("action_error",this._lang))}}_renderObjectsTable(e){let t=this._lang,i=this._objectsTableColumns;return o`
|
||||
<div class="objects-table-wrap">
|
||||
<table class="objects-table">
|
||||
<thead>
|
||||
@@ -8355,7 +8400,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<mwc-icon-button title="${s("qr_code",i)}" @click=${l=>{l.stopPropagation(),this._openQrForObject(t.entry_id,a.name)}}>
|
||||
<ha-icon icon="mdi:qrcode"></ha-icon>
|
||||
</mwc-icon-button>
|
||||
</td>`;default:return o`<td></td>`}}_renderWarrantyCell(e,t){let i=Ft(e);return i.kind==="none"?o`<span class="warranty-none">—</span>`:o`<span class="warranty-chip warranty-${i.kind}">${this._warrantyLabel(i,e,t)}</span>`}async _onSettingsChanged(){await this._loadData()}_renderGroupsSection(){if(!this._features.groups)return p;let e=Object.entries(this._groups),t=this._lang;return o`
|
||||
</td>`;default:return o`<td></td>`}}_renderWarrantyCell(e,t){let i=Vt(e);return i.kind==="none"?o`<span class="warranty-none">—</span>`:o`<span class="warranty-chip warranty-${i.kind}">${this._warrantyLabel(i,e,t)}</span>`}async _onSettingsChanged(){await this._loadData()}_renderGroupsSection(){if(!this._features.groups)return p;let e=Object.entries(this._groups),t=this._lang;return o`
|
||||
<div class="groups-section">
|
||||
<div class="groups-header">
|
||||
<h3>${s("groups",t)}</h3>
|
||||
@@ -8401,7 +8446,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
</div>
|
||||
`})}
|
||||
</div>
|
||||
`}_renderOverviewRow(e){let t=this._lang,i=e.schedule_type==="time_based"&&e.interval_days&&e.interval_days>0,a=0,l=Ke.ok,c=!1;if(i&&e.days_until_due!==null){let v=_t(e.interval_days,e.days_until_due,e.interval_unit);a=v.pct,c=v.overflow,e.status==="overdue"?l=Ke.overdue:e.status==="due_soon"&&(l=Ke.due_soon)}let h=e.area_id?this.hass?.areas?.[e.area_id]?.name:null,u=e.responsible_user_id?this._userService?.getUserName(e.responsible_user_id):null,g=e.group_names.length>0||h||u,m=this._bulkMode&&this._bulkSelected.has(this._bulkKey(e));return o`
|
||||
`}_renderOverviewRow(e){let t=this._lang,i=e.schedule_type==="time_based"&&e.interval_days&&e.interval_days>0,a=0,l=Ke.ok,c=!1;if(i&&e.days_until_due!==null){let v=vt(e.interval_days,e.days_until_due,e.interval_unit);a=v.pct,c=v.overflow,e.status==="overdue"?l=Ke.overdue:e.status==="due_soon"&&(l=Ke.due_soon)}let h=e.area_id?this.hass?.areas?.[e.area_id]?.name:null,u=e.responsible_user_id?this._userService?.getUserName(e.responsible_user_id):null,g=e.group_names.length>0||h||u,m=this._bulkMode&&this._bulkSelected.has(this._bulkKey(e));return o`
|
||||
<div class="task-row${e.enabled?"":" task-disabled"}${m?" bulk-selected":""}">
|
||||
${this._bulkMode?o`
|
||||
<label class="cell bulk-check" @click=${v=>v.stopPropagation()}>
|
||||
@@ -8439,8 +8484,8 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
<span class="due-cell" @click=${()=>this._showTask(e.entry_id,e.task_id)}>
|
||||
<span class="due-text">${Re(e.days_until_due,t)}</span>
|
||||
${i?o`<div class="days-bar"><div class="days-bar-fill${c?" overflow":""}" style="width:${a}%;background:${l}"></div></div>`:p}
|
||||
${e.trigger_config?Ut(e):!i&&e.trigger_active?o`<span style="color:var(--maint-triggered-color);font-weight:600">⚡</span>`:p}
|
||||
${Bt(e,this._miniStatsData,this._lang)}
|
||||
${e.trigger_config?Wt(e):!i&&e.trigger_active?o`<span style="color:var(--maint-triggered-color);font-weight:600">⚡</span>`:p}
|
||||
${Kt(e,this._miniStatsData,this._lang)}
|
||||
</span>
|
||||
<span class="row-actions">
|
||||
<mwc-icon-button class="btn-complete" title="${s("complete",t)}" @click=${v=>{v.stopPropagation(),this._openCompleteDialogForRow(e)}}>
|
||||
@@ -8518,12 +8563,12 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
${h.document_count?o`<span class="doc-badge" title="${h.document_count} ${s("documents",i)}"><ha-icon icon="mdi:paperclip"></ha-icon>${h.document_count}</span>`:p}
|
||||
</span>
|
||||
<span class="cell task-name" @click=${()=>this._showTask(e.entry_id,h.id)}>${h.name}</span>
|
||||
<span class="task-sub${h.responsible_user_id?"":" task-sub-empty"}">${Kt(h,u=>this._userService?.getUserName(u)??null)}</span>
|
||||
<span class="task-sub${h.responsible_user_id?"":" task-sub-empty"}">${Qt(h,u=>this._userService?.getUserName(u)??null)}</span>
|
||||
<span class="cell type">${s(h.type,i)}</span>
|
||||
<span class="due-cell" @click=${()=>this._showTask(e.entry_id,h.id)}>
|
||||
<span class="due-text">${Re(h.days_until_due,i)}</span>
|
||||
${h.trigger_config?Ut(h):p}
|
||||
${Bt(h,this._miniStatsData,this._lang)}
|
||||
${h.trigger_config?Wt(h):p}
|
||||
${Kt(h,this._miniStatsData,this._lang)}
|
||||
</span>
|
||||
<span class="row-actions">
|
||||
<mwc-icon-button class="btn-complete" title="${s("complete",i)}" @click=${u=>{u.stopPropagation(),this._openCompleteDialog(e.entry_id,h.id,h.name,this._features.checklists?h.checklist:void 0,this._features.adaptive&&!!h.adaptive_config?.enabled)}}>
|
||||
@@ -8553,7 +8598,7 @@ ${h?`<div class="sub">${h}</div>`:""}
|
||||
`}_toggleMoreMenu(){if(this._moreMenuOpen=!this._moreMenuOpen,this._moreMenuOpen){let e=()=>{this._moreMenuOpen=!1,document.removeEventListener("click",e)};setTimeout(()=>document.addEventListener("click",e,{once:!0}),0)}}_closeMoreMenu(){this._moreMenuOpen=!1}get _sparklineCtx(){return{lang:this._lang,detailStatsData:this._detailStatsData,hasStatsService:!!this._statsService,isCounterEntity:e=>this._isCounterEntity(e),rangeDays:this._chartRangeDays,setRangeDays:e=>this._setChartRange(e),hideOutliers:this._hideOutliers,setHideOutliers:e=>this._setHideOutliers(e)}}_toggleSection(e){let t=new Set(this._collapsedSections);t.has(e)?t.delete(e):t.add(e),this._collapsedSections=t;try{localStorage.setItem(B.collapsedSections,JSON.stringify([...t]))}catch{}}_historyCtx(){let e=this._selectedEntryId&&this._selectedTaskId?this._getObject(this._selectedEntryId)?.tasks.find(i=>i.id===this._selectedTaskId):void 0,t=(e?.history||[]).filter(i=>i.reading_value!=null).sort((i,a)=>i.timestamp.localeCompare(a.timestamp));return{lang:this._lang,hass:this.hass,filter:this._historyFilter,search:this._historySearch,currencySymbol:this._budget?.currency_symbol||Se,setFilter:i=>{this._historyFilter=i},setSearch:i=>{this._historySearch=i},openEdit:i=>this._openHistoryEdit(i),readingUnit:e?.reading_unit??null,readingDelta:i=>{let a=t.findIndex(l=>l.timestamp===i.timestamp);return a<=0?null:i.reading_value-t[a-1].reading_value}}}_taskDetailCtx(){let e=this._selectedEntryId,t=this._selectedTaskId,i=this._getObject(e);return{lang:this._lang,hass:this.hass,entryId:e,taskId:t,objectName:i?.object.name||"",objectDocUrl:i?.object?.documentation_url??null,isOperator:this._isOperator,actionLoading:this._actionLoading,moreMenuOpen:this._moreMenuOpen,activeTab:this._activeTab,features:this._features,currencySymbol:this._budget?.currency_symbol||Se,collapsedSections:this._collapsedSections,costDurationToggle:this._costDurationToggle,suggestionDismissed:this._dismissedSuggestions.has(`${e}_${t}`),sparkline:this._sparklineCtx,history:this._historyCtx(),getUserName:a=>this._userService?.getUserName(a)??null,setActiveTab:a=>{this._activeTab=a},toggleSection:a=>this._toggleSection(a),setCostDurationToggle:a=>{this._costDurationToggle=a},showTaskView:()=>{this._view="task"},showObject:()=>this._showObject(e),toggleMoreMenu:()=>this._toggleMoreMenu(),closeMoreMenu:()=>this._closeMoreMenu(),openEdit:a=>{this.shadowRoot.querySelector("maintenance-task-dialog")?.openEdit(e,a)},openComplete:a=>this._openCompleteDialog(e,t,a.name,this._features.checklists?a.checklist:void 0,this._features.adaptive&&!!a.adaptive_config?.enabled),promptSkip:()=>this._promptSkipTask(e,t),toggleArchive:a=>this._toggleArchiveTask(e,t,a),openQr:a=>this._openQrForTask(e,t,i?.object.name||"",a),duplicateTask:()=>this._duplicateTask(e,t),promptReset:()=>this._promptResetTask(e,t),promptPostpone:()=>this._promptPostponeTask(e,t),snoozeTask:()=>this._snoozeTask(e,t),printWorksheet:()=>this._printTaskWorksheet(e,t),deleteTask:()=>this._deleteTask(e,t),applySuggestion:a=>this._applySuggestion(e,t,a),reanalyze:()=>this._reanalyzeInterval(e,t),dismissSuggestion:()=>this._dismissSuggestion(e,t),openSeasonalOverrides:a=>this._openSeasonalOverrides(a)}}_renderTaskDetail(){if(!this._selectedEntryId||!this._selectedTaskId)return p;let e=this._getTask(this._selectedEntryId,this._selectedTaskId);return e?o`<maintenance-task-detail-view
|
||||
.task=${e}
|
||||
.ctx=${this._taskDetailCtx()}
|
||||
></maintenance-task-detail-view>`:o`<p>Task not found.</p>`}_openHistoryEdit(e){if(!this._selectedEntryId||!this._selectedTaskId)return;let t={entry_id:this._selectedEntryId,task_id:this._selectedTaskId,original_timestamp:e.timestamp,type:e.type,timestamp:e.timestamp,notes:e.notes??null,cost:e.cost??null,duration:e.duration??null,completed_by:e.completed_by??null};this.shadowRoot?.querySelector("maintenance-history-edit-dialog")?.openEdit(t)}};E.styles=[ut,bi],d([y({attribute:!1})],E.prototype,"hass",2),d([y({type:Boolean,reflect:!0})],E.prototype,"narrow",2),d([y({attribute:!1})],E.prototype,"panel",2),d([_()],E.prototype,"_objects",2),d([_()],E.prototype,"_stats",2),d([_()],E.prototype,"_view",2),d([_()],E.prototype,"_selectedEntryId",2),d([_()],E.prototype,"_selectedTaskId",2),d([_()],E.prototype,"_filterStatus",2),d([_()],E.prototype,"_filterUser",2),d([_()],E.prototype,"_filterLabel",2),d([_()],E.prototype,"_savedViews",2),d([_()],E.prototype,"_activeViewId",2),d([_()],E.prototype,"_unsub",2),d([_()],E.prototype,"_chartRangeDays",2),d([_()],E.prototype,"_hideOutliers",2),d([_()],E.prototype,"_historyFilter",2),d([_()],E.prototype,"_budget",2),d([_()],E.prototype,"_groups",2),d([_()],E.prototype,"_detailStatsData",2),d([_()],E.prototype,"_miniStatsData",2),d([_()],E.prototype,"_features",2),d([_()],E.prototype,"_adminPanelUserIds",2),d([_()],E.prototype,"_operatorWriteEnabled",2),d([_()],E.prototype,"_defaultWarningDays",2),d([_()],E.prototype,"_actionLoading",2),d([_()],E.prototype,"_moreMenuOpen",2),d([_()],E.prototype,"_toastMessage",2),d([_()],E.prototype,"_toastUndo",2),d([_()],E.prototype,"_overviewTab",2),d([_()],E.prototype,"_activeTab",2),d([_()],E.prototype,"_costDurationToggle",2),d([_()],E.prototype,"_historySearch",2),d([_()],E.prototype,"_sortMode",2),d([_()],E.prototype,"_objectSortMode",2),d([_()],E.prototype,"_groupByMode",2),d([_()],E.prototype,"_objectViewMode",2),d([_()],E.prototype,"_objectsTableColumns",2),d([_()],E.prototype,"_showArchived",2),d([_()],E.prototype,"_bulkMode",2),d([_()],E.prototype,"_bulkSelected",2),d([_()],E.prototype,"_virtStart",2),d([_()],E.prototype,"_virtEnd",2),d([_()],E.prototype,"_collapsedSections",2),d([_()],E.prototype,"_paletteOpen",2),d([_()],E.prototype,"_paletteQuery",2),d([_()],E.prototype,"_paletteActive",2),d([_()],E.prototype,"_templateGalleryOpen",2),d([_()],E.prototype,"_templates",2),d([_()],E.prototype,"_templateCategories",2),d([_()],E.prototype,"_templateBusy",2),E=d([pi("maintenance-supporter-panel")],E);export{E as MaintenanceSupporterPanel};
|
||||
></maintenance-task-detail-view>`:o`<p>Task not found.</p>`}_openHistoryEdit(e){if(!this._selectedEntryId||!this._selectedTaskId)return;let t={entry_id:this._selectedEntryId,task_id:this._selectedTaskId,original_timestamp:e.timestamp,type:e.type,timestamp:e.timestamp,notes:e.notes??null,cost:e.cost??null,duration:e.duration??null,completed_by:e.completed_by??null};this.shadowRoot?.querySelector("maintenance-history-edit-dialog")?.openEdit(t)}};E.styles=[mt,xi],d([y({attribute:!1})],E.prototype,"hass",2),d([y({type:Boolean,reflect:!0})],E.prototype,"narrow",2),d([y({attribute:!1})],E.prototype,"panel",2),d([_()],E.prototype,"_objects",2),d([_()],E.prototype,"_stats",2),d([_()],E.prototype,"_view",2),d([_()],E.prototype,"_selectedEntryId",2),d([_()],E.prototype,"_selectedTaskId",2),d([_()],E.prototype,"_filterStatus",2),d([_()],E.prototype,"_filterUser",2),d([_()],E.prototype,"_filterLabel",2),d([_()],E.prototype,"_savedViews",2),d([_()],E.prototype,"_activeViewId",2),d([_()],E.prototype,"_unsub",2),d([_()],E.prototype,"_chartRangeDays",2),d([_()],E.prototype,"_hideOutliers",2),d([_()],E.prototype,"_historyFilter",2),d([_()],E.prototype,"_budget",2),d([_()],E.prototype,"_groups",2),d([_()],E.prototype,"_detailStatsData",2),d([_()],E.prototype,"_miniStatsData",2),d([_()],E.prototype,"_features",2),d([_()],E.prototype,"_adminPanelUserIds",2),d([_()],E.prototype,"_operatorWriteEnabled",2),d([_()],E.prototype,"_defaultWarningDays",2),d([_()],E.prototype,"_actionLoading",2),d([_()],E.prototype,"_moreMenuOpen",2),d([_()],E.prototype,"_toastMessage",2),d([_()],E.prototype,"_toastUndo",2),d([_()],E.prototype,"_overviewTab",2),d([_()],E.prototype,"_activeTab",2),d([_()],E.prototype,"_costDurationToggle",2),d([_()],E.prototype,"_historySearch",2),d([_()],E.prototype,"_sortMode",2),d([_()],E.prototype,"_objectSortMode",2),d([_()],E.prototype,"_groupByMode",2),d([_()],E.prototype,"_objectViewMode",2),d([_()],E.prototype,"_objectsTableColumns",2),d([_()],E.prototype,"_showArchived",2),d([_()],E.prototype,"_bulkMode",2),d([_()],E.prototype,"_bulkSelected",2),d([_()],E.prototype,"_virtStart",2),d([_()],E.prototype,"_virtEnd",2),d([_()],E.prototype,"_collapsedSections",2),d([_()],E.prototype,"_paletteOpen",2),d([_()],E.prototype,"_paletteQuery",2),d([_()],E.prototype,"_paletteActive",2),d([_()],E.prototype,"_templateGalleryOpen",2),d([_()],E.prototype,"_templates",2),d([_()],E.prototype,"_templateCategories",2),d([_()],E.prototype,"_templateBusy",2),E=d([_i("maintenance-supporter-panel")],E);export{E as MaintenanceSupporterPanel};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as f}from"./chunk-ELFU7VML.js";import{a as h,b as o,d as b,e as m,f as g,g as n,h as _,i as a,k as v,s as p}from"./chunk-K74DD3QA.js";import{a as i}from"./chunk-PEGRBZWY.js";var s=class extends m{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=parseFloat(this._localMonthly),e=parseFloat(this._localYearly),r={};!isNaN(t)&&t>=0&&(r.budget_monthly=t),!isNaN(e)&&e>=0&&(r.budget_yearly=e),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:r}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._status;if(!e)return o`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=e.currency_symbol||_,l=e.monthly_budget?Math.min(100,(e.monthly_spent||0)/e.monthly_budget*100):0,d=e.yearly_budget?Math.min(100,(e.yearly_spent||0)/e.yearly_budget*100):0,u=l>=100?"danger":l>=80?"warning":"ok",y=d>=100?"danger":d>=80?"warning":"ok";return o`
|
||||
import{a as f}from"./chunk-MLZYQIUF.js";import{a as h,b as o,d as b,e as m,f as g,g as n,h as _,i as a,k as v,s as p}from"./chunk-XJVTMRPN.js";import{a as i}from"./chunk-PEGRBZWY.js";var s=class extends m{constructor(){super(...arguments);this._config={type:""};this._status=null;this._busy=!1;this._error="";this._localMonthly="";this._localYearly="";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),v(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"});this._status=t,this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1}catch(t){this._error=p(t,this._lang)}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=parseFloat(this._localMonthly),e=parseFloat(this._localYearly),r={};!isNaN(t)&&t>=0&&(r.budget_monthly=t),!isNaN(e)&&e>=0&&(r.budget_yearly=e),await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/global/update",settings:r}),await this._load()}catch(t){this._error=p(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_budget"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._status;if(!e)return o`<ha-card><div class="loading">${a("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=e.currency_symbol||_,l=e.monthly_budget?Math.min(100,(e.monthly_spent||0)/e.monthly_budget*100):0,d=e.yearly_budget?Math.min(100,(e.yearly_spent||0)/e.yearly_budget*100):0,u=l>=100?"danger":l>=80?"warning":"ok",y=d>=100?"danger":d>=80?"warning":"ok";return o`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as r}from"./chunk-K74DD3QA.js";var a=r`
|
||||
import{a as r}from"./chunk-XJVTMRPN.js";var a=r`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
+14
-7
@@ -1,8 +1,8 @@
|
||||
var L=globalThis,D=L.ShadowRoot&&(L.ShadyCSS===void 0||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,F=Symbol(),re=new WeakMap,$=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==F)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(D&&e===void 0){let o=t!==void 0&&t.length===1;o&&(e=re.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&re.set(t,e))}return e}toString(){return this.cssText}},ne=r=>new $(typeof r=="string"?r:r+"",void 0,F),M=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((o,n,a)=>o+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new $(t,r,F)},ae=(r,e)=>{if(D)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let o=document.createElement("style"),n=L.litNonce;n!==void 0&&o.setAttribute("nonce",n),o.textContent=t.cssText,r.appendChild(o)}},B=D?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let o of e.cssRules)t+=o.cssText;return ne(t)})(r):r;var{is:Ee,defineProperty:Ce,getOwnPropertyDescriptor:Te,getOwnPropertyNames:je,getOwnPropertySymbols:Ne,getPrototypeOf:Re}=Object,U=globalThis,ie=U.trustedTypes,ze=ie?ie.emptyScript:"",Pe=U.reactiveElementPolyfillSupport,E=(r,e)=>r,C={toAttribute(r,e){switch(e){case Boolean:r=r?ze:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},q=(r,e)=>!Ee(r,e),se={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:q};Symbol.metadata??=Symbol("metadata"),U.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let o=Symbol(),n=this.getPropertyDescriptor(e,o,t);n!==void 0&&Ce(this.prototype,e,n)}}static getPropertyDescriptor(e,t,o){let{get:n,set:a}=Te(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:n,set(i){let l=n?.call(this);a?.call(this,i),this.requestUpdate(e,l,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??se}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=Re(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let t=this.properties,o=[...je(t),...Ne(t)];for(let n of o)this.createProperty(n,t[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[o,n]of t)this.elementProperties.set(o,n)}this._$Eh=new Map;for(let[t,o]of this.elementProperties){let n=this._$Eu(t,o);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let o=new Set(e.flat(1/0).reverse());for(let n of o)t.unshift(B(n))}else e!==void 0&&t.push(B(e));return t}static _$Eu(e,t){let o=t.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ae(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,o){this._$AK(e,o)}_$ET(e,t){let o=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,o);if(n!==void 0&&o.reflect===!0){let a=(o.converter?.toAttribute!==void 0?o.converter:C).toAttribute(t,o.type);this._$Em=e,a==null?this.removeAttribute(n):this.setAttribute(n,a),thLine truncated
|
||||
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,de=/-->/g,pe=/>/g,b=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),_e=/'/g,ue=/"/g,fe=/^(?:script|style|textarea|title)$/i,X=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ze=X(1),Xe=X(2),et=X(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),he=new WeakMap,y=v.createTreeWalker(v,129);function be(r,e){if(!Z(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ce!==void 0?ce.createHTML(e):e}var De=(r,e)=>{let t=r.length-1,o=[],n,a=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=r[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=de:_[1]!==void 0?i=pe:_[2]!==void 0?(fe.test(_[2])&&(n=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=n??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?ue:_e):i===ue||i===_e?i=b:i===de||i===pe?i=T:(i=b,n=void 0);let m=i===b&&r[l+1].startsWith("/>")?" ":"";a+=i===T?s+Oe:c>=0?(o.push(d),s.slice(0,c)+ge+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[be(r,a+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),o]},R=class r{constructor({strings:e,_$litType$:t},o){let n;this.parts=[];let a=0,i=0,l=e.length-1,s=this.parts,[d,_]=De(e,t);if(this.el=r.createElement(d,o),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=y.nextNode())!==null&&s.length<l;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(ge)){let h=_[i++],m=n.getAttribute(c).split(f),O=/([.?@])?(.*)/.exec(h);s.push({type:1,index:a,name:O[2],strings:m,ctor:O[1]==="."?V:O[1]==="?"?Q:O[1]==="@"?K:S}),n.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:a}),n.removeAttribute(c));if(fe.test(n.tagName)){let c=n.textContent.split(f),h=c.length-1;if(h>0){n.textContent=H?H.emptyScript:"";for(let m=0;m<h;m++)n.append(c[m],j()),y.nextNode(),s.push({type:2,index:++a});n.append(c[h],j())}}}else if(n.nodeType===8)if(n.data===me)s.push({type:2,index:a});else{let c=-1;for(;(c=n.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:a}),c+=f.length-1}a++}}static createElement(e,t){let o=v.createElement("template");return o.innerHTML=e,o}};function k(r,e,t=r,o){if(e===x)return e;let n=o!==void 0?t._$Co?.[o]:t._$Cl,a=N(e)?void 0:e._$litDirective$;return n?.constructor!==a&&(n?._$AO?.(!1),a===void 0?n=void 0:(n=new a(r),n._$AT(r,t,o)),o!==void 0?(t._$Co??=[])[o]=n:t._$Cl=n),n!==void 0&&(e=k(r,n._$AS(r,e.values),n,o)),e}var G=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:o}=this._$AD,n=(e?.creationScope??v).importNode(t,!0);y.currentNode=n;let a=y.nextNode(),i=0,l=0,s=o[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new z(a,a.nextSibling,this,e):s.type===1?d=new s.ctor(a,s.name,s.strings,this,e):s.type===6&&(d=new J(a,this,e)),this._$AV.push(d),s=o[++l]}i!==s?.index&&(a=y.nextNode(),i++)}return y.currentNode=v,n}p(e){let t=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}},z=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,n){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),N(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Le(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:o}=e,n=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=R.createElement(be(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===n)this._$AH.p(t);else{let a=new G(n,this),i=a.u(this.options);a.p(t),this.T(i),this._$AH=a}}_$AC(e){let t=he.get(e.strings);return t===void 0&&he.set(e.strings,t=new R(e)),t}k(e){Z(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,o,n=0;for(let a of e)n===t.length?t.push(o=new r(this.O(j()),this.O(j()),this,this.options)):o=t[n],o._$AI(a),n++;n<t.length&&(this._$AR(o&&o._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let o=le(e).nextSibling;le(e).remove(),e=o}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,o,n,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=Line truncated
|
||||
var D=globalThis,L=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,B=Symbol(),ne=new WeakMap,$=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==B)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(L&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ne.set(t,e))}return e}toString(){return this.cssText}},ae=o=>new $(typeof o=="string"?o:o+"",void 0,B),M=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,n,a)=>r+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+o[a+1],o[0]);return new $(t,o,B)},ie=(o,e)=>{if(L)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),n=D.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,o.appendChild(r)}},W=L?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ae(t)})(o):o;var{is:Te,defineProperty:je,getOwnPropertyDescriptor:Ne,getOwnPropertyNames:Pe,getOwnPropertySymbols:Re,getPrototypeOf:ze}=Object,U=globalThis,se=U.trustedTypes,Oe=se?se.emptyScript:"",De=U.reactiveElementPolyfillSupport,E=(o,e)=>o,C={toAttribute(o,e){switch(e){case Boolean:o=o?Oe:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch{t=null}}return t}},q=(o,e)=>!Te(o,e),le={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:q};Symbol.metadata??=Symbol("metadata"),U.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=le){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);n!==void 0&&je(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:a}=Ne(this.prototype,e)??{get(){return this[t]},set(i){this[t]=i}};return{get:n,set(i){let l=n?.call(this);a?.call(this,i),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??le}static _$Ei(){if(this.hasOwnProperty(E("elementProperties")))return;let e=ze(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(E("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(E("properties"))){let t=this.properties,r=[...Pe(t),...Re(t)];for(let n of r)this.createProperty(n,t[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,n]of t)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let n=this._$Eu(t,r);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(W(n))}else e!==void 0&&t.push(W(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ie(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(n!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:C).toAttribute(t,r.type);this._$Em=e,a==null?this.removeAttribute(n):this.setAttribute(n,a),thLine truncated
|
||||
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pe=/-->/g,_e=/>/g,b=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ue=/'/g,he=/"/g,be=/^(?:script|style|textarea|title)$/i,ee=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),ot=ee(1),rt=ee(2),nt=ee(3),x=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ge=new WeakMap,y=v.createTreeWalker(v,129);function ye(o,e){if(!X(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return de!==void 0?de.createHTML(e):e}var Ue=(o,e)=>{let t=o.length-1,r=[],n,a=e===2?"<svg>":e===3?"<math>":"",i=T;for(let l=0;l<t;l++){let s=o[l],d,_,c=-1,h=0;for(;h<s.length&&(i.lastIndex=h,_=i.exec(s),_!==null);)h=i.lastIndex,i===T?_[1]==="!--"?i=pe:_[1]!==void 0?i=_e:_[2]!==void 0?(be.test(_[2])&&(n=RegExp("</"+_[2],"g")),i=b):_[3]!==void 0&&(i=b):i===b?_[0]===">"?(i=n??T,c=-1):_[1]===void 0?c=-2:(c=i.lastIndex-_[2].length,d=_[1],i=_[3]===void 0?b:_[3]==='"'?he:ue):i===he||i===ue?i=b:i===pe||i===_e?i=T:(i=b,n=void 0);let m=i===b&&o[l+1].startsWith("/>")?" ":"";a+=i===T?s+Le:c>=0?(r.push(d),s.slice(0,c)+me+s.slice(c)+f+m):s+f+(c===-2?l:m)}return[ye(o,a+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},P=class o{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,i=0,l=e.length-1,s=this.parts,[d,_]=Ue(e,t);if(this.el=o.createElement(d,r),y.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=y.nextNode())!==null&&s.length<l;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(me)){let h=_[i++],m=n.getAttribute(c).split(f),O=/([.?@])?(.*)/.exec(h);s.push({type:1,index:a,name:O[2],strings:m,ctor:O[1]==="."?Q:O[1]==="?"?Y:O[1]==="@"?K:S}),n.removeAttribute(c)}else c.startsWith(f)&&(s.push({type:6,index:a}),n.removeAttribute(c));if(be.test(n.tagName)){let c=n.textContent.split(f),h=c.length-1;if(h>0){n.textContent=H?H.emptyScript:"";for(let m=0;m<h;m++)n.append(c[m],j()),y.nextNode(),s.push({type:2,index:++a});n.append(c[h],j())}}}else if(n.nodeType===8)if(n.data===fe)s.push({type:2,index:a});else{let c=-1;for(;(c=n.data.indexOf(f,c+1))!==-1;)s.push({type:7,index:a}),c+=f.length-1}a++}}static createElement(e,t){let r=v.createElement("template");return r.innerHTML=e,r}};function k(o,e,t=o,r){if(e===x)return e;let n=r!==void 0?t._$Co?.[r]:t._$Cl,a=N(e)?void 0:e._$litDirective$;return n?.constructor!==a&&(n?._$AO?.(!1),a===void 0?n=void 0:(n=new a(o),n._$AT(o,t,r)),r!==void 0?(t._$Co??=[])[r]=n:t._$Cl=n),n!==void 0&&(e=k(o,n._$AS(o,e.values),n,r)),e}var V=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??v).importNode(t,!0);y.currentNode=n;let a=y.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let d;s.type===2?d=new R(a,a.nextSibling,this,e):s.type===1?d=new s.ctor(a,s.name,s.strings,this,e):s.type===6&&(d=new J(a,this,e)),this._$AV.push(d),s=r[++l]}i!==s?.index&&(a=y.nextNode(),i++)}return y.currentNode=v,n}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},R=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=p,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),N(e)?e===p||e==null||e===""?(this._$AH!==p&&this._$AR(),this._$AH=p):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Me(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==p&&N(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=P.createElement(ye(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let a=new V(n,this),i=a.u(this.options);a.p(t),this.T(i),this._$AH=a}}_$AC(e){let t=ge.get(e.strings);return t===void 0&&ge.set(e.strings,t=new P(e)),t}k(e){X(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new o(this.O(j()),this.O(j()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=ce(e).nextSibling;ce(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._Line truncated
|
||||
Replace seal
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_optional:"Due at time (optional, HH:MM)",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",for_at_least_minutes:"For at least (minutes)",safety_interval_days:"Safety interval (days, optional)",safety_interval:"Safety interval (optional)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_window_7:"7 days",cal_window_14:"14 days",cal_window_30:"30 days",cal_window_365:"1 year",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Sel
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -13,7 +13,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-family: inherit; width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.field-input:focus { outline: none; border-color: var(--primary-color); }
|
||||
`,Xt=M`
|
||||
`,ro=M`
|
||||
:host {
|
||||
--maint-ok-color: var(--success-color, #4caf50);
|
||||
--maint-due-soon-color: var(--warning-color, #ff9800);
|
||||
@@ -1143,10 +1143,17 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.sparkline-svg { height: 100px; }
|
||||
|
||||
.stats-bar { gap: 8px; padding: 12px; }
|
||||
.stat-item { min-width: 60px; }
|
||||
/* min-width: 0 (NOT a fixed floor) — a fixed min-width re-enables the
|
||||
grid's auto minimum, so the 5 KPI tracks couldn't shrink below their
|
||||
label text and the last KPI clipped off-screen on phones (the header
|
||||
only *looked* cut — .content scrolls sideways, but nothing hints so).
|
||||
With 0 the tracks compress and the labels wrap to a second line. */
|
||||
.stat-item { min-width: 0; }
|
||||
.stat-item.clickable { padding: 4px 4px; }
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var We={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"};function Ge(r,e){let t=We[r];if(!t)return r;let o=u(t,e);return o&&o!==t?o:r}function Ve(r){let t=r.match(/data\['([^']+)'\]/)?.[1],o;return(o=r.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:o[1]}:(o=r.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:o[1]}:(o=r.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:o[1]}:(o=r.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:o[1]}:/required key not provided/.test(r)?{field:t,rule:"required"}:(o=r.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:o[1]}:/value must be one of/.test(r)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(r)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function ro(r,e,t){if(t=t??u("action_error",e),typeof r=="string")return r;if(typeof r!="object"||r===null)return t;let o=r,n=o.message||o.error?.message||"";if(!n)return t;let a=Ve(n),i=a.field?Ge(a.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",a.param??"");switch(a.rule){case"too_long":return l("err_too_long");case"too_short":return l("err_too_short");case"value_too_high":return l("err_value_too_high");case"value_too_low":return l("err_value_too_low");case"required":return l("err_required");case"wrong_type":return l("err_wrong_type").replace("{type}",a.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return n||t}}export{M as a,Ze as b,Xe as c,p as d,A as e,ve as f,mt as g,Gt as h,u as i,Vt as j,Qt as k,we as l,Kt as m,Se as n,Jt as o,Yt as p,Zt as q,Xt as r,ro as s};
|
||||
`;var Ye={name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",group_name:"name",group_description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_for_minutes:"trigger_for_minutes"};function Ke(o,e){let t=Ye[o];if(!t)return o;let r=u(t,e);return r&&r!==t?r:o}function Je(o){let t=o.match(/data\['([^']+)'\]/)?.[1],r;return(r=o.match(/length of value must be at most (\d+)/))?{field:t,rule:"too_long",param:r[1]}:(r=o.match(/length of value must be at least (\d+)/))?{field:t,rule:"too_short",param:r[1]}:(r=o.match(/value must be at most (\S+)/))?{field:t,rule:"value_too_high",param:r[1]}:(r=o.match(/value must be at least (\S+)/))?{field:t,rule:"value_too_low",param:r[1]}:/required key not provided/.test(o)?{field:t,rule:"required"}:(r=o.match(/expected (\w+)/))?{field:t,rule:"wrong_type",param:r[1]}:/value must be one of/.test(o)?{field:t,rule:"invalid_choice"}:/not a valid value/.test(o)?{field:t,rule:"invalid_value"}:{field:t,rule:"unknown"}}function so(o,e,t){if(t=t??u("action_error",e),typeof o=="string")return o;if(typeof o!="object"||o===null)return t;let r=o,n=r.message||r.error?.message||"";if(!n)return t;let a=Je(n),i=a.field?Ke(a.field,e):"",l=s=>u(s,e).replace("{field}",i).replace("{n}",a.param??"");switch(a.rule){case"too_long":return l("err_too_long");case"too_short":return l("err_too_short");case"value_too_high":return l("err_value_too_high");case"value_too_low":return l("err_value_too_low");case"required":return l("err_required");case"wrong_type":return l("err_wrong_type").replace("{type}",a.param??"");case"invalid_choice":return l("err_invalid_choice");case"invalid_value":return l("err_invalid_value");default:return n||t}}export{M as a,ot as b,rt as c,p as d,A as e,xe as f,vt as g,Kt as h,u as i,Jt as j,Zt as k,ke as l,Xt as m,Ae as n,eo as o,to as p,oo as q,ro as r,so as s};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
import{a as w,b as r,c as N,d as c,e as E,f as g,g as l,i as s,j as Z,k as J,l as U,m as X,n as Q,o as tt,p as et,q as it,r as st,s as I}from"./chunk-K74DD3QA.js";import{a,b as V}from"./chunk-PEGRBZWY.js";var T=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(t){let e=t.target.value;this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e}}))}render(){return r`
|
||||
import{a as w,b as r,c as N,d as c,e as E,f as g,g as l,i as s,j as Z,k as J,l as U,m as X,n as Q,o as tt,p as et,q as it,r as st,s as I}from"./chunk-XJVTMRPN.js";import{a,b as V}from"./chunk-PEGRBZWY.js";var T=class extends E{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1}_onInput(t){let e=t.target.value;this.value=e,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:e}}))}render(){return r`
|
||||
<label class="field">
|
||||
${this.label?r`<span class="label">${this.label}${this.required?r`<span class="req">*</span>`:c}</span>`:c}
|
||||
<input
|
||||
@@ -1822,7 +1822,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
${ct.map((S,P)=>r`<span class="seasonal-label ${P===i?"active-month":""}">${s(S,d)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var k=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(t,e){this._entryId=t,this._taskId=e,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});t?.features&&(this._features={...this._features,...t.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=t.object?.name||"";let e=(t.tasks||[]).find(i=>i.id===this._taskId);this._task=e??null}catch(t){this._error=I(t,this._lang)}}async _runWs(t){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(t),this._busy=!1,!0}catch(e){return this._error=I(e,this._lang),this._busy=!1,!1}}_notifyChanged(t){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:t},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-ZZQ2BDDI.js").then(({openCompleteDialog:t})=>{t({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-ZZQ2BDDI.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-ZZQ2BDDI.js").then(({openQrDialog:t})=>{t({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let t=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(t))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let t=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",t),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=s("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=t.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${t.recommended_interval}d (${t.data_points} pts)`:s("reanalyze_insufficient_data",this._lang)||"Not enough data",await this._loadTask(),setTimeout(()=>{this._toast=""},3500)}catch(t){this._error=I(t,this._lang)}finally{this._busy=!1}}}_onEditHistoryEntry(
Line truncated
|
||||
`}var k=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1}get _lang(){return this.hass?.language||"en"}async openFor(t,e){this._entryId=t,this._taskId=e,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=new Date().toISOString().slice(0,10),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});t?.features&&(this._features={...this._features,...t.features}),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=t.object?.name||"";let e=(t.tasks||[]).find(i=>i.id===this._taskId);this._task=e??null}catch(t){this._error=I(t,this._lang)}}async _runWs(t){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(t),this._busy=!1,!0}catch(e){return this._error=I(e,this._lang),this._busy=!1,!1}}_notifyChanged(t){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:t},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-VJ6O3DI6.js").then(({openCompleteDialog:t})=>{t({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,checklist:this._task.checklist||[],adaptive_enabled:!!this._task.adaptive_config?.enabled})&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-VJ6O3DI6.js").then(({openEditTaskDialog:t})=>{t(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-VJ6O3DI6.js").then(({openQrDialog:t})=>{t({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let t=s("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(t))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let t=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",t),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=s("suggestion_applied",this._lang)||"Applied",this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=t.recommended_interval?`${s("reanalyze_result",this._lang)||"Recomputed"}: ${t.recommended_interval}d (${t.data_points} pts)`:s("reanalyze_insufficient_data",this._lang)||"Not enough data",await this._loadTask(),setTimeout(()=>{this._toast=""},3500)}catch(t){this._error=I(t,this._lang)}finally{this._busy=!1}}}_onEditHistoryEntry(
Line truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",e)}</h4>
|
||||
${dt(t.interval_days,t.suggested_interval,t.interval_confidence||"medium",e)}
|
||||
@@ -1906,7 +1906,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
<span class="task-name">${e.name}</span>
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-ZZQ2BDDI.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-VJ6O3DI6.js").then(({openObjectQuickActions:n})=>{n(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${e.next_due?r`<span><strong>${s("next_due",t)||"Next due"}:</strong> ${U(e.next_due,t)}</span>`:c}
|
||||
@@ -2183,7 +2183,7 @@ ${m?`<div class="sub">${m}</div>`:""}
|
||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||
`],a([g({attribute:!1})],k.prototype,"hass",2),a([l()],k.prototype,"_open",2),a([l()],k.prototype,"_entryId",2),a([l()],k.prototype,"_taskId",2),a([l()],k.prototype,"_task",2),a([l()],k.prototype,"_objectName",2),a([l()],k.prototype,"_busy",2),a([l()],k.prototype,"_error",2),a([l()],k.prototype,"_showSkip",2),a([l()],k.prototype,"_showReset",2),a([l()],k.prototype,"_showDetails",2),a([l()],k.prototype,"_showAdaptive",2),a([l()],k.prototype,"_skipReason",2),a([l()],k.prototype,"_resetDate",2),a([l()],k.prototype,"_features",2),a([l()],k.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function _t(o){return!!o&&/^https?:\/\//i.test(o)}var H=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(t){this._entryId=t,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=t}catch(t){this._error=I(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-ZZQ2BDDI.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-ZZQ2BDDI.js").then(({openCreateTaskDialog:t})=>{t(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let t=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(t)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(e){this._error=I(e,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let t=!!this._data.object.archived;if(!t){let e=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(e))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:t?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(e){this._error=I(e,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-ZZQ2BDDI.js").then(({openTaskQuickActions:e})=>{e(this._entryId,t)})}render(){if(!this._open)return c;let t=this._lang,e=this._data,i=e?.object,n=e?.tasks||[],h=this.hass?.user?.is_admin??!0;return r`
|
||||
`],a([g({attribute:!1})],k.prototype,"hass",2),a([l()],k.prototype,"_open",2),a([l()],k.prototype,"_entryId",2),a([l()],k.prototype,"_taskId",2),a([l()],k.prototype,"_task",2),a([l()],k.prototype,"_objectName",2),a([l()],k.prototype,"_busy",2),a([l()],k.prototype,"_error",2),a([l()],k.prototype,"_showSkip",2),a([l()],k.prototype,"_showReset",2),a([l()],k.prototype,"_showDetails",2),a([l()],k.prototype,"_showAdaptive",2),a([l()],k.prototype,"_skipReason",2),a([l()],k.prototype,"_resetDate",2),a([l()],k.prototype,"_features",2),a([l()],k.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",k);function _t(o){return!!o&&/^https?:\/\//i.test(o)}var H=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return this.hass?.language||"en"}async openFor(t){this._entryId=t,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=t}catch(t){this._error=I(t,this._lang)}}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-VJ6O3DI6.js").then(({openEditObjectDialog:t})=>{t(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-VJ6O3DI6.js").then(({openCreateTaskDialog:t})=>{t(),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let t=s("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(t)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(e){this._error=I(e,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let t=!!this._data.object.archived;if(!t){let e=s("confirm_archive_object",this._lang)||"Archive this object and its tasks?";if(!window.confirm(e))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:t?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(e){this._error=I(e,this._lang)}finally{this._busy=!1}}_onTaskClick(t){this._entryId&&import("./dialog-mount-VJ6O3DI6.js").then(({openTaskQuickActions:e})=>{e(this._entryId,t)})}render(){if(!this._open)return c;let t=this._lang,e=this._data,i=e?.object,n=e?.tasks||[],h=this.hass?.user?.is_admin??!0;return r`
|
||||
<div class="backdrop" @click=${this.close}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true">
|
||||
${e&&i?r`
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as m}from"./chunk-ELFU7VML.js";import{a as u,b as s,d as l,e as h,f as g,g as o,i,k as _,s as p}from"./chunk-K74DD3QA.js";import{a}from"./chunk-PEGRBZWY.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),_(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
import{a as m}from"./chunk-MLZYQIUF.js";import{a as u,b as s,d as l,e as h,f as g,g as o,i,k as _,s as p}from"./chunk-XJVTMRPN.js";import{a}from"./chunk-PEGRBZWY.js";var e=class extends h{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),_(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"});this._groups=t.groups||{},this._loaded=!0}catch(t){this._error=p(t,this._lang)}}async _addGroup(){if(!this._isAdmin)return;let t=this._newName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/create",name:t}),this._newName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._isAdmin||!this._editingId)return;let t=this._editingName.trim();if(t){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t}),this._editingId=null,this._editingName="",await this._load()}catch(r){this._error=p(r,this._lang)}finally{this._busy=!1}}}async _deleteGroup(t,r){if(!this._isAdmin)return;let n=(i("group_delete_confirm",this._lang)||'Delete group "{name}"?').replace("{name}",r);if(window.confirm(n)){this._busy=!0;try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/group/delete",group_id:t}),await this._load()}catch(d){this._error=p(d,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_groups"),window.dispatchEvent(new CustomEvent("location-changed"))}_onKeyDown(t,r){t.key==="Enter"?(t.preventDefault(),r()):t.key==="Escape"&&(t.preventDefault(),this._editingId=null,this._editingName="")}render(){let t=this._lang;if(!this._loaded)return s`<ha-card><div class="loading">${i("loading",t)||"Loading\u2026"}</div></ha-card>`;let r=Object.keys(this._groups);return s`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import{a as m}from"./chunk-ELFU7VML.js";import{a as h,b as n,d as c,e as _,f as v,g as r,i as e,k as f,s as l}from"./chunk-K74DD3QA.js";import{a as i}from"./chunk-PEGRBZWY.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),f(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,b=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",g=p?"active":d?"scheduled":"inactive";return n`
|
||||
import{a as m}from"./chunk-MLZYQIUF.js";import{a as h,b as n,d as c,e as _,f as v,g as r,i as e,k as f,s as l}from"./chunk-XJVTMRPN.js";import{a as i}from"./chunk-PEGRBZWY.js";var a=class extends _{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer=7;this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return this.hass?.language||"en"}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),f(this._lang).then(()=>this.requestUpdate()))}async _load(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/state"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=t.buffer_days??7,this._dirty=!1}catch(t){this._error=l(t,this._lang)}}async _toggleEnabled(t){this._busy=!0,this._error="";try{let s=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",enabled:t});this._state=s}catch(s){this._error=l(s,this._lang)}finally{this._busy=!1}}async _save(){if(this._isAdmin){this._busy=!0,this._error="";try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:this._localBuffer});this._state=t,this._dirty=!1}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}async _endNow(){if(this._isAdmin&&window.confirm(e("vacation_end_now_confirm",this._lang)||"End vacation immediately?")){this._busy=!0;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/vacation/end_now"});this._state=t,this._localStart=t.start||"",this._localEnd=t.end||""}catch(t){this._error=l(t,this._lang)}finally{this._busy=!1}}}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,s=this._state;if(!s)return n`<ha-card><div class="loading">${e("loading",t)||"Loading\u2026"}</div></ha-card>`;let p=s.is_active===!0,d=s.enabled===!0,u=s.exempt_task_ids?.length??0,b=p?e("vacation_status_active",t)||"Active now":d?e("vacation_status_scheduled",t)||"Scheduled":e("vacation_status_inactive",t)||"Inactive",g=p?"active":d?"scheduled":"inactive";return n`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+1
-1
@@ -21,4 +21,4 @@ import{c as y}from"./chunks/chunk-PEGRBZWY.js";var L="maintenance-supporter",G=`
|
||||
The "Overview" view is always first. Empty groups are skipped.
|
||||
</div>
|
||||
</div>
|
||||
`;let t=this.querySelector("#group-by");t?.addEventListener("change",()=>{let o={...this._config,group_by:t.value};this._config=o,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:o},bubbles:!0,composed:!0}))})}},I="maintenance-supporter-section",Q=`ll-strategy-section-${I}`,v=class extends HTMLElement{static async generate(i,e){let s={type:"custom:maintenance-supporter-card",show_header:!1};i?.filter_status?.length&&(s.filter_status=i.filter_status),i?.max_items&&(s.max_items=i.max_items),i?.filter_due_min_days!==void 0&&(s.filter_due_min_days=i.filter_due_min_days),i?.filter_due_max_days!==void 0&&(s.filter_due_max_days=i.filter_due_max_days);let t=i?.filter_objects;if(i?.area_id&&!t)try{t=((await e.connection.sendMessagePromise({type:"maintenance_supporter/objects"})).objects||[]).filter(r=>r.object.area_id===i.area_id).map(r=>r.object.name)}catch{}t&&t.length>0&&(s.filter_objects=t);let o=[];return i?.title&&o.push({type:"heading",heading:i.title,heading_style:"title"}),o.push(s),{type:"grid",cards:o}}},D="2.3.6",X="[maintenance-supporter]";function M(n,i){try{return customElements.get(n)?"skipped":(customElements.define(n,i),"ok")}catch(e){return`ERROR: ${String(e)}`}}var P={editor:M(x,w),section:M(Q,v)};console.log(`${X} strategy bundle v${D} loaded \u2014 registrations:`,P,"\u2014 run maintenanceSupporterDiagnose() in console for full state");window.maintenanceSupporterDiagnose=async()=>{let n=G,i=[];try{let e=document.querySelector("home-assistant");e?.hass&&(i=(await e.hass.connection.sendMessagePromise({type:"lovelace/resources"})).resources||[])}catch(e){i=[{url:`<error: ${String(e)}>`}]}return{version:D,el_registered:!!customElements.get(n),el_class_excerpt:customElements.get(n)?.toString().slice(0,100)||null,customStrategies_dashboard:window.customStrategies?.filter(e=>e.strategyType==="dashboard").map(e=>e.type)||[],scriptTagsInPage:Array.from(document.querySelectorAll("script[type=module]")).map(e=>e.src).filter(e=>/maint|strateg/i.test(e)),lovelaceResources_matching:i.filter(e=>/maint|strateg/i.test(e.url||"")).map(e=>e.url),registrations:P}};var k=class extends HTMLElement{static async generate(i,e){return await import("./chunks/vacation-section-card-CIMYKXDO.js"),{type:"grid",cards:[{type:"custom:maintenance-vacation-section-card",title:i?.title}]}}},C=class extends HTMLElement{static async generate(i,e){return await import("./chunks/budget-section-card-JN6BNICH.js"),{type:"grid",cards:[{type:"custom:maintenance-budget-section-card",title:i?.title}]}}},S=class extends HTMLElement{static async generate(i,e){return await import("./chunks/groups-section-card-KFFRX347.js"),{type:"grid",cards:[{type:"custom:maintenance-groups-section-card",title:i?.title}]}}},j="ll-strategy-section-maintenance-supporter-vacation",R="ll-strategy-section-maintenance-supporter-budget",A="ll-strategy-section-maintenance-supporter-groups";customElements.get(j)||customElements.define(j,k);customElements.get(R)||customElements.define(R,C);customElements.get(A)||customElements.define(A,S);var h=null;function J(){return h||(h=import("./chunks/dialog-mount-ZZQ2BDDI.js").catch(n=>{throw h=null,n})),h}var O="_msSupporterLlCustomBound";function m(n){history.pushState(null,"",n),window.dispatchEvent(new CustomEvent("location-changed"))}function Z(){let n=window;n[O]||(n[O]=!0,document.addEventListener("ll-custom",i=>{let e=i.detail;if(!e||typeof e!="object")return;let s=e.ll_custom,t=s&&typeof s=="object"?s:e;if(!t||typeof t.type!="string"||!t.type.startsWith("maintenance-supporter:"))return;let o=t.type.slice(22);if(o==="deep-link"&&typeof t.path=="string"){m(t.path);return}(async()=>{let a;try{a=await J()}catch{m("/maintenance-supporter");return}if(o==="add-object"){if(a.openCreateObjectDialog())return;m("/maintenance-supporter?ms_action=add_object");return}if(o==="open-task"&&typeof t.entry_id=="string"&&typeof t.task_id=="string"){if(a.openTaskQuickActions(t.entry_id,t.task_id)||a.openEditTaskDialog(t.entry_id,t.task_id))return;m(`/maintenance-supporter?entry_id=${encodeURIComponent(t.entry_id)}&task_id=${encodeURIComponent(t.task_id)}`);return}if(o==="open-object"&&typeof t.entry_id=="string"){if(a.openObjectQuickActions(t.entry_id))return;m(`/maintenance-supporter?entry_id=${encodeURIComponent(t.entry_id)}`);return}if(o==="edit-history"&&typeof t.entry_id=="string"&&typeof t.task_id=="string"&&typeof t.original_timestamp=="string"){let d=document.querySelector("home-assistant")?.hass;if(!d)return;try{let u=(await d.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:t.entry_id})).tasks?.find(p=>p.id===t.task_id)?.history?.find(p=>p.timestamp===t.original_timestamp);if(!u)return;a.openHistoryEditDialog({entry_id:t.entry_id,task_id:t.task_id,original_timestamp:t.original_timestamp,type:u.type||"completed",timestamp:u.timestamp||t.original_timestamp,notes:u.notes??null,cost:u.cost??null,duration:u.duration??null,completed_by:u.completed_by??null})}catch{m("/maintenance-suppor
Line truncated
|
||||
`;let t=this.querySelector("#group-by");t?.addEventListener("change",()=>{let o={...this._config,group_by:t.value};this._config=o,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:o},bubbles:!0,composed:!0}))})}},I="maintenance-supporter-section",Q=`ll-strategy-section-${I}`,v=class extends HTMLElement{static async generate(i,e){let s={type:"custom:maintenance-supporter-card",show_header:!1};i?.filter_status?.length&&(s.filter_status=i.filter_status),i?.max_items&&(s.max_items=i.max_items),i?.filter_due_min_days!==void 0&&(s.filter_due_min_days=i.filter_due_min_days),i?.filter_due_max_days!==void 0&&(s.filter_due_max_days=i.filter_due_max_days);let t=i?.filter_objects;if(i?.area_id&&!t)try{t=((await e.connection.sendMessagePromise({type:"maintenance_supporter/objects"})).objects||[]).filter(r=>r.object.area_id===i.area_id).map(r=>r.object.name)}catch{}t&&t.length>0&&(s.filter_objects=t);let o=[];return i?.title&&o.push({type:"heading",heading:i.title,heading_style:"title"}),o.push(s),{type:"grid",cards:o}}},D="2.3.6",X="[maintenance-supporter]";function M(n,i){try{return customElements.get(n)?"skipped":(customElements.define(n,i),"ok")}catch(e){return`ERROR: ${String(e)}`}}var P={editor:M(x,w),section:M(Q,v)};console.log(`${X} strategy bundle v${D} loaded \u2014 registrations:`,P,"\u2014 run maintenanceSupporterDiagnose() in console for full state");window.maintenanceSupporterDiagnose=async()=>{let n=G,i=[];try{let e=document.querySelector("home-assistant");e?.hass&&(i=(await e.hass.connection.sendMessagePromise({type:"lovelace/resources"})).resources||[])}catch(e){i=[{url:`<error: ${String(e)}>`}]}return{version:D,el_registered:!!customElements.get(n),el_class_excerpt:customElements.get(n)?.toString().slice(0,100)||null,customStrategies_dashboard:window.customStrategies?.filter(e=>e.strategyType==="dashboard").map(e=>e.type)||[],scriptTagsInPage:Array.from(document.querySelectorAll("script[type=module]")).map(e=>e.src).filter(e=>/maint|strateg/i.test(e)),lovelaceResources_matching:i.filter(e=>/maint|strateg/i.test(e.url||"")).map(e=>e.url),registrations:P}};var k=class extends HTMLElement{static async generate(i,e){return await import("./chunks/vacation-section-card-TZDWBB73.js"),{type:"grid",cards:[{type:"custom:maintenance-vacation-section-card",title:i?.title}]}}},C=class extends HTMLElement{static async generate(i,e){return await import("./chunks/budget-section-card-3D2JGOGA.js"),{type:"grid",cards:[{type:"custom:maintenance-budget-section-card",title:i?.title}]}}},S=class extends HTMLElement{static async generate(i,e){return await import("./chunks/groups-section-card-E3ORCIUH.js"),{type:"grid",cards:[{type:"custom:maintenance-groups-section-card",title:i?.title}]}}},j="ll-strategy-section-maintenance-supporter-vacation",R="ll-strategy-section-maintenance-supporter-budget",A="ll-strategy-section-maintenance-supporter-groups";customElements.get(j)||customElements.define(j,k);customElements.get(R)||customElements.define(R,C);customElements.get(A)||customElements.define(A,S);var h=null;function J(){return h||(h=import("./chunks/dialog-mount-VJ6O3DI6.js").catch(n=>{throw h=null,n})),h}var O="_msSupporterLlCustomBound";function m(n){history.pushState(null,"",n),window.dispatchEvent(new CustomEvent("location-changed"))}function Z(){let n=window;n[O]||(n[O]=!0,document.addEventListener("ll-custom",i=>{let e=i.detail;if(!e||typeof e!="object")return;let s=e.ll_custom,t=s&&typeof s=="object"?s:e;if(!t||typeof t.type!="string"||!t.type.startsWith("maintenance-supporter:"))return;let o=t.type.slice(22);if(o==="deep-link"&&typeof t.path=="string"){m(t.path);return}(async()=>{let a;try{a=await J()}catch{m("/maintenance-supporter");return}if(o==="add-object"){if(a.openCreateObjectDialog())return;m("/maintenance-supporter?ms_action=add_object");return}if(o==="open-task"&&typeof t.entry_id=="string"&&typeof t.task_id=="string"){if(a.openTaskQuickActions(t.entry_id,t.task_id)||a.openEditTaskDialog(t.entry_id,t.task_id))return;m(`/maintenance-supporter?entry_id=${encodeURIComponent(t.entry_id)}&task_id=${encodeURIComponent(t.task_id)}`);return}if(o==="open-object"&&typeof t.entry_id=="string"){if(a.openObjectQuickActions(t.entry_id))return;m(`/maintenance-supporter?entry_id=${encodeURIComponent(t.entry_id)}`);return}if(o==="edit-history"&&typeof t.entry_id=="string"&&typeof t.task_id=="string"&&typeof t.original_timestamp=="string"){let d=document.querySelector("home-assistant")?.hass;if(!d)return;try{let u=(await d.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:t.entry_id})).tasks?.find(p=>p.id===t.task_id)?.history?.find(p=>p.timestamp===t.original_timestamp);if(!u)return;a.openHistoryEditDialog({entry_id:t.entry_id,task_id:t.task_id,original_timestamp:t.original_timestamp,type:u.type||"completed",timestamp:u.timestamp||t.original_timestamp,notes:u.notes??null,cost:u.cost??null,duration:u.duration??null,completed_by:u.completed_by??null})}catch{m("/maintenance-suppor
Line truncated
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Loaded 100 of 757 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user