198 files
This commit is contained in:
1 parent
4a64770282
commit
669d229519
198 files changed
+4891
-2815
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as w,b as $}from"./chunk-JDDRFTDX.js";import{B as u,a as h,b as o,d as m,e as y,f as v,g as l,h as g,i as _,j as f,k as x,n as p}from"./chunk-5FHGCMEA.js";import{a as n,g as i}from"./chunk-TAYZJBPE.js";var E=80,s=class extends y{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 f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),_(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){let t=await u(this,{type:"maintenance_supporter/budget_status"},{onError:e=>{this._error=e}});t&&(this._status=t,x(t),this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1)}async _save(){if(!this._isAdmin)return;this._error="";let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),e=this._localYearly.trim()===""?0:parseFloat(this._localYearly),a={};!isNaN(t)&&t>=0&&(a.budget_monthly=t),!isNaN(e)&&e>=0&&(a.budget_yearly=e),await u(this,{type:"maintenance_supporter/global/update",settings:a},{busy:d=>{this._busy=d},reload:()=>this._load(),onError:d=>{this._error=d}})}_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">${i("loading",t)}</div></ha-card>`;let a=g(e),d=e.alert_threshold_pct??E,k=[{label:i("budget_monthly",t),spent:e.monthly_spent||0,budget:e.monthly_budget||0},{label:i("budget_yearly",t),spent:e.yearly_spent||0,budget:e.yearly_budget||0}];return o`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as w,b as $}from"./chunk-2E6THN76.js";import{C as u,a as h,b as o,d as m,f as y,g as v,h as l,i as g,j as _,k as f,l as x,o as p}from"./chunk-XJSTERIM.js";import{a as n,g as i}from"./chunk-IUWFIZIT.js";var E=80,s=class extends y{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 f(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),_(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load())}async _load(){let t=await u(this,{type:"maintenance_supporter/budget_status"},{onError:e=>{this._error=e}});t&&(this._status=t,x(t),this._localMonthly=t.monthly_budget?String(t.monthly_budget):"",this._localYearly=t.yearly_budget?String(t.yearly_budget):"",this._dirty=!1)}async _save(){if(!this._isAdmin)return;this._error="";let t=this._localMonthly.trim()===""?0:parseFloat(this._localMonthly),e=this._localYearly.trim()===""?0:parseFloat(this._localYearly),a={};!isNaN(t)&&t>=0&&(a.budget_monthly=t),!isNaN(e)&&e>=0&&(a.budget_yearly=e),await u(this,{type:"maintenance_supporter/global/update",settings:a},{busy:d=>{this._busy=d},reload:()=>this._load(),onError:d=>{this._error=d}})}_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">${i("loading",t)}</div></ha-card>`;let a=g(e),d=e.alert_threshold_pct??E,k=[{label:i("budget_monthly",t),spent:e.monthly_spent||0,budget:e.monthly_budget||0},{label:i("budget_yearly",t),spent:e.yearly_spent||0,budget:e.yearly_budget||0}];return o`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as t}from"./chunk-5FHGCMEA.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as t}from"./chunk-XJSTERIM.js";function e(o){let r=window;r.customCards=r.customCards||[],r.customCards.some(a=>a.type===o.type)||r.customCards.push(o)}var d=t`
|
||||
ha-card { overflow: hidden; }
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as y,b as s,d,e as g,f as o,g as f,q as m}from"./chunk-5FHGCMEA.js";import{a,g as l}from"./chunk-TAYZJBPE.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as y,b as s,d,f as g,g as o,h as f,r as m}from"./chunk-XJSTERIM.js";import{a,g as l}from"./chunk-IUWFIZIT.js";function $(n){let t=m("2001-02-03",n).match(/\d+/g)||[],e=v=>t.findIndex(_=>Number(_)===v),h=e(2001),c=e(2),u=e(3);return h===0?"YMD":c>=0&&u>=0&&c<u?"MDY":"DMY"}function p(n,i,t){if(n<1e3||n>9999||i<1||i>12||t<1||t>31)return null;let e=new Date(n,i-1,t);return e.getFullYear()!==n||e.getMonth()!==i-1||e.getDate()!==t?null:`${n}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function b(n,i){let t=n.trim(),e;if(e=t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return p(+e[1],+e[2],+e[3]);if(e=t.match(/^(\d{4})$/))return p(+e[1],1,1);if(e=t.match(/^(\d{1,2})[./](\d{4})$/))return p(+e[2],+e[1],1);if(e=t.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return p(+e[3],+e[2],+e[1]);if(e=t.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let h=+e[1],c=+e[2],u=+e[3];return $(i)==="MDY"?p(u,h,c):p(u,c,h)}return null}function x(n,i){if(i)switch(n){case"date":return i.split("T")[0];case"time":return i.length===5?`${i}:00`:i;case"datetime":{let[t,e="00:00:00"]=i.split("T");return`${t} ${e.length===5?`${e}:00`:e}`}}}function k(n,i){if(typeof i!="string"||!i)return"";switch(n){case"date":return i.slice(0,10);case"time":return i.slice(0,5);case"datetime":{let[t,e="00:00:00"]=i.split(" ");return`${t}T${e.length===5?`${e}:00`:e}`}}}var r=class extends g{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let t=b(this._typed,this.lang);if(!t){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(t)}_onTypedKey(t){t.key==="Enter"?(t.preventDefault(),this._commitTyped()):t.key==="Escape"&&(t.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(t){t.stopPropagation(),this._emit(k(this.kind,t.detail?.value))}_clear(){this._emit("")}_emit(t){t!==this.value&&(this.value=t,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:t}})))}render(){return s`
|
||||
<div class="field">
|
||||
${this.label?s`<span class="label">${this.label}${this.required?s`<span class="req">*</span>`:d}</span>`:d}
|
||||
<div class="row">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as u,b as s,d as r,e as _,f as m,g as o,j as d,z as c}from"./chunk-5FHGCMEA.js";import{a as i,g as p}from"./chunk-TAYZJBPE.js";var g={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]};var b=[0,14],x=[0,1440],y=[1,1e4],R=[0,365],A=15,E=[.1,.9],T=[0,365],$=[.01,1e4],G=[.01,1e5];var n=class extends _{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return r;let e=d(this.hass);return s`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{A as c,a as u,b as s,d as r,f as _,g as m,h as o,k as d}from"./chunk-XJSTERIM.js";import{a as i,g as p}from"./chunk-IUWFIZIT.js";var g={default_warning_days:[0,365],default_consumable_threshold:[1,90],battery_low_percent:[1,90],battery_recovered_percent:[20,100],archive_oneoff_days:[0,3650],delete_archived_oneoff_days:[0,3650],notify_due_soon_interval_hours:[0,720],notify_overdue_interval_hours:[0,720],notify_triggered_interval_hours:[0,720],max_notifications_per_day:[0,1e3],notification_bundle_threshold:[2,20],snooze_duration_hours:[1,168],warranty_reminder_days:[1,365],budget_alert_threshold:[10,100],currency_decimals:[0,3]};var b=[0,14],x=[0,1440],y=[1,1e4],R=[0,365],A=15,E=[.1,.9],T=[0,365],$=[.01,1e4],G=[.01,1e5];var n=class extends _{constructor(){super(...arguments);this._open=!1;this._title="";this._message="";this._confirmText="";this._danger=!1;this._inputLabel="";this._inputType="";this._options=null;this._inputValue="";this._resolve=null;this._promptResolve=null}confirm(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel="",this._inputType="",this._options=null,this._inputValue="",this._open=!0,new Promise(t=>{this._resolve=t,this._promptResolve=null})}prompt(e){return this._title=e.title,this._message=e.message,this._confirmText=e.confirmText||"OK",this._danger=e.danger||!1,this._inputLabel=e.inputLabel||"",this._inputType=e.inputType||"text",this._options=e.options&&e.options.length?e.options:null,this._inputValue=e.inputValue||"",this._open=!0,new Promise(t=>{this._promptResolve=t,this._resolve=null})}_cancel(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!1,value:""}),this._promptResolve=null),this._resolve?.(!1),this._resolve=null}_confirmAction(){this._open=!1,this._promptResolve&&(this._promptResolve({confirmed:!0,value:this._inputValue}),this._promptResolve=null),this._resolve?.(!0),this._resolve=null}render(){if(!this._open)return r;let e=d(this.hass);return s`
|
||||
<ha-dialog open @closed=${this._cancel}>
|
||||
<div class="dialog-title">${this._title}</div>
|
||||
<div class="content">
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
var w=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var B=(n,e,t,r)=>{for(var o=r>1?void 0:r?y(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(e,t,o):s(o))||o);return r&&o&&w(e,t,o),o};var W={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},C=["overdue","triggered","due_soon","ok"],j=["overdue","triggered","due_soon"],Y=Object.fromEntries(C.map((n,e)=>[n,e]));var z={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"};var D="2.100.0";var b="en",x=(()=>{let n=window;return n.__msLocales||(n.__msLocales={store:{},inflight:{}}),n.__msLocales})(),l=x.store,m=x.inflight;function q(n){l.en=Object.assign({},n,l.en??{})}var O=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),R="/maintenance_supporter_locales";function _(n){let e=(n||b).toLowerCase();return e.startsWith("pt")&&e.endsWith("br")?"pt-br":e.substring(0,2)}function J(n,e,t){let r=_(e);return l[r]?.[n]??l.en?.[n]??t??n}function Q(n){let e=_(n);return e===b||e in l}function X(n){let e=_(n);return e===b||e in l||!O.has(e)?Promise.resolve():(e in m||(m[e]=fetch(`${R}/${e}.json?v=${D}`).then(t=>t.ok?t.json():null).then(t=>{t?l[e]=t:delete m[e]}).catch(()=>{delete m[e]})),m[e])}var L=window.__msDateTimePrefs??={},$=864e5,a=(n,e=2)=>String(n).padStart(e,"0"),A=new Map;function d(n){let e=A.get(n);if(e===void 0){try{e=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{e=null}A.set(n,e)}return e}var S;function v(){if(S===void 0){let n;try{n=new Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}S=n&&d(n)?n:null}return S}function E(){return v()??"UTC"}function f(){let n=L.serverTimeZone;return n&&d(n)?n:E()}function en(){let n=v();return L.timeZone!=="server"&&n?n:f()}function p(n,e){let t=d(e)??d(E())??d("UTC"),r={};for(let o of t.formatToParts(n))o.type!=="literal"&&(r[o.type]=Number(o.value));return{y:r.year,mo:r.month,d:r.day,h:r.hour%24,mi:r.minute,s:r.second}}var N=n=>`${a(n.y,4)}-${a(n.mo)}-${a(n.d)}`;function M(n,e){return N(p(+n,e))}function I(n,e){let t=p(+n,e);return`${N(t)}T${a(t.h)}:${a(t.mi)}`}function tn(){return M(Date.now(),f())}function rn(){return I(Date.now(),f())}function h(n,e){let t=p(n,e);return Date.UTC(t.y,t.mo-1,t.d,t.h,t.mi,t.s)-Math.floor(n/1e3)*1e3}function P(n,e,t,r,o,i,s){let u=Date.UTC(n,e-1,t,r,o,i),c=h(u-$,s),g=h(u+$,s);for(let T of c===g?[c]:[c,g])if(h(u-T,s)===T)return u-T;return u-c}var U=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/;var Z=new Map,F=2e4;function k(n,e,t){if(n.has(e))return n.get(e);n.size>=F&&n.clear();let r=t();return n.set(e,r),r}function on(n){if(typeof n!="string"||!n)return NaN;let e=U.exec(n);if(!e)return Date.parse(n);let t=f();return k(Z,`${t}|${n}`,()=>{let[r,o,i,s,u,c]=[e[1],e[2],e[3],e[4]??"0",e[5]??"0",e[6]??"0"].map(Number);if(o<1||o>12||new Date(Date.UTC(r,o-1,i)).getUTCDate()!==i||s>23||u>59||c>59)return NaN;let g=e[7]?Math.floor(+`0.${e[7]}`*1e3):0;return P(r,o,i,s,u,c,t)+g})}function sn(n){if(typeof n!="string"||!n)return"";let e=U.exec(n);if(e)return`${e[1]}-${e[2]}-${e[3]}T${e[4]??"00"}:${e[5]??"00"}:${e[6]??"00"}`;let t=Date.parse(n);if(!Number.isFinite(t))return"";let r=p(t,f());return`${N(r)}T${a(r.h)}:${a(r.mi)}:${a(r.s)}`}export{B as a,W as b,j as c,z as d,q as e,_ as f,J as g,Q as h,X as i,f as j,en as k,M as l,I as m,tn as n,rn as o,on as p,sn as q};
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
var w=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var B=(n,e,t,r)=>{for(var o=r>1?void 0:r?y(e,t):e,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(e,t,o):s(o))||o);return r&&o&&w(e,t,o),o};var W={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},C=["overdue","triggered","due_soon","ok"],j=["overdue","triggered","due_soon"],Y=Object.fromEntries(C.map((n,e)=>[n,e]));var z={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"};var D="2.102.0";var b="en",x=(()=>{let n=window;return n.__msLocales||(n.__msLocales={store:{},inflight:{}}),n.__msLocales})(),l=x.store,m=x.inflight;function q(n){l.en=Object.assign({},n,l.en??{})}var O=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),R="/maintenance_supporter_locales";function _(n){let e=(n||b).toLowerCase();return e.startsWith("pt")&&e.endsWith("br")?"pt-br":e.substring(0,2)}function J(n,e,t){let r=_(e);return l[r]?.[n]??l.en?.[n]??t??n}function Q(n){let e=_(n);return e===b||e in l}function X(n){let e=_(n);return e===b||e in l||!O.has(e)?Promise.resolve():(e in m||(m[e]=fetch(`${R}/${e}.json?v=${D}`).then(t=>t.ok?t.json():null).then(t=>{t?l[e]=t:delete m[e]}).catch(()=>{delete m[e]})),m[e])}var L=window.__msDateTimePrefs??={},$=864e5,a=(n,e=2)=>String(n).padStart(e,"0"),A=new Map;function d(n){let e=A.get(n);if(e===void 0){try{e=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{e=null}A.set(n,e)}return e}var S;function v(){if(S===void 0){let n;try{n=new Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}S=n&&d(n)?n:null}return S}function E(){return v()??"UTC"}function f(){let n=L.serverTimeZone;return n&&d(n)?n:E()}function en(){let n=v();return L.timeZone!=="server"&&n?n:f()}function p(n,e){let t=d(e)??d(E())??d("UTC"),r={};for(let o of t.formatToParts(n))o.type!=="literal"&&(r[o.type]=Number(o.value));return{y:r.year,mo:r.month,d:r.day,h:r.hour%24,mi:r.minute,s:r.second}}var N=n=>`${a(n.y,4)}-${a(n.mo)}-${a(n.d)}`;function M(n,e){return N(p(+n,e))}function I(n,e){let t=p(+n,e);return`${N(t)}T${a(t.h)}:${a(t.mi)}`}function tn(){return M(Date.now(),f())}function rn(){return I(Date.now(),f())}function h(n,e){let t=p(n,e);return Date.UTC(t.y,t.mo-1,t.d,t.h,t.mi,t.s)-Math.floor(n/1e3)*1e3}function P(n,e,t,r,o,i,s){let u=Date.UTC(n,e-1,t,r,o,i),c=h(u-$,s),g=h(u+$,s);for(let T of c===g?[c]:[c,g])if(h(u-T,s)===T)return u-T;return u-c}var U=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/;var Z=new Map,F=2e4;function k(n,e,t){if(n.has(e))return n.get(e);n.size>=F&&n.clear();let r=t();return n.set(e,r),r}function on(n){if(typeof n!="string"||!n)return NaN;let e=U.exec(n);if(!e)return Date.parse(n);let t=f();return k(Z,`${t}|${n}`,()=>{let[r,o,i,s,u,c]=[e[1],e[2],e[3],e[4]??"0",e[5]??"0",e[6]??"0"].map(Number);if(o<1||o>12||new Date(Date.UTC(r,o-1,i)).getUTCDate()!==i||s>23||u>59||c>59)return NaN;let g=e[7]?Math.floor(+`0.${e[7]}`*1e3):0;return P(r,o,i,s,u,c,t)+g})}function sn(n){if(typeof n!="string"||!n)return"";let e=U.exec(n);if(e)return`${e[1]}-${e[2]}-${e[3]}T${e[4]??"00"}:${e[5]??"00"}:${e[6]??"00"}`;let t=Date.parse(n);if(!Number.isFinite(t))return"";let r=p(t,f());return`${N(r)}T${a(r.h)}:${a(r.mi)}:${a(r.s)}`}export{B as a,W as b,j as c,z as d,q as e,_ as f,J as g,Q as h,X as i,f as j,en as k,M as l,I as m,tn as n,rn as o,on as p,sn as q};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as i}from"./chunk-FC7BLTBL.js";var r={operatorWriteEnabled:!1,operatorIds:[]};function f(e,t=r){return e?e.is_admin?!0:t.operatorWriteEnabled&&t.operatorIds.includes(e.id):!1}function l(e){return e==="use"?"use":"purchase"}var c=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function b(e){let t=c(e?.cost);if(t===null)return null;let n=c(e?.package_size);return n&&n>0?t/n:t}var d=["buttons_compact","buttons","icons"];function _(e){let[t,n]=i.default_warning_days,s=e?.general?.default_warning_days,a=e?.general?.row_action_style;return{features:{...o.features,...e?.features??{}},defaultWarningDays:typeof s=="number"&&Number.isFinite(s)&&s>=t&&s<=n?s:o.defaultWarningDays,rowActionStyle:d.includes(a??"")?a:o.rowActionStyle,access:{operatorWriteEnabled:e?.operator_write_enabled===!0,operatorIds:Array.isArray(e?.admin_panel_user_ids)?e.admin_panel_user_ids.filter(p=>typeof p=="string"):[]},budget:e?.budget??null,rowActionNoticePending:e?.general?.row_action_notice_pending===!0,refsInLists:e?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(e?.objects_table_columns)?e.objects_table_columns:void 0,partsCostMode:l(e?.budget?.parts_cost_mode)}}var o={features:{adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact",access:r,budget:null,rowActionNoticePending:!1,refsInLists:!1,objectsTableColumns:void 0,partsCostMode:"purchase"};function u(){let e=window;return e.__msSettingsCache??={promise:null}}function w(e){let t=u();if(t.promise)return t.promise;let n=e.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>_(s)).catch(()=>(t.promise===n&&(t.promise=null),o));return t.promise=n,n}function h(){u().promise=null}export{r as a,f as b,b as c,w as d,h as e};
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as i}from"./chunk-DGKPZQYM.js";var r={operatorWriteEnabled:!1,operatorIds:[]};function f(e,t=r){return e?e.is_admin?!0:t.operatorWriteEnabled&&t.operatorIds.includes(e.id):!1}function l(e){return e==="use"?"use":"purchase"}var c=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function b(e){let t=c(e?.cost);if(t===null)return null;let n=c(e?.package_size);return n&&n>0?t/n:t}var d=["buttons_compact","buttons","icons"];function _(e){let[t,n]=i.default_warning_days,s=e?.general?.default_warning_days,a=e?.general?.row_action_style;return{features:{...o.features,...e?.features??{}},defaultWarningDays:typeof s=="number"&&Number.isFinite(s)&&s>=t&&s<=n?s:o.defaultWarningDays,rowActionStyle:d.includes(a??"")?a:o.rowActionStyle,access:{operatorWriteEnabled:e?.operator_write_enabled===!0,operatorIds:Array.isArray(e?.admin_panel_user_ids)?e.admin_panel_user_ids.filter(p=>typeof p=="string"):[]},budget:e?.budget??null,rowActionNoticePending:e?.general?.row_action_notice_pending===!0,refsInLists:e?.general?.ref_numbers_in_lists===!0,objectsTableColumns:Array.isArray(e?.objects_table_columns)?e.objects_table_columns:void 0,partsCostMode:l(e?.budget?.parts_cost_mode)}}var o={features:{adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact",access:r,budget:null,rowActionNoticePending:!1,refsInLists:!1,objectsTableColumns:void 0,partsCostMode:"purchase"};function u(){let e=window;return e.__msSettingsCache??={promise:null}}function w(e){let t=u();if(t.promise)return t.promise;let n=e.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(s=>_(s)).catch(()=>(t.promise===n&&(t.promise=null),o));return t.promise=n,n}function h(){u().promise=null}export{r as a,f as b,b as c,w as d,h as e};
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{p as l}from"./chunk-TAYZJBPE.js";function c(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}var f=20;function _(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function d(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function y(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||d(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function R(r){return y(r??[]).map(n=>({timestamp:n.timestamp,values:d(n)})).filter(n=>n.values.length>0)}function h(r,n,i){let o;for(let t of r){if(i!==void 0){let s=l(t.timestamp);if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function k(r,n,i){let o=d(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of y(r)){if(e.timestamp>=n.timestamp)break;let s=d(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function w(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function S(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=f))break}return n}function g(r,n,i,o){let t=i,e=u=>typeof u=="string"?u:null,s=u=>typeof u=="number"?u:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:c(t),reading_value:s(t.reading_value),reading_values:d(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function v(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i);if(!e)return null;let s=e.history?.find(a=>a.timestamp===o);return s||(s=(await r.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:n,task_id:i})).history?.find(u=>u.timestamp===o)),s?g(n,i,s,e):null}export{c as a,f as b,_ as c,d,R as e,h as f,k as g,w as h,S as i,g as j,v as k};
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{p as l}from"./chunk-IUWFIZIT.js";function c(r){if(!r)return[];let n=[],i=r.photo_doc_id;typeof i=="string"&&n.push(i);let o=r.photo_doc_ids;Array.isArray(o)&&n.push(...o);let t=[];for(let e of n){if(typeof e!="string")continue;let s=e.trim();if(!(!s||t.includes(s))&&(t.push(s),t.length>=10))break}return t}var f=20;function _(){let r=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:n=>n.map(()=>Math.floor(Math.random()*256))}).getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function d(r){let n=r?.reading_values;if(!Array.isArray(n))return[];let i=[],o=new Set;for(let t of n){if(!t||typeof t!="object")continue;let e=t;typeof e.id!="string"||!e.id||o.has(e.id)||typeof e.value!="number"||!Number.isFinite(e.value)||(o.add(e.id),i.push({id:e.id,name:typeof e.name=="string"?e.name:e.id,unit:typeof e.unit=="string"?e.unit:null,value:e.value}))}return i}function y(r){return r.filter(n=>n.type==="completed"&&(n.reading_value!=null||d(n).length>0)).sort((n,i)=>n.timestamp.localeCompare(i.timestamp))}function R(r){return y(r??[]).map(n=>({timestamp:n.timestamp,values:d(n)})).filter(n=>n.values.length>0)}function h(r,n,i){let o;for(let t of r){if(i!==void 0){let s=l(t.timestamp);if(!isNaN(s)&&s>=i)break}let e=t.values.find(s=>s.id===n);e&&(o=e)}return o}function k(r,n,i){let o=d(n).find(e=>e.id===i);if(!o)return null;let t=null;for(let e of y(r)){if(e.timestamp>=n.timestamp)break;let s=d(e).find(a=>a.id===i);s&&(t=s.value)}return t==null?null:o.value-t}function w(r){let n=new Set,i=new Set;for(let o of r){let t=(o.name||"").trim().toLowerCase();t&&(n.has(t)?i.add(o.id):n.add(t))}return i}function S(r){let n=[],i=new Set,o=new Set;for(let t of r){let e=(t.name||"").trim();if(!(!e||i.has(t.id)||o.has(e.toLowerCase()))&&(i.add(t.id),o.add(e.toLowerCase()),n.push({id:t.id,name:e,unit:(t.unit||"").trim()||null}),n.length>=f))break}return n}function g(r,n,i,o){let t=i,e=u=>typeof u=="string"?u:null,s=u=>typeof u=="number"?u:null,a=e(t.timestamp)??"";return{entry_id:r,task_id:n,original_timestamp:a,type:e(t.type)||"completed",timestamp:a,notes:e(t.notes),cost:s(t.cost),duration:s(t.duration),completed_by:e(t.completed_by),used_parts:Array.isArray(t.used_parts)?t.used_parts:null,photo_doc_ids:c(t),reading_value:s(t.reading_value),reading_values:d(t),readings:o?.readings??[],task_type:o?.type??null,reading_unit:o?.reading_unit??null}}async function v(r,n,i,o){let e=(await r.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:n})).tasks?.find(a=>a.id===i);if(!e)return null;let s=e.history?.find(a=>a.timestamp===o);return s||(s=(await r.connection.sendMessagePromise({type:"maintenance_supporter/task/history",entry_id:n,task_id:i})).history?.find(u=>u.timestamp===o)),s?g(n,i,s,e):null}export{c as a,f as b,_ as c,d,R as e,h as f,k as g,w as h,S as i,g as j,v as k};
|
||||
+27
-10
@@ -1,9 +1,9 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{e as K,f as j,g as _,h as V,i as Y,j as he,k as E,l as me,m as G,p as Q}from"./chunk-TAYZJBPE.js";var U=globalThis,I=U.ShadowRoot&&(U.ShadyCSS===void 0||U.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Z=Symbol(),ge=new WeakMap,N=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Z)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(I&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ge.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ge.set(t,e))}return e}toString(){return this.cssText}},fe=o=>new N(typeof o=="string"?o:o+"",void 0,Z),S=(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 N(t,o,Z)},ye=(o,e)=>{if(I)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),n=U.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,o.appendChild(r)}},J=I?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return fe(t)})(o):o;var{is:We,defineProperty:Ke,getOwnPropertyDescriptor:Ve,getOwnPropertyNames:Ye,getOwnPropertySymbols:Ge,getPrototypeOf:Qe}=Object,F=globalThis,be=F.trustedTypes,Ze=be?be.emptyScript:"",Je=F.reactiveElementPolyfillSupport,R=(o,e)=>o,P={toAttribute(o,e){switch(e){case Boolean:o=o?Ze: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}},H=(o,e)=>!We(o,e),ve={attribute:!0,type:String,converter:P,reflect:!1,useDefault:!1,hasChanged:H};Symbol.metadata??=Symbol("metadata"),F.litPropertyMetadata??=new WeakMap;var f=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=ve){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&&Ke(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:a}=Ve(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)??ve}static _$Ei(){if(this.hasOwnProperty(R("elementProperties")))return;let e=Qe(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(R("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(R("properties"))){let t=this.properties,r=[...Ye(t),...Ge(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(J(n))}else e!==void 0&&t.push(J(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 ye(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?rLine truncated
|
||||
\f\r]`,z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xe=/-->/g,Se=/>/g,v=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,Te=/"/g,Ee=/^(?:script|style|textarea|title)$/i,se=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),At=se(1),Tt=se(2),$t=se(3),x=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),$e=new WeakMap,w=k.createTreeWalker(k,129);function Ne(o,e){if(!ie(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ke!==void 0?ke.createHTML(e):e}var tt=(o,e)=>{let t=o.length-1,r=[],n,a=e===2?"<svg>":e===3?"<math>":"",i=z;for(let l=0;l<t;l++){let s=o[l],p,d,c=-1,g=0;for(;g<s.length&&(i.lastIndex=g,d=i.exec(s),d!==null);)g=i.lastIndex,i===z?d[1]==="!--"?i=xe:d[1]!==void 0?i=Se:d[2]!==void 0?(Ee.test(d[2])&&(n=RegExp("</"+d[2],"g")),i=v):d[3]!==void 0&&(i=v):i===v?d[0]===">"?(i=n??z,c=-1):d[1]===void 0?c=-2:(c=i.lastIndex-d[2].length,p=d[1],i=d[3]===void 0?v:d[3]==='"'?Te:Ae):i===Te||i===Ae?i=v:i===xe||i===Se?i=z:(i=v,n=void 0);let y=i===v&&o[l+1].startsWith("/>")?" ":"";a+=i===z?s+Xe:c>=0?(r.push(p),s.slice(0,c)+Ce+s.slice(c)+b+y):s+b+(c===-2?l:y)}return[Ne(o,a+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},M=class o{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,i=0,l=e.length-1,s=this.parts,[p,d]=tt(e,t);if(this.el=o.createElement(p,r),w.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=w.nextNode())!==null&&s.length<l;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(Ce)){let g=d[i++],y=n.getAttribute(c).split(b),q=/([.?@])?(.*)/.exec(g);s.push({type:1,index:a,name:q[2],strings:y,ctor:q[1]==="."?te:q[1]==="?"?oe:q[1]==="@"?re:T}),n.removeAttribute(c)}else c.startsWith(b)&&(s.push({type:6,index:a}),n.removeAttribute(c));if(Ee.test(n.tagName)){let c=n.textContent.split(b),g=c.length-1;if(g>0){n.textContent=B?B.emptyScript:"";for(let y=0;y<g;y++)n.append(c[y],D()),w.nextNode(),s.push({type:2,index:++a});n.append(c[g],D())}}}else if(n.nodeType===8)if(n.data===je)s.push({type:2,index:a});else{let c=-1;for(;(c=n.data.indexOf(b,c+1))!==-1;)s.push({type:7,index:a}),c+=b.length-1}a++}}static createElement(e,t){let r=k.createElement("template");return r.innerHTML=e,r}};function A(o,e,t=o,r){if(e===x)return e;let n=r!==void 0?t._$Co?.[r]:t._$Cl,a=O(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=A(o,n._$AS(o,e.values),n,r)),e}var ee=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??k).importNode(t,!0);w.currentNode=n;let a=w.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let p;s.type===2?p=new L(a,a.nextSibling,this,e):s.type===1?p=new s.ctor(a,s.name,s.strings,this,e):s.type===6&&(p=new ne(a,this,e)),this._$AV.push(p),s=r[++l]}i!==s?.index&&(a=w.nextNode(),i++)}return w.currentNode=k,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++}},L=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=u,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=A(this,e,t),O(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==x&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):et(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!==u&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.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=M.createElement(Ne(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let a=new ee(n,this),i=a.u(this.options);a.p(t),this.T(i),this._$AH=a}}_$AC(e){let t=$e.get(e.strings);return t===void 0&&$e.set(e.strings,t=new M(e)),t}k(e){ie(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(D()),this.O(D()),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=we(e).nextSibling;we(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,a){this.type=1,this._$AH=u,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=rLine truncated
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{e as Z,f as E,g as _,h as J,i as X,j as ge,k as N,l as fe,m as ee,p as te}from"./chunk-IUWFIZIT.js";var U=globalThis,I=U.ShadowRoot&&(U.ShadyCSS===void 0||U.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oe=Symbol(),ye=new WeakMap,R=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==oe)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(I&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ye.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ye.set(t,e))}return e}toString(){return this.cssText}},be=o=>new R(typeof o=="string"?o:o+"",void 0,oe),T=(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 R(t,o,oe)},ve=(o,e)=>{if(I)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),n=U.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,o.appendChild(r)}},re=I?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return be(t)})(o):o;var{is:Ve,defineProperty:Ye,getOwnPropertyDescriptor:Ge,getOwnPropertyNames:Qe,getOwnPropertySymbols:Ze,getPrototypeOf:Je}=Object,F=globalThis,we=F.trustedTypes,Xe=we?we.emptyScript:"",et=F.reactiveElementPolyfillSupport,P=(o,e)=>o,z={toAttribute(o,e){switch(e){case Boolean:o=o?Xe: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}},H=(o,e)=>!Ve(o,e),xe={attribute:!0,type:String,converter:z,reflect:!1,useDefault:!1,hasChanged:H};Symbol.metadata??=Symbol("metadata"),F.litPropertyMetadata??=new WeakMap;var f=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=xe){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&&Ye(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:a}=Ge(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)??xe}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;let e=Je(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){let t=this.properties,r=[...Qe(t),...Ze(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(re(n))}else e!==void 0&&t.push(re(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 ve(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!=Line truncated
|
||||
\f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ae=/-->/g,Te=/>/g,v=RegExp(`>|${ne}(?:([^\\s"'>=/]+)(${ne}*=${ne}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),$e=/'/g,Ce=/"/g,Ne=/^(?:script|style|textarea|title)$/i,ce=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),At=ce(1),Tt=ce(2),$t=ce(3),k=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),je=new WeakMap,w=x.createTreeWalker(x,129);function Re(o,e){if(!le(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Se!==void 0?Se.createHTML(e):e}var Pe=(o,e)=>{let t=o.length-1,r=[],n,a=e===2?"<svg>":e===3?"<math>":"",i=D;for(let l=0;l<t;l++){let s=o[l],p,d,c=-1,g=0;for(;g<s.length&&(i.lastIndex=g,d=i.exec(s),d!==null);)g=i.lastIndex,i===D?d[1]==="!--"?i=Ae:d[1]!==void 0?i=Te:d[2]!==void 0?(Ne.test(d[2])&&(n=RegExp("</"+d[2],"g")),i=v):d[3]!==void 0&&(i=v):i===v?d[0]===">"?(i=n??D,c=-1):d[1]===void 0?c=-2:(c=i.lastIndex-d[2].length,p=d[1],i=d[3]===void 0?v:d[3]==='"'?Ce:$e):i===Ce||i===$e?i=v:i===Ae||i===Te?i=D:(i=v,n=void 0);let b=i===v&&o[l+1].startsWith("/>")?" ":"";a+=i===D?s+tt:c>=0?(r.push(p),s.slice(0,c)+ie+s.slice(c)+y+b):s+y+(c===-2?l:b)}return[Re(o,a+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},L=class o{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,i=0,l=e.length-1,s=this.parts,[p,d]=Pe(e,t);if(this.el=o.createElement(p,r),w.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=w.nextNode())!==null&&s.length<l;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(ie)){let g=d[i++],b=n.getAttribute(c).split(y),q=/([.?@])?(.*)/.exec(g);s.push({type:1,index:a,name:q[2],strings:b,ctor:q[1]==="."?K:q[1]==="?"?V:q[1]==="@"?Y:A}),n.removeAttribute(c)}else c.startsWith(y)&&(s.push({type:6,index:a}),n.removeAttribute(c));if(Ne.test(n.tagName)){let c=n.textContent.split(y),g=c.length-1;if(g>0){n.textContent=B?B.emptyScript:"";for(let b=0;b<g;b++)n.append(c[b],O()),w.nextNode(),s.push({type:2,index:++a});n.append(c[g],O())}}}else if(n.nodeType===8)if(n.data===se)s.push({type:2,index:a});else{let c=-1;for(;(c=n.data.indexOf(y,c+1))!==-1;)s.push({type:7,index:a}),c+=y.length-1}a++}}static createElement(e,t){let r=x.createElement("template");return r.innerHTML=e,r}};function S(o,e,t=o,r){if(e===k)return e;let n=r!==void 0?t._$Co?.[r]:t._$Cl,a=M(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=S(o,n._$AS(o,e.values),n,r)),e}var W=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??x).importNode(t,!0);w.currentNode=n;let a=w.nextNode(),i=0,l=0,s=r[0];for(;s!==void 0;){if(i===s.index){let p;s.type===2?p=new $(a,a.nextSibling,this,e):s.type===1?p=new s.ctor(a,s.name,s.strings,this,e):s.type===6&&(p=new G(a,this,e)),this._$AV.push(p),s=r[++l]}i!==s?.index&&(a=w.nextNode(),i++)}return w.currentNode=x,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++}},$=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=u,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=S(this,e,t),M(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==k&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ee(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!==u&&M(this._$AH)?this._$AA.nextSibling.data=e:this.T(x.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=L.createElement(Re(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let a=new W(n,this),i=a.u(this.options);a.p(t),this.T(i),this._$AH=a}}_$AC(e){let t=je.get(e.strings);return t===void 0&&je.set(e.strings,t=new L(e)),t}k(e){le(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(O()),this.O(O()),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=ke(e).nextSibling;ke(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},A=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,a){this.type=1,this._$AH=u,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):thisLine 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",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",ws_err_invalid_icon:"The notification icon must be an mdi: name, e.g. mdi:air-filter",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_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",ha_time_zone_hint:"Time in Home Assistant's time zone ({zone})",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",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.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",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",object_replaces:"Replaces",object_replaced_by:"Replaced by",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",all_parts:"All parts",all_areas:"All areas",areas_filter:"Filter areas\u2026",areas_filter_none:"No area matches the filter.",area_cost_year:"Cost {year}",area_object_count:"{n} o
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",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",ws_err_invalid_icon:"The notification icon must be an mdi: name, e.g. mdi:air-filter",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_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",ha_time_zone_hint:"Time in Home Assistant's time zone ({zone})",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",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.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",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",object_replaces:"Replaces",object_replaced_by:"Replaced by",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",all_parts:"All parts",all_areas:"All areas",areas_filter:"Filter areas\u2026",areas_filter_none:"No area matches the filter.",area_cost_year:"Cost {year}",area_object_count:"{n} o
Line truncated
|
||||
.field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.field-label { font-size: 12px; color: var(--secondary-text-color); }
|
||||
.field-input {
|
||||
@@ -14,7 +14,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=S`
|
||||
`,ut=T`
|
||||
.person-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; vertical-align: middle; }
|
||||
.person-avatar {
|
||||
width: 22px; height: 22px; border-radius: 50%; flex: none;
|
||||
@@ -24,7 +24,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
||||
`,ht=S`
|
||||
`,ht=T`
|
||||
.ref-chip {
|
||||
display: inline-block; font-size: 11.5px; font-weight: 500; line-height: 1; padding: 3px 6px;
|
||||
border-radius: 6px; border: 1px solid var(--divider-color); color: var(--secondary-text-color);
|
||||
@@ -33,7 +33,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
}
|
||||
/* #189: "· Residual waste, Paper" after a calendar-driven task's name. */
|
||||
.event-titles { color: var(--secondary-text-color); font-weight: 400; }
|
||||
`,Uo=S`
|
||||
`,Io=T`
|
||||
${ut}
|
||||
${ht}
|
||||
:host {
|
||||
@@ -806,10 +806,13 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
margin-bottom: 4px;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.group-card-actions {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
gap: 0;
|
||||
}
|
||||
.group-card-actions ha-icon-button {
|
||||
@@ -856,6 +859,8 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
border-radius: 10px;
|
||||
background: var(--secondary-background-color, #f5f5f5);
|
||||
color: var(--primary-text-color);
|
||||
max-width: 100%;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* Adaptive scheduling suggestion badge */
|
||||
@@ -1244,7 +1249,19 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
suffix is hidden instead — the bar and the title carry the ratio. */
|
||||
.budget-tile-max { display: none; }
|
||||
|
||||
.group-card { min-width: 0; max-width: 100%; }
|
||||
/* #206 — one group per row. flex: 1 with min-width 0 put every group
|
||||
into ONE row: three groups were 96 px each on a 360 px phone, and the
|
||||
delete button of one lay over the next group. The buttons get the
|
||||
same 44 px targets as the task rows, apart from each other; the
|
||||
negative margin lets them reach into the card's padding instead of
|
||||
pushing the tasks down. */
|
||||
.group-card { flex: 1 1 100%; min-width: 0; max-width: 100%; }
|
||||
.group-card-actions { gap: 8px; margin: -8px -8px -8px 0; }
|
||||
.group-card-actions ha-icon-button {
|
||||
--ha-icon-button-size: 44px;
|
||||
--mdc-icon-button-size: 44px;
|
||||
--mdc-icon-size: 22px;
|
||||
}
|
||||
|
||||
.filter-chip { padding: 6px 12px; font-size: 13px; }
|
||||
|
||||
@@ -1273,7 +1290,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
|
||||
.stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; hyphens: auto; overflow-wrap: anywhere; }
|
||||
.stat-value { font-size: 20px; }
|
||||
}
|
||||
`;var mt={already_archived:"ws_err_already_archived",already_paused:"ws_err_already_paused",archived:"ws_err_archived",changed_since:"undo_changed",create_failed:"ws_err_create_failed",duplicate_failed:"ws_err_duplicate_failed",empty:"ws_err_empty",empty_csv:"ws_err_empty_csv",invalid_cursor:"ws_err_invalid_cursor",invalid_date:"ws_err_invalid_date",invalid_device:"ws_err_invalid_device",invalid_entity_slug:"ws_err_invalid_entity_slug",invalid_format:"ws_err_invalid_format",invalid_input:"ws_err_invalid_input",invalid_mirror_todo:"ws_err_invalid_mirror_todo",invalid_parent:"ws_err_invalid_parent",invalid_icon:"ws_err_invalid_icon",invalid_range:"ws_err_invalid_range",invalid_search_template:"ws_err_invalid_search_template",invalid_target:"ws_err_invalid_target",invalid_trigger_config:"ws_err_invalid_trigger_config",invalid_url:"ws_err_invalid_url",invalid_user:"ws_err_invalid_user",invalid_view:"ws_err_invalid_view",limit_reached:"ws_err_limit_reached",no_defaults:"ws_err_no_defaults",no_phases:"ws_err_no_phases",no_url:"ws_err_no_url",not_archived:"ws_err_not_archived",not_available:"ws_err_not_available",not_configured:"ws_err_not_configured",not_found:"ws_err_not_found",not_loaded:"ws_err_not_loaded",not_paused:"ws_err_not_paused",nothing_to_undo:"undo_nothing",replace_failed:"ws_err_replace_failed",self_link_device:"ws_err_self_link_device",storage_unavailable:"ws_err_storage_unavailable",too_early:"ws_err_too_early",too_large:"ws_err_too_large",too_many:"ws_err_too_many",too_many_views:"ws_err_too_many_views",unauthorized:"ws_err_unauthorized",unavailable:"ws_err_unavailable"},gt={entry_id:"object",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",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};function ft(o){let e=o.replace(/_ids?$/,"").split("_").filter(Boolean);if(e.length===0)return o;let t=e.join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}function yt(o,e){let t=gt[o];if(t){let r=_(t,e);if(r&&r!==t)return r}return ft(o)}function bt(o){let e=[...o.matchAll(/\['([^']+)'\]/g)].map(n=>n[1]),t=e.length?e[e.length-1]:void 0,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"}}var He=o=>o.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>1);function vt(o,e){let t=new Set(He(e));return He(o).every(r=>t.has(r))}function Be(o,e,t){if(t=t??_("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||"",a=r.code||r.error?.code||"",i=a?mt[a]:void 0,l=Oe(r.translation_domain??r.error?.translation_domain,r.translation_key??r.error?.translation_key,r.translation_placeholders??r.error?.translation_placeholders);if(l)return l;if(!n&&!i)return t;let s=bt(n),p=s.field?yt(s.field,e):"",d=c=>_(c,e).replace("{field}",p).replace("{n}",s.param??"");switch(s.rule){case"too_long":return d("err_too_long");case"too_short":return d("err_too_short");case"value_too_high":return d("err_value_too_high");case"value_too_low":return d("err_value_too_low");case"required":return d("err_required");case"wrong_type":return d("err_wrong_type").replace("{type}",s.param??"");case"invalid_choice":return d("err_invalid_choice");case"invalid_value":return d("err_invalid_value");default:if(i){let c=_(i,e);return j(e)==="en"&&n&&!vt(n,a)?`${c} (${n})`:c}return n||t}}async function Qo(o,e,t={}){t.busy?.(!0);try{let r=typeof e=="function"?await e():await o.hass.connection.sendMessagePromise(e);return t.reload&&await t.reload(),t.successToast&&
Line truncated
|
||||
`;var mt={already_archived:"ws_err_already_archived",already_paused:"ws_err_already_paused",archived:"ws_err_archived",changed_since:"undo_changed",create_failed:"ws_err_create_failed",duplicate_failed:"ws_err_duplicate_failed",empty:"ws_err_empty",empty_csv:"ws_err_empty_csv",invalid_cursor:"ws_err_invalid_cursor",invalid_date:"ws_err_invalid_date",invalid_device:"ws_err_invalid_device",invalid_entity_slug:"ws_err_invalid_entity_slug",invalid_format:"ws_err_invalid_format",invalid_input:"ws_err_invalid_input",invalid_mirror_todo:"ws_err_invalid_mirror_todo",invalid_parent:"ws_err_invalid_parent",invalid_icon:"ws_err_invalid_icon",invalid_range:"ws_err_invalid_range",invalid_search_template:"ws_err_invalid_search_template",invalid_target:"ws_err_invalid_target",invalid_trigger_config:"ws_err_invalid_trigger_config",invalid_url:"ws_err_invalid_url",invalid_user:"ws_err_invalid_user",invalid_view:"ws_err_invalid_view",limit_reached:"ws_err_limit_reached",no_defaults:"ws_err_no_defaults",no_phases:"ws_err_no_phases",no_url:"ws_err_no_url",not_archived:"ws_err_not_archived",not_available:"ws_err_not_available",not_configured:"ws_err_not_configured",not_found:"ws_err_not_found",not_loaded:"ws_err_not_loaded",not_paused:"ws_err_not_paused",nothing_to_undo:"undo_nothing",replace_failed:"ws_err_replace_failed",self_link_device:"ws_err_self_link_device",storage_unavailable:"ws_err_storage_unavailable",too_early:"ws_err_too_early",too_large:"ws_err_too_large",too_many:"ws_err_too_many",too_many_views:"ws_err_too_many_views",unauthorized:"ws_err_unauthorized",unavailable:"ws_err_unavailable"},gt={entry_id:"object",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",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};function ft(o){let e=o.replace(/_ids?$/,"").split("_").filter(Boolean);if(e.length===0)return o;let t=e.join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}function yt(o,e){let t=gt[o];if(t){let r=_(t,e);if(r&&r!==t)return r}return ft(o)}function bt(o){let e=[...o.matchAll(/\['([^']+)'\]/g)].map(n=>n[1]),t=e.length?e[e.length-1]:void 0,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"}}var We=o=>o.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>1);function vt(o,e){let t=new Set(We(e));return We(o).every(r=>t.has(r))}function Ke(o,e,t){if(t=t??_("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||"",a=r.code||r.error?.code||"",i=a?mt[a]:void 0,l=Le(r.translation_domain??r.error?.translation_domain,r.translation_key??r.error?.translation_key,r.translation_placeholders??r.error?.translation_placeholders);if(l)return l;if(!n&&!i)return t;let s=bt(n),p=s.field?yt(s.field,e):"",d=c=>_(c,e).replace("{field}",p).replace("{n}",s.param??"");switch(s.rule){case"too_long":return d("err_too_long");case"too_short":return d("err_too_short");case"value_too_high":return d("err_value_too_high");case"value_too_low":return d("err_value_too_low");case"required":return d("err_required");case"wrong_type":return d("err_wrong_type").replace("{type}",s.param??"");case"invalid_choice":return d("err_invalid_choice");case"invalid_value":return d("err_invalid_value");default:if(i){let c=_(i,e);return E(e)==="en"&&n&&!vt(n,a)?`${c} (${n})`:c}return n||t}}async function Zo(o,e,t={}){t.busy?.(!0);try{let r=typeof e=="function"?await e():await o.hass.connection.sendMessagePromise(e);return t.reload&&await t.reload(),t.successToast&&
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
+131
-108
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j as ut}from"./chunk-OQLAJWAS.js";import"./chunk-LEI6V6UO.js";import{a as Ce,b as le,c as kt,d as V,e as wt}from"./chunk-B4IMAOHY.js";import{c as $t,d as xt,e as ge,f as ve,g as fe,h as Ue,i as Y,j as oe,k as te}from"./chunk-FC7BLTBL.js";import{A as bt,B as A,a as w,b as l,c as ne,d as h,e as T,f as v,g as p,h as me,j as P,k as _t,l as mt,m as E,n as z,o as ae,p as De,q as U,r as Ie,s as Te,t as gt,u as Se,v as ze,w as vt,x as ft,y as yt,z as Ae}from"./chunk-5FHGCMEA.js";import{a as d,b as Xe,d as ke,g as s,h as et,i as tt,k as Fe,l as we,n as Ee,o as st,p as ee,q as rt}from"./chunk-TAYZJBPE.js";var C=class extends T{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(e){let i=e.target.value;this.value=i,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:i}}))}render(){return l`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as _t,b as vt,c as ft,d as yt,e as bt,f as $t,g as xt,h as kt,i as wt,j as Et}from"./chunk-QPKGRI5H.js";import"./chunk-AOWCK2OJ.js";import{a as Pe,b as le,c as Nt,d as V,e as Mt}from"./chunk-N4RJZ6Z2.js";import{c as qt,d as Ht,e as ge,f as ve,g as fe,h as Qe,i as Y,j as oe,k as te}from"./chunk-DGKPZQYM.js";import{A as Ce,B as Lt,C as A,a as w,b as l,c as ne,d as h,e as Tt,f as I,g as v,h as p,i as me,k as P,l as It,m as St,n as E,o as z,p as ae,q as We,r as U,s as Ie,t as Se,u as At,v as Ae,w as Ge,x as Ct,y as Pt,z as Rt}from"./chunk-XJSTERIM.js";import{a as d,b as pt,d as we,g as s,h as ht,i as ut,k as Ve,l as Ee,n as Te,o as mt,p as ee,q as gt}from"./chunk-IUWFIZIT.js";var C=class extends I{constructor(){super(...arguments);this.label="";this.value="";this.placeholder="";this.type="text";this.required=!1;this.disabled=!1;this.multiline=!1;this.rows=3}_onInput(e){let i=e.target.value;this.value=i,this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:i}}))}render(){return l`
|
||||
<label class="field">
|
||||
${this.label?l`<span class="label">${this.label}${this.required?l`<span class="req">*</span>`:h}</span>`:h}
|
||||
${this.multiline?l`
|
||||
@@ -76,7 +76,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
color: var(--secondary-text-color);
|
||||
font-style: italic;
|
||||
}
|
||||
`,d([v()],C.prototype,"label",2),d([v()],C.prototype,"value",2),d([v()],C.prototype,"placeholder",2),d([v()],C.prototype,"type",2),d([v({type:Boolean})],C.prototype,"required",2),d([v({type:Boolean})],C.prototype,"disabled",2),d([v()],C.prototype,"step",2),d([v()],C.prototype,"min",2),d([v()],C.prototype,"max",2),d([v()],C.prototype,"pattern",2),d([v()],C.prototype,"helper",2),d([v({type:Boolean})],C.prototype,"multiline",2),d([v({type:Number})],C.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",C);var k=class extends T{constructor(){super(...arguments);this.objects=[];this.placesEnabled=!1;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._place="";this._remindOnSite=!1;this._entryId=null;this._replacing=!1;this._oldDeviceId="";this._replaceDevice="keep"}get _lang(){return P(this.hass)}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._place="",this._remindOnSite=!1,this._replacing=!1,this._error="",this._open=!0}openReplace(e,i){this._entryId=e,this._replacing=!0,this._name=i.name||"",this._oldDeviceId=i.ha_device_id||"",this._haDeviceId="",this._replaceDevice="keep",this._error="",this._open=!0}openEdit(e,i){this._entryId=e,this._name=i.name||"",this._manufacturer=i.manufacturer||"",this._model=i.model||"",this._serialNumber=i.serial_number||"",this._areaId=i.area_id||"",this._installationDate=i.installation_date||"",this._warrantyExpiry=i.warranty_expiry||"",this._documentationUrl=i.documentation_url||"",this._notes=i.notes||"",this._haDeviceId=i.ha_device_id||"",this._parentEntryId=i.parent_entry_id||"",this._place=i.place||"",this._remindOnSite=!!i.remind_on_site,this._replacing=!1,this._error="",this._open=!0}async _replace(){if(this._loading||!this._entryId)return;let e={type:"maintenance_supporter/object/replace",entry_id:this._entryId,name:this._name.trim()||null};this._oldDeviceId?(this._replaceDevice==="other"&&(e.ha_device_id=this._haDeviceId),this._replaceDevice==="none"&&(e.ha_device_id=null)):this._haDeviceId&&(e.ha_device_id=this._haDeviceId);let i=await A(this,e,{busy:t=>{this._loading=t},fallbackKey:"save_error",onError:t=>{this._error=t}});i!==void 0&&(this._open=!1,this.dispatchEvent(new CustomEvent("object-replaced",{detail:{entry_id:i?.entry_id,device_swap:i?.device_swap}})))}_deviceName(e){let t=this.hass?.devices?.[e];return t?.name_by_user||t?.name||e}_deviceSelector(e){return l`<ha-form
|
||||
`,d([v()],C.prototype,"label",2),d([v()],C.prototype,"value",2),d([v()],C.prototype,"placeholder",2),d([v()],C.prototype,"type",2),d([v({type:Boolean})],C.prototype,"required",2),d([v({type:Boolean})],C.prototype,"disabled",2),d([v()],C.prototype,"step",2),d([v()],C.prototype,"min",2),d([v()],C.prototype,"max",2),d([v()],C.prototype,"pattern",2),d([v()],C.prototype,"helper",2),d([v({type:Boolean})],C.prototype,"multiline",2),d([v({type:Number})],C.prototype,"rows",2);customElements.get("ms-textfield")||customElements.define("ms-textfield",C);var k=class extends I{constructor(){super(...arguments);this.objects=[];this.placesEnabled=!1;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._place="";this._remindOnSite=!1;this._entryId=null;this._replacing=!1;this._oldDeviceId="";this._replaceDevice="keep"}get _lang(){return P(this.hass)}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._place="",this._remindOnSite=!1,this._replacing=!1,this._error="",this._open=!0}openReplace(e,i){this._entryId=e,this._replacing=!0,this._name=i.name||"",this._oldDeviceId=i.ha_device_id||"",this._haDeviceId="",this._replaceDevice="keep",this._error="",this._open=!0}openEdit(e,i){this._entryId=e,this._name=i.name||"",this._manufacturer=i.manufacturer||"",this._model=i.model||"",this._serialNumber=i.serial_number||"",this._areaId=i.area_id||"",this._installationDate=i.installation_date||"",this._warrantyExpiry=i.warranty_expiry||"",this._documentationUrl=i.documentation_url||"",this._notes=i.notes||"",this._haDeviceId=i.ha_device_id||"",this._parentEntryId=i.parent_entry_id||"",this._place=i.place||"",this._remindOnSite=!!i.remind_on_site,this._replacing=!1,this._error="",this._open=!0}async _replace(){if(this._loading||!this._entryId)return;let e={type:"maintenance_supporter/object/replace",entry_id:this._entryId,name:this._name.trim()||null};this._oldDeviceId?(this._replaceDevice==="other"&&(e.ha_device_id=this._haDeviceId),this._replaceDevice==="none"&&(e.ha_device_id=null)):this._haDeviceId&&(e.ha_device_id=this._haDeviceId);let i=await A(this,e,{busy:t=>{this._loading=t},fallbackKey:"save_error",onError:t=>{this._error=t}});i!==void 0&&(this._open=!1,this.dispatchEvent(new CustomEvent("object-replaced",{detail:{entry_id:i?.entry_id,device_swap:i?.device_swap}})))}_deviceName(e){let t=this.hass?.devices?.[e];return t?.name_by_user||t?.name||e}_deviceSelector(e){return l`<ha-form
|
||||
.hass=${this.hass}
|
||||
.data=${{device:this._haDeviceId||void 0}}
|
||||
.schema=${[{name:"device",selector:{device:{}}}]}
|
||||
@@ -330,7 +330,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.radio-row input {
|
||||
margin: 0;
|
||||
}
|
||||
`,d([v({attribute:!1})],k.prototype,"hass",2),d([v({attribute:!1})],k.prototype,"objects",2),d([v({type:Boolean})],k.prototype,"placesEnabled",2),d([p()],k.prototype,"_open",2),d([p()],k.prototype,"_loading",2),d([p()],k.prototype,"_error",2),d([p()],k.prototype,"_name",2),d([p()],k.prototype,"_manufacturer",2),d([p()],k.prototype,"_model",2),d([p()],k.prototype,"_serialNumber",2),d([p()],k.prototype,"_areaId",2),d([p()],k.prototype,"_installationDate",2),d([p()],k.prototype,"_warrantyExpiry",2),d([p()],k.prototype,"_documentationUrl",2),d([p()],k.prototype,"_notes",2),d([p()],k.prototype,"_haDeviceId",2),d([p()],k.prototype,"_parentEntryId",2),d([p()],k.prototype,"_place",2),d([p()],k.prototype,"_remindOnSite",2),d([p()],k.prototype,"_entryId",2),d([p()],k.prototype,"_replacing",2),d([p()],k.prototype,"_oldDeviceId",2),d([p()],k.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",k);var Et=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"];function Ei(r){let a=(r||"").split(/\s+/).filter(Boolean);return a.length===0?"?":a.length===1?a[0][0].toUpperCase():(a[0][0]+a[a.length-1][0]).toUpperCase()}function Ii(r){let a=0;for(let e of r)a=a*31+e.charCodeAt(0)>>>0;return Et[a%Et.length]}function It(r){return r?{id:r.id,name:r.name,initials:r.initials||Ei(r.name),color:r.color||Ii(r.id)}:null}var Pe=class{constructor(a){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=a}updateHass(a){this.hass=a}async getUsers(a=!1){let e=Date.now();if(!a&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=i.users,this.cacheTimestamp=e,this.usersCache}catch(i){return console.error("Failed to fetch users:",i),this.usersCache||[]}}async assignUser(a,e,i){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:a,task_id:e,user_id:i})}async getTasksByUser(a){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:a})).tasks}getUserName(a){return!a||!this.usersCache?null:this.usersCache.find(i=>i.id===a)?.name||null}getPerson(a){return It(this.getUser(a))}getUser(a){return!a||!this.usersCache?null:this.usersCache.find(e=>e.id===a)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(a){return a?a===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function j(r){return`${r.entry_id??""}\0${r.part_id}`}function Tt(r,a,e,i){let t=!!r.entry_id&&r.entry_id!==a,n=t?r.entry_id:a,o=e.find(g=>g.entry_id===n),c=(o?.parts||[]).find(g=>g.id===r.part_id)||null,u=t&&o?.object?.name||"",m=c?.name||s("shared_part_unknown",i);return{part:c,foreign:t,ownerName:u,label:u?`${m} (${u})`:m}}function St(r,a,e,i){let{part:t,label:n}=Tt(r,a,e,i),o=t&&t.stock!==null&&t.stock!==void 0?` (${ae(t.stock,t.unit,i)})`:"",c=t?.storage_location?` \u2014 ${t.storage_location}`:"";return`${E(r.quantity,i)}\xD7 ${n}${o}${c}`}function At(r,a,e,i){let n=(e.find(c=>c.entry_id===a)?.parts||[]).map(c=>({...c})),o=new Set(n.map(c=>j({part_id:c.id})));for(let c of r?.consumes_parts||[]){if(!c.entry_id||c.entry_id===a)continue;let u=j(c);if(o.has(u))continue;o.add(u);let{part:m,ownerName:g}=Tt(c,a,e,i);n.push({id:c.part_id,name:m?.name||s("shared_part_unknown",i),unit:m?.unit,stock:m?.stock??null,storage_location:m?.storage_location,entry_id:c.entry_id,owner_name:g})}return n}var je=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock","plant"],Ct=["sensor"],Pt=["temperature","humidity","pressure"];function de(r){let a=(r??"").trim();if(a==="")return null;let e=Number(a.replace(",","."));return!Number.isFinite(e)||e<0?null:Math.round(e)}var Be=["notes","cost","duration","photo","user"],ye={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var Ti={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},Si="mdi:wrench-clock",Ve=r=>r&&Ti[r]||Si;function Re(r){return r?Array.isArray(r.entity_ids)&&r.entity_ids.length>0?[...r.entity_ids]:r.entity_id?[r.entity_id]:[]:[]}function Rt(r){if(!(!r||r.type==="compound"))return Re(r)[0]}var J=class extends T{constructor(){super(...arguments);this.value="";this.lang="en";this._credit=!1;this._amount=""}willUpdate(e){if(!e.has("value"))return;let i=(this.value??"").trim();if(i===this._signed())return;let t=parseFloat(i);if(i===""||Number.isNaN(t)){this._amount="",this._credit=!1;return}this._credit=t<0,this._amount=String(Math.abs(t))}_signed(){let e=this._amount.trim
Line truncated
|
||||
`,d([v({attribute:!1})],k.prototype,"hass",2),d([v({attribute:!1})],k.prototype,"objects",2),d([v({type:Boolean})],k.prototype,"placesEnabled",2),d([p()],k.prototype,"_open",2),d([p()],k.prototype,"_loading",2),d([p()],k.prototype,"_error",2),d([p()],k.prototype,"_name",2),d([p()],k.prototype,"_manufacturer",2),d([p()],k.prototype,"_model",2),d([p()],k.prototype,"_serialNumber",2),d([p()],k.prototype,"_areaId",2),d([p()],k.prototype,"_installationDate",2),d([p()],k.prototype,"_warrantyExpiry",2),d([p()],k.prototype,"_documentationUrl",2),d([p()],k.prototype,"_notes",2),d([p()],k.prototype,"_haDeviceId",2),d([p()],k.prototype,"_parentEntryId",2),d([p()],k.prototype,"_place",2),d([p()],k.prototype,"_remindOnSite",2),d([p()],k.prototype,"_entryId",2),d([p()],k.prototype,"_replacing",2),d([p()],k.prototype,"_oldDeviceId",2),d([p()],k.prototype,"_replaceDevice",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",k);var Ot=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"];function ji(r){let a=(r||"").split(/\s+/).filter(Boolean);return a.length===0?"?":a.length===1?a[0][0].toUpperCase():(a[0][0]+a[a.length-1][0]).toUpperCase()}function Bi(r){let a=0;for(let e of r)a=a*31+e.charCodeAt(0)>>>0;return Ot[a%Ot.length]}function Ft(r){return r?{id:r.id,name:r.name,initials:r.initials||ji(r.name),color:r.color||Bi(r.id)}:null}var Re=class{constructor(a){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=a}updateHass(a){this.hass=a}async getUsers(a=!1){let e=Date.now();if(!a&&this.usersCache&&e-this.cacheTimestamp<this.CACHE_TTL_MS)return this.usersCache;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/users/list"});return this.usersCache=i.users,this.cacheTimestamp=e,this.usersCache}catch(i){return console.error("Failed to fetch users:",i),this.usersCache||[]}}async assignUser(a,e,i){await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/assign_user",entry_id:a,task_id:e,user_id:i})}async getTasksByUser(a){return(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/tasks/by_user",user_id:a})).tasks}getUserName(a){return!a||!this.usersCache?null:this.usersCache.find(i=>i.id===a)?.name||null}getPerson(a){return Ft(this.getUser(a))}getUser(a){return!a||!this.usersCache?null:this.usersCache.find(e=>e.id===a)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(a){return a?a===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}};function j(r){return`${r.entry_id??""}\0${r.part_id}`}function Dt(r,a,e,i){let t=!!r.entry_id&&r.entry_id!==a,n=t?r.entry_id:a,o=e.find(g=>g.entry_id===n),c=(o?.parts||[]).find(g=>g.id===r.part_id)||null,u=t&&o?.object?.name||"",m=c?.name||s("shared_part_unknown",i);return{part:c,foreign:t,ownerName:u,label:u?`${m} (${u})`:m}}function zt(r,a,e,i){let{part:t,label:n}=Dt(r,a,e,i),o=t&&t.stock!==null&&t.stock!==void 0?` (${ae(t.stock,t.unit,i)})`:"",c=t?.storage_location?` \u2014 ${t.storage_location}`:"";return`${E(r.quantity,i)}\xD7 ${n}${o}${c}`}function Ut(r,a,e,i){let n=(e.find(c=>c.entry_id===a)?.parts||[]).map(c=>({...c})),o=new Set(n.map(c=>j({part_id:c.id})));for(let c of r?.consumes_parts||[]){if(!c.entry_id||c.entry_id===a)continue;let u=j(c);if(o.has(u))continue;o.add(u);let{part:m,ownerName:g}=Dt(c,a,e,i);n.push({id:c.part_id,name:m?.name||s("shared_part_unknown",i),unit:m?.unit,stock:m?.stock??null,storage_location:m?.storage_location,entry_id:c.entry_id,owner_name:g})}return n}var Ke=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock","plant"],jt=["sensor"],Bt=["temperature","humidity","pressure"];function de(r){let a=(r??"").trim();if(a==="")return null;let e=Number(a.replace(",","."));return!Number.isFinite(e)||e<0?null:Math.round(e)}var Ye=["notes","cost","duration","photo","user"],ye={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"};var Vi={cleaning:"mdi:broom",inspection:"mdi:magnify",replacement:"mdi:swap-horizontal",calibration:"mdi:tune",service:"mdi:wrench",reading:"mdi:counter",custom:"mdi:wrench-clock"},Wi="mdi:wrench-clock",Ze=r=>r&&Vi[r]||Wi;function Le(r){return r?Array.isArray(r.entity_ids)&&r.entity_ids.length>0?[...r.entity_ids]:r.entity_id?[r.entity_id]:[]:[]}function Vt(r){if(!(!r||r.type==="compound"))return Le(r)[0]}var Z=class extends I{constructor(){super(...arguments);this.value="";this.lang="en";this._credit=!1;this._amount=""}willUpdate(e){if(!e.has("value"))return;let i=(this.value??"").trim();if(i===this._signed())return;let t=parseFloat(i);if(i===""||Number.isNaN(t)){this._amount="",this._credit=!1;return}this._credit=t<0,this._amount=String(Math.abs(t))}_signed(){let e=this._amount.trim
Line truncated
|
||||
<div class="wrap">
|
||||
<div class="sign" role="group">
|
||||
<button type="button" class="kind cost ${this._credit?"":"on"}" aria-pressed=${String(!this._credit)}
|
||||
@@ -342,7 +342,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._amount} @input=${this._onInput} />
|
||||
</div>
|
||||
${this._credit?l`<div class="hint">${s("cost_credit_hint",e)}</div>`:h}
|
||||
`}};J.styles=[Ae,w`
|
||||
`}};Z.styles=[Ce,w`
|
||||
:host { display: block; }
|
||||
.wrap { display: flex; gap: 8px; align-items: stretch; }
|
||||
.sign {
|
||||
@@ -365,9 +365,9 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.kind.credit.on { background: var(--success-color, #43a047); }
|
||||
.amount { flex: 1; min-width: 0; }
|
||||
.hint { margin-top: 4px; font-size: 12px; color: var(--secondary-text-color); }
|
||||
`],d([v()],J.prototype,"value",2),d([v()],J.prototype,"lang",2),d([p()],J.prototype,"_credit",2),d([p()],J.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",J);var Ai=["cleaning","inspection","replacement","calibration","service","reading","custom"],Ci=["low","normal","high"],Pi=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],Le=["weekdays","nth_weekday","day_of_month","calendar"],Lt=["time_based","one_time",...Le],Nt=["threshold","counter","state_change","runtime","due_date"],qt=(r,a)=>s(r==="due_date"?"trigger_type_due_date":r,a),Ri=[...Nt,"compound"],W={alpha:"0.3",min:"7",max:"365"},ie=Y;function Ht(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}var Li=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states","trigger_days_before"]);function Ot(r){return{type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),daysBefore:r.trigger_days_before?.toString()??"0"}}function Mt(r,a){a.attribute&&(r.attribute=a.attribute);let e=parseInt(a.forMinutes,10);if(a.type==="threshold"){let i=parseFloat(a.above);isNaN(i)||(r.trigger_above=i);let t=parseFloat(a.below);isNaN(t)||(r.trigger_below=t);let n=parseFloat(a.equals);isNaN(n)||(r.trigger_equals=n);let o=parseFloat(a.notEquals);isNaN(o)||(r.trigger_not_equals=o),isNaN(e)||(r.trigger_for_minutes=e)}else if(a.type==="counter"){let i=parseFloat(a.targetValue);isNaN(i)||(r.trigger_target_value=i),r.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(r.trigger_from_state=a.fromState),a.toState&&(r.trigger_to_state=a.toState);let i=parseInt(a.targetChanges,10);isNaN(i)||(r.trigger_target_changes=i),isNaN(e)||(r.trigger_for_minutes=e)}else if(a.type==="runtime"){let i=parseFloat(a.runtimeHours);isNaN(i)||(r.trigger_runtime_hours=i);let t=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);t.length>0&&(r.trigger_on_states=t)}else if(a.type==="due_date"){let i=parseInt(a.daysBefore,10);r.trigger_days_before=isNaN(i)?0:i}}function qi(r){return{entityIds:Re(r).join(", "),...Ot(r),carry:Object.fromEntries(Object.entries(r).filter(([e])=>!Li.has(e)&&!e.startsWith("_")))}}function Hi(r){let a=r.entityIds.split(",").map(i=>i.trim()).filter(Boolean);if(a.length===0)return null;let e={...r.carry||{},entity_id:a[0],entity_ids:a,type:r.type};return Mt(e,r),e}function Ni(r){return Array.from({length:7},(a,e)=>ze(e,r,"short"))}function Oi(r){return Array.from({length:12},(a,e)=>vt(e,r,"short"))}var _=class _ extends T{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.adaptiveFeature=!1;this.seasonalFeature=!1;this.environmentalFeature=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._isFleetTask=!1;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._calendarEntity="";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._notifyIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._triggerForMinutes="0";this._triggerCombinator="any";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._triggerBaselineValue="";this._li
Line truncated
|
||||
`],d([v()],Z.prototype,"value",2),d([v()],Z.prototype,"lang",2),d([p()],Z.prototype,"_credit",2),d([p()],Z.prototype,"_amount",2);customElements.get("ms-cost-input")||customElements.define("ms-cost-input",Z);var Gi=["cleaning","inspection","replacement","calibration","service","reading","custom"],Qi=["low","normal","high"],Ki=["time_based","weekdays","nth_weekday","day_of_month","calendar","sensor_based","one_time","manual"],qe=["weekdays","nth_weekday","day_of_month","calendar"],Wt=["time_based","one_time",...qe],Kt=["threshold","counter","state_change","runtime","due_date"],Gt=(r,a)=>s(r==="due_date"?"trigger_type_due_date":r,a),Yi=[...Kt,"compound"],W={alpha:"0.3",min:"7",max:"365"},ie=Y;function Qt(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",daysBefore:"0",carry:{}}}var Zi=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states","trigger_days_before"]);function Yt(r){return{type:r.type||"threshold",attribute:r.attribute||"",above:r.trigger_above?.toString()??"",below:r.trigger_below?.toString()??"",equals:r.trigger_equals?.toString()??"",notEquals:r.trigger_not_equals?.toString()??"",forMinutes:r.trigger_for_minutes?.toString()??"0",targetValue:r.trigger_target_value?.toString()??"",deltaMode:r.trigger_delta_mode||!1,fromState:r.trigger_from_state||"",toState:r.trigger_to_state||"",targetChanges:r.trigger_target_changes?.toString()??"",runtimeHours:r.trigger_runtime_hours?.toString()??"",onStates:(r.trigger_on_states||[]).join(", "),daysBefore:r.trigger_days_before?.toString()??"0"}}function Zt(r,a){a.attribute&&(r.attribute=a.attribute);let e=parseInt(a.forMinutes,10);if(a.type==="threshold"){let i=parseFloat(a.above);isNaN(i)||(r.trigger_above=i);let t=parseFloat(a.below);isNaN(t)||(r.trigger_below=t);let n=parseFloat(a.equals);isNaN(n)||(r.trigger_equals=n);let o=parseFloat(a.notEquals);isNaN(o)||(r.trigger_not_equals=o),isNaN(e)||(r.trigger_for_minutes=e)}else if(a.type==="counter"){let i=parseFloat(a.targetValue);isNaN(i)||(r.trigger_target_value=i),r.trigger_delta_mode=a.deltaMode}else if(a.type==="state_change"){a.fromState&&(r.trigger_from_state=a.fromState),a.toState&&(r.trigger_to_state=a.toState);let i=parseInt(a.targetChanges,10);isNaN(i)||(r.trigger_target_changes=i),isNaN(e)||(r.trigger_for_minutes=e)}else if(a.type==="runtime"){let i=parseFloat(a.runtimeHours);isNaN(i)||(r.trigger_runtime_hours=i);let t=(a.onStates||"").split(",").map(n=>n.trim()).filter(Boolean);t.length>0&&(r.trigger_on_states=t)}else if(a.type==="due_date"){let i=parseInt(a.daysBefore,10);r.trigger_days_before=isNaN(i)?0:i}}function Ji(r){return{entityIds:Le(r).join(", "),...Yt(r),carry:Object.fromEntries(Object.entries(r).filter(([e])=>!Zi.has(e)&&!e.startsWith("_")))}}function Xi(r){let a=r.entityIds.split(",").map(i=>i.trim()).filter(Boolean);if(a.length===0)return null;let e={...r.carry||{},entity_id:a[0],entity_ids:a,type:r.type};return Zt(e,r),e}function es(r){return Array.from({length:7},(a,e)=>Ge(e,r,"short"))}function ts(r){return Array.from({length:12},(a,e)=>Ct(e,r,"short"))}var _=class _ extends I{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.adaptiveFeature=!1;this.seasonalFeature=!1;this.environmentalFeature=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._isFleetTask=!1;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._calendarEntity="";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._notifyIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._triggerForMinutes="0";this._triggerCombinator="any";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._triggerBaselineValue="";this._li
Line truncated
|
||||
`),this._phaseDefs=Object.entries(i.phases||{}).map(([m,g])=>{let{name:f,checklist:x,consumes_parts:b,required_completion_fields:S,...N}=g,K=g.consumes_parts||[],X=K.findIndex(B=>!B.entry_id),F=X>=0?K[X]:void 0;return{id:m,name:g.name||m,checklistText:(g.checklist||[]).join(`
|
||||
`),partId:F?.part_id||"",partQty:F?.quantity!=null?String(F.quantity):"",reqOverride:g.required_completion_fields!==void 0,reqFields:[...g.required_completion_fields||[]],extraParts:K.filter((B,re)=>re!==X).map(B=>({...B})),carry:N}}),this._phaseSeq=[...i.phase_sequence||[]],this._requiredCompletion=[...i.required_completion_fields||[]],this._scheduleTime=i.schedule_time||"",this._scheduleTimeOn=!!i.schedule_time;let o=i.on_complete_action;if(o&&o.service){this._actionService=o.service;let m=o.target?.entity_id;this._actionTargetEntity=Array.isArray(m)?m[0]||"":m||"",this._actionTargetStored=o.target&&typeof o.target=="object"?JSON.parse(JSON.stringify(o.target)):null,this._actionTargetInitial=this._actionTargetEntity,this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback="",this._actionSkipAuto=o.skip_auto===!0,this._actionPresent=!0}else this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1;let c=i.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 u=i.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!u.enabled,this._adaptiveAlpha=u.ewa_alpha?.toString()??W.alpha,this._adaptiveMin=u.min_interval_days?.toString()??W.min,this._adaptiveMax=u.max_interval_days?.toString()??W.max,this._adaptiveSeasonal=u.seasonal_enabled!==!1,this._adaptivePrediction=u.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,i.trigger_config){let m=i.trigger_config;this._triggerEntityId=Rt(m)||"",this._triggerEntityIds=Re(m),this._triggerEntityLogic=m.entity_logic||"any",this._setTypeFields(Ot(m)),this._triggerCombinator=m.trigger_combinator==="all"?"all":"any",this._triggerBaselineValue=m.trigger_baseline_value?.toString()||"",this._liveBaselineValue=i.trigger_baseline_value??null,this._autoCompleteOnRecovery=m.auto_complete_on_recovery||!1,this._triggerRuntimeMaxSession=m.trigger_runtime_max_session_seconds?.toString()||"",m.type==="compound"?(this._compoundLogic=m.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(m.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._loadForeignPools()]),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._notifyIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._consumesQtyText={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=W.alpha,this._adaptiveMin=W.min,this._adaptiveMax=W.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=!1,this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1,this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_typeFields(){return{type:this._triggerType,attribute:this._triggerAttribute,above:this._triggerAbove,below:this._triggerBelow,equals:this._triggerEquals,notEquals:this._triggerNotEquals,forMinutes:this._triggerForMinutes,targetValue:this._triggerTargetValue,deltaMode:this._triggerDeltaMode,fromState:this._triggerFromState,toState:this._triggerToState,targetChanges:this._triggerTarget
Line truncated
|
||||
`),partId:F?.part_id||"",partQty:F?.quantity!=null?String(F.quantity):"",reqOverride:g.required_completion_fields!==void 0,reqFields:[...g.required_completion_fields||[]],extraParts:K.filter((B,re)=>re!==X).map(B=>({...B})),carry:N}}),this._phaseSeq=[...i.phase_sequence||[]],this._requiredCompletion=[...i.required_completion_fields||[]],this._scheduleTime=i.schedule_time||"",this._scheduleTimeOn=!!i.schedule_time;let o=i.on_complete_action;if(o&&o.service){this._actionService=o.service;let m=o.target?.entity_id;this._actionTargetEntity=Array.isArray(m)?m[0]||"":m||"",this._actionTargetStored=o.target&&typeof o.target=="object"?JSON.parse(JSON.stringify(o.target)):null,this._actionTargetInitial=this._actionTargetEntity,this._actionData=o.data&&typeof o.data=="object"?{...o.data}:{},this._actionDataJsonFallback="",this._actionSkipAuto=o.skip_auto===!0,this._actionPresent=!0}else this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1;let c=i.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 u=i.adaptive_config||{};if(this._environmentalEntity=u.environmental_entity||"",this._environmentalAttribute=u.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!u.enabled,this._adaptiveAlpha=u.ewa_alpha?.toString()??W.alpha,this._adaptiveMin=u.min_interval_days?.toString()??W.min,this._adaptiveMax=u.max_interval_days?.toString()??W.max,this._adaptiveSeasonal=u.seasonal_enabled!==!1,this._adaptivePrediction=u.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=this._adaptiveEnabled,i.trigger_config){let m=i.trigger_config;this._triggerEntityId=Vt(m)||"",this._triggerEntityIds=Le(m),this._triggerEntityLogic=m.entity_logic||"any",this._setTypeFields(Yt(m)),this._triggerCombinator=m.trigger_combinator==="all"?"all":"any",this._triggerBaselineValue=m.trigger_baseline_value?.toString()||"",this._liveBaselineValue=i.trigger_baseline_value??null,this._autoCompleteOnRecovery=m.auto_complete_on_recovery||!1,this._triggerRuntimeMaxSession=m.trigger_runtime_max_session_seconds?.toString()||"",m.type==="compound"?(this._compoundLogic=m.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(m.conditions||[]).map(Ji)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),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._notifyIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._consumesQtyText={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=W.alpha,this._adaptiveMin=W.min,this._adaptiveMax=W.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._adaptiveWasEnabled=!1,this._actionService="",this._actionTargetEntity="",this._actionTargetStored=null,this._actionTargetInitial="",this._actionData={},this._actionDataJsonFallback="",this._actionSkipAuto=!1,this._actionPresent=!1,this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_typeFields(){return{type:this._triggerType,attribute:this._triggerAttribute,above:this._triggerAbove,below:this._triggerBelow,equals:this._triggerEquals,notEquals:this._triggerNotEquals,forMinutes:this._triggerForMinutes,targetValue:this._triggerTargetValue,deltaMode:this._triggerDeltaMode,fromState:this._triggerFromState,toState:this._triggerToState,targetChanges:this._triggerTarget
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>
|
||||
@@ -469,7 +469,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
@input=${c=>{let u=c.target.value;this._consumesQtyText={...this._consumesQtyText,[t]:u};let m=parseFloat(u.replace(",","."));Number.isFinite(m)&&m>=ie[0]&&(this._consumesParts={...this._consumesParts,[t]:{...o,quantity:m}})}}
|
||||
/>`:h}
|
||||
</div>
|
||||
`}_applyConsumesQtyText(){let e={...this._consumesParts};for(let i of Object.keys(e)){let t=this._consumesQtyText[i];if(t===void 0)continue;let n=parseFloat(t.replace(",","."));if(!Number.isFinite(n)||n<ie[0]||n>ie[1]){let o=c=>E(c,this._lang,{maximumFractionDigits:2});return this._error=s("settings_value_out_of_range",this._lang).replace("{min}",o(ie[0])).replace("{max}",o(ie[1])),!1}e[i]={...e[i],quantity:n}}return this._consumesParts=e,!0}_toggleRequired(e,i){let t=new Set(this._requiredCompletion);i?t.add(e):t.delete(e),this._requiredCompletion=[...t]}_patchReading(e,i){this._readings=this._readings.map(t=>t.id===e?{...t,...i}:t)}_renderReadingsEditor(e){let i=pt(this._readings);return l`
|
||||
`}_applyConsumesQtyText(){let e={...this._consumesParts};for(let i of Object.keys(e)){let t=this._consumesQtyText[i];if(t===void 0)continue;let n=parseFloat(t.replace(",","."));if(!Number.isFinite(n)||n<ie[0]||n>ie[1]){let o=c=>E(c,this._lang,{maximumFractionDigits:2});return this._error=s("settings_value_out_of_range",this._lang).replace("{min}",o(ie[0])).replace("{max}",o(ie[1])),!1}e[i]={...e[i],quantity:n}}return this._consumesParts=e,!0}_toggleRequired(e,i){let t=new Set(this._requiredCompletion);i?t.add(e):t.delete(e),this._requiredCompletion=[...t]}_patchReading(e,i){this._readings=this._readings.map(t=>t.id===e?{...t,...i}:t)}_renderReadingsEditor(e){let i=kt(this._readings);return l`
|
||||
<div class="readings-editor">
|
||||
<div class="field-label">${s("readings_section",e)}</div>
|
||||
<div class="field-help">${s("readings_hint",e)}</div>
|
||||
@@ -493,9 +493,9 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
</ha-icon-button>
|
||||
</div>
|
||||
`)}
|
||||
${this._readings.length<nt?l`
|
||||
${this._readings.length<vt?l`
|
||||
<ha-button appearance="plain" class="reading-add"
|
||||
@click=${()=>this._readings=[...this._readings,{id:at(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
|
||||
@click=${()=>this._readings=[...this._readings,{id:ft(),name:"",unit:this._readings.length?this._readings[this._readings.length-1].unit:this._readingUnit}]}>
|
||||
<ha-icon icon="mdi:plus"></ha-icon> ${s("reading_add",e)}
|
||||
</ha-button>`:h}
|
||||
</div>
|
||||
@@ -550,7 +550,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
</label>
|
||||
${t.reqOverride?l`
|
||||
<div class="required-completion phase-req-fields">
|
||||
${Be.map(n=>l`
|
||||
${Ye.map(n=>l`
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -586,8 +586,8 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
</select>
|
||||
</div>
|
||||
`:h}
|
||||
`}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),i=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(i)&&e>i){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=s("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=s("calendar_entity_required",this._lang);return}if(this._applyConsumesQtyText()){this._loading=!0,this._error="";try{let e=await A(this,()=>this.hass.connection.sendMessagePromise(this._savePayload()),{fallbackKey:"save_error",onError:o=>{this._error=o}});if(e===void 0)return;let i=this._taskId||e?.task_id,t=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;this._warning="";let n=o=>{this._warning=s("subsave_warning",this._lang).replace("{detail}",o)};if(i&&this._scheduleType==="sensor_based"&&t&&await A(this,{type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:i,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null},{onError:n})!==void 0&&(this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute),i&&this._adaptiveSnapshot()!==this._adaptiveInitial){let o=parseFloat(this._adaptiveAlpha),c=parseInt(this._adaptiveMin,10),u=parseInt(this._adaptiveMax,10);await A(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:i,enabled:this._adaptiveEnabled,...o>=fe[0]&&o<=fe[1]?{ewa_alpha:o}:{},...!isNaN(c)&&c>=1?{min_interval_days:c}:{},...!isNaN(u)&&u>=1?{max_interval_days:u}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:n})!==void 0&&(this._adaptiveInitial=this._adaptiveSnapshot())}this._warning?i&&(this._taskId=i):this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}finally{this._loading=!1}}}}_savePayload(){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:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},i=this._earliestCompletionDays.trim();e.earliest_completion_days=i===""?null:Math.max(0,parseInt(i,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):Le.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.notify_icon=this._notifyIcon.trim()||null,e.priority=this._priority,e.labels=this._labels.split(",").map(t=>t.trim()).filter(Boolean),e.mirror_todo_entities=this._mirrorTodoEntities.filter(Boolean),e.enabled=this._enabled,(!this._taskId||this._lastPerformed!==this._loadedLastPerformed)&&(e.last_performed=this._lastPerformed||null),e.nfc_tag_id=this._nfcTagId||null,e.require_tag_scan=this._requireTagScan,e.allow_skip=this._allowSkip,e.notify_enabled=this._notifyEnabled,e.reading_unit=this._readingUnit.trim()||null,e.readings=ht(this._readings);{let t={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let c={...o.carry,name:o.name.trim()},u=o.checklistText.split(`
|
||||
`).map(g=>g.trim()).filter(Boolean);u.length&&(c.checklist=u);let m=[];if(o.partId){let g=parseFloat(o.partQty);m.push({part_id:o.partId,quantity:Number.isFinite(g)&&g>0?g:1})}for(let g of o.extraParts)m.push(g.entry_id?{part_id:g.part_id,quantity:g.quantity,entry_id:g.entry_id}:{part_id:g.part_id,quantity:g.quantity});m.length&&(c.consumes_parts=m),o.reqOverride&&(c.required_completion_fields=[...o.reqFields]),t[o.id]=c}let n=this._phaseSeq.filter(o=>o in t);e.phases=Object.keys(t).length&&n.length?t:null,e.phase_sequence=e.phases?n:null}if((this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(t=>t.entry_id?{part_id:t.part_id,quantity:t.quantity,entry_id:t.entry_id}:{part_id:t.part_id,quantity:t.quantity})),(!this._taskId||this._responsibleUserId!==this._loadedResponsibleUserId)&&(e.responsible_user_id=this._responsibleUserId),e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let t=this._compoundConditions.map(Hi).filter(n=>n!==null);if(t.length>0){let n={type:"compound",compound_logic:this._compoundLogic,conditions:t};this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),e.trigger_config=n}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let t=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],n={entity_id:t[0],entity_ids:t,type:this._triggerType};if(Mt(n,this._typeFields()),this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),t.length>1&&(n.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(n.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(n.trigger_runtime_max_session_seconds=o)}e.trigger_config=n}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&Lt.includes(this._scheduleType)){let t=this._scheduleTimeOn?this._scheduleTime.trim():"";e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(t)?t:null}if(this.checklistsEnabled){let t=this._checklistText.split(`
|
||||
`}async _save(){if(!this._loading&&this._name.trim()){if(this._adaptiveSnapshot()!==this._adaptiveInitial){let e=parseInt(this._adaptiveMin,10),i=parseInt(this._adaptiveMax,10);if(!isNaN(e)&&!isNaN(i)&&e>i){this._error=`${s("adaptive_min_interval",this._lang)} > ${s("adaptive_max_interval",this._lang)}`;return}}if(this._triggerType==="threshold"&&this._thresholdLimitsOverlap()){this._error=s("trigger_hint_overlap",this._lang);return}if(this._scheduleType==="calendar"&&!this._calendarEntity.trim().startsWith("calendar.")){this._error=s("calendar_entity_required",this._lang);return}if(this._applyConsumesQtyText()){this._loading=!0,this._error="";try{let e=await A(this,()=>this.hass.connection.sendMessagePromise(this._savePayload()),{fallbackKey:"save_error",onError:o=>{this._error=o}});if(e===void 0)return;let i=this._taskId||e?.task_id,t=this._environmentalEntity!==this._environmentalInitial||this._environmentalAttribute!==this._environmentalAttributeInitial;this._warning="";let n=o=>{this._warning=s("subsave_warning",this._lang).replace("{detail}",o)};if(i&&this._scheduleType==="sensor_based"&&t&&await A(this,{type:"maintenance_supporter/task/set_environmental_entity",entry_id:this._entryId,task_id:i,environmental_entity:this._environmentalEntity||null,environmental_attribute:this._environmentalAttribute||null},{onError:n})!==void 0&&(this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute),i&&this._adaptiveSnapshot()!==this._adaptiveInitial){let o=parseFloat(this._adaptiveAlpha),c=parseInt(this._adaptiveMin,10),u=parseInt(this._adaptiveMax,10);await A(this,{type:"maintenance_supporter/task/set_adaptive",entry_id:this._entryId,task_id:i,enabled:this._adaptiveEnabled,...o>=fe[0]&&o<=fe[1]?{ewa_alpha:o}:{},...!isNaN(c)&&c>=1?{min_interval_days:c}:{},...!isNaN(u)&&u>=1?{max_interval_days:u}:{},seasonal_enabled:this._adaptiveSeasonal,sensor_prediction_enabled:this._adaptivePrediction},{onError:n})!==void 0&&(this._adaptiveInitial=this._adaptiveSnapshot())}this._warning?i&&(this._taskId=i):this._open=!1,this.dispatchEvent(new CustomEvent("task-saved"))}finally{this._loading=!1}}}}_savePayload(){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:Number.isNaN(parseInt(this._warningDays,10))?this.defaultWarningDays:Math.max(0,parseInt(this._warningDays,10))},i=this._earliestCompletionDays.trim();e.earliest_completion_days=i===""?null:Math.max(0,parseInt(i,10)||0),this._taskId&&(e.task_id=this._taskId),this._scheduleType==="one_time"?(e.due_date=this._dueDate||null,e.interval_days=null):qe.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.notify_icon=this._notifyIcon.trim()||null,e.priority=this._priority,e.labels=this._labels.split(",").map(t=>t.trim()).filter(Boolean),e.mirror_todo_entities=this._mirrorTodoEntities.filter(Boolean),e.enabled=this._enabled,(!this._taskId||this._lastPerformed!==this._loadedLastPerformed)&&(e.last_performed=this._lastPerformed||null),e.nfc_tag_id=this._nfcTagId||null,e.require_tag_scan=this._requireTagScan,e.allow_skip=this._allowSkip,e.notify_enabled=this._notifyEnabled,e.reading_unit=this._readingUnit.trim()||null,e.readings=wt(this._readings);{let t={};for(let o of this._phaseDefs){if(!o.name.trim())continue;let c={...o.carry,name:o.name.trim()},u=o.checklistText.split(`
|
||||
`).map(g=>g.trim()).filter(Boolean);u.length&&(c.checklist=u);let m=[];if(o.partId){let g=parseFloat(o.partQty);m.push({part_id:o.partId,quantity:Number.isFinite(g)&&g>0?g:1})}for(let g of o.extraParts)m.push(g.entry_id?{part_id:g.part_id,quantity:g.quantity,entry_id:g.entry_id}:{part_id:g.part_id,quantity:g.quantity});m.length&&(c.consumes_parts=m),o.reqOverride&&(c.required_completion_fields=[...o.reqFields]),t[o.id]=c}let n=this._phaseSeq.filter(o=>o in t);e.phases=Object.keys(t).length&&n.length?t:null,e.phase_sequence=e.phases?n:null}if((this.parts.length||this._foreignOwners.length)&&(e.consumes_parts=Object.values(this._consumesParts).map(t=>t.entry_id?{part_id:t.part_id,quantity:t.quantity,entry_id:t.entry_id}:{part_id:t.part_id,quantity:t.quantity})),(!this._taskId||this._responsibleUserId!==this._loadedResponsibleUserId)&&(e.responsible_user_id=this._responsibleUserId),e.assignee_pool=this._assigneePool,e.required_completion_fields=this._requiredCompletion,e.rotation_strategy=this._assigneePool.length>=2&&this._rotationStrategy?this._rotationStrategy:null,this._scheduleType==="sensor_based"&&this._triggerType==="compound"){let t=this._compoundConditions.map(Xi).filter(n=>n!==null);if(t.length>0){let n={type:"compound",compound_logic:this._compoundLogic,conditions:t};this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),e.trigger_config=n}else this._taskId&&(e.trigger_config=null)}else if(this._scheduleType==="sensor_based"&&this._triggerEntityId){let t=this._triggerEntityIds.length>0?this._triggerEntityIds:[this._triggerEntityId],n={entity_id:t[0],entity_ids:t,type:this._triggerType};if(Zt(n,this._typeFields()),this._autoCompleteOnRecovery&&(n.auto_complete_on_recovery=!0),this._triggerCombinator==="all"&&(n.trigger_combinator="all"),t.length>1&&(n.entity_logic=this._triggerEntityLogic),this._triggerType==="counter"&&this._triggerDeltaMode&&this._triggerBaselineValue){let o=parseFloat(this._triggerBaselineValue);!isNaN(o)&&o>=0&&(n.trigger_baseline_value=o)}else if(this._triggerType==="runtime"&&this._triggerRuntimeMaxSession){let o=parseInt(this._triggerRuntimeMaxSession,10);!isNaN(o)&&o>0&&(n.trigger_runtime_max_session_seconds=o)}e.trigger_config=n}else this._taskId&&(e.trigger_config=null);if(this.scheduleTimeEnabled&&Wt.includes(this._scheduleType)){let t=this._scheduleTimeOn?this._scheduleTime.trim():"";e.schedule_time=/^([01]\d|2[0-3]):[0-5]\d$/.test(t)?t:null}if(this.checklistsEnabled){let t=this._checklistText.split(`
|
||||
`).map(n=>n.trim()).filter(Boolean).slice(0,100);e.checklist=t.length?t:null}if(this.completionActionsEnabled||this._actionPresent){let t=this._actionService.trim();if(t&&/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(t)){let n={service:t},o=this._actionTargetEntity.trim();this._actionTargetStored&&o===this._actionTargetInitial?n.target=JSON.parse(JSON.stringify(this._actionTargetStored)):o&&(n.target={entity_id:o});let c=this._buildActionData();Object.keys(c).length>0&&(n.data=c),this._actionSkipAuto&&(n.skip_auto=!0),e.on_complete_action=n}else e.on_complete_action=null}if(this.completionActionsEnabled){let t={};this._qcNotes.trim()&&(t.notes=this._qcNotes.trim());let n=parseFloat(this._qcCost);isNaN(n)||(t.cost=n);let o=de(this._qcDuration);o!==null&&(t.duration=o),this._qcFeedback&&(t.feedback=this._qcFeedback),e.quick_complete_defaults=Object.keys(t).length?t:null}return e}_close(){this._open=!1,this._warning="",this._pickerProbeTimer!==void 0&&(clearTimeout(this._pickerProbeTimer),this._pickerProbeTimer=void 0),this._pickerProbeStrikes=0}_renderTriggerFields(){if(this._scheduleType!=="sensor_based")return h;let e=this._lang,i=this._triggerType==="compound";return l`
|
||||
<h3>${s("trigger_configuration",e)}</h3>
|
||||
<div class="select-row">
|
||||
@@ -596,7 +596,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._triggerType}
|
||||
@change=${t=>this._triggerType=t.target.value}
|
||||
>
|
||||
${Ri.map(t=>l`<option value=${t} ?selected=${t===this._triggerType}>${qt(t,e)}</option>`)}
|
||||
${Yi.map(t=>l`<option value=${t} ?selected=${t===this._triggerType}>${Gt(t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${i?this._renderCompoundEditor():l`
|
||||
@@ -610,7 +610,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:je}}}]}
|
||||
.schema=${[{name:"trigger_entities",selector:{entity:{multiple:!0,domain:Ke}}}]}
|
||||
.data=${{trigger_entities:this._triggerEntityIds.length>0?this._triggerEntityIds:this._triggerEntityId?[this._triggerEntityId]:[]}}
|
||||
.computeLabel=${()=>s("entity_id",e)}
|
||||
@value-changed=${t=>{let n=(t.detail.value.trigger_entities||[]).filter(Boolean);this._triggerEntityId=n[0]||"",this._triggerEntityIds=n,n[0]?this._fetchEntityAttributes(n[0]):this._fetchEntityAttributes("")}}
|
||||
@@ -658,7 +658,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
</select>
|
||||
</div>
|
||||
`:h}
|
||||
`}_patchCondition(e,i){this._compoundConditions=this._compoundConditions.map((t,n)=>n===e?{...t,...i}:t)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Ht()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((i,t)=>t!==e)}_renderCompoundEditor(){let e=this._lang;return l`
|
||||
`}_patchCondition(e,i){this._compoundConditions=this._compoundConditions.map((t,n)=>n===e?{...t,...i}:t)}_addCondition(){this._compoundConditions=[...this._compoundConditions,Qt()]}_removeCondition(e){this._compoundConditions=this._compoundConditions.filter((i,t)=>t!==e)}_renderCompoundEditor(){let e=this._lang;return l`
|
||||
<div class="select-row">
|
||||
<label>${s("compound_logic",e)}</label>
|
||||
<select
|
||||
@@ -695,7 +695,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:je}}}]}
|
||||
.schema=${[{name:"condition_entities",selector:{entity:{multiple:!0,domain:Ke}}}]}
|
||||
.data=${{condition_entities:e.entityIds.split(",").map(o=>o.trim()).filter(Boolean)}}
|
||||
.computeLabel=${()=>s("entity_id",t)}
|
||||
@value-changed=${o=>{let c=(o.detail.value.condition_entities||[]).filter(Boolean);this._patchCondition(i,{entityIds:c.join(", ")})}}
|
||||
@@ -707,7 +707,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${e.type}
|
||||
@change=${o=>this._patchCondition(i,{type:o.target.value})}
|
||||
>
|
||||
${Nt.map(o=>l`<option value=${o} ?selected=${o===e.type}>${qt(o,t)}</option>`)}
|
||||
${Kt.map(o=>l`<option value=${o} ?selected=${o===e.type}>${Gt(o,t)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._renderConditionTypeFields(e,i)}
|
||||
@@ -857,12 +857,12 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
>
|
||||
${["days","weeks","months","years"].map(i=>l`<option value=${i} ?selected=${i===this._intervalUnit}>${s("unit_"+i,e)}</option>`)}
|
||||
</select>
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(i=>i!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(this._scheduleType==="calendar"&&!this._calendarEntity.trim())return null;if(Le.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let i of e.keys())if(_._PREVIEW_RELEVANT.has(String(i))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),i=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!i){this._pickerProbeStrikes=0;return}let t=(u,m,g=0)=>{if(!(!u||g>10)){(u.tagName?.toLowerCase()??"")==="ha-entity-picker"&&m.push(u);for(let f of[u.shadowRoot,u])if(f)for(let x of Array.from(f.children??[]))t(x,m,g+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let u of n)t(u,o);let c=o.length===0||o.some(u=>u.offsetHeight===0);if(e.offsetHeight===0||c){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let i=++this._previewSeq;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(i!==this._previewSeq)return;this._schedulePreview=t.occurrences||[],this._schedulePreviewEnded=!!t.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,i=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",t=this._schedulePreview.map((o,c)=>{let u=new Date(`${o}T12:00:00`).getDay();return`${ze(u===0?6:u-1,e,"short")} ${U(o,e)}${c===0?i:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${s("schedule_preview_ontime",e)}</div>`:h;return l`
|
||||
</div>`}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(i=>i!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(this._scheduleType==="calendar"&&!this._calendarEntity.trim())return null;if(qe.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let i of e.keys())if(_._PREVIEW_RELEVANT.has(String(i))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),i=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!i){this._pickerProbeStrikes=0;return}let t=(u,m,g=0)=>{if(!(!u||g>10)){(u.tagName?.toLowerCase()??"")==="ha-entity-picker"&&m.push(u);for(let f of[u.shadowRoot,u])if(f)for(let x of Array.from(f.children??[]))t(x,m,g+1)}},n=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let u of n)t(u,o);let c=o.length===0||o.some(u=>u.offsetHeight===0);if(e.offsetHeight===0||c){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let i=++this._previewSeq;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(i!==this._previewSeq)return;this._schedulePreview=t.occurrences||[],this._schedulePreviewEnded=!!t.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return h;let e=this._lang,i=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",t=this._schedulePreview.map((o,c)=>{let u=new Date(`${o}T12:00:00`).getDay();return`${Ge(u===0?6:u-1,e,"short")} ${U(o,e)}${c===0?i:""}`}).join(" \xB7 "),n=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`<div class="field-help">${s("schedule_preview_ontime",e)}</div>`:h;return l`
|
||||
<div class="trigger-live-hint schedule-preview">
|
||||
${s("schedule_preview_title",e)}: ${t}${this._schedulePreviewEnded?l` <span class="field-help">${s("schedule_preview_ends",e)}</span>`:h}
|
||||
${n}
|
||||
</div>
|
||||
`}_buildSchedule(){let e=t=>{let n=parseInt(this._calOffset,10)||0;return n&&(t.offset=Math.max(-ve,Math.min(n,ve))),t};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((t,n)=>t-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});if(this._scheduleType==="calendar")return e({kind:"calendar",entity_id:this._calendarEntity.trim()});let i={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(i.business=!0),e(i)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((i,t)=>i-t)),this._endsMode==="count"){let i=parseInt(this._endsCount,10);i>=1&&(e.ends={count:i})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(i=>i!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||Le.includes(this._scheduleType)))return h;let t=Oi(e);return l`
|
||||
`}_buildSchedule(){let e=t=>{let n=parseInt(this._calOffset,10)||0;return n&&(t.offset=Math.max(-ve,Math.min(n,ve))),t};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((t,n)=>t-n)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});if(this._scheduleType==="calendar")return e({kind:"calendar",entity_id:this._calendarEntity.trim()});let i={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(i.business=!0),e(i)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((i,t)=>i-t)),this._endsMode==="count"){let i=parseInt(this._endsCount,10);i>=1&&(e.ends={count:i})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(i=>i!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||qe.includes(this._scheduleType)))return h;let t=ts(e);return l`
|
||||
<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">
|
||||
@@ -899,7 +899,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._endsUntil}
|
||||
@value-changed=${n=>this._endsUntil=n.detail.value}
|
||||
></ms-date-field>`:h}
|
||||
`}_renderCalendarFields(){let e=this._lang,i=Ni(e);if(this._scheduleType==="weekdays")return l`
|
||||
`}_renderCalendarFields(){let e=this._lang,i=es(e);if(this._scheduleType==="weekdays")return l`
|
||||
<label class="field-label">${s("recurrence_on_days",e)}</label>
|
||||
<div class="weekday-chips">
|
||||
${i.map((t,n)=>l`
|
||||
@@ -1042,7 +1042,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<ms-textfield
|
||||
label="${s("target_changes",e)}"
|
||||
type="number"
|
||||
min=${xt[0]}
|
||||
min=${Ht[0]}
|
||||
.value=${this._triggerTargetChanges}
|
||||
@input=${i=>this._triggerTargetChanges=i.target.value}
|
||||
></ms-textfield>
|
||||
@@ -1051,7 +1051,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<ms-textfield
|
||||
label="${s("for_at_least_minutes",e)}"
|
||||
type="number"
|
||||
min=${$t[0]}
|
||||
min=${qt[0]}
|
||||
.value=${this._triggerForMinutes}
|
||||
@input=${i=>this._triggerForMinutes=i.target.value}
|
||||
></ms-textfield>
|
||||
@@ -1114,7 +1114,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._type}
|
||||
@change=${t=>this._type=t.target.value}
|
||||
>
|
||||
${Ai.map(t=>l`<option value=${t} ?selected=${t===this._type}>${s(t,e)}</option>`)}
|
||||
${Gi.map(t=>l`<option value=${t} ?selected=${t===this._type}>${s(t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._type==="reading"?l`
|
||||
@@ -1149,7 +1149,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._priority}
|
||||
@change=${t=>this._priority=t.target.value}
|
||||
>
|
||||
${Ci.map(t=>l`<option value=${t} ?selected=${t===this._priority}>${s("priority_"+t,e)}</option>`)}
|
||||
${Qi.map(t=>l`<option value=${t} ?selected=${t===this._priority}>${s("priority_"+t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
@@ -1187,7 +1187,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._scheduleType}
|
||||
@change=${t=>this._scheduleType=t.target.value}
|
||||
>
|
||||
${Pi.map(t=>l`<option value=${t} ?selected=${t===this._scheduleType}>${s(t,e)}</option>`)}
|
||||
${Ki.map(t=>l`<option value=${t} ?selected=${t===this._scheduleType}>${s(t,e)}</option>`)}
|
||||
</select>
|
||||
</div>
|
||||
${this._scheduleType==="time_based"?l`
|
||||
@@ -1220,7 +1220,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
@value-changed=${t=>this._dueDate=t.detail.value}
|
||||
></ms-date-field>
|
||||
`:h}
|
||||
${this.scheduleTimeEnabled&&Lt.includes(this._scheduleType)?l`
|
||||
${this.scheduleTimeEnabled&&Wt.includes(this._scheduleType)?l`
|
||||
<label class="checkbox-row schedule-time-toggle">
|
||||
<input type="checkbox" .checked=${this._scheduleTimeOn}
|
||||
@change=${t=>this._scheduleTimeOn=t.target.checked} />
|
||||
@@ -1242,8 +1242,8 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<ms-textfield
|
||||
label="${s("warning_days",e)}"
|
||||
type="number"
|
||||
min=${Ue[0]}
|
||||
max=${Ue[1]}
|
||||
min=${Qe[0]}
|
||||
max=${Qe[1]}
|
||||
.value=${this._warningDays}
|
||||
@input=${t=>this._warningDays=t.target.value}
|
||||
></ms-textfield>
|
||||
@@ -1269,7 +1269,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
${this._renderPhasesEditor(e)}
|
||||
<h3>${s("require_on_completion",e)}</h3>
|
||||
<div class="required-completion">
|
||||
${Be.map(t=>l`
|
||||
${Ye.map(t=>l`
|
||||
<label class="req-option">
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -1338,7 +1338,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<ha-form
|
||||
class="entity-picker-form"
|
||||
.hass=${this.hass}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:Ct,device_class:Pt}}}]}
|
||||
.schema=${[{name:"environmental_entity",selector:{entity:{domain:jt,device_class:Bt}}}]}
|
||||
.data=${{environmental_entity:this._environmentalEntity}}
|
||||
.computeLabel=${()=>s("environmental_entity_optional",e)}
|
||||
.computeHelper=${()=>s("environmental_entity_helper",e)}
|
||||
@@ -1374,8 +1374,8 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
@value-changed=${t=>this._notifyIcon=t.detail.value||""}
|
||||
></ha-icon-picker>
|
||||
<div class="field-help notify-icon-help">
|
||||
<ha-icon icon=${this._notifyIcon.trim()||Ve(this._type)}></ha-icon>
|
||||
${s("notify_icon_hint",e).replace("{default}",Ve(this._type))}
|
||||
<ha-icon icon=${this._notifyIcon.trim()||Ze(this._type)}></ha-icon>
|
||||
${s("notify_icon_hint",e).replace("{default}",Ze(this._type))}
|
||||
</div>
|
||||
${this._availableTags.length>0?l`
|
||||
<div class="select-row">
|
||||
@@ -1853,8 +1853,8 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
`,d([v({attribute:!1})],_.prototype,"hass",2),d([v({type:Boolean,attribute:"checklists-enabled"})],_.prototype,"checklistsEnabled",2),d([v({type:Boolean,attribute:"schedule-time-enabled"})],_.prototype,"scheduleTimeEnabled",2),d([v({type:Boolean,attribute:"completion-actions-enabled"})],_.prototype,"completionActionsEnabled",2),d([v({type:Boolean,attribute:"adaptive-feature"})],_.prototype,"adaptiveFeature",2),d([v({type:Boolean,attribute:"seasonal-feature"})],_.prototype,"seasonalFeature",2),d([v({type:Boolean,attribute:"environmental-feature"})],_.prototype,"environmentalFeature",2),d([v({type:Number,attribute:"default-warning-days"})],_.prototype,"defaultWarningDays",2),d([p()],_.prototype,"parts",2),d([p()],_.prototype,"_foreignOwners",2),d([p()],_.prototype,"_open",2),d([p()],_.prototype,"_entityPickerFallback",2),d([p()],_.prototype,"_loading",2),d([p()],_.prototype,"_error",2),d([p()],_.prototype,"_warning",2),d([p()],_.prototype,"_entryId",2),d([p()],_.prototype,"_taskId",2),d([p()],_.prototype,"_isFleetTask",2),d([p()],_.prototype,"_objectChoices",2),d([p()],_.prototype,"_name",2),d([p()],_.prototype,"_type",2),d([p()],_.prototype,"_scheduleType",2),d([p()],_.prototype,"_intervalDays",2),d([p()],_.prototype,"_intervalUnit",2),d([p()],_.prototype,"_dueDate",2),d([p()],_.prototype,"_warningDays",2),d([p()],_.prototype,"_earliestCompletionDays",2),d([p()],_.prototype,"_intervalAnchor",2),d([p()],_.prototype,"_weekdays",2),d([p()],_.prototype,"_nth",2),d([p()],_.prototype,"_nthWeekday",2),d([p()],_.prototype,"_domDay",2),d([p()],_.prototype,"_domLastDay",2),d([p()],_.prototype,"_domBusiness",2),d([p()],_.prototype,"_calOffset",2),d([p()],_.prototype,"_calendarEntity",2),d([p()],_.prototype,"_seasonMonths",2),d([p()],_.prototype,"_endsMode",2),d([p()],_.prototype,"_endsCount",2),d([p()],_.prototype,"_endsUntil",2),d([p()],_.prototype,"_schedulePreview",2),d([p()],_.prototype,"_schedulePreviewEnded",2),d([p()],_.prototype,"_notes",2),d([p()],_.prototype,"_documentationUrl",2),d([p()],_.prototype,"_customIcon",2),d([p()],_.prototype,"_notifyIcon",2),d([p()],_.prototype,"_priority",2),d([p()],_.prototype,"_labels",2),d([p()],_.prototype,"_mirrorTodoEntities",2),d([p()],_.prototype,"_enabled",2),d([p()],_.prototype,"_triggerEntityId",2),d([p()],_.prototype,"_triggerEntityIds",2),d([p()],_.prototype,"_triggerEntityLogic",2),d([p()],_.prototype,"_triggerAttribute",2),d([p()],_.prototype,"_triggerType",2),d([p()],_.prototype,"_triggerAbove",2),d([p()],_.prototype,"_triggerBelow",2),d([p()],_.prototype,"_triggerEquals",2),d([p()],_.prototype,"_triggerNotEquals",2),d([p()],_.prototype,"_triggerForMinutes",2),d([p()],_.prototype,"_triggerCombinator",2),d([p()],_.prototype,"_triggerTargetValue",2),d([p()],_.prototype,"_triggerDeltaMode",2),d([p()],_.prototype,"_triggerBaselineValue",2),d([p()],_.prototype,"_liveBaselineValue",2),d([p()],_.prototype,"_autoCompleteOnRecovery",2),d([p()],_.prototype,"_triggerFromState",2),d([p()],_.prototype,"_triggerToState",2),d([p()],_.prototype,"_triggerTargetChanges",2),d([p()],_.prototype,"_triggerRuntimeHours",2),d([p()],_.prototype,"_triggerDaysBefore",2),d([p()],_.prototype,"_triggerRuntimeMaxSession",2),d([p()],_.prototype,"_triggerOnStates",2),d([p()],_.prototype,"_compoundLogic",2),d([p()],_.prototype,"_compoundConditions",2),d([p()],_.prototype,"_suggestedAttributes",2),d([p()],_.prototype,"_availableAttributes",2),d([p()],_.prototype,"_entityDomain",2),d([p()],_.prototype,"_lastPerformed",2),d([p()],_.prototype,"_nfcTagId",2),d([p()],_.prototype,"_requireTagScan",2),d([p()],_.prototype,"_allowSkip",2),d([p()],_.prototype,"_notifyEnabled",2),d([p()],_.prototype,"_readingUnit",2),d([p()],_.prototype,"_readings",2),d([p()],_.prototype,"_consumesParts",2),d([p()],_.prototype,"_consumesQtyText",2),d([p()],_.prototype,"_partsLoadFailed",2),d([p()],_.prototype,"_availableTags",2),d([p()],_.prototype,"_responsibleUserId",2),d([p()],_.prototype,"_assigneePool",2),d([p()],_.prototype,"_rotationStrategy",2),d([p()],_.prototype,"_availableUsers",2),d([p()],_.prototype,"_checklistText",2),d([p()],_.prototype,"_phaseDefs",2),d([p()],_.prototype,"_phaseSeq",2),d([p()],_.prototype,"_requiredCompletion",2),d([p()],_.prototype,"_scheduleTime",2),d([p()],_.prototype,"_scheduleTimeOn",2),d([p()],_.prototype,"_actionService",2),d([p()],_.prototype,"_actionTargetEntity",2),d([p()],_.prototype,"_actionSkipAuto",2),d([p()],_.prototype,"_actionPresent",2),d([p()],_.prototype,"_actionData",2),d([p()],_.prototype,"_actionDataJsonFallback",2),d([p()],_.prototype,"_actionTesting",2),d([p()],_.prototype,"_actionTestResult",2),d([p()],_.prototype,"_actionTestError",2),d([p()],_.prototype,"_qcNotes",2),d([p()],_.prototype,"_qcCost",2),d([p()],_.prototype,"_qcDuration",2),d([p()],_.prototype,"_qcFeedback",2),d([p()],_.prototype,"_environmentalEntity",2),d([p()],_.prototype,"_environmentalAttribute",2),d([p()],_.prototype,"_adaptiveEnabled",2),d([p()],_.prototype,"_adaptiveAlpha",2),d([p()],_.prototy
Line truncated
|
||||
`),i=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),i=!0)}catch{}if(!i){let t=this.shadowRoot?.querySelector(".details textarea");if(t){t.focus(),t.select();try{i=document.execCommand("copy")}catch{i=!1}}}this._copied=i}async _shoot(){let e=this._video;if(!(!e||this._busy||this._switching)){this._busy=!0;try{let i=e.videoWidth||640,t=e.videoHeight||480,n=Math.min(1,zi/Math.max(i,t)),o=document.createElement("canvas");o.width=Math.round(i*n),o.height=Math.round(t*n);let c=o.getContext("2d");if(!c)throw new Error("no_canvas");c.drawImage(e,0,0,o.width,o.height);let u=await new Promise(f=>o.toBlob(f,"image/jpeg",Ui));if(!u)throw new Error("no_blob");let m=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),g=new File([u],`photo-${m}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:g},bubbles:!0,composed:!0}))}catch(i){this._unavailable(i instanceof Error?i.message:String(i))}finally{this._busy=!1}}}render(){if(!this._open)return h;let e=this.lang,i=this._busy||this._switching;return l`
|
||||
`,d([v({attribute:!1})],_.prototype,"hass",2),d([v({type:Boolean,attribute:"checklists-enabled"})],_.prototype,"checklistsEnabled",2),d([v({type:Boolean,attribute:"schedule-time-enabled"})],_.prototype,"scheduleTimeEnabled",2),d([v({type:Boolean,attribute:"completion-actions-enabled"})],_.prototype,"completionActionsEnabled",2),d([v({type:Boolean,attribute:"adaptive-feature"})],_.prototype,"adaptiveFeature",2),d([v({type:Boolean,attribute:"seasonal-feature"})],_.prototype,"seasonalFeature",2),d([v({type:Boolean,attribute:"environmental-feature"})],_.prototype,"environmentalFeature",2),d([v({type:Number,attribute:"default-warning-days"})],_.prototype,"defaultWarningDays",2),d([p()],_.prototype,"parts",2),d([p()],_.prototype,"_foreignOwners",2),d([p()],_.prototype,"_open",2),d([p()],_.prototype,"_entityPickerFallback",2),d([p()],_.prototype,"_loading",2),d([p()],_.prototype,"_error",2),d([p()],_.prototype,"_warning",2),d([p()],_.prototype,"_entryId",2),d([p()],_.prototype,"_taskId",2),d([p()],_.prototype,"_isFleetTask",2),d([p()],_.prototype,"_objectChoices",2),d([p()],_.prototype,"_name",2),d([p()],_.prototype,"_type",2),d([p()],_.prototype,"_scheduleType",2),d([p()],_.prototype,"_intervalDays",2),d([p()],_.prototype,"_intervalUnit",2),d([p()],_.prototype,"_dueDate",2),d([p()],_.prototype,"_warningDays",2),d([p()],_.prototype,"_earliestCompletionDays",2),d([p()],_.prototype,"_intervalAnchor",2),d([p()],_.prototype,"_weekdays",2),d([p()],_.prototype,"_nth",2),d([p()],_.prototype,"_nthWeekday",2),d([p()],_.prototype,"_domDay",2),d([p()],_.prototype,"_domLastDay",2),d([p()],_.prototype,"_domBusiness",2),d([p()],_.prototype,"_calOffset",2),d([p()],_.prototype,"_calendarEntity",2),d([p()],_.prototype,"_seasonMonths",2),d([p()],_.prototype,"_endsMode",2),d([p()],_.prototype,"_endsCount",2),d([p()],_.prototype,"_endsUntil",2),d([p()],_.prototype,"_schedulePreview",2),d([p()],_.prototype,"_schedulePreviewEnded",2),d([p()],_.prototype,"_notes",2),d([p()],_.prototype,"_documentationUrl",2),d([p()],_.prototype,"_customIcon",2),d([p()],_.prototype,"_notifyIcon",2),d([p()],_.prototype,"_priority",2),d([p()],_.prototype,"_labels",2),d([p()],_.prototype,"_mirrorTodoEntities",2),d([p()],_.prototype,"_enabled",2),d([p()],_.prototype,"_triggerEntityId",2),d([p()],_.prototype,"_triggerEntityIds",2),d([p()],_.prototype,"_triggerEntityLogic",2),d([p()],_.prototype,"_triggerAttribute",2),d([p()],_.prototype,"_triggerType",2),d([p()],_.prototype,"_triggerAbove",2),d([p()],_.prototype,"_triggerBelow",2),d([p()],_.prototype,"_triggerEquals",2),d([p()],_.prototype,"_triggerNotEquals",2),d([p()],_.prototype,"_triggerForMinutes",2),d([p()],_.prototype,"_triggerCombinator",2),d([p()],_.prototype,"_triggerTargetValue",2),d([p()],_.prototype,"_triggerDeltaMode",2),d([p()],_.prototype,"_triggerBaselineValue",2),d([p()],_.prototype,"_liveBaselineValue",2),d([p()],_.prototype,"_autoCompleteOnRecovery",2),d([p()],_.prototype,"_triggerFromState",2),d([p()],_.prototype,"_triggerToState",2),d([p()],_.prototype,"_triggerTargetChanges",2),d([p()],_.prototype,"_triggerRuntimeHours",2),d([p()],_.prototype,"_triggerDaysBefore",2),d([p()],_.prototype,"_triggerRuntimeMaxSession",2),d([p()],_.prototype,"_triggerOnStates",2),d([p()],_.prototype,"_compoundLogic",2),d([p()],_.prototype,"_compoundConditions",2),d([p()],_.prototype,"_suggestedAttributes",2),d([p()],_.prototype,"_availableAttributes",2),d([p()],_.prototype,"_entityDomain",2),d([p()],_.prototype,"_lastPerformed",2),d([p()],_.prototype,"_nfcTagId",2),d([p()],_.prototype,"_requireTagScan",2),d([p()],_.prototype,"_allowSkip",2),d([p()],_.prototype,"_notifyEnabled",2),d([p()],_.prototype,"_readingUnit",2),d([p()],_.prototype,"_readings",2),d([p()],_.prototype,"_consumesParts",2),d([p()],_.prototype,"_consumesQtyText",2),d([p()],_.prototype,"_partsLoadFailed",2),d([p()],_.prototype,"_availableTags",2),d([p()],_.prototype,"_responsibleUserId",2),d([p()],_.prototype,"_assigneePool",2),d([p()],_.prototype,"_rotationStrategy",2),d([p()],_.prototype,"_availableUsers",2),d([p()],_.prototype,"_checklistText",2),d([p()],_.prototype,"_phaseDefs",2),d([p()],_.prototype,"_phaseSeq",2),d([p()],_.prototype,"_requiredCompletion",2),d([p()],_.prototype,"_scheduleTime",2),d([p()],_.prototype,"_scheduleTimeOn",2),d([p()],_.prototype,"_actionService",2),d([p()],_.prototype,"_actionTargetEntity",2),d([p()],_.prototype,"_actionSkipAuto",2),d([p()],_.prototype,"_actionPresent",2),d([p()],_.prototype,"_actionData",2),d([p()],_.prototype,"_actionDataJsonFallback",2),d([p()],_.prototype,"_actionTesting",2),d([p()],_.prototype,"_actionTestResult",2),d([p()],_.prototype,"_actionTestError",2),d([p()],_.prototype,"_qcNotes",2),d([p()],_.prototype,"_qcCost",2),d([p()],_.prototype,"_qcDuration",2),d([p()],_.prototype,"_qcFeedback",2),d([p()],_.prototype,"_environmentalEntity",2),d([p()],_.prototype,"_environmentalAttribute",2),d([p()],_.prototype,"_adaptiveEnabled",2),d([p()],_.prototype,"_adaptiveAlpha",2),d([p()],_.prototy
Line truncated
|
||||
`),i=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),i=!0)}catch{}if(!i){let t=this.shadowRoot?.querySelector(".details textarea");if(t){t.focus(),t.select();try{i=document.execCommand("copy")}catch{i=!1}}}this._copied=i}async _shoot(){let e=this._video;if(!(!e||this._busy||this._switching)){this._busy=!0;try{let i=e.videoWidth||640,t=e.videoHeight||480,n=Math.min(1,as/Math.max(i,t)),o=document.createElement("canvas");o.width=Math.round(i*n),o.height=Math.round(t*n);let c=o.getContext("2d");if(!c)throw new Error("no_canvas");c.drawImage(e,0,0,o.width,o.height);let u=await new Promise(f=>o.toBlob(f,"image/jpeg",os));if(!u)throw new Error("no_blob");let m=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),g=new File([u],`photo-${m}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:g},bubbles:!0,composed:!0}))}catch(i){this._unavailable(i instanceof Error?i.message:String(i))}finally{this._busy=!1}}}render(){if(!this._open)return h;let e=this.lang,i=this._busy||this._switching;return l`
|
||||
<div class="overlay" role="dialog" aria-modal="true" aria-label=${s("doc_camera",e)}>
|
||||
<video autoplay playsinline muted></video>
|
||||
${this._switching?l`<div class="switching" role="status">${s("camera_switching",e)}</div>`:h}
|
||||
@@ -1919,7 +1919,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.shoot { background: var(--primary-color, #03a9f4); color: #fff; border: none; font-weight: 600; }
|
||||
.shoot[disabled] { opacity: 0.6; cursor: default; }
|
||||
.shoot ha-icon { --mdc-icon-size: 22px; }
|
||||
`,d([v({type:String})],q.prototype,"lang",2),d([p()],q.prototype,"_open",2),d([p()],q.prototype,"_busy",2),d([p()],q.prototype,"_switching",2),d([p()],q.prototype,"_devices",2),d([p()],q.prototype,"_deviceIndex",2),d([p()],q.prototype,"_switchFailed",2),d([p()],q.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",q);var He=w`
|
||||
`,d([v({type:String})],q.prototype,"lang",2),d([p()],q.prototype,"_open",2),d([p()],q.prototype,"_busy",2),d([p()],q.prototype,"_switching",2),d([p()],q.prototype,"_devices",2),d([p()],q.prototype,"_deviceIndex",2),d([p()],q.prototype,"_switchFailed",2),d([p()],q.prototype,"_copied",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",q);var Ne=w`
|
||||
ms-photo-picker { display: contents; }
|
||||
.photo-pickers {
|
||||
display: flex;
|
||||
@@ -1948,7 +1948,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
color: var(--secondary-text-color);
|
||||
margin-top: 4px;
|
||||
}
|
||||
`,H=class extends T{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=qe();this._inAppCamera=Qt()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let i=e.target,t=Array.from(i.files??[]);i.value="",this._emit(t)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return h;let e=this.lang,i=this._locked?"disabled":"",t=this.busy?s("uploading",e):s("doc_camera",e),n=s(this._singlePick?"choose_photo":"choose_photos",e);return l`
|
||||
`,H=class extends I{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=He();this._inAppCamera=oi()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let i=e.target,t=Array.from(i.files??[]);i.value="",this._emit(t)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return h;let e=this.lang,i=this._locked?"disabled":"",t=this.busy?s("uploading",e):s("doc_camera",e),n=s(this._singlePick?"choose_photo":"choose_photos",e);return l`
|
||||
<div class="photo-pickers">
|
||||
${this.showCamera?l`<label class="photo-pick photo-pick-camera ${i}" role="button" tabindex="0"
|
||||
aria-label=${t} title=${this.compact?t:h}
|
||||
@@ -1971,7 +1971,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
${this.showCamera&&this._inAppCamera?l`<ms-camera-capture .lang=${e}
|
||||
@photo-captured=${o=>this._emit([o.detail.file])}
|
||||
@capture-unavailable=${this._onCameraUnavailable}></ms-camera-capture>`:h}
|
||||
`}};d([v({type:String})],H.prototype,"lang",2),d([v({type:Boolean})],H.prototype,"disabled",2),d([v({type:Boolean})],H.prototype,"busy",2),d([v({type:String})],H.prototype,"accept",2),d([v({type:Boolean})],H.prototype,"showCamera",2),d([v({type:Boolean})],H.prototype,"showGallery",2),d([v({type:Boolean})],H.prototype,"compact",2),d([v({type:Number})],H.prototype,"remaining",2),d([p()],H.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",H);var pe=Y,y=class extends T{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.readings=[];this.readingHistory=[];this.restockDefault=null;this.restockUnitCost=null;this.restockPackage="";this.currencySymbol="";this.partsCostMode="purchase";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photos=new ce(this,{entryId:()=>this.entryId,hass:()=>this.hass});this._readingValue="";this._readingValues={};this._restockQty="";this._completedAt="";this._usedParts={};this._usedQtyText={};this.checklistPrefill={}}open(e={}){this._open||(this._open=!0,this.viaTagScan=!!e.viaTagScan,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState=Object.fromEntries(this.checklist.map((i,t)=>[String(t),!!this.checklistPrefill[i]]).filter(([,i])=>i)),this._feedback="needed",this._photos.reset(),this._readingValue="",this._readingValues={},this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._completedAt="",this._usedParts=Object.fromEntries(this.consumesParts.map(i=>[j(i),{...i}])),this._usedQtyText={})}_rangeError(e,i){let t=this.lang;return s("settings_value_out_of_range",t).replace("{min}",E(e,t,{maximumFractionDigits:2})).replace("{max}",E(i,t,{maximumFractionDigits:2}))}_toggleCheck(e){let i=String(e);this._checklistState={...this._checklistState,[i]:!this._checklistState[i]}}_setFeedback(e){this._feedback=e}async _complete(){if(this._loading||this._photos.uploading)return;this._error="",this._photos.clearError();let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId},i=this._notes.trim();if(i&&(e.notes=i),this._cost){let c=parseFloat(this._cost);isNaN(c)||(e.cost=c)}let t=de(this._duration);if(t!==null&&(e.duration=t),this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photos.photos.length>0&&(e.photo_doc_ids=this._photos.ids),this.viaTagScan&&(e.via_tag_scan=!0),this._completedAt){if(ee(this._completedAt)>Date.now()){this._error=s("completed_at_future_error",this.lang);return}e.completed_at=this._completedAt.length===16?`${this._completedAt}:00`:this._completedAt}if(this.readings.length>0){let c={};for(let u of this.readings){let m=(this._readingValues[u.id]??"").trim();if(m==="")continue;let g=parseFloat(m.replace(",","."));isNaN(g)||(c[u.id]=g)}Object.keys(c).length>0&&(e.reading_values=c)}else if(this._readingValue!==""){let c=parseFloat(this._readingValue);isNaN(c)||(e.reading_value=c)}if(this.restockDefault!==null&&this._restockQty.trim()!==""){let c=parseFloat(this._restockQty.replace(",","."));if(!Number.isFinite(c)||c<oe[0]||c>oe[1]){this._error=this._rangeError(...oe);return}e.restock_quantity=c}if(this.parts.length>0){let c=[];for(let[u,m]of Object.entries(this._usedParts)){let g=this._usedQtyText[u],f=g===void 0?m.quantity:parseFloat(g.replace(",","."));if(!Number.isFinite(f)||f<pe[0]||f>pe[1]){this._error=this._rangeError(...pe);return}c.push({...m,quantity:f})}e.used_parts=c.map(u=>u.entry_id?{part_id:u.part_id,quantity:u.quantity,entry_id:u.entry_id}:{part_id:u.part_id,quantity:u.quantity})}let n=await A(this,e,{busy:c=>{this._loading=c},lang:this.lang,fallbackKey:"save_error",onError:c=>{this._error=c}});if(n===void 0)return;this._photos.markAttached(),this._open=!1;let o={entryId:this.entryId,taskId:this.taskId,taskName:this.taskName,undo:n?.undo===!0};this.dispatchEvent(new CustomEvent("task-completed",{detail:o}))}_renderReadingField(e,i){let t=this._completedAt?ee(this._completedAt):NaN,n=dt(this.readingHistory,e.id,isNaN(t)?void 0:t),o=e.unit||this.readingUnit,c=(this._readingValues[e.id]??"").trim(),u=c===""?NaN:parseFloat(c.replace(",",".")),m=n!==void 0&&!isNaN(u)&&u<n.value,g=n!==void 0?E(n.value,i,{maximumFractionDigits:3}):"";return l`
|
||||
`}};d([v({type:String})],H.prototype,"lang",2),d([v({type:Boolean})],H.prototype,"disabled",2),d([v({type:Boolean})],H.prototype,"busy",2),d([v({type:String})],H.prototype,"accept",2),d([v({type:Boolean})],H.prototype,"showCamera",2),d([v({type:Boolean})],H.prototype,"showGallery",2),d([v({type:Boolean})],H.prototype,"compact",2),d([v({type:Number})],H.prototype,"remaining",2),d([p()],H.prototype,"_inAppCamera",2);customElements.get("ms-photo-picker")||customElements.define("ms-photo-picker",H);var pe=Y,y=class extends I{constructor(){super(...arguments);this.entryId="";this.taskId="";this.taskName="";this.lang="en";this.checklist=[];this.adaptiveEnabled=!1;this.taskType="";this.readingUnit="";this.readings=[];this.readingHistory=[];this.restockDefault=null;this.restockUnitCost=null;this.restockPackage="";this.currencySymbol="";this.partsCostMode="purchase";this.parts=[];this.consumesParts=[];this.consumesInfo=[];this.requiredFields=[];this.phaseLabel="";this.requireTagScan=!1;this.viaTagScan=!1;this._open=!1;this._notes="";this._cost="";this._duration="";this._loading=!1;this._error="";this._checklistState={};this._feedback="needed";this._photos=new ce(this,{entryId:()=>this.entryId,hass:()=>this.hass});this._readingValue="";this._readingValues={};this._restockQty="";this._completedAt="";this._usedParts={};this._usedQtyText={};this.checklistPrefill={}}open(e={}){this._open||(this._open=!0,this.viaTagScan=!!e.viaTagScan,this._notes="",this._cost="",this._duration="",this._error="",this._checklistState=Object.fromEntries(this.checklist.map((i,t)=>[String(t),!!this.checklistPrefill[i]]).filter(([,i])=>i)),this._feedback="needed",this._photos.reset(),this._readingValue="",this._readingValues={},this._restockQty=this.restockDefault!==null?String(this.restockDefault):"",this._completedAt="",this._usedParts=Object.fromEntries(this.consumesParts.map(i=>[j(i),{...i}])),this._usedQtyText={})}_rangeError(e,i){let t=this.lang;return s("settings_value_out_of_range",t).replace("{min}",E(e,t,{maximumFractionDigits:2})).replace("{max}",E(i,t,{maximumFractionDigits:2}))}_toggleCheck(e){let i=String(e);this._checklistState={...this._checklistState,[i]:!this._checklistState[i]}}_setFeedback(e){this._feedback=e}async _complete(){if(this._loading||this._photos.uploading)return;this._error="",this._photos.clearError();let e={type:"maintenance_supporter/task/complete",entry_id:this.entryId,task_id:this.taskId},i=this._notes.trim();if(i&&(e.notes=i),this._cost){let c=parseFloat(this._cost);isNaN(c)||(e.cost=c)}let t=de(this._duration);if(t!==null&&(e.duration=t),this.checklist.length>0&&(e.checklist_state=this._checklistState),this.adaptiveEnabled&&(e.feedback=this._feedback),this._photos.photos.length>0&&(e.photo_doc_ids=this._photos.ids),this.viaTagScan&&(e.via_tag_scan=!0),this._completedAt){if(ee(this._completedAt)>Date.now()){this._error=s("completed_at_future_error",this.lang);return}e.completed_at=this._completedAt.length===16?`${this._completedAt}:00`:this._completedAt}if(this.readings.length>0){let c={};for(let u of this.readings){let m=(this._readingValues[u.id]??"").trim();if(m==="")continue;let g=parseFloat(m.replace(",","."));isNaN(g)||(c[u.id]=g)}Object.keys(c).length>0&&(e.reading_values=c)}else if(this._readingValue!==""){let c=parseFloat(this._readingValue);isNaN(c)||(e.reading_value=c)}if(this.restockDefault!==null&&this._restockQty.trim()!==""){let c=parseFloat(this._restockQty.replace(",","."));if(!Number.isFinite(c)||c<oe[0]||c>oe[1]){this._error=this._rangeError(...oe);return}e.restock_quantity=c}if(this.parts.length>0){let c=[];for(let[u,m]of Object.entries(this._usedParts)){let g=this._usedQtyText[u],f=g===void 0?m.quantity:parseFloat(g.replace(",","."));if(!Number.isFinite(f)||f<pe[0]||f>pe[1]){this._error=this._rangeError(...pe);return}c.push({...m,quantity:f})}e.used_parts=c.map(u=>u.entry_id?{part_id:u.part_id,quantity:u.quantity,entry_id:u.entry_id}:{part_id:u.part_id,quantity:u.quantity})}let n=await A(this,e,{busy:c=>{this._loading=c},lang:this.lang,fallbackKey:"save_error",onError:c=>{this._error=c}});if(n===void 0)return;this._photos.markAttached(),this._open=!1;let o={entryId:this.entryId,taskId:this.taskId,taskName:this.taskName,undo:n?.undo===!0};this.dispatchEvent(new CustomEvent("task-completed",{detail:o}))}_renderReadingField(e,i){let t=this._completedAt?ee(this._completedAt):NaN,n=$t(this.readingHistory,e.id,isNaN(t)?void 0:t),o=e.unit||this.readingUnit,c=(this._readingValues[e.id]??"").trim(),u=c===""?NaN:parseFloat(c.replace(",",".")),m=n!==void 0&&!isNaN(u)&&u<n.value,g=n!==void 0?E(n.value,i,{maximumFractionDigits:3}):"";return l`
|
||||
<label class="field reading-field">
|
||||
<span class="field-label">${e.name}${o?` (${o})`:""}</span>
|
||||
<input type="text" inputmode="decimal" class="field-input"
|
||||
@@ -1979,11 +1979,11 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.value=${this._readingValues[e.id]??""}
|
||||
@input=${f=>{this._readingValues={...this._readingValues,[e.id]:f.target.value}}} />
|
||||
${m?l`<span class="reading-warn">${s("reading_below_last",i).replace("{value}",g)}</span>`:h}
|
||||
</label>`}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(i=>!e[i])}_demands(e){return this.requiredFields.includes(e)}_req(e){return this._demands(e)?l`<span class="req-mark" aria-hidden="true">*</span>`:h}_purchaseSuggestion(){if(this.restockDefault===null)return null;let e=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(e)||e<=0?null:Math.round(this.restockUnitCost*e*100)/100}_partsValue(){if(this.restockDefault!==null||!this.parts.length)return null;let e=0,i=!1;for(let t of Object.values(this._usedParts)){let n=this.parts.find(c=>j({part_id:c.id,entry_id:c.entry_id})===j(t)),o=kt(n);o!==null&&(e+=o*(t.quantity||1),i=!0)}return i?Math.round(e*100)/100:null}_renderCostSuggestion(e){let i=this._purchaseSuggestion();if(this.restockDefault!==null){let c=this.partsCostMode==="use"?l`<div class="cost-note">${s("cost_purchase_use_hint",e)}</div>`:h;if(this._cost.trim()!==""||i==null||i<=0)return c;let u=z(i,this.currencySymbol,e);return l`<button
|
||||
</label>`}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(i=>!e[i])}_demands(e){return this.requiredFields.includes(e)}_req(e){return this._demands(e)?l`<span class="req-mark" aria-hidden="true">*</span>`:h}_purchaseSuggestion(){if(this.restockDefault===null)return null;let e=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(e)||e<=0?null:Math.round(this.restockUnitCost*e*100)/100}_partsValue(){if(this.restockDefault!==null||!this.parts.length)return null;let e=0,i=!1;for(let t of Object.values(this._usedParts)){let n=this.parts.find(c=>j({part_id:c.id,entry_id:c.entry_id})===j(t)),o=Nt(n);o!==null&&(e+=o*(t.quantity||1),i=!0)}return i?Math.round(e*100)/100:null}_renderCostSuggestion(e){let i=this._purchaseSuggestion();if(this.restockDefault!==null){let c=this.partsCostMode==="use"?l`<div class="cost-note">${s("cost_purchase_use_hint",e)}</div>`:h;if(this._cost.trim()!==""||i==null||i<=0)return c;let u=z(i,this.currencySymbol,e);return l`<button
|
||||
type="button"
|
||||
class="cost-suggestion"
|
||||
@click=${()=>this._cost=String(Math.round(i*100)/100)}
|
||||
>${s("cost_from_parts",e).replace("{amount}",u)}</button>${c}`}let t=this._partsValue();if(t==null||t<=0)return h;let n=z(t,this.currencySymbol,e),o=this.partsCostMode==="use"?"cost_parts_booked":"cost_parts_info";return l`<div class="cost-note">${s(o,e).replace("{amount}",n)}</div>`}_close(){this._open=!1,this._photos.discardOrphans()}_pickCompletedAt(){this._completedAt=`${st()}:00`}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",i=this._error||this._photos.errorText(e);return l`
|
||||
>${s("cost_from_parts",e).replace("{amount}",u)}</button>${c}`}let t=this._partsValue();if(t==null||t<=0)return h;let n=z(t,this.currencySymbol,e),o=this.partsCostMode==="use"?"cost_parts_booked":"cost_parts_info";return l`<div class="cost-note">${s(o,e).replace("{amount}",n)}</div>`}_close(){this._open=!1,this._photos.discardOrphans()}_pickCompletedAt(){this._completedAt=`${mt()}:00`}render(){if(!this._open)return l``;let e=this.lang||this.hass?.language||"en",i=this._error||this._photos.errorText(e);return l`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${s("complete_title",e)}${this.taskName}</div>
|
||||
${this.phaseLabel?l`<div class="phase-line">${s("phase_current",e)}: ${this.phaseLabel}</div>`:h}
|
||||
@@ -2070,7 +2070,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.hass=${this.hass}
|
||||
.lang=${e}
|
||||
.value=${this._completedAt}
|
||||
.helper=${Te(e)}
|
||||
.helper=${Se(e)}
|
||||
@value-changed=${t=>this._completedAt=t.detail.value}
|
||||
></ms-date-field>`:l`<button type="button" class="backdate-pick" @click=${this._pickCompletedAt}>
|
||||
<ha-icon icon="mdi:calendar-clock"></ha-icon>${s("completed_at_pick",e)}
|
||||
@@ -2123,7 +2123,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>
|
||||
`}};y.styles=[Ae,He,w`
|
||||
`}};y.styles=[Ce,Ne,w`
|
||||
.req-mark {
|
||||
color: var(--error-color, #f44336);
|
||||
margin-left: 2px;
|
||||
@@ -2359,15 +2359,15 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
}
|
||||
/* Focused programmatically on open (so Escape works at once) — no ring. */
|
||||
.dialog:focus { outline: none; }
|
||||
`;function Wi(r,a){r.key!=="Escape"||r.defaultPrevented||r.composedPath().some(e=>e instanceof Element&&e.localName==="ms-camera-capture")||(r.preventDefault(),r.stopPropagation(),a())}function ue(r,a){return l`
|
||||
`;function ps(r,a){r.key!=="Escape"||r.defaultPrevented||r.composedPath().some(e=>e instanceof Element&&e.localName==="ms-camera-capture")||(r.preventDefault(),r.stopPropagation(),a())}function ue(r,a){return l`
|
||||
<div class="backdrop" @click=${r}></div>
|
||||
<div class="dialog" role="dialog" aria-modal="true" tabindex="-1"
|
||||
@keydown=${e=>Wi(e,r)}>${a}</div>
|
||||
`}function _e(r){r?.querySelector(".dialog")?.focus({preventScroll:!0})}function Yt(r,a,e){let i=new Blob([r],{type:e}),t=URL.createObjectURL(i),n=document.createElement("a");n.href=t,n.download=a,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(t),6e4)}async function Gi(r,a,e=300){return(await r.connection.sendMessagePromise({type:"auth/sign_path",path:a,expires:e})).path}async function Jt(r,a,e=300){return Gi(r,`/api/maintenance_supporter/document/${a}`,e)}var Z=class extends T{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await Jt(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?h:this._url?l`
|
||||
@keydown=${e=>ps(e,r)}>${a}</div>
|
||||
`}function _e(r){r?.querySelector(".dialog")?.focus({preventScroll:!0})}function di(r,a,e){let i=new Blob([r],{type:e}),t=URL.createObjectURL(i),n=document.createElement("a");n.href=t,n.download=a,n.target="_blank",n.rel="noopener",n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(t),6e4)}async function hs(r,a,e=300){return(await r.connection.sendMessagePromise({type:"auth/sign_path",path:a,expires:e})).path}async function ci(r,a,e=300){return hs(r,`/api/maintenance_supporter/document/${a}`,e)}var J=class extends I{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await ci(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?h:this._url?l`
|
||||
<a href=${this._url} target="_blank" rel="noopener" class="wrap">
|
||||
<img src=${this._url} alt="" loading="lazy"
|
||||
@error=${()=>this._failed=!0} />
|
||||
</a>`:l`<div class="ph"></div>`}};Z.styles=w`
|
||||
</a>`:l`<div class="ph"></div>`}};J.styles=w`
|
||||
.wrap { display: inline-block; margin-top: 4px; }
|
||||
/* #161: uniform 96px tiles — several photos sit in a strip, so a
|
||||
tiny or portrait shot must not collapse its slot. */
|
||||
@@ -2387,7 +2387,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
background: var(--secondary-background-color, rgba(0,0,0,0.06));
|
||||
margin-top: 4px;
|
||||
}
|
||||
`,d([v({attribute:!1})],Z.prototype,"hass",2),d([v()],Z.prototype,"docId",2),d([p()],Z.prototype,"_url",2),d([p()],Z.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",Z);var R=class extends T{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal="";this._openGen=0;this._photos=new ce(this,{entryId:()=>this._draft?.entry_id??"",hass:()=>this.hass});this._photosOriginal="";this._readingRows=[];this._readingText={};this._readingsOriginal=""}get _lang(){return P(this.hass)}openEdit(e){this._openGen++,this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._photos.reset(e.photo_doc_ids??[]),this._photosOriginal=JSON.stringify(this._photos.ids),this._seedReadings(e),this._loadPartOptions()}_seedReadings(e){let i=[],t=new Set;for(let o of e.readings??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));for(let o of e.reading_values??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));this._readingRows=i;let n={};for(let o of e.reading_values??[])n[o.id]=String(o.value);this._readingText=n,this._readingsOriginal=JSON.stringify(this._readingNumbers())}_readingNumbers(){let e={};for(let i of this._readingRows){let t=(this._readingText[i.id]??"").trim();if(t==="")continue;let n=parseFloat(t.replace(",","."));isNaN(n)||(e[i.id]=n)}return e}async _loadPartOptions(){let e=this._draft;if(!e)return;let i=this._openGen;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});if(i!==this._openGen)return;let n=[];for(let c of t.parts||[]){let u=c.entry_id===e.entry_id,m=c.consumers.some(g=>g.entry_id===e.entry_id&&g.task_id===e.task_id);!u&&!m||n.push({part_id:c.part_id,name:c.name,entry_id:c.entry_id,foreign:!u,object_name:c.object_name})}for(let c of e.used_parts||[]){let u=c.entry_id||e.entry_id;n.some(m=>m.part_id===c.part_id&&m.entry_id===u)||n.push({part_id:c.part_id,name:c.name||c.part_id,entry_id:u,foreign:u!==e.entry_id,object_name:null})}let o={};for(let c of e.used_parts||[])o[`${c.entry_id||e.entry_id}:${c.part_id}`]=c.quantity??1;this._partOptions=n,this._partQty=o,this._partQtyOriginal=this._partSelectionKey()}catch{if(i!==this._openGen)return;this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[i])=>e.localeCompare(i)))}close(){this._openGen++,this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null,this._photos.discardOrphans()}_set(e,i){this._draft&&(this._draft={...this._draft,[e]:i})}async _delete(){if(!this._draft||!this._originalSnapshot)return;let e=this._lang,t=(this._originalSnapshot.used_parts||[]).filter(u=>u.quantity>0).map(u=>`${E(u.quantity,e)}\xD7 ${u.name||u.part_id}`).join(", ");if(!await te(this.hass,{title:s("history_delete_entry",e),message:t?`${s("history_delete_confirm_entry",e)} ${s("history_delete_returns_parts",e).replace("{parts}",t)}`:s("history_delete_confirm_entry",e),confirmText:s("delete",e),danger:!0})||!this._draft||!this._originalSnapshot)return;let o=this._draft;this._error="",await this._runWs({type:"maintenance_supporter/task/history/delete",entry_id:o.entry_id,task_id:o.task_id,timestamp:this._originalSnapshot.original_timestamp})!==void 0&&(this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:o.entry_id,task_id:o.task_id,deleted:!0},bubbles:!0,composed:!0})),this.close())}_runWs(e){return A(this,e,{busy:i=>{this._saving=i},onError:i=>{this._error=i}})}async _save(){if(!this._draft||!this._originalSnapshot||this._saving||this._photos.uploading)return;this._error="",this._photos.clearError();let e=this._draft,i=this._originalSnapshot,t={type:"maintenance_supporter/task/history/update",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:i.original_timestamp};if(e.timestamp!==i.timestamp&&(t.timestamp=e.timestamp),e.notes!==i.notes&&(t.notes=e.notes),e.cost!==i.cost&&(t.cost=e.cost),e.duration!==i.duration&&(t.duration=e.duration),e.completed_by!==i.completed_by&&(t.completed_by=e.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(t.used_parts=(this._partOptions||[]).filter(o=>(this._partQty[`${o.entry_id}:${o.part_id}`]||0)>0).map(o=>({part_id:o.part_id,quantity:this._partQty[`${o.entry_id}:${o.part_id}`],...o.foreign?{entry_id:o.entry_id}:{}}))),e.reading_value!==i.reading_value&&(t.reading_value=e.reading_value??null),this._readingRows.length>0&&JSON.stringify(this._readingNumbers())!==this._readingsOriginal){let o=this._readingNumbers(),c={};for(let u of this._readingRows)c[u.id]=o[u.id]??null;t.reading_values=c}if(JSON.stringify(this._photos.ids)!==this._photosOriginal&&(t.photo_doc_ids=this._photos.ids),Object.keys(t).filter(o=>!
Line truncated
|
||||
`,d([v({attribute:!1})],J.prototype,"hass",2),d([v()],J.prototype,"docId",2),d([p()],J.prototype,"_url",2),d([p()],J.prototype,"_failed",2);customElements.get("maintenance-history-photo")||customElements.define("maintenance-history-photo",J);var R=class extends I{constructor(){super(...arguments);this._open=!1;this._saving=!1;this._error="";this._draft=null;this._originalSnapshot=null;this._partOptions=null;this._partQty={};this._partQtyOriginal="";this._openGen=0;this._photos=new ce(this,{entryId:()=>this._draft?.entry_id??"",hass:()=>this.hass});this._photosOriginal="";this._readingRows=[];this._readingText={};this._readingsOriginal=""}get _lang(){return P(this.hass)}openEdit(e){this._openGen++,this._draft={...e},this._originalSnapshot={...e},this._error="",this._open=!0,this._partOptions=null,this._partQty={},this._partQtyOriginal="",this._photos.reset(e.photo_doc_ids??[]),this._photosOriginal=JSON.stringify(this._photos.ids),this._seedReadings(e),this._loadPartOptions()}_seedReadings(e){let i=[],t=new Set;for(let o of e.readings??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));for(let o of e.reading_values??[])t.has(o.id)||(t.add(o.id),i.push({id:o.id,name:o.name,unit:o.unit??null}));this._readingRows=i;let n={};for(let o of e.reading_values??[])n[o.id]=String(o.value);this._readingText=n,this._readingsOriginal=JSON.stringify(this._readingNumbers())}_readingNumbers(){let e={};for(let i of this._readingRows){let t=(this._readingText[i.id]??"").trim();if(t==="")continue;let n=parseFloat(t.replace(",","."));isNaN(n)||(e[i.id]=n)}return e}async _loadPartOptions(){let e=this._draft;if(!e)return;let i=this._openGen;try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});if(i!==this._openGen)return;let n=[];for(let c of t.parts||[]){let u=c.entry_id===e.entry_id,m=c.consumers.some(g=>g.entry_id===e.entry_id&&g.task_id===e.task_id);!u&&!m||n.push({part_id:c.part_id,name:c.name,entry_id:c.entry_id,foreign:!u,object_name:c.object_name})}for(let c of e.used_parts||[]){let u=c.entry_id||e.entry_id;n.some(m=>m.part_id===c.part_id&&m.entry_id===u)||n.push({part_id:c.part_id,name:c.name||c.part_id,entry_id:u,foreign:u!==e.entry_id,object_name:null})}let o={};for(let c of e.used_parts||[])o[`${c.entry_id||e.entry_id}:${c.part_id}`]=c.quantity??1;this._partOptions=n,this._partQty=o,this._partQtyOriginal=this._partSelectionKey()}catch{if(i!==this._openGen)return;this._partOptions=[]}}_partSelectionKey(){return JSON.stringify(Object.entries(this._partQty).filter(([,e])=>e>0).sort(([e],[i])=>e.localeCompare(i)))}close(){this._openGen++,this._open=!1,this._error="",this._draft=null,this._originalSnapshot=null,this._photos.discardOrphans()}_set(e,i){this._draft&&(this._draft={...this._draft,[e]:i})}async _delete(){if(!this._draft||!this._originalSnapshot)return;let e=this._lang,t=(this._originalSnapshot.used_parts||[]).filter(u=>u.quantity>0).map(u=>`${E(u.quantity,e)}\xD7 ${u.name||u.part_id}`).join(", ");if(!await te(this.hass,{title:s("history_delete_entry",e),message:t?`${s("history_delete_confirm_entry",e)} ${s("history_delete_returns_parts",e).replace("{parts}",t)}`:s("history_delete_confirm_entry",e),confirmText:s("delete",e),danger:!0})||!this._draft||!this._originalSnapshot)return;let o=this._draft;this._error="",await this._runWs({type:"maintenance_supporter/task/history/delete",entry_id:o.entry_id,task_id:o.task_id,timestamp:this._originalSnapshot.original_timestamp})!==void 0&&(this.dispatchEvent(new CustomEvent("history-entry-saved",{detail:{entry_id:o.entry_id,task_id:o.task_id,deleted:!0},bubbles:!0,composed:!0})),this.close())}_runWs(e){return A(this,e,{busy:i=>{this._saving=i},onError:i=>{this._error=i}})}async _save(){if(!this._draft||!this._originalSnapshot||this._saving||this._photos.uploading)return;this._error="",this._photos.clearError();let e=this._draft,i=this._originalSnapshot,t={type:"maintenance_supporter/task/history/update",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:i.original_timestamp};if(e.timestamp!==i.timestamp&&(t.timestamp=e.timestamp),e.notes!==i.notes&&(t.notes=e.notes),e.cost!==i.cost&&(t.cost=e.cost),e.duration!==i.duration&&(t.duration=e.duration),e.completed_by!==i.completed_by&&(t.completed_by=e.completed_by),this._partOptions!==null&&this._partSelectionKey()!==this._partQtyOriginal&&(t.used_parts=(this._partOptions||[]).filter(o=>(this._partQty[`${o.entry_id}:${o.part_id}`]||0)>0).map(o=>({part_id:o.part_id,quantity:this._partQty[`${o.entry_id}:${o.part_id}`],...o.foreign?{entry_id:o.entry_id}:{}}))),e.reading_value!==i.reading_value&&(t.reading_value=e.reading_value??null),this._readingRows.length>0&&JSON.stringify(this._readingNumbers())!==this._readingsOriginal){let o=this._readingNumbers(),c={};for(let u of this._readingRows)c[u.id]=o[u.id]??null;t.reading_values=c}if(JSON.stringify(this._photos.ids)!==this._photosOriginal&&(t.photo_doc_ids=this._photos.ids),Object.keys(t).filter(o=>!
Line truncated
|
||||
<h2>${s("history_edit_title",e)}</h2>
|
||||
<div class="entry-type">
|
||||
<ha-icon icon="mdi:tag-outline"></ha-icon>
|
||||
@@ -2399,8 +2399,8 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
.hass=${this.hass}
|
||||
.lang=${e}
|
||||
.label=${s("history_edit_timestamp",e)}
|
||||
.helper=${Te(e)}
|
||||
.value=${rt(i.timestamp)}
|
||||
.helper=${Se(e)}
|
||||
.value=${gt(i.timestamp)}
|
||||
@value-changed=${n=>{let o=n.detail.value;o&&this._set("timestamp",o)}}
|
||||
></ms-date-field>
|
||||
<label>
|
||||
@@ -2487,7 +2487,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
<input type="number" step="any"
|
||||
.value=${e.reading_value!=null?String(e.reading_value):""}
|
||||
@input=${t=>{let n=t.target.value,o=n===""?NaN:Number(n);this._set("reading_value",isNaN(o)?null:o)}} />
|
||||
</label>`}};R.styles=[He,he,w`
|
||||
</label>`}};R.styles=[Ne,he,w`
|
||||
:host { display: contents; --ms-modal-max-height: 90vh; --ms-modal-gap: 12px; }
|
||||
h2 { margin: 0; font-size: 18px; }
|
||||
.entry-type {
|
||||
@@ -2577,7 +2577,7 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
}
|
||||
/* the camera / gallery pickers come from photoPickerStyles (ms-photo-picker) */
|
||||
.photos-hint { font-size: 12px; color: var(--secondary-text-color); }
|
||||
`],d([v({attribute:!1})],R.prototype,"hass",2),d([p()],R.prototype,"_open",2),d([p()],R.prototype,"_saving",2),d([p()],R.prototype,"_error",2),d([p()],R.prototype,"_draft",2),d([p()],R.prototype,"_partOptions",2),d([p()],R.prototype,"_partQty",2),d([p()],R.prototype,"_readingRows",2),d([p()],R.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function se(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ke(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":se(r)}function Qi(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var L=class extends T{constructor(){super(...arguments);this.lang="";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._quickResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}get _dialogLang(){return this.lang||P(this.hass)}openForObject(e,i){this._entryId=e,this._taskId=null,this._objectName=i,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}openForTask(e,i,t,n){this._entryId=e,this._taskId=i,this._objectName=t,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null;try{let i={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(i.task_id=this._taskId);let t=[this.hass.connection.sendMessagePromise({...i,action:"view"})];this._taskId&&(t.push(this.hass.connection.sendMessagePromise({...i,action:"complete"})),await this._hasQuickCompleteDefaults()&&t.push(this.hass.connection.sendMessagePromise({...i,action:"quick_complete"})));let n=await Promise.all(t);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1]),n.length>2&&(this._quickResult=n[2])}catch(i){if(e!==this._generateSeq)return;let t=i?.code,n=i?.message;this._error=t==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this._dialogLang):s("qr_error",this._dialogLang)}finally{e===this._generateSeq&&(this._loading=!1)}}async _hasQuickCompleteDefaults(){try{let i=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId})).tasks||[]).find(t=>t.id===this._taskId);return!!i?.quick_complete_defaults&&Object.keys(i.quick_complete_defaults).length>0}catch{return!1}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,i=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,t=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this._dialogLang,c=se(i),u=se(t),m=!!this._completeResult,g=!!this._quickResult,f=se(s("qr_action_view",o)),x=se(s("qr_action_complete",o)),b=se(s("qr_action_quick_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
`],d([v({attribute:!1})],R.prototype,"hass",2),d([p()],R.prototype,"_open",2),d([p()],R.prototype,"_saving",2),d([p()],R.prototype,"_error",2),d([p()],R.prototype,"_draft",2),d([p()],R.prototype,"_partOptions",2),d([p()],R.prototype,"_partQty",2),d([p()],R.prototype,"_readingRows",2),d([p()],R.prototype,"_readingText",2);customElements.get("maintenance-history-edit-dialog")||customElements.define("maintenance-history-edit-dialog",R);function se(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function tt(r){return!r.startsWith("data:image/svg+xml,")&&!r.startsWith("data:image/png;base64,")?"":se(r)}function us(r){return r.replace(/[/\\:*?"<>|#%]+/g,"").replace(/\s+/g,"-").toLowerCase().substring(0,100)}var L=class extends I{constructor(){super(...arguments);this.lang="";this._open=!1;this._loading=!1;this._error="";this._viewResult=null;this._completeResult=null;this._quickResult=null;this._urlMode="companion";this._entryId="";this._taskId=null;this._objectName="";this._taskName="";this._generateSeq=0}get _dialogLang(){return this.lang||P(this.hass)}openForObject(e,i){this._entryId=e,this._taskId=null,this._objectName=i,this._taskName="",this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}openForTask(e,i,t,n){this._entryId=e,this._taskId=i,this._objectName=t,this._taskName=n,this._urlMode="companion",this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null,this._open=!0,this._generate()}async _generate(){let e=++this._generateSeq;this._loading=!0,this._error="",this._viewResult=null,this._completeResult=null,this._quickResult=null;try{let i={type:"maintenance_supporter/qr/generate",entry_id:this._entryId,url_mode:this._urlMode};this._taskId&&(i.task_id=this._taskId);let t=[this.hass.connection.sendMessagePromise({...i,action:"view"})];this._taskId&&(t.push(this.hass.connection.sendMessagePromise({...i,action:"complete"})),await this._hasQuickCompleteDefaults()&&t.push(this.hass.connection.sendMessagePromise({...i,action:"quick_complete"})));let n=await Promise.all(t);if(e!==this._generateSeq)return;this._viewResult=n[0],n.length>1&&(this._completeResult=n[1]),n.length>2&&(this._quickResult=n[2])}catch(i){if(e!==this._generateSeq)return;let t=i?.code,n=i?.message;this._error=t==="no_url"||typeof n=="string"&&n.includes("No Home Assistant URL")?s("qr_error_no_url",this._dialogLang):s("qr_error",this._dialogLang)}finally{e===this._generateSeq&&(this._loading=!1)}}async _hasQuickCompleteDefaults(){try{let i=((await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId})).tasks||[]).find(t=>t.id===this._taskId);return!!i?.quick_complete_defaults&&Object.keys(i.quick_complete_defaults).length>0}catch{return!1}}_setUrlMode(e){this._urlMode!==e&&(this._urlMode=e,this._generate())}_print(){if(!this._viewResult)return;let e=this._viewResult,i=e.label.task_name?`${e.label.object_name} \u2014 ${e.label.task_name}`:e.label.object_name,t=[e.label.manufacturer,e.label.model].filter(Boolean).join(" "),n=window.open("","_blank","width=600,height=500");if(!n)return;let o=this._dialogLang,c=se(i),u=se(t),m=!!this._completeResult,g=!!this._quickResult,f=se(s("qr_action_view",o)),x=se(s("qr_action_complete",o)),b=se(s("qr_action_quick_complete",o));n.document.write(`<!DOCTYPE html><html><head><meta charset="utf-8">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>${c}</title>
|
||||
<style>
|
||||
@@ -2599,21 +2599,21 @@ import{a as it,b as nt,c as at,d as ot,e as lt,f as dt,g as ct,h as pt,i as ht,j
|
||||
${u?`<div class="sub">${u}</div>`:""}
|
||||
<div class="qr-row">
|
||||
<div class="qr-col">
|
||||
<img src="${Ke(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<img src="${tt(this._viewResult.svg_data_uri)}" alt="QR Info" />
|
||||
<div class="qr-label">${f}</div>
|
||||
</div>
|
||||
${m?`<div class="qr-col">
|
||||
<img src="${Ke(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<img src="${tt(this._completeResult.svg_data_uri)}" alt="QR Complete" />
|
||||
<div class="qr-label">${x}</div>
|
||||
</div>`:""}
|
||||
${g?`<div class="qr-col">
|
||||
<img src="${Ke(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
|
||||
<img src="${tt(this._quickResult.svg_data_uri)}" alt="QR Quick-complete" />
|
||||
<div class="qr-label">${b}</div>
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="url">${se(this._viewResult.url)}</div>
|
||||
<script>setTimeout(()=>window.print(),300)<\/script>
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,i){let t=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;Yt(t,`qr-${Qi(n)}-${i}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._quickResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this._dialogLang,i=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,t=!!this._viewResult;return l`
|
||||
</body></html>`),n.document.close()}_downloadSvg(e,i){let t=decodeURIComponent(e.svg_data_uri.replace("data:image/svg+xml,","")),n=this._taskName?`${this._objectName}-${this._taskName}`:this._objectName;di(t,`qr-${us(n)}-${i}.svg`,"image/svg+xml")}_close(){this._open=!1,this._viewResult=null,this._completeResult=null,this._quickResult=null,this._error="",this._loading=!1}render(){if(!this._open)return l``;let e=this._dialogLang,i=this._taskName?`${s("qr_code",e)}: ${this._objectName} \u2014 ${this._taskName}`:`${s("qr_code",e)}: ${this._objectName}`,t=!!this._viewResult;return l`
|
||||
<ha-dialog open @closed=${this._close}>
|
||||
<div class="dialog-title">${i}</div>
|
||||
<div class="content">
|
||||
@@ -2809,9 +2809,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
color: var(--text-primary-color, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
`,d([v({attribute:!1})],L.prototype,"hass",2),d([v()],L.prototype,"lang",2),d([p()],L.prototype,"_open",2),d([p()],L.prototype,"_loading",2),d([p()],L.prototype,"_error",2),d([p()],L.prototype,"_viewResult",2),d([p()],L.prototype,"_completeResult",2),d([p()],L.prototype,"_quickResult",2),d([p()],L.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",L);function Zt(r,a,e=new Date){let i=r?.hours,t=ee(r?.snoozed_until);if(typeof i!="number"||!Number.isFinite(t))return s("snoozed",a);let n=Fe(),c=we(t,n)===we(e,n)?De(new Date(t),a):Ie(r.snoozed_until,a);return(i===1?s("snoozed_for_one",a):s("snoozed_for",a).replace("{hours}",E(i,a))).replace("{until}",c)}function Ki(r,a){if(a<=0)return 0;let e=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return e<0?0:e%a}function Yi(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function Ye(r){if(!r||!Yi(r))return null;let a=r.phase_sequence,e=Ki(r.phase_cursor,a.length),i=a[e],t=r.phases?.[i];return t?{id:i,name:t.name,index:e,count:a.length,notes:t.notes,checklist:t.checklist!==void 0?t.checklist:r.checklist??[],consumesParts:t.consumes_parts!==void 0?t.consumes_parts:r.consumes_parts??[],requiredFields:t.required_completion_fields!==void 0?t.required_completion_fields:r.required_completion_fields??[]}:null}function be(r){let a=Ye(r);return a?`${a.index+1}/${a.count} \xB7 ${a.name}`:""}function Ji(r,a){return typeof r=="number"&&Number.isFinite(r)&&r>=.01?r:a}function Xt(r){let a=r.task??null,e=a?Ye(a):null,i=e?e.consumesParts:a?.consumes_parts||[],t=!!a?.part_ref,n=r.objects.find(g=>g.entry_id===r.entryId)?.parts||[],o=t?n.find(g=>g.id===a.part_ref.part_id):void 0,c=r.features?r.features.checklists:r.checklistsEnabled??!0,u=r.features?r.features.checklists?r.checklist??a?.checklist??[]:[]:r.checklist??[],m=r.features?r.features.adaptive&&(r.adaptiveEnabled??!!a?.adaptive_config?.enabled):!!r.adaptiveEnabled;return{entry_id:r.entryId,task_id:r.taskId,task_name:r.taskName,checklist:e?c?e.checklist:[]:u,adaptive_enabled:m,required_completion_fields:e?e.requiredFields:a?.required_completion_fields||[],task_type:a?.type||"",reading_unit:a?.reading_unit||"",readings:a?.readings||[],reading_history:lt(a?.history),parts:t?[]:At({consumes_parts:i},r.entryId,r.objects,r.lang),consumes_parts:t?[]:i,phase_label:e?be(a):"",require_tag_scan:!!a?.require_tag_scan,restock_default:t?Ji(o?.restock_quantity,1):null,restock_unit_cost:t?o?.cost??null:null,restock_package:t&&o?.package_size?ae(o.package_size,o.unit,r.lang):"",currency_symbol:me({currency_symbol:r.currencySymbol}),consumes_info:i.map(g=>St(g,r.entryId,r.objects,r.lang)),checklist_prefill:a?.checklist_progress||{},via_tag_scan:!!r.viaTagScan,parts_cost_mode:r.partsCostMode??"purchase"}}function ei(r,a,e){r.entryId=a.entry_id,r.taskId=a.task_id,r.taskName=a.task_name,r.lang=e,r.checklist=a.checklist??[],r.adaptiveEnabled=!!a.adaptive_enabled,r.requiredFields=a.required_completion_fields??[],r.taskType=a.task_type??"",r.readingUnit=a.reading_unit??"",r.readings=a.readings??[],r.readingHistory=a.reading_history??[],r.parts=a.parts??[],r.consumesParts=a.consumes_parts??[],r.phaseLabel=a.phase_label??"",r.requireTagScan=!!a.require_tag_scan,r.restockDefault=a.restock_default??null,r.restockUnitCost=a.restock_unit_cost??null,r.restockPackage=a.restock_package??"",r.currencySymbol=me(a),r.consumesInfo=a.consumes_info??[],r.checklistPrefill=a.checklist_prefill??{},r.viaTagScan=!!a.via_tag_scan,r.partsCostMode=a.parts_cost_mode??"purchase",r.open({viaTagScan:!!a.via_tag_scan})}function Ne(r){return r?customElements.get("ha-markdown")?l`<ha-markdown class="notes-md" .content=${r} breaks></ha-markdown>`:l`${r}`:h}var ti=r=>typeof r=="number"&&Number.isInteger(r)&&r>0;function Zi(r){return r&&ti(r.ref_no)?String(r.ref_no):null}function ii(r,a){let e=Zi(r);return e&&a&&ti(a.ref_no)?`${e}.${a.ref_no}`:null}function si(r,a){return r?l`<span class="ref-chip" title=${a??""}>#${r}</span>`:h}var Xi={"Completed from dashboard button":"hist_note_button","Completed from the To-do list":"hist_note_todo","Completed by voice":"hist_note_voice","Completed from the notification":"hist_note_notification","Completed via NFC tag":"hist_note_nfc","Completed from the shopping list":"hist_note_shopping_list","Completed from a mirrored to-do list":"hist_note_todo_mirror","Skipped from notification":"hist_note_skipped_notification","Skipped from dashboard button":"hist_note_skipped_button","Sensor trigger activated":"hist_note_sensor_triggered","Initial value set during task creation":"hist_note_initial"},es=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",r=>({value:r[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(r,a)=>({date:U(r[1],a)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",r=>({old:r[1],new:r[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converted to (\w+)\.$/,"hist_note_triggLine truncated
|
||||
`,d([v({attribute:!1})],L.prototype,"hass",2),d([v()],L.prototype,"lang",2),d([p()],L.prototype,"_open",2),d([p()],L.prototype,"_loading",2),d([p()],L.prototype,"_error",2),d([p()],L.prototype,"_viewResult",2),d([p()],L.prototype,"_completeResult",2),d([p()],L.prototype,"_quickResult",2),d([p()],L.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",L);function pi(r,a,e=new Date){let i=r?.hours,t=ee(r?.snoozed_until);if(typeof i!="number"||!Number.isFinite(t))return s("snoozed",a);let n=Ve(),c=Ee(t,n)===Ee(e,n)?We(new Date(t),a):Ie(r.snoozed_until,a);return(i===1?s("snoozed_for_one",a):s("snoozed_for",a).replace("{hours}",E(i,a))).replace("{until}",c)}function _s(r,a){if(a<=0)return 0;let e=typeof r=="number"&&Number.isFinite(r)?Math.trunc(r):0;return e<0?0:e%a}function ms(r){return!!(r?.phases&&r.phase_sequence&&r.phase_sequence.length>0)}function it(r){if(!r||!ms(r))return null;let a=r.phase_sequence,e=_s(r.phase_cursor,a.length),i=a[e],t=r.phases?.[i];return t?{id:i,name:t.name,index:e,count:a.length,notes:t.notes,checklist:t.checklist!==void 0?t.checklist:r.checklist??[],consumesParts:t.consumes_parts!==void 0?t.consumes_parts:r.consumes_parts??[],requiredFields:t.required_completion_fields!==void 0?t.required_completion_fields:r.required_completion_fields??[]}:null}function be(r){let a=it(r);return a?`${a.index+1}/${a.count} \xB7 ${a.name}`:""}function gs(r,a){return typeof r=="number"&&Number.isFinite(r)&&r>=.01?r:a}function hi(r){let a=r.task??null,e=a?it(a):null,i=e?e.consumesParts:a?.consumes_parts||[],t=!!a?.part_ref,n=r.objects.find(g=>g.entry_id===r.entryId)?.parts||[],o=t?n.find(g=>g.id===a.part_ref.part_id):void 0,c=r.features?r.features.checklists:r.checklistsEnabled??!0,u=r.features?r.features.checklists?r.checklist??a?.checklist??[]:[]:r.checklist??[],m=r.features?r.features.adaptive&&(r.adaptiveEnabled??!!a?.adaptive_config?.enabled):!!r.adaptiveEnabled;return{entry_id:r.entryId,task_id:r.taskId,task_name:r.taskName,checklist:e?c?e.checklist:[]:u,adaptive_enabled:m,required_completion_fields:e?e.requiredFields:a?.required_completion_fields||[],task_type:a?.type||"",reading_unit:a?.reading_unit||"",readings:a?.readings||[],reading_history:bt(a?.history),parts:t?[]:Ut({consumes_parts:i},r.entryId,r.objects,r.lang),consumes_parts:t?[]:i,phase_label:e?be(a):"",require_tag_scan:!!a?.require_tag_scan,restock_default:t?gs(o?.restock_quantity,1):null,restock_unit_cost:t?o?.cost??null:null,restock_package:t&&o?.package_size?ae(o.package_size,o.unit,r.lang):"",currency_symbol:me({currency_symbol:r.currencySymbol}),consumes_info:i.map(g=>zt(g,r.entryId,r.objects,r.lang)),checklist_prefill:a?.checklist_progress||{},via_tag_scan:!!r.viaTagScan,parts_cost_mode:r.partsCostMode??"purchase"}}function ui(r,a,e){r.entryId=a.entry_id,r.taskId=a.task_id,r.taskName=a.task_name,r.lang=e,r.checklist=a.checklist??[],r.adaptiveEnabled=!!a.adaptive_enabled,r.requiredFields=a.required_completion_fields??[],r.taskType=a.task_type??"",r.readingUnit=a.reading_unit??"",r.readings=a.readings??[],r.readingHistory=a.reading_history??[],r.parts=a.parts??[],r.consumesParts=a.consumes_parts??[],r.phaseLabel=a.phase_label??"",r.requireTagScan=!!a.require_tag_scan,r.restockDefault=a.restock_default??null,r.restockUnitCost=a.restock_unit_cost??null,r.restockPackage=a.restock_package??"",r.currencySymbol=me(a),r.consumesInfo=a.consumes_info??[],r.checklistPrefill=a.checklist_prefill??{},r.viaTagScan=!!a.via_tag_scan,r.partsCostMode=a.parts_cost_mode??"purchase",r.open({viaTagScan:!!a.via_tag_scan})}var{I:ma}=Tt;var _i=r=>r.strings===void 0;var mi={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},st=r=>(...a)=>({_$litDirective$:r,values:a}),Me=class{constructor(a){}get _$AU(){return this._$AM._$AU}_$AT(a,e,i){this._$Ct=a,this._$AM=e,this._$Ci=i}_$AS(a,e){return this.update(a,e)}update(a,e){return this.render(...e)}};var $e=(r,a)=>{let e=r._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(a,!1),$e(i,a);return!0},Oe=r=>{let a,e;do{if((a=r._$AM)===void 0)break;e=a._$AN,e.delete(r),r=a}while(e?.size===0)},gi=r=>{for(let a;a=r._$AM;r=a){let e=a._$AN;if(e===void 0)a._$AN=e=new Set;else if(e.has(r))break;e.add(r),ys(a)}};function vs(r){this._$AN!==void 0?(Oe(this),this._$AM=r,gi(this)):this._$AM=r}function fs(r,a=!1,e=0){let i=this._$AH,t=this._$AN;if(t!==void 0&&t.size!==0)if(a)if(Array.isArray(i))for(let n=e;n<i.length;n++)$e(i[n],!1),Oe(i[n]);else i!=null&&($e(i,!1),Oe(i));else $e(this,r)}var ys=r=>{r.type==mi.CHILD&&(r._$AP??=fs,r._$AQ??=vs)},Fe=class extends Me{constructor(){super(...arguments),this._$AN=void 0}_$AT(a,e,i){super._$AT(a,e,i),gi(this),this.isConnected=a._$AU}_$AO(a,e=!0){a!==this.isConnected&&(this.isConnected=a,a?this.reconnected?.():this.disconnected?.()),e&&($e(this,a),Oe(this))}setValue(a){if(_i(this._$Ct))this._$Ct._$AI(a,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=a,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected()
Line truncated
|
||||
class="notes-md"
|
||||
.content=${a}
|
||||
breaks
|
||||
${vi(i=>ws(i,e))}
|
||||
></ha-markdown>`}return l`${r}`}var lt="https://app-link.invalid/",$s=new Set(["http","https","mailto","tel","ftp"]),xs=/(```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`)/,ze="[a-zA-Z][a-zA-Z0-9+.-]+:";function ks(r){let a=[],e=n=>{let o=at(n);return!o||$s.has(o)||!De(n)?null:(a.push(nt(n)),`${lt}${a.length-1}`)},i=n=>n.replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)<(${ze}[^>\\n]*)>`,"g"),(o,c,u,m)=>{let g=c?null:e(m);return g?`${u}${g}`:o}).replace(new RegExp(`(!?)(\\[[^\\]\\n]*\\]\\(\\s*)(${ze}[^\\s)]*)`,"g"),(o,c,u,m)=>{let g=c?null:e(m);return g?`${u}${g}`:o}).replace(new RegExp(`(^|[^(])<(${ze}[^\\s<>]*)>`,"gm"),(o,c,u)=>{let m=e(u);return m?`${c}[${u.replace(/([\\[\]])/g,"\\$1")}](${m})`:o}).replace(new RegExp(`^( {0,3}\\[[^\\]\\n]+\\]:[ \\t]*)<?(${ze}[^\\s>]*)>?`,"gm"),(o,c,u)=>{let m=e(u);return m?`${c}${m}`:o});return{content:r.split(xs).map((n,o)=>o%2?n:i(n)).join(""),links:a}}function ot(r,a){for(let e of r.querySelectorAll(`a[href^="${lt}"]`)){let i=a[Number(e.getAttribute("href").slice(lt.length))];i&&e.setAttribute("href",i)}}var yi=new WeakMap;function ws(r,a){if(!r)return;let e=yi.get(r);if(!e&&a.length===0)return;if(e){e.links=a,r.shadowRoot&&ot(r.shadowRoot,a);return}let i={links:a};yi.set(r,i),(async()=>{await r.updateComplete;let t=r.shadowRoot;t&&(new MutationObserver(()=>ot(t,i.links)).observe(t,{childList:!0,subtree:!0}),ot(t,i.links))})()}var bi=r=>typeof r=="number"&&Number.isInteger(r)&&r>0;function Es(r){return r&&bi(r.ref_no)?String(r.ref_no):null}function $i(r,a){let e=Es(r);return e&&a&&bi(a.ref_no)?`${e}.${a.ref_no}`:null}function xi(r,a){return r?l`<span class="ref-chip" title=${a??""}>#${r}</span>`:h}var Ts={"Completed from dashboard button":"hist_note_button","Completed from the To-do list":"hist_note_todo","Completed by voice":"hist_note_voice","Completed from the notification":"hist_note_notification","Completed via NFC tag":"hist_note_nfc","Completed from the shopping list":"hist_note_shopping_list","Completed from a mirrored to-do list":"hist_note_todo_mirror","Skipped from notification":"hist_note_skipped_notification","Skipped from dashboard button":"hist_note_skipped_button","Sensor trigger activated":"hist_note_sensor_triggered","Initial value set during task creation":"hist_note_initial"},Is=[[/^Auto-completed: sensor recovered \((.+)\)$/,"hist_note_auto_recovered",r=>({value:r[1]})],[/^Reset to (\d{4}-\d{2}-\d{2})$/,"hist_note_reset",(r,a)=>({date:U(r[1],a)})],[/^Trigger entity replaced: (.+) → (.+)$/,"hist_note_trigger_replaced",r=>({old:r[1],new:r[2]})],[/^Sensor trigger removed \(entity was: (.+)\)\. Schedule converted to (\w+)\.$/,"hist_note_trigger_removed",(r,a)=>({entity:r[1],schedule:s(r[2],a)})],[/^Entity (.+) removed from compound trigger; (\d+) conditions remain\.$/,"hist_note_compound_removed",r=>({entity:r[1],count:r[2]})]];function ki(r,a){if(!r)return"";let e=Ts[r.trim()];if(e)return s(e,a);for(let[i,t,n]of Is){let o=r.trim().match(i);if(o){let c=n(o,a);return s(t,a).replace(/\{(\w+)\}/g,(u,m)=>c[m]??u)}}return r}var Ss=["completed","reset","skipped"];function wi(r){let a=e=>{let i=ee(e.timestamp);return Number.isNaN(i)?-1/0:i};return(r??[]).map((e,i)=>({entry:e,index:i,at:a(e)})).sort((e,i)=>i.at-e.at||i.index-e.index).map(e=>e.entry)}function As(r,a){return r.taskRef&&a.ref_no?`${r.taskRef}-${a.ref_no}`:null}function Cs(r,a){let e=_t(a);return e.length>0?l`<div class="history-photos">
|
||||
${e.map(i=>l`<maintenance-history-photo .hass=${r} .docId=${i}></maintenance-history-photo>`)}
|
||||
</div>`:h}function rs(r,a){let e=a.lang,i=o=>E(o,e,{maximumFractionDigits:3}),t=o=>o==null?"":` (${o>=0?"+":""}${i(o)})`,n=ot(r);return n.length>0?l`<div class="history-readings">
|
||||
</div>`:h}function Ps(r,a){let e=a.lang,i=o=>E(o,e,{maximumFractionDigits:3}),t=o=>o==null?"":` (${o>=0?"+":""}${i(o)})`,n=yt(r);return n.length>0?l`<div class="history-readings">
|
||||
${n.map(o=>l`<span class="history-reading">
|
||||
<span class="history-reading-name">${o.name}</span>
|
||||
<span class="history-reading-value">${i(o.value)}${o.unit?` ${o.unit}`:""}${t(a.readingSlotDelta?.(r,o.id))}</span>
|
||||
@@ -2819,15 +2824,15 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>`:r.reading_value!=null?l`<div class="history-readings"><span class="history-reading">
|
||||
<span class="history-reading-name">${s("reading_label",e)}</span>
|
||||
<span class="history-reading-value">${i(r.reading_value)}${a.readingUnit?` ${a.readingUnit}`:""}${t(a.readingDelta?.(r))}</span>
|
||||
</span></div>`:h}function ai(r,a,e={}){let i=a.lang,{compact:t=!1,showRef:n=!0,showBadges:o=!0,showEdit:c=!0}=e,u=a.openEdit,m=c&&!!u&&ts.includes(r.type),g=typeof r.parts_cost=="number"?r.parts_cost:null,f=r.cost_basis==="use",x=f&&!!r.purchase;return l`
|
||||
</span></div>`:h}function Ei(r,a,e={}){let i=a.lang,{compact:t=!1,showRef:n=!0,showBadges:o=!0,showEdit:c=!0}=e,u=a.openEdit,m=c&&!!u&&Ss.includes(r.type),g=typeof r.parts_cost=="number"?r.parts_cost:null,f=r.cost_basis==="use",x=f&&!!r.purchase;return l`
|
||||
<div class="history-entry${t?" compact":""}">
|
||||
${t?h:l`<div class="history-icon ${r.type}">
|
||||
<ha-icon .icon=${ke[r.type]||"mdi:circle"}></ha-icon>
|
||||
<ha-icon .icon=${we[r.type]||"mdi:circle"}></ha-icon>
|
||||
</div>`}
|
||||
<div class="history-content">
|
||||
<div class="history-row">
|
||||
<strong>${s(r.type,i)}</strong>
|
||||
${n?si(is(a,r),s("ref_number",i)):h}
|
||||
${n?xi(As(a,r),s("ref_number",i)):h}
|
||||
${o&&r.phase_id?l`<span class="history-phase-badge">${a.phaseNames?.[r.phase_id]||r.phase_id}</span>`:h}
|
||||
${o&&r.auto?l`<span class="history-auto-badge">${s("history_auto",i)}</span>`:h}
|
||||
${m?l`<button class="history-edit-btn"
|
||||
@@ -2837,41 +2842,41 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</button>`:h}
|
||||
</div>
|
||||
<div class="history-date">${Ie(r.timestamp,i)}</div>
|
||||
${r.notes?l`<div class="history-notes">${ri(r.notes,i)}</div>`:h}
|
||||
${ss(a.hass,r)}
|
||||
${rs(r,a)}
|
||||
${r.notes?l`<div class="history-notes">${ki(r.notes,i)}</div>`:h}
|
||||
${Cs(a.hass,r)}
|
||||
${Ps(r,a)}
|
||||
${r.cost!=null||r.duration!=null||r.trigger_value!=null||g!=null?l`<div class="history-details">
|
||||
${r.cost!=null?x?l`<span>${s("history_purchase_stock",i).replace("{amount}",z(r.cost,a.currencySymbol,i))}</span>`:r.cost<0?l`<span class="history-credit">${s("cost_kind_credit",i)}: ${z(-r.cost,a.currencySymbol,i)}</span>`:l`<span>${s("cost",i)}: ${z(r.cost,a.currencySymbol,i)}</span>`:h}
|
||||
${g!=null?l`<span title=${s(f?"history_parts_counted_hint":"history_parts_info_hint",i)}>${s(f?"history_parts_counted":"history_parts_info",i).replace("{amount}",z(g,a.currencySymbol,i))}</span>`:h}
|
||||
${r.duration!=null?l`<span>${s("duration",i)}: ${Se(r.duration,i)}</span>`:h}
|
||||
${r.duration!=null?l`<span>${s("duration",i)}: ${Ae(r.duration,i)}</span>`:h}
|
||||
${r.trigger_value!=null?l`<span>${s("trigger_val",i)}: ${r.trigger_value}</span>`:h}
|
||||
</div>`:h}
|
||||
</div>
|
||||
</div>
|
||||
`}var ns="var(--maint-done-color, #78909c)";function $e(r){return r.archived?"archived":r.is_done?"done":r.status||"ok"}function Je(r,a){return s(r==="done"?"completed":r,a)}function Oe(r){let a=$e(r);return a==="done"?ns:Xe[a]||"var(--disabled-color, #9e9e9e)"}function as(r){return ke[r==="done"?"completed":r]||"mdi:circle-medium"}function oi(r,a,e="pill"){let i=$e(r),t=Je(i,a);return e==="chip"?l`<span class="status-chip ${i}">${t}</span>`:l`<span class="status-badge ${i}" role="img" title="${t}" aria-label="${t}"><ha-icon icon="${as(i)}"></ha-icon><span class="status-label">${t}</span></span>`}var Me=class{constructor(){this._handle=null}schedule(a,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,a()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}};function $(r){return r.toFixed(1)}function li(r,a){let e=r.interval_analysis,i=e?.weibull_beta,t=e?.weibull_eta;if(i==null||t==null||t<=0)return h;let n=r.interval_days??0,o=r.suggested_interval??n;return l`
|
||||
`}var Rs="var(--maint-done-color, #78909c)";function xe(r){return r.archived?"archived":r.is_done?"done":r.status||"ok"}function dt(r,a){return s(r==="done"?"completed":r,a)}function je(r){let a=xe(r);return a==="done"?Rs:pt[a]||"var(--disabled-color, #9e9e9e)"}function Ls(r){return we[r==="done"?"completed":r]||"mdi:circle-medium"}function Ti(r,a,e="pill"){let i=xe(r),t=dt(i,a);return e==="chip"?l`<span class="status-chip ${i}">${t}</span>`:l`<span class="status-badge ${i}" role="img" title="${t}" aria-label="${t}"><ha-icon icon="${Ls(i)}"></ha-icon><span class="status-label">${t}</span></span>`}var Be=class{constructor(){this._handle=null}schedule(a,e=4e3){this.clear(),this._handle=setTimeout(()=>{this._handle=null,a()},e)}clear(){this._handle!==null&&(clearTimeout(this._handle),this._handle=null)}get pending(){return this._handle!==null}};function $(r){return r.toFixed(1)}function Ii(r,a){let e=r.interval_analysis,i=e?.weibull_beta,t=e?.weibull_eta;if(i==null||t==null||t<=0)return h;let n=r.interval_days??0,o=r.suggested_interval??n;return l`
|
||||
<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",a)}
|
||||
${os(i,a)}
|
||||
${qs(i,a)}
|
||||
</div>
|
||||
${ls(i,t,n,o,a)}
|
||||
${ds(e,a)}
|
||||
${e?.confidence_interval_low!=null?cs(e,r,a):h}
|
||||
${Hs(i,t,n,o,a)}
|
||||
${Ns(e,a)}
|
||||
${e?.confidence_interval_low!=null?Ms(e,r,a):h}
|
||||
</div>
|
||||
`}function os(r,a){let e,i,t;return r<.8?(e="early_failures",i="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",t="beta_early_failures"):r<=1.2?(e="random_failures",i="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",t="beta_random_failures"):r<=3.5?(e="wear_out",i="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",t="beta_wear_out"):(e="highly_predictable",i="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",t="beta_highly_predictable"),l`
|
||||
`}function qs(r,a){let e,i,t;return r<.8?(e="early_failures",i="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z",t="beta_early_failures"):r<=1.2?(e="random_failures",i="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",t="beta_random_failures"):r<=3.5?(e="wear_out",i="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",t="beta_wear_out"):(e="highly_predictable",i="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",t="beta_highly_predictable"),l`
|
||||
<span class="beta-badge ${e}">
|
||||
<ha-svg-icon path="${i}"></ha-svg-icon>
|
||||
${s(t,a)} (\u03B2=${E(r,a,2)})
|
||||
</span>
|
||||
`}function ls(r,a,e,i,t){let b=Math.max(e,i,a,1)*1.3,S=50,N=[];for(let O=0;O<=S;O++){let D=O/S*b,xi=1-Math.exp(-Math.pow(D/a,r)),ki=32+D/b*260,wi=136-xi*128;N.push([ki,wi])}let K=N.map(([O,D])=>`${$(O)},${$(D)}`).join(" "),X="M32,136 "+N.map(([O,D])=>`L${$(O)},${$(D)}`).join(" ")+` L${$(N[S][0])},136 Z`,F=32+e/b*260,B=1-Math.exp(-Math.pow(e/a,r)),re=136-B*128,bi=E((1-B)*100,t,0),Ze=32+i/b*260,$i=[0,.25,.5,.75,1];return l`
|
||||
`}function Hs(r,a,e,i,t){let b=Math.max(e,i,a,1)*1.3,S=50,N=[];for(let M=0;M<=S;M++){let D=M/S*b,Di=1-Math.exp(-Math.pow(D/a,r)),zi=32+D/b*260,Ui=136-Di*128;N.push([zi,Ui])}let K=N.map(([M,D])=>`${$(M)},${$(D)}`).join(" "),X="M32,136 "+N.map(([M,D])=>`L${$(M)},${$(D)}`).join(" ")+` L${$(N[S][0])},136 Z`,F=32+e/b*260,B=1-Math.exp(-Math.pow(e/a,r)),re=136-B*128,Oi=E((1-B)*100,t,0),ct=32+i/b*260,Fi=[0,.25,.5,.75,1];return l`
|
||||
<div class="weibull-chart">
|
||||
<svg viewBox="0 0 ${300} ${160}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${s("chart_weibull",t)}">
|
||||
${$i.map(O=>{let D=136-O*128;return ne`
|
||||
${Fi.map(M=>{let D=136-M*128;return ne`
|
||||
<line x1="${32}" y1="${$(D)}" x2="${292}" y2="${$(D)}"
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${O===.5?"4,3":h}" />
|
||||
stroke="var(--divider-color)" stroke-width="0.5" stroke-dasharray="${M===.5?"4,3":h}" />
|
||||
<text x="${28}" y="${$(D+3)}" fill="var(--secondary-text-color)"
|
||||
font-size="8" text-anchor="end">${E(O*100,t,0)}%</text>
|
||||
font-size="8" text-anchor="end">${E(M*100,t,0)}%</text>
|
||||
`})}
|
||||
|
||||
<text x="${32}" y="${156}" fill="var(--secondary-text-color)" font-size="8" text-anchor="middle">0</text>
|
||||
@@ -2888,11 +2893,11 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<circle cx="${$(F)}" cy="${$(re)}" r="3"
|
||||
fill="var(--primary-color, #03a9f4)" />
|
||||
<text x="${$(F+4)}" y="${$(re-6)}" fill="var(--primary-color, #03a9f4)"
|
||||
font-size="9" font-weight="600">R=${bi}%</text>
|
||||
font-size="9" font-weight="600">R=${Oi}%</text>
|
||||
`:h}
|
||||
|
||||
${i>0&&i!==e?ne`
|
||||
<line x1="${$(Ze)}" y1="${8}" x2="${$(Ze)}" y2="${$(136)}"
|
||||
<line x1="${$(ct)}" y1="${8}" x2="${$(ct)}" y2="${$(136)}"
|
||||
stroke="var(--success-color, #4caf50)" stroke-width="1.5" stroke-dasharray="4,3" />
|
||||
`:h}
|
||||
|
||||
@@ -2907,7 +2912,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${e>0?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--primary-color, #03a9f4); opacity:0.5"></span> ${s("current_interval_marker",t)}</span>`:h}
|
||||
${i>0&&i!==e?l`<span class="legend-item"><span class="legend-swatch" style="background:var(--success-color, #4caf50)"></span> ${s("recommended_marker",t)}</span>`:h}
|
||||
</div>
|
||||
`}function ds(r,a){return l`
|
||||
`}function Ns(r,a){return l`
|
||||
<div class="weibull-info-row">
|
||||
<div class="weibull-info-item">
|
||||
<span>${s("characteristic_life",a)}</span>
|
||||
@@ -2920,7 +2925,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
`:h}
|
||||
</div>
|
||||
`}function cs(r,a,e){let i=r.confidence_interval_low,t=r.confidence_interval_high,n=a.suggested_interval??a.interval_days??0,o=a.interval_days??0,c=Math.max(0,i-5),m=t+5-c,g=(i-c)/m*100,f=(t-i)/m*100,x=(n-c)/m*100,b=o>0?(o-c)/m*100:-1;return l`
|
||||
`}function Ms(r,a,e){let i=r.confidence_interval_low,t=r.confidence_interval_high,n=a.suggested_interval??a.interval_days??0,o=a.interval_days??0,c=Math.max(0,i-5),m=t+5-c,g=(i-c)/m*100,f=(t-i)/m*100,x=(n-c)/m*100,b=o>0?(o-c)/m*100:-1;return l`
|
||||
<div class="confidence-range">
|
||||
<div class="confidence-range-title">
|
||||
${s("confidence_interval",e)}: ${n} ${s("days",e)} (${i}\u2013${t})
|
||||
@@ -2935,7 +2940,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<span class="confidence-text high">${s("confidence_aggressive",e)} (${t}${s("days",e).charAt(0)})</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function di(r,a,e){let i=r.degradation_trend!=null&&r.degradation_trend!=="insufficient_data",t=r.days_until_threshold!=null,n=r.environmental_factor!=null&&r.environmental_factor!==1;if(!i&&!t&&!n)return h;let o=r.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":r.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 l`
|
||||
`}function Si(r,a,e){let i=r.degradation_trend!=null&&r.degradation_trend!=="insufficient_data",t=r.days_until_threshold!=null,n=r.environmental_factor!=null&&r.environmental_factor!==1;if(!i&&!t&&!n)return h;let o=r.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":r.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 l`
|
||||
<div class="prediction-section">
|
||||
${r.sensor_prediction_urgency?l`
|
||||
<div class="prediction-urgency-banner">
|
||||
@@ -2971,12 +2976,12 @@ ${u?`<div class="sub">${u}</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">${s("environmental_adjustment",a)}</span>
|
||||
<span class="prediction-value">${E(r.environmental_factor,a,2)}x</span>
|
||||
${r.environmental_entity?l`<span class="prediction-entity entity-link" @click=${c=>yt(c,r.environmental_entity)}>${r.environmental_entity}</span>`:h}
|
||||
${r.environmental_entity?l`<span class="prediction-entity entity-link" @click=${c=>Rt(c,r.environmental_entity)}>${r.environmental_entity}</span>`:h}
|
||||
</div>
|
||||
`:h}
|
||||
</div>
|
||||
</div>
|
||||
`}function ci(r,a,e,i){let t=Math.max(r||1,a);return l`
|
||||
`}function Ai(r,a,e,i){let t=Math.max(r||1,a);return l`
|
||||
<div class="interval-comparison">
|
||||
<div class="interval-bar">
|
||||
<div class="interval-label">
|
||||
@@ -2994,7 +2999,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
style="width: ${Math.min(a/t*100,100)}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
`}var pi=["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 hi(){return Number(Ee().slice(5,7))-1}function ui(r,a,e){if(!e.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return h;let i=pi.map(c=>s(c,a)),t=hi(),n=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:i.map((c,u)=>{let m=r.seasonal_factor||1,g=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,m+g))});return l`
|
||||
`}var Ci=["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 Pi(){return Number(Te().slice(5,7))-1}function Ri(r,a,e){if(!e.seasonal||!r.seasonal_factor||r.seasonal_factor===1)return h;let i=Ci.map(c=>s(c,a)),t=Pi(),n=r.seasonal_factors||r.interval_analysis?.seasonal_factors||null,o=n&&n.length===12?n:i.map((c,u)=>{let m=r.seasonal_factor||1,g=Math.sin((u-6)*Math.PI/6)*.3;return Math.max(.7,Math.min(1.3,m+g))});return l`
|
||||
<div class="seasonal-card-compact">
|
||||
<h4>${s("seasonal_awareness",a)}</h4>
|
||||
<div class="seasonal-mini-chart">
|
||||
@@ -3011,7 +3016,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<span class="legend-item"><span class="dot high"></span> ${s("longer",a)}</span>
|
||||
</div>
|
||||
</div>
|
||||
`}function _i(r,a){return ps(r,a)}function ps(r,a){let e=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let i=r.interval_analysis?.seasonal_reason,t=hi(),n=300,o=100,c=8,m=o-c-4,g=Math.max(...e,1.5),f=n/12,x=f*.65,b=c+m-1/g*m;return l`
|
||||
`}function Li(r,a){return Os(r,a)}function Os(r,a){let e=r.seasonal_factors??r.interval_analysis?.seasonal_factors;if(!e||e.length!==12)return h;let i=r.interval_analysis?.seasonal_reason,t=Pi(),n=300,o=100,c=8,m=o-c-4,g=Math.max(...e,1.5),f=n/12,x=f*.65,b=c+m-1/g*m;return l`
|
||||
<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>
|
||||
@@ -3028,13 +3033,13 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
`})}
|
||||
</svg>
|
||||
<div class="seasonal-labels">
|
||||
${pi.map((S,N)=>l`<span class="seasonal-label ${N===t?"active-month":""}">${s(S,a)}</span>`)}
|
||||
${Ci.map((S,N)=>l`<span class="seasonal-label ${N===t?"active-month":""}">${s(S,a)}</span>`)}
|
||||
</div>
|
||||
</div>
|
||||
`}var I=class extends T{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showPostpone=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._postponeDate="";this._features={adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1};this._toast="";this._toastTimer=new Me;this._access=Ce;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return P(this.hass)}async openFor(e,i){(e!==this._entryId||i!==this._taskId)&&(this._task=null),this._entryId=e,this._taskId=i,this._error="",this._showSkip=!1,this._showReset=!1,this._showPostpone=!1,this._showAdaptive=!1,this._skipReason="",this._postponeDate="",this._resetDate=Ee(),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await V(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=me(e.budget??void 0),_t(e.budget??void 0),this._partsCostMode=e.partsCostMode}close(){this._loadSeq++,this._open=!1,this._task=null,this._error="",this._toastTimer.clear(),this._toast=""}_showToast(e,i){this._toast=e,this._toastTimer.schedule(()=>{this._toast=""},i)}async _loadTask(){let e=this._entryId,i=this._taskId;if(!e||!i)return;let t=++this._loadSeq,n="",o=await A(this,{type:"maintenance_supporter/object",entry_id:e},{onError:u=>{n=u}});if(t!==this._loadSeq)return;if(o===void 0){this._error=n;return}this._objectName=o?.object?.name||"";let c=(o?.tasks||[]).find(u=>u.id===i);this._task=c??null,this._taskRef=ii(o?.object,c),c||(this._error=s("ws_err_not_found",this._lang))}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_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||import("./dialog-mount-G4RBVSCP.js").then(async({openCompleteDialog:e})=>{let i=this._task,t=[];try{t=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(Xt({entryId:this._entryId,taskId:this._taskId,taskName:i.name,task:i,objects:t,lang:this._lang,features:this._features,currencySymbol:this._currencySymbol,partsCostMode:this._partsCostMode}))&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("reset"),this.close())}async _onPostponeConfirm(){if(!this._entryId||!this._taskId||!this._postponeDate)return;await this._runWs({type:"maintenance_supporter/task/postpone",entry_id:this._entryId,task_id:this._taskId,until:this._postponeDate})!==void 0&&(this._notifyChanged("postpone"),this.close())}async _onSnooze(){if(!this._entryId||!this._taskId)return;let e=await this._runWs({type:"maintenance_supporter/task/snooze",entry_id:this._entryId,task_id:this._taskId});e!==void 0&&(this._notifyChanged("snooze"),this.dispatchEvent(new CustomEvent("hass-notification",{detail:{message:Zt(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-G4RBVSCP.js").then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-G4RBVSCP.js").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||!await te(this.hass,{title:s("delete",this._lang),message:s("delete_task_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})!==void 0&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/mainLine truncated
|
||||
`}var T=class extends I{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showPostpone=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._postponeDate="";this._features={adaptive:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1,places:!1};this._toast="";this._toastTimer=new Be;this._access=Pe;this._currencySymbol="";this._partsCostMode="purchase";this._loadSeq=0}get _lang(){return P(this.hass)}async openFor(e,i){(e!==this._entryId||i!==this._taskId)&&(this._task=null),this._entryId=e,this._taskId=i,this._error="",this._showSkip=!1,this._showReset=!1,this._showPostpone=!1,this._showAdaptive=!1,this._skipReason="",this._postponeDate="",this._resetDate=Te(),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){let e=await V(this.hass);this._features={...this._features,...e.features},this._access=e.access,this._currencySymbol=me(e.budget??void 0),It(e.budget??void 0),this._partsCostMode=e.partsCostMode}close(){this._loadSeq++,this._open=!1,this._task=null,this._error="",this._toastTimer.clear(),this._toast=""}_showToast(e,i){this._toast=e,this._toastTimer.schedule(()=>{this._toast=""},i)}async _loadTask(){let e=this._entryId,i=this._taskId;if(!e||!i)return;let t=++this._loadSeq,n="",o=await A(this,{type:"maintenance_supporter/object",entry_id:e},{onError:u=>{n=u}});if(t!==this._loadSeq)return;if(o===void 0){this._error=n;return}this._objectName=o?.object?.name||"";let c=(o?.tasks||[]).find(u=>u.id===i);this._task=c??null,this._taskRef=$i(o?.object,c),c||(this._error=s("ws_err_not_found",this._lang))}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_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||import("./dialog-mount-23TVVS4T.js").then(async({openCompleteDialog:e})=>{let i=this._task,t=[];try{t=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(hi({entryId:this._entryId,taskId:this._taskId,taskName:i.name,task:i,objects:t,lang:this._lang,features:this._features,currencySymbol:this._currencySymbol,partsCostMode:this._partsCostMode}))&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("reset"),this.close())}async _onPostponeConfirm(){if(!this._entryId||!this._taskId||!this._postponeDate)return;await this._runWs({type:"maintenance_supporter/task/postpone",entry_id:this._entryId,task_id:this._taskId,until:this._postponeDate})!==void 0&&(this._notifyChanged("postpone"),this.close())}async _onSnooze(){if(!this._entryId||!this._taskId)return;let e=await this._runWs({type:"maintenance_supporter/task/snooze",entry_id:this._entryId,task_id:this._taskId});e!==void 0&&(this._notifyChanged("snooze"),this.dispatchEvent(new CustomEvent("hass-notification",{detail:{message:pi(e,this._lang)},bubbles:!0,composed:!0})),this.close())}_onEdit(){!this._entryId||!this._taskId||import("./dialog-mount-23TVVS4T.js").then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||import("./dialog-mount-23TVVS4T.js").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||!await te(this.hass,{title:s("delete",this._lang),message:s("delete_task_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})!==void 0&&(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})!==void 0&&(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})!==void 0&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/mainLine truncated
|
||||
<div class="recommendation-card">
|
||||
<h4>${s("suggested_interval",i)}</h4>
|
||||
${ci(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",i)}
|
||||
${Ai(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",i)}
|
||||
<div class="recommendation-actions">
|
||||
${le(this.hass?.user,this._access)?l`<button class="btn primary qa-apply-suggestion"
|
||||
@click=${this._applySuggestion} ?disabled=${this._busy}>
|
||||
@@ -3054,14 +3059,14 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<div class="adaptive-stack">
|
||||
${this._toast?l`<div class="toast">${this._toast}</div>`:h}
|
||||
${t?this._renderRecommendation(e):h}
|
||||
${n?di(e,i,this._features):h}
|
||||
${o?li(e,i):h}
|
||||
${n?Si(e,i,this._features):h}
|
||||
${o?Ii(e,i):h}
|
||||
${c?l`
|
||||
${ui(e,i,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?_i(e,i):h}
|
||||
${Ri(e,i,this._features)}
|
||||
${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?Li(e,i):h}
|
||||
`:h}
|
||||
</div>
|
||||
`}_renderDetails(e){let i=this._lang,t=e.history||[],n=e.history_count??t.length,o=ni(t).slice(0,20);return l`
|
||||
`}_renderDetails(e){let i=this._lang,t=e.history||[],n=e.history_count??t.length,o=wi(t).slice(0,20);return l`
|
||||
<div class="details">
|
||||
<div class="stats-grid">
|
||||
<div class="stat">
|
||||
@@ -3074,7 +3079,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="stat-label">${s("avg_duration",i)}</span>
|
||||
<span class="stat-value">${Se(e.average_duration!=null?Math.round(e.average_duration):null,i)}</span>
|
||||
<span class="stat-value">${Ae(e.average_duration!=null?Math.round(e.average_duration):null,i)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history-header">
|
||||
@@ -3083,7 +3088,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
${t.length===0?l`<div class="history-empty">${s("history_empty",i)}</div>`:l`
|
||||
<div class="history-list">
|
||||
${o.map(c=>ai(c,{lang:i,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:le(this.hass?.user,this._access)?u=>this._onEditHistoryEntry(u):void 0,readingUnit:e.reading_unit,readingSlotDelta:(u,m)=>ct(t,u,m),taskRef:this._taskRef},{compact:!0}))}
|
||||
${o.map(c=>Ei(c,{lang:i,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:le(this.hass?.user,this._access)?u=>this._onEditHistoryEntry(u):void 0,readingUnit:e.reading_unit,readingSlotDelta:(u,m)=>xt(t,u,m),taskRef:this._taskRef},{compact:!0}))}
|
||||
${n>o.length?l`<div class="history-more">… +${n-o.length} ${s("older_entries",i)}</div>`:h}
|
||||
</div>
|
||||
`}
|
||||
@@ -3092,20 +3097,20 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${i?l`
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<span class="status-dot" style="background: ${Oe(i)}"></span>
|
||||
<span class="status-dot" style="background: ${je(i)}"></span>
|
||||
<span class="task-name">${i.name}</span>
|
||||
${oi(i,e)}
|
||||
${Ti(i,e)}
|
||||
</div>
|
||||
<div class="object">
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-G4RBVSCP.js").then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
<button class="link-inline" @click=${()=>{this._entryId&&import("./dialog-mount-23TVVS4T.js").then(({openObjectQuickActions:o})=>{o(this._entryId),this.close()})}}>${this._objectName}</button>
|
||||
</div>
|
||||
<div class="quick-info">
|
||||
${i.next_due?l`<span><strong>${s("next_due",e)}:</strong> ${U(i.next_due,e)}</span>`:h}
|
||||
${i.last_performed?l`<span><strong>${s("last_performed",e)}:</strong> ${U(i.last_performed,e)}</span>`:h}
|
||||
${i.schedule?.kind&&!["manual","one_time"].includes(i.schedule.kind)||i.interval_days!=null?l`<span><strong>${s("interval",e)}:</strong> ${ft(i,e)}</span>`:h}
|
||||
${i.schedule?.kind&&!["manual","one_time"].includes(i.schedule.kind)||i.interval_days!=null?l`<span><strong>${s("interval",e)}:</strong> ${Pt(i,e)}</span>`:h}
|
||||
${be(i)?l`<span><strong>${s("phase_current",e)}:</strong> ${be(i)}</span>`:h}
|
||||
</div>
|
||||
${i.notes?l`<div class="notes-body">${Ne(i.notes)}</div>`:h}
|
||||
${i.notes?l`<div class="notes-body">${Ue(i.notes)}</div>`:h}
|
||||
</div>
|
||||
|
||||
${this._error?l`<div class="error">${this._error}</div>`:h}
|
||||
@@ -3232,7 +3237,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
`}
|
||||
`:this._error?l`<div class="error">${this._error}</div>`:l`<div class="loading">${s("loading",e)}</div>`}
|
||||
`)}updated(e){e.has("_open")&&this._open&&_e(this.shadowRoot)}};I.styles=[bt,he,w`
|
||||
`)}updated(e){e.has("_open")&&this._open&&_e(this.shadowRoot)}};T.styles=[Lt,he,w`
|
||||
:host { display: contents; --ms-modal-max-width: 460px; }
|
||||
.header { display: flex; flex-direction: column; gap: 6px; }
|
||||
.title { display: flex; align-items: center; gap: 10px; }
|
||||
@@ -3390,7 +3395,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
.weibull-section, .seasonal-card-compact { max-width: 100%; }
|
||||
.weibull-chart svg { max-width: 100%; height: auto; }
|
||||
.details-toggle { gap: 12px; flex-wrap: wrap; }
|
||||
`],d([v({attribute:!1})],I.prototype,"hass",2),d([p()],I.prototype,"_open",2),d([p()],I.prototype,"_entryId",2),d([p()],I.prototype,"_taskId",2),d([p()],I.prototype,"_task",2),d([p()],I.prototype,"_objectName",2),d([p()],I.prototype,"_taskRef",2),d([p()],I.prototype,"_busy",2),d([p()],I.prototype,"_error",2),d([p()],I.prototype,"_showSkip",2),d([p()],I.prototype,"_showReset",2),d([p()],I.prototype,"_showPostpone",2),d([p()],I.prototype,"_showDetails",2),d([p()],I.prototype,"_showAdaptive",2),d([p()],I.prototype,"_skipReason",2),d([p()],I.prototype,"_resetDate",2),d([p()],I.prototype,"_postponeDate",2),d([p()],I.prototype,"_features",2),d([p()],I.prototype,"_toast",2),d([p()],I.prototype,"_access",2),d([p()],I.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",I);function mi(r){return!!r&&/^https?:\/\//i.test(r)}var M=class extends T{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=Ce}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),V(this.hass).then(i=>{this._access=i.access})])}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(!this._entryId)return;let e=await A(this,{type:"maintenance_supporter/object",entry_id:this._entryId},{onError:i=>{this._error=i}});e!==void 0&&(this._data=e)}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-G4RBVSCP.js").then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-G4RBVSCP.js").then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await te(this.hass,{title:s("delete",this._lang),message:s("delete_object_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;let i=this._entryId;await this._runWs({type:"maintenance_supporter/object/delete",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e&&!await te(this.hass,{title:s("archive_object",this._lang),message:s("confirm_archive_object",this._lang),confirmText:s("archive_object",this._lang)}))return;let i=this._entryId;await this._runWs({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}_onTaskClick(e){this._entryId&&import("./dialog-mount-G4RBVSCP.js").then(({openTaskQuickActions:i})=>{i(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,i=this._data,t=i?.object,n=i?.tasks||[],o=le(this.hass?.user,this._access);return ue(()=>this.close(),l`
|
||||
`],d([v({attribute:!1})],T.prototype,"hass",2),d([p()],T.prototype,"_open",2),d([p()],T.prototype,"_entryId",2),d([p()],T.prototype,"_taskId",2),d([p()],T.prototype,"_task",2),d([p()],T.prototype,"_objectName",2),d([p()],T.prototype,"_taskRef",2),d([p()],T.prototype,"_busy",2),d([p()],T.prototype,"_error",2),d([p()],T.prototype,"_showSkip",2),d([p()],T.prototype,"_showReset",2),d([p()],T.prototype,"_showPostpone",2),d([p()],T.prototype,"_showDetails",2),d([p()],T.prototype,"_showAdaptive",2),d([p()],T.prototype,"_skipReason",2),d([p()],T.prototype,"_resetDate",2),d([p()],T.prototype,"_postponeDate",2),d([p()],T.prototype,"_features",2),d([p()],T.prototype,"_toast",2),d([p()],T.prototype,"_access",2),d([p()],T.prototype,"_partsCostMode",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",T);var O=class extends I{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error="";this._access=Pe}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await Promise.all([this._load(),V(this.hass).then(i=>{this._access=i.access})])}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(!this._entryId)return;let e=await A(this,{type:"maintenance_supporter/object",entry_id:this._entryId},{onError:i=>{this._error=i}});e!==void 0&&(this._data=e)}_runWs(e){return this._error="",A(this,e,{busy:i=>{this._busy=i},onError:i=>{this._error=i}})}_onEditObject(){!this._entryId||!this._data||import("./dialog-mount-23TVVS4T.js").then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&import("./dialog-mount-23TVVS4T.js").then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data||!await te(this.hass,{title:s("delete",this._lang),message:s("delete_object_confirm",this._lang),confirmText:s("delete",this._lang),danger:!0}))return;let i=this._entryId;await this._runWs({type:"maintenance_supporter/object/delete",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e&&!await te(this.hass,{title:s("archive_object",this._lang),message:s("confirm_archive_object",this._lang),confirmText:s("archive_object",this._lang)}))return;let i=this._entryId;await this._runWs({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:i})!==void 0&&(this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:i},bubbles:!0,composed:!0})),this.close())}_onTaskClick(e){this._entryId&&import("./dialog-mount-23TVVS4T.js").then(({openTaskQuickActions:i})=>{i(this._entryId,e)})}render(){if(!this._open)return h;let e=this._lang,i=this._data,t=i?.object,n=i?.tasks||[],o=le(this.hass?.user,this._access);return ue(()=>this.close(),l`
|
||||
${i&&t?l`
|
||||
<div class="header">
|
||||
<div class="title">${t.name}</div>
|
||||
@@ -3408,9 +3413,9 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
<div class="task-list">
|
||||
${n.map(c=>l`
|
||||
<div class="task-row" @click=${()=>this._onTaskClick(c.id)}>
|
||||
<span class="status-dot" style="background: ${Oe(c)}"></span>
|
||||
<span class="status-dot" style="background: ${je(c)}"></span>
|
||||
<span class="task-name">${c.name}</span>
|
||||
<span class="task-status ${$e(c)}">${Je($e(c),e)}</span>
|
||||
<span class="task-status ${xe(c)}">${dt(xe(c),e)}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
@@ -3420,7 +3425,7 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
${t.notes?l`
|
||||
<div class="notes-section">
|
||||
<strong>${s("object_notes_label",e)}</strong>
|
||||
<div class="notes-body">${Ne(t.notes)}</div>
|
||||
<div class="notes-body">${Ue(t.notes)}</div>
|
||||
</div>
|
||||
`:h}
|
||||
|
||||
@@ -3445,16 +3450,16 @@ ${u?`<div class="sub">${u}</div>`:""}
|
||||
</div>
|
||||
`:h}
|
||||
`:l`<div class="loading">${s("loading",e)}</div>`}
|
||||
`)}updated(e){e.has("_open")&&this._open&&_e(this.shadowRoot)}_renderMetaRow(e){let i=this._lang,t=[];return e.area_id&&t.push([s("area",i),e.area_id]),e.manufacturer&&t.push([s("manufacturer",i),e.manufacturer]),e.model&&t.push([s("model",i),e.model]),e.serial_number&&t.push([s("serial_number_label",i),e.serial_number]),e.installation_date&&t.push([s("installed",i),e.installation_date]),e.warranty_expiry&&t.push([s("warranty",i),e.warranty_expiry]),e.documentation_url&&t.push([s("documentation_url_label",i),e.documentation_url]),t.length===0?h:l`
|
||||
`)}updated(e){e.has("_open")&&this._open&&_e(this.shadowRoot)}_renderMetaRow(e){let i=this._lang,t=[];return e.area_id&&t.push([s("area",i),e.area_id]),e.manufacturer&&t.push([s("manufacturer",i),e.manufacturer]),e.model&&t.push([s("model",i),e.model]),e.serial_number&&t.push([s("serial_number_label",i),e.serial_number]),e.installation_date&&t.push([s("installed",i),e.installation_date]),e.warranty_expiry&&t.push([s("warranty",i),e.warranty_expiry]),e.documentation_url&&t.push([s("documentation_url_label",i),e.documentation_url,De(e.documentation_url)]),t.length===0?h:l`
|
||||
<div class="meta">
|
||||
${t.map(([n,o])=>l`
|
||||
${t.map(([n,o,c])=>l`
|
||||
<div class="meta-item">
|
||||
<span class="meta-label">${n}</span>
|
||||
<span class="meta-value">${mi(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
|
||||
<span class="meta-value">${c||fi(o)?l`<a href="${o}" target="_blank" rel="noopener noreferrer">${o}</a>`:o}</span>
|
||||
</div>
|
||||
`)}
|
||||
</div>
|
||||
`}};M.styles=[he,w`
|
||||
`}};O.styles=[he,w`
|
||||
:host { display: contents; }
|
||||
.header { display: flex; flex-direction: column; gap: 6px; }
|
||||
.title { font-size: 20px; font-weight: 600; }
|
||||
@@ -3499,4 +3504,22 @@ ${u?`<div class="sub">${u}</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; }
|
||||
`],d([v({attribute:!1})],M.prototype,"hass",2),d([p()],M.prototype,"_open",2),d([p()],M.prototype,"_entryId",2),d([p()],M.prototype,"_data",2),d([p()],M.prototype,"_busy",2),d([p()],M.prototype,"_error",2),d([p()],M.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",M);var gi="maintenance-object-dialog",vi="maintenance-task-dialog",hs="maintenance-history-edit-dialog",us="maintenance-complete-dialog",_s="maintenance-qr-dialog",ms="maintenance-task-quick-actions-dialog",gs="maintenance-object-quick-actions-dialog";function xe(){return document.querySelector("home-assistant")?.hass}function vs(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function G(r){let a=vs(),e=a.querySelector(r)??document.body.querySelector(r);return e?e.parentNode!==a&&a.appendChild(e):(e=document.createElement(r),a.appendChild(e)),e}function Q(r){let a=xe();if(!a)return!1;r.hass=a;let e=P(a);return et(e)||tt(e).then(()=>{r.requestUpdate?.()}),mt(a.locale,a.config?.country,a.config?.time_zone),!0}function Io(r){return V(r).then(a=>a.rowActionStyle)}function To(){wt()}function So(){let r=G(gi);return Q(r)?(r.openCreate(),fi(r),!0):!1}async function fi(r){let a=xe();a&&(r.placesEnabled=(await V(a)).features.places)}function Ao(r,a){let e=G(gi);return Q(e)?(e.openEdit(r,a),fi(e),!0):!1}function Co(r="",a){let e=G(vi);if(!Q(e))return!1;let i=xe();return i?((async()=>{let t=await V(i),n=e;yi(n,t),n.openCreate(r,a)})(),!0):!1}function yi(r,a){r.checklistsEnabled=a.features.checklists,r.scheduleTimeEnabled=a.features.schedule_time,r.completionActionsEnabled=a.features.completion_actions,r.adaptiveFeature=a.features.adaptive,r.seasonalFeature=a.features.seasonal,r.environmentalFeature=a.features.environmental,r.defaultWarningDays=a.defaultWarningDays}function Po(r,a){let e=G(vi);if(!Q(e))return!1;let i=xe();return i?((async()=>{try{let[t,n]=await Promise.all([i.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),V(i)]),o=(t.tasks||[]).find(u=>u.id===a);if(!o){console.warn(`openEditTaskDialog: task ${a} not found in entry ${r}`);return}let c=e;yi(c,n),await c.openEdit(r,o)}catch(t){console.warn("openEditTaskDialog: failed to load task/features",t)}})(),!0):!1}function Ro(r){let a=G(hs);return Q(a)?(a.openEdit(r),!0):!1}function Lo(r){let a=G(us);return Q(a)?(ei(a,r,P(xe())),!0):!1}function qo(r){let a=G(_s);return Q(a)?(a.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function Ho(r,a){let e=G(ms);return Q(e)?(e.openFor(r,a),!0):!1}function No(r){let a=G(gs);return Q(a)?(a.openFor(r),!0):!1}export{To as __resetSettingsCacheForTests,Io as getRowActionStyle,Lo as openCompleteDialog,So as openCreateObjectDialog,Co as openCreateTaskDialog,Ao as openEditObjectDialog,Po as openEditTaskDialog,Ro as openHistoryEditDialog,No as openObjectQuickActions,qo as openQrDialog,Ho as openTaskQuickActions};
|
||||
`],d([v({attribute:!1})],O.prototype,"hass",2),d([p()],O.prototype,"_open",2),d([p()],O.prototype,"_entryId",2),d([p()],O.prototype,"_data",2),d([p()],O.prototype,"_busy",2),d([p()],O.prototype,"_error",2),d([p()],O.prototype,"_access",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",O);var qi="maintenance-object-dialog",Hi="maintenance-task-dialog",Fs="maintenance-history-edit-dialog",Ds="maintenance-complete-dialog",zs="maintenance-qr-dialog",Us="maintenance-task-quick-actions-dialog",js="maintenance-object-quick-actions-dialog";function ke(){return document.querySelector("home-assistant")?.hass}function Bs(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function G(r){let a=Bs(),e=a.querySelector(r)??document.body.querySelector(r);return e?e.parentNode!==a&&a.appendChild(e):(e=document.createElement(r),a.appendChild(e)),e}function Q(r){let a=ke();if(!a)return!1;r.hass=a;let e=P(a);return ht(e)||ut(e).then(()=>{r.requestUpdate?.()}),St(a.locale,a.config?.country,a.config?.time_zone),!0}function gl(r){return V(r).then(a=>a.rowActionStyle)}function vl(){Mt()}function fl(){let r=G(qi);return Q(r)?(r.openCreate(),Ni(r),!0):!1}async function Ni(r){let a=ke();a&&(r.placesEnabled=(await V(a)).features.places)}function yl(r,a){let e=G(qi);return Q(e)?(e.openEdit(r,a),Ni(e),!0):!1}function bl(r="",a){let e=G(Hi);if(!Q(e))return!1;let i=ke();return i?((async()=>{let t=await V(i),n=e;Mi(n,t),n.openCreate(r,a)})(),!0):!1}function Mi(r,a){r.checklistsEnabled=a.features.checklists,r.scheduleTimeEnabled=a.features.schedule_time,r.completionActionsEnabled=a.features.completion_actions,r.adaptiveFeature=a.features.adaptive,r.seasonalFeature=a.features.seasonal,r.environmentalFeature=a.features.environmental,r.defaultWarningDays=a.defaultWarningDays}function $l(r,a){let e=G(Hi);if(!Q(e))return!1;let i=ke();return i?((async()=>{try{let[t,n]=await Promise.all([i.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:r}),V(i)]),o=(t.tasks||[]).find(u=>u.id===a);if(!o){console.warn(`openEditTaskDialog: task ${a} not found in entry ${r}`);return}let c=e;Mi(c,n),await c.openEdit(r,o)}catch(t){console.warn("openEditTaskDialog: failed to load task/features",t)}})(),!0):!1}function xl(r){let a=G(Fs);return Q(a)?(a.openEdit(r),!0):!1}function kl(r){let a=G(Ds);return Q(a)?(ui(a,r,P(ke())),!0):!1}function wl(r){let a=G(zs);return Q(a)?(a.openForTask(r.entry_id,r.task_id,r.object_name,r.task_name),!0):!1}function El(r,a){let e=G(Us);return Q(e)?(e.openFor(r,a),!0):!1}function Tl(r){let a=G(js);return Q(a)?(a.openFor(r),!0):!1}export{vl as __resetSettingsCacheForTests,gl as getRowActionStyle,kl as openCompleteDialog,fl as openCreateObjectDialog,bl as openCreateTaskDialog,yl as openEditObjectDialog,$l as openEditTaskDialog,xl as openHistoryEditDialog,Tl as openObjectQuickActions,wl as openQrDialog,El as openTaskQuickActions};
|
||||
/*! Bundled license information:
|
||||
|
||||
lit-html/directive-helpers.js:
|
||||
lit-html/directives/ref.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
|
||||
lit-html/directive.js:
|
||||
lit-html/async-directive.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
*/
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as v,b as y}from"./chunk-JDDRFTDX.js";import{a as f,b as x,d as k}from"./chunk-B4IMAOHY.js";import{k as b}from"./chunk-FC7BLTBL.js";import{B as l,a as h,b as a,d as c,e as g,f as _,g as o,j as m}from"./chunk-5FHGCMEA.js";import{a as n,g as i,i as u}from"./chunk-TAYZJBPE.js";var e=class extends g{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._access=f;this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return m(this.hass)}get _canWrite(){return x(this.hass?.user,this._access)}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),k(this.hass).then(r=>{this._access=r.access}),u(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await l(this,{type:"maintenance_supporter/groups"},{onError:r=>{this._error=r}});t!==void 0&&(this._groups=t?.groups||{},this._loaded=!0)}async _act(t,r){this._error="",await l(this,t,{busy:s=>{this._busy=s},reload:async()=>{r?.(),await this._load()},onError:s=>{this._error=s}})}async _addGroup(){if(!this._canWrite)return;let t=this._newName.trim();t&&await this._act({type:"maintenance_supporter/group/create",name:t},()=>{this._newName=""})}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._canWrite||!this._editingId)return;let t=this._editingName.trim();t&&await this._act({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t},()=>{this._editingId=null,this._editingName=""})}async _deleteGroup(t,r){!this._canWrite||!await b(this.hass,{title:i("delete",this._lang),message:i("delete_group_confirm",this._lang).replace("{name}",r),confirmText:i("delete",this._lang),danger:!0})||await this._act({type:"maintenance_supporter/group/delete",group_id:t})}_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 a`<ha-card><div class="loading">${i("loading",t)}</div></ha-card>`;let r=Object.keys(this._groups);return a`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as v,b as y}from"./chunk-2E6THN76.js";import{a as f,b as x,d as k}from"./chunk-N4RJZ6Z2.js";import{k as b}from"./chunk-DGKPZQYM.js";import{C as l,a as h,b as a,d as c,f as g,g as _,h as o,k as m}from"./chunk-XJSTERIM.js";import{a as n,g as i,i as u}from"./chunk-IUWFIZIT.js";var e=class extends g{constructor(){super(...arguments);this._config={type:""};this._groups={};this._loaded=!1;this._busy=!1;this._error="";this._newName="";this._editingId=null;this._editingName="";this._access=f;this._hasInitiallyLoaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return m(this.hass)}get _canWrite(){return x(this.hass?.user,this._access)}updated(t){super.updated(t),t.has("hass")&&this.hass&&!this._hasInitiallyLoaded&&(this._hasInitiallyLoaded=!0,this._load(),k(this.hass).then(r=>{this._access=r.access}),u(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await l(this,{type:"maintenance_supporter/groups"},{onError:r=>{this._error=r}});t!==void 0&&(this._groups=t?.groups||{},this._loaded=!0)}async _act(t,r){this._error="",await l(this,t,{busy:s=>{this._busy=s},reload:async()=>{r?.(),await this._load()},onError:s=>{this._error=s}})}async _addGroup(){if(!this._canWrite)return;let t=this._newName.trim();t&&await this._act({type:"maintenance_supporter/group/create",name:t},()=>{this._newName=""})}_startEdit(t){this._editingId=t,this._editingName=this._groups[t]?.name||""}async _saveEdit(){if(!this._canWrite||!this._editingId)return;let t=this._editingName.trim();t&&await this._act({type:"maintenance_supporter/group/update",group_id:this._editingId,name:t},()=>{this._editingId=null,this._editingName=""})}async _deleteGroup(t,r){!this._canWrite||!await b(this.hass,{title:i("delete",this._lang),message:i("delete_group_confirm",this._lang).replace("{name}",r),confirmText:i("delete",this._lang),danger:!0})||await this._act({type:"maintenance_supporter/group/delete",group_id:t})}_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 a`<ha-card><div class="loading">${i("loading",t)}</div></ha-card>`;let r=Object.keys(this._groups);return a`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*! maintenance_supporter frontend 2.100.0 */
|
||||
import{a as y,b as x}from"./chunk-JDDRFTDX.js";import"./chunk-LEI6V6UO.js";import{b as p,k as $}from"./chunk-FC7BLTBL.js";import{B as u,a as v,b as r,d as c,e as f,f as m,g as n,i as b,j as g}from"./chunk-5FHGCMEA.js";import{a as s,g as a,i as h}from"./chunk-TAYZJBPE.js";var i=class extends f{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer="3";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return g(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),b(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),h(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await u(this,{type:"maintenance_supporter/vacation/state"},{onError:e=>{this._error=e}});t&&(this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=String(t.buffer_days??3),this._dirty=!1)}_act(t){return this._error="",u(this,t,{busy:e=>{this._busy=e},onError:e=>{this._error=e}})}async _toggleEnabled(t){let e=await this._act({type:"maintenance_supporter/vacation/update",enabled:t});e&&(this._state=e)}async _save(){if(!this._isAdmin)return;let[t,e]=p,o=Number(this._localBuffer);if(this._localBuffer.trim()===""||!Number.isInteger(o)||o<t||o>e){this._error=a("settings_value_out_of_range",this._lang).replace("{min}",String(t)).replace("{max}",String(e));return}let l=await this._act({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:o});l&&(this._state=l,this._dirty=!1)}async _endNow(){if(!this._isAdmin||!await $(this.hass,{title:a("vacation_end_now",this._lang),message:a("vacation_end_now_confirm",this._lang),confirmText:a("vacation_end_now",this._lang)}))return;let e=await this._act({type:"maintenance_supporter/vacation/end_now"});e&&(this._state=e,this._localStart=e.start||"",this._localEnd=e.end||"")}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._state;if(!e)return r`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let o=e.is_active===!0,l=e.enabled===!0,_=e.exempt_task_ids?.length??0,w=o?a("vacation_status_active",t):l?a("vacation_status_scheduled",t):a("vacation_status_inactive",t),k=o?"active":l?"scheduled":"inactive";return r`
|
||||
/*! maintenance_supporter frontend 2.102.0 */
|
||||
import{a as y,b as x}from"./chunk-2E6THN76.js";import"./chunk-AOWCK2OJ.js";import{b as p,k as $}from"./chunk-DGKPZQYM.js";import{C as u,a as v,b as r,d as c,f,g as m,h as n,j as b,k as g}from"./chunk-XJSTERIM.js";import{a as s,g as a,i as h}from"./chunk-IUWFIZIT.js";var i=class extends f{constructor(){super(...arguments);this._config={type:""};this._state=null;this._busy=!1;this._error="";this._localStart="";this._localEnd="";this._localBuffer="3";this._dirty=!1;this._loaded=!1}setConfig(t){this._config=t}getCardSize(){return 2}get _lang(){return g(this.hass)}get _isAdmin(){return this.hass?.user?.is_admin??!0}updated(t){super.updated(t),b(this,t),t.has("hass")&&this.hass&&!this._loaded&&(this._loaded=!0,this._load(),h(this._lang).then(()=>this.requestUpdate()))}async _load(){let t=await u(this,{type:"maintenance_supporter/vacation/state"},{onError:e=>{this._error=e}});t&&(this._state=t,this._localStart=t.start||"",this._localEnd=t.end||"",this._localBuffer=String(t.buffer_days??3),this._dirty=!1)}_act(t){return this._error="",u(this,t,{busy:e=>{this._busy=e},onError:e=>{this._error=e}})}async _toggleEnabled(t){let e=await this._act({type:"maintenance_supporter/vacation/update",enabled:t});e&&(this._state=e)}async _save(){if(!this._isAdmin)return;let[t,e]=p,o=Number(this._localBuffer);if(this._localBuffer.trim()===""||!Number.isInteger(o)||o<t||o>e){this._error=a("settings_value_out_of_range",this._lang).replace("{min}",String(t)).replace("{max}",String(e));return}let l=await this._act({type:"maintenance_supporter/vacation/update",start:this._localStart||null,end:this._localEnd||null,buffer_days:o});l&&(this._state=l,this._dirty=!1)}async _endNow(){if(!this._isAdmin||!await $(this.hass,{title:a("vacation_end_now",this._lang),message:a("vacation_end_now_confirm",this._lang),confirmText:a("vacation_end_now",this._lang)}))return;let e=await this._act({type:"maintenance_supporter/vacation/end_now"});e&&(this._state=e,this._localStart=e.start||"",this._localEnd=e.end||"")}_onDeepLink(){history.pushState(null,"","/maintenance-supporter?ms_action=open_vacation"),window.dispatchEvent(new CustomEvent("location-changed"))}render(){let t=this._lang,e=this._state;if(!e)return r`<ha-card><div class="loading">${a("loading",t)}</div></ha-card>`;let o=e.is_active===!0,l=e.enabled===!0,_=e.exempt_task_ids?.length??0,w=o?a("vacation_status_active",t):l?a("vacation_status_scheduled",t):a("vacation_status_inactive",t),k=o?"active":l?"scheduled":"inactive";return r`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<div class="header">
|
||||
Reference in new issue
Block a user