/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ var j=globalThis,B=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),ct=new WeakMap,P=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(B&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=ct.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ct.set(i,t))}return t}toString(){return this.cssText}},pt=s=>new P(typeof s=="string"?s:s+"",void 0,K),w=(s,...t)=>{let i=s.length===1?s[0]:t.reduce((r,e,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+s[n+1],s[0]);return new P(i,s,K)},ut=(s,t)=>{if(B)s.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),e=j.litNonce;e!==void 0&&r.setAttribute("nonce",e),r.textContent=i.cssText,s.appendChild(r)}},Y=B?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return pt(i)})(s):s;var{is:Lt,defineProperty:Ot,getOwnPropertyDescriptor:Dt,getOwnPropertyNames:Nt,getOwnPropertySymbols:Ut,getPrototypeOf:It}=Object,V=globalThis,ft=V.trustedTypes,jt=ft?ft.emptyScript:"",Bt=V.reactiveElementPolyfillSupport,L=(s,t)=>s,J={toAttribute(s,t){switch(t){case Boolean:s=s?jt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let i=s;switch(t){case Boolean:i=s!==null;break;case Number:i=s===null?null:Number(s);break;case Object:case Array:try{i=JSON.parse(s)}catch{i=null}}return i}},mt=(s,t)=>!Lt(s,t),gt={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:mt};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=gt){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){let r=Symbol(),e=this.getPropertyDescriptor(t,r,i);e!==void 0&&Ot(this.prototype,t,e)}}static getPropertyDescriptor(t,i,r){let{get:e,set:n}=Dt(this.prototype,t)??{get(){return this[i]},set(o){this[i]=o}};return{get:e,set(o){let d=e?.call(this);n?.call(this,o),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(L("elementProperties")))return;let t=It(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(L("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(L("properties"))){let i=this.properties,r=[...Nt(i),...Ut(i)];for(let e of r)this.createProperty(e,i[e])}let t=this[Symbol.metadata];if(t!==null){let i=litPropertyMetadata.get(t);if(i!==void 0)for(let[r,e]of i)this.elementProperties.set(r,e)}this._$Eh=new Map;for(let[i,r]of this.elementProperties){let e=this._$Eu(i,r);e!==void 0&&this._$Eh.set(e,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let e of r)i.unshift(Y(e))}else t!==void 0&&i.push(Y(t));return i}static _$Eu(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,i=this.constructor.elementProperties;for(let r of i.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ut(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$ET(t,i){let r=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,r);if(e!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:J).toAttribute(i,r.type);this._$Em=t,n==null?this.removeAttribute(e):this.setAttribute(e,n),this._$Em=null}}_$AK(t,i){let r=this.constructor,e=r._$Eh.get(t);if(e!==void 0&&this._$Em!==e){let n=r.getPropertyOptions(e),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:J;this._$Em=e;let d=o.fromAttribute(i,n.type);this[e]=d??this._$Ej?.get(e)??d,this._$Em=null}}requestUpdate(t,i,r,e=!1,n){if(t!==void 0){let o=this.constructor;if(e===!1&&(n=this[t]),r??=o.getPropertyOptions(t),!((r.hasChanged??mt)(n,i)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,i,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,i,{useDefault:r,reflect:e,wrapped:n},o){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??i??this[t]),n!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(i=void 0),this._$AL.set(t,i)),e===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,n]of this._$Ep)this[e]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[e,n]of r){let{wrapped:o}=n,d=this[e];o!==!0||this._$AL.has(e)||d===void 0||this.C(e,void 0,n,d)}}let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(i)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(i)}willUpdate(t){}_$AE(t){this._$EO?.forEach(i=>i.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(i=>this._$ET(i,this[i])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[L("elementProperties")]=new Map,_[L("finalized")]=new Map,Bt?.({ReactiveElement:_}),(V.reactiveElementVersions??=[]).push("2.1.2");var rt=globalThis,bt=s=>s,W=rt.trustedTypes,vt=W?W.createPolicy("lit-html",{createHTML:s=>s}):void 0,St="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+S,Vt=`<${At}>`,M=document,D=()=>M.createComment(""),N=s=>s===null||typeof s!="object"&&typeof s!="function",nt=Array.isArray,Wt=s=>nt(s)||typeof s?.[Symbol.iterator]=="function",G=`[ \f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xt=/-->/g,$t=/>/g,E=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,wt=/"/g,Et=/^(?:script|style|textarea|title)$/i,st=s=>(t,...i)=>({_$litType$:s,strings:t,values:i}),v=st(1),A=st(2),Xt=st(3),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),_t=new WeakMap,k=M.createTreeWalker(M,129);function kt(s,t){if(!nt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return vt!==void 0?vt.createHTML(t):t}var qt=(s,t)=>{let i=s.length-1,r=[],e,n=t===2?"":t===3?"":"",o=O;for(let d=0;d"?(o=e??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?E:p[3]==='"'?wt:yt):o===wt||o===yt?o=E:o===xt||o===$t?o=O:(o=E,e=void 0);let m=o===E&&s[d+1].startsWith("/>")?" ":"";n+=o===O?l+Vt:c>=0?(r.push(h),l.slice(0,c)+St+l.slice(c)+S+m):l+S+(c===-2?d:m)}return[kt(s,n+(s[i]||"")+(t===2?"":t===3?"":"")),r]},U=class s{constructor({strings:t,_$litType$:i},r){let e;this.parts=[];let n=0,o=0,d=t.length-1,l=this.parts,[h,p]=qt(t,i);if(this.el=s.createElement(h,r),k.currentNode=this.el.content,i===2||i===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(e=k.nextNode())!==null&&l.length0){e.textContent=W?W.emptyScript:"";for(let m=0;m2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,i=this,r,e){let n=this.strings,o=!1;if(n===void 0)t=H(this,t,i,0),o=!N(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else{let d=t,l,h;for(t=n[0],l=0;l{let r=i?.renderBefore??t,e=r._$litPart$;if(e===void 0){let n=i?.renderBefore??null;r._$litPart$=e=new I(t.insertBefore(D(),n),n,void 0,i??{})}return e._$AI(s),e};var ot=globalThis,$=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Mt(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return T}};$._$litElement$=!0,$.finalized=!0,ot.litElementHydrateSupport?.({LitElement:$});var Ft=ot.litElementPolyfillSupport;Ft?.({LitElement:$});(ot.litElementVersions??=[]).push("4.2.2");var q=w` :host { --nf-text: var(--primary-text-color, #e1e1e1); --nf-muted: var(--secondary-text-color, #9b9b9b); --nf-accent: var(--primary-color, #03a9f4); --nf-accent-text: var(--text-primary-color, #ffffff); --nf-surface: var(--ha-card-background, var(--card-background-color, #1c1c1c)); --nf-bg: var(--primary-background-color, #111111); --nf-bg2: var(--secondary-background-color, #1c1c1c); /* floating bars and cards over the 3D view: the card colour, a little see-through */ --nf-chrome: color-mix(in srgb, var(--nf-surface) var(--nf-chrome-mix, 84%), transparent); --nf-chrome-solid: var(--nf-surface); --nf-line: var(--divider-color, rgba(255, 255, 255, 0.12)); /* quiet fills for buttons and fields, and the tonal accent of an active control */ --nf-fill: color-mix(in srgb, var(--nf-text) 7%, transparent); --nf-fill-strong: color-mix(in srgb, var(--nf-text) 13%, transparent); --nf-tonal: color-mix(in srgb, var(--nf-accent) 20%, transparent); --nf-soft: var(--info-color, #4a90e2); --nf-warm: var(--state-light-active-color, #ffa726); --nf-danger: var(--error-color, #db4437); --nf-good: var(--success-color, #43a047); --nf-radius: var(--ha-card-border-radius, 12px); --nf-shadow: var(--ha-card-box-shadow, 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 20px rgba(0, 0, 0, 0.2)); --nf-font: var(--primary-font-family, Roboto, "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif); --nf-title-font: var(--nf-font); font-family: var(--nf-font); color: var(--nf-text); } `,pe=w` :host([readable]) { --secondary-text-color: var(--primary-text-color, #e1e1e1); --divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent); --nf-chrome-mix: 97%; } :host([readable]) nf-room-panel, :host([readable]) .nf-nav, :host([readable]) .nf-overlay { zoom: 1.2; } `,ue=w` /* a group of switches: one rounded pill, the active one tinted with the accent */ .nf-seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--nf-chrome); box-shadow: var(--nf-shadow); backdrop-filter: blur(10px); } .nf-seg button, .nf-chip { font: inherit; font-size: 14px; font-weight: 500; border: none; background: none; color: var(--nf-muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; min-height: 36px; transition: background 0.15s, color 0.15s; } .nf-seg button:hover:not(:disabled), .nf-chip:hover { background: var(--nf-fill); color: var(--nf-text); } /* on a small stage (a small window, a zoomed browser, a dashboard column) the switches at the bottom take less room */ @container nf ((max-width: 1360px) or (max-height: 640px)) { :is(.nf-overlay, .nf-card-controls) .nf-seg { padding: 3px; } :is(.nf-overlay, .nf-card-controls) :is(.nf-seg button, .nf-chip) { font-size: 12.5px; padding: 5px 10px; } } .nf-time-slider { display: inline-flex; align-items: center; padding: 4px 10px; } .nf-time-slider input { width: 160px; accent-color: var(--nf-accent); } .nf-seg button[aria-pressed="true"], .nf-chip[aria-pressed="true"] { background: color-mix(in srgb, var(--nf-accent) 24%, var(--nf-chrome-solid)); color: var(--nf-accent); font-weight: 600; } .nf-seg button:disabled { opacity: 0.4; cursor: default; } /* a single pill, like the chips of the Mushroom cards */ .nf-chip { background: var(--nf-chrome); color: var(--nf-text); box-shadow: var(--nf-shadow); backdrop-filter: blur(10px); } button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--nf-accent); outline-offset: 2px; } /* the round icon badge every row and card starts with */ .nf-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--nf-tonal); color: var(--nf-accent); --mdc-icon-size: 20px; } .nf-ico.nf-warm { background: color-mix(in srgb, var(--nf-warm) 22%, transparent); color: var(--nf-warm); } .nf-ico.nf-off { background: var(--nf-fill); color: var(--nf-muted); } .nf-btn { font: inherit; font-size: 14px; font-weight: 500; border: none; background: var(--nf-fill); color: var(--nf-text); border-radius: var(--nf-radius); padding: 7px 14px; cursor: pointer; min-height: 36px; transition: background 0.15s; } .nf-btn:hover { background: var(--nf-fill-strong); } .nf-btn.nf-danger { color: var(--nf-danger); } .nf-btn.nf-primary { background: var(--nf-accent); color: var(--nf-accent-text); } .nf-btn.nf-primary:hover { background: color-mix(in srgb, var(--nf-accent) 88%, var(--nf-text)); } .nf-field { display: grid; gap: 4px; font-size: 12px; color: var(--nf-muted); } .nf-field input, .nf-field select, .nf-field textarea { font: inherit; font-size: 14px; color: var(--nf-text); background: var(--nf-fill); border: none; border-bottom: 1px solid var(--nf-line); border-radius: 10px 10px 4px 4px; padding: 8px 10px; min-width: 0; } .nf-field input:focus, .nf-field select:focus, .nf-field textarea:focus { border-bottom-color: var(--nf-accent); } .nf-field input[type="range"] { padding: 0; accent-color: var(--nf-accent); } .nf-field select option { background: var(--nf-chrome-solid); color: var(--nf-text); } /* fingers need 40 px */ @media (pointer: coarse) { .nf-seg button, .nf-chip, .nf-btn { min-height: 40px; } } `;var Tt={auto:"Automatisch",raw:"Rohdaten",minute:"1 Minute","5minutes":"5 Minuten","15minutes":"15 Minuten",hour:"Stunde",day:"Tag",week:"Woche",month:"Monat",year:"Jahr"};function zt(s,t){let i=new Set;return t.flatMap(r=>{let e=String(s?.states[r]?.attributes.symcon_source_entity||r),n=s?.states[e]?.attributes,o=Number(n?.symcon_id);return!o||!n?.symcon_archive||i.has(o)?[]:(i.add(o),[e])})}function at(s){if(!Number.isFinite(s))return"";let t=new Date(s*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Ct(s,t,i,r){let e=h=>h.trim()&&Number.isFinite(Number(h.replace(",",".")))?Number(h.replace(",",".")):null,n=e(t),o=e(i),d=n??s.reduce((h,p)=>Math.min(h,p),r||!s.length?0:1/0),l=o??s.reduce((h,p)=>Math.max(h,p),r?0:s.length?-1/0:1);if(d===l&&(n===null&&!r&&(d-=Math.max(1,Math.abs(d)*.05)),o===null&&(l+=Math.max(1,Math.abs(l)*.05))),d>=l)throw new Error("Der untere Wertebereich muss kleiner als der obere sein.");return[d,l]}function Ht(s,t){let i=r=>{let e=String(r??"");return`"${/^[=+@\-\t\r]/.test(e)?"'":""}${e.replaceAll('"','""')}"`};return"\uFEFF"+[["Variable","Zeit","Wert","Minimum","Maximum"].join(";"),...s.flatMap(r=>r.points.map(e=>[t[r.entity_id]||r.entity_id,new Date(e.t*1e3).toISOString(),e.v,e.min??"",e.max??""].map(i).join(";")))].join(`\r `)}var lt=class extends ${static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return v` t.stopPropagation()} @click=${t=>{if(t.target!==t.currentTarget)return;let i=this.dialog.getBoundingClientRect();(t.clientXi.right||t.clientYi.bottom)&&this.dialog?.close()}}>
Information

${this.text}

`}static styles=[q,w` :host { display:inline-block; margin:4px 0; vertical-align:middle; } button { font:inherit; cursor:pointer; color:var(--nf-muted); background:transparent; border:1px solid var(--nf-line); border-radius:50%; pointer-events:auto; } .info { width:26px; height:26px; padding:0; font-size:18px; line-height:24px; } button:hover { color:var(--nf-accent); } button:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; } dialog { box-sizing:border-box; width:min(560px,calc(100vw - 32px)); max-height:80vh; max-height:80dvh; overflow:auto; padding:18px 22px; border:1px solid var(--nf-line); border-radius:14px; background:var(--nf-chrome-solid); color:var(--nf-text); font:14px/1.5 system-ui,sans-serif; box-shadow:var(--nf-shadow); pointer-events:auto; } dialog::backdrop { background:#050b16a6; } header { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:16px; } .close { width:30px; height:30px; padding:0; font-size:23px; } p { white-space:pre-wrap; overflow-wrap:anywhere; margin:16px 0 4px; } `]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",lt);var Rt=["#4ec9ff","#ffbe69","#ae9bff","#72deb0","#ff87aa","#ebde72"],z=(s,t)=>String(s.states[t]?.attributes.friendly_name||t),Pt=s=>({variable_not_logged:"Die Variable wird nicht mehr geloggt.",trend_range_too_large_for_resolution:"Bitte f\xFCr diesen Zeitraum eine gr\xF6bere Aufl\xF6sung w\xE4hlen.",invalid_trend_range:"Bitte einen g\xFCltigen Zeitraum w\xE4hlen."})[String(s instanceof Error?s.message:s)]||String(s instanceof Error?s.message:s),ht=class extends ${static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},from:{state:!0},to:{state:!0},resolution:{state:!0},chartStyle:{state:!0},field:{state:!0},min:{state:!0},max:{state:!0},zero:{state:!0},band:{state:!0},live:{state:!0},series:{state:!0},hiddenSeries:{state:!0},loading:{state:!0},errors:{state:!0},hover:{state:!0},width:{state:!0},plotHeight:{state:!0},page:{state:!0}};request=0;drag=null;timer;observer;resize=()=>{this.plotHeight=Math.round(Math.min(600,Math.max(220,window.innerHeight*(window.innerWidth<600?.52:.65))))};constructor(){super(),this.ids=[],this.label="",this.to=Math.floor(Date.now()/1e3),this.from=this.to-86400,this.resolution="auto",this.chartStyle="auto",this.field="v",this.min="",this.max="",this.zero=!1,this.band=!0,this.live=!1,this.series=[],this.hiddenSeries=new Set,this.loading=!1,this.errors=[],this.hover=null,this.width=900,this.plotHeight=400,this.page=0}async open(){await this.updateComplete,this.renderRoot.querySelector("dialog").showModal(),this.observer=new ResizeObserver(([t])=>{this.width=Math.max(280,Math.floor(t.contentRect.width))}),this.observer.observe(this.renderRoot.querySelector(".body")),this.resize(),window.addEventListener("resize",this.resize),this.timer=setInterval(()=>{if(this.live&&!this.loading){let t=this.to-this.from;this.to=Math.floor(Date.now()/1e3),this.from=this.to-t,this.load()}},3e4),await this.load()}disconnectedCallback(){super.disconnectedCallback(),++this.request,clearInterval(this.timer),this.observer?.disconnect(),window.removeEventListener("resize",this.resize)}async load(){let t=++this.request,i=this.from,r=this.to;if(this.errors=[],this.series=[],this.hover=null,this.page=0,!Number.isSafeInteger(i)||!Number.isSafeInteger(r)||i<1||r<=i){this.errors=["Das Ende muss nach dem Beginn des Zeitraums liegen."],this.loading=!1;return}this.loading=!0;let e=[],n=[];for(let o=0;othis.hass.callWS({type:"nextfloor/archive/trend",entity_id:h,start:i,end:r,aggregation:this.resolution})))).forEach((h,p)=>h.status==="fulfilled"?e.push(h.value):n.push(`${z(this.hass,d[p])}: ${Pt(h.reason)}`))}t!==this.request||!this.isConnected||(this.series=e,this.errors=n,this.loading=!1)}range(t,i){this.from=Math.max(1,Math.floor(t)),this.to=Math.max(this.from+1,Math.floor(i)),this.live=!1,this.load()}zoom(t,i=.5){let r=Math.max(60,Math.min(315576e3,(this.to-this.from)*t)),e=this.from+(this.to-this.from)*i;this.range(e-r*i,e+r*(1-i))}stamp(t){return new Date(t*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"medium"})}number(t){return t.toLocaleString(this.hass.language,{maximumFractionDigits:Math.abs(t)<.01&&t!==0?5:2})}unit(t){return String(this.hass.states[t]?.attributes.unit_of_measurement??"")}selected(){return this.series.filter(t=>!this.hiddenSeries.has(t.entity_id))}value(t){let i=this.field==="v"?t.v:t[this.field]??t.v;return typeof i=="number"&&Number.isFinite(i)?i:null}color(t){return Rt[this.ids.indexOf(t)%Rt.length]}ratio(t){let i=t.currentTarget.getBoundingClientRect();return Math.max(0,Math.min(1,((t.clientX-i.left)/i.width*this.width-64)/(this.width-80)))}exportCsv(){let t=Object.fromEntries(this.ids.map(e=>[e,String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))])),i=URL.createObjectURL(new Blob([Ht(this.selected(),t)],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=i,r.download="Symcon-Trend.csv",r.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}plot(t,i){let r=t.flatMap(a=>a.points.flatMap(f=>{let g=this.value(f);return g===null?[]:this.band&&!a.counter?[g,f.min??g,f.max??g]:[g]}));if(!r.length)return v`

Keine numerischen Archivwerte in diesem Zeitraum.

`;let e,n;try{[e,n]=Ct(r,this.min,this.max,this.zero||this.chartStyle==="bar"||t.some(a=>a.type===0)||this.chartStyle==="auto"&&t.some(a=>a.counter&&a.aggregation!=="raw"))}catch(a){return v`

${Pt(a)}

`}let o=new Set(this.selected().filter(a=>a.type!==3).map(a=>this.unit(a.entity_id))).size,d=Math.max(200,Math.round(this.plotHeight/Math.max(1,Math.min(o,2)))),l=64,h=this.width-16,p=14,c=d-32,b=a=>l+(a-this.from)/(this.to-this.from)*(h-l),m=a=>c-(a-e)/(n-e)*(c-p),y=(a,f=this.field)=>Number(f==="v"?a.v:a[f]??a.v),Z=(a,f=this.field)=>{let g=a.points.filter(C=>typeof C.v=="number"),x=this.chartStyle==="step"||this.chartStyle==="auto"&&a.type===0;return g.map((C,dt)=>`${dt?x?`H${b(C.t).toFixed(1)}V`:"L":"M"}${x&&dt?m(y(C,f)).toFixed(1):`${b(C.t).toFixed(1)},${m(y(C,f)).toFixed(1)}`}`).join("")+(g.length?x?`H${h}`:a.aggregation==="raw"?`L${h},${m(y(g[g.length-1],f)).toFixed(1)}`:"":"")},F=this.width<480?2:5;return v`

${i||"Wert"}

{a.preventDefault(),this.zoom(a.deltaY>0?1.5:1/1.5,this.ratio(a))}} @pointerdown=${a=>{this.drag=this.ratio(a),a.currentTarget.setPointerCapture(a.pointerId)}} @pointerup=${a=>{if(this.drag===null)return;let f=this.drag,g=this.ratio(a);if(this.drag=null,Math.abs(f-g)>.02){let x=this.to-this.from;this.range(this.from+x*Math.min(f,g),this.from+x*Math.max(f,g))}}} @pointercancel=${()=>{this.drag=null}} @pointermove=${a=>{this.hover=this.from+(this.to-this.from)*this.ratio(a)}}> ${[0,1,2,3,4].map(a=>{let f=e+(n-e)*a/4;return A`${this.number(f)}`})} ${Array.from({length:F},(a,f)=>{let g=this.from+(this.to-this.from)*f/(F-1);return A`${new Date(g*1e3).toLocaleString(this.hass.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}`})} ${t.map(a=>{let f=this.chartStyle==="bar"||this.chartStyle==="auto"&&a.counter&&a.aggregation!=="raw",g=this.color(a.entity_id);return f?a.points.filter(x=>this.value(x)!==null).map(x=>A``):A`${this.band&&a.aggregation!=="raw"&&!a.counter?A``:u}${a.points.length===1?A``:u}`})}${this.hover!==null?A``:u}
`}table(t){let i=t.flatMap(n=>n.points.map(o=>({id:n.entity_id,...o}))).sort((n,o)=>o.t-n.t),r=Math.max(1,Math.ceil(i.length/100)),e=Math.min(this.page,r-1);return v`
${i.slice(e*100,(e+1)*100).map(n=>v``)}
ZeitVariableWert
${this.stamp(n.t)}${z(this.hass,n.id)}${typeof n.v=="number"?this.number(n.v):n.v} ${this.unit(n.id)}
${e+1} / ${r}
`}render(){let t=this.selected(),i=t.length>0&&t.every(e=>e.type===3),r=this.hover===null?"Letzter Wert":this.stamp(this.hover);return v`this.remove()} @keydown=${e=>{e.stopPropagation();let n=this.renderRoot.querySelector(".settings");e.key==="Escape"&&n?.open&&(e.preventDefault(),n.open=!1)}} @click=${e=>{let n=this.renderRoot.querySelector(".settings");n?.open&&!e.composedPath().includes(n)&&(n.open=!1)}}>

${this.label||"Variablentrend"}

${new Date(this.from*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})} – ${new Date(this.to*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})}
${[["1 h",3600],["6 h",21600],["24 h",86400],["7 Tage",604800],["30 Tage",2592e3],["1 Jahr",31536e3]].map(([e,n])=>v``)}
⚙︎
{e.preventDefault(),this.load()}}>
Darstellung und Wertebereich
${this.ids.map(e=>v``)}
${this.errors.map(e=>v``)}${this.loading?v`

Archivwerte werden geladen …

`:u} ${t.filter(e=>e.truncated).map(e=>v`

${z(this.hass,e.entity_id)}: Die Abfrage ist auf ${(e.limit??1e4).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.

`)} ${t.some(e=>e.counter&&e.aggregation!=="raw")?v`

Zähler: Verbrauch pro Intervall

`:u}
${this.chartStyle==="table"||i?this.table(t):[...new Set(t.filter(e=>e.type!==3).map(e=>this.unit(e.entity_id)))].map(e=>this.plot(t.filter(n=>n.type!==3&&this.unit(n.entity_id)===e),e))} ${t.some(e=>e.type===3)&&!i&&this.chartStyle!=="table"?this.table(t.filter(e=>e.type===3)):u} ${!this.loading&&t.length&&t.every(e=>!e.points.length)?v`

Keine Archivwerte in diesem Zeitraum.

`:u}
${r}${t.map(e=>{let n=e.points.at(-1);if(this.hover!==null){let o=0,d=e.points.length;for(;o>>1;e.points[l].t<=this.hover?o=l+1:d=l}n=e.points[o-1]}return v`${z(this.hass,e.entity_id)}: ${n?typeof n.v=="number"?`${this.number(this.value(n))} ${this.unit(e.entity_id)}`:n.v:"\u2013"}`})}
`}static styles=[q,w` :host { font:13px/1.4 system-ui,sans-serif; color:var(--nf-text); } dialog { box-sizing:border-box; width:min(1080px,calc(100vw - 24px)); max-height:92vh; max-height:92dvh; padding:0; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome-solid,#1c1c1c); color:inherit; box-shadow:var(--nf-shadow); overflow:auto; } dialog::backdrop { background:#050b16a8; } header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; border-bottom:1px solid var(--nf-line); position:sticky; top:0; z-index:3; background:var(--nf-chrome-solid,#1c1c1c); } header>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 14px; min-width:0; } h2 { font-size:15px; margin:0; } .range { font-size:11px; color:var(--nf-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } header button { width:26px; height:26px; font-size:19px; padding:0; flex-shrink:0; } .body { padding:8px 12px; } .toolbar { position:relative; display:flex; align-items:center; flex-wrap:wrap; gap:5px 10px; margin-bottom:6px; } .presets,.navigation { display:flex; align-items:center; gap:3px; } button,input,select { box-sizing:border-box; color:var(--nf-text); font:inherit; } button,select,input:not([type=checkbox]),summary { border:1px solid var(--nf-line); border-radius:5px; padding:4px 7px; background:var(--nf-fill,#292929); min-width:0; } button { cursor:pointer; font-size:12px; } button:disabled { opacity:.45; } button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; } .toolbar button,.toolbar summary { height:26px; } .navigation button { width:26px; padding:0; font-size:16px; } .presets button { padding:3px 6px; font-size:11px; } .presets button[aria-pressed=true],.settings[open]>summary { border-color:var(--nf-accent); background:color-mix(in srgb,var(--nf-accent) 16%,var(--nf-fill)); } .live-toggle { display:flex; align-items:center; gap:3px; font-size:11px; white-space:nowrap; } input[type=checkbox] { margin:0; } .settings { margin-left:auto; } .settings:not([open])>.settings-panel { display:none; } summary { display:flex; align-items:center; justify-content:center; width:28px; padding:0; list-style:none; font-size:17px; cursor:pointer; } summary::-webkit-details-marker { display:none; } .settings-panel { position:absolute; z-index:2; top:calc(100% + 5px); right:0; box-sizing:border-box; width:min(620px,100%); max-height:min(62vh,480px); overflow:auto; padding:10px 12px; border:1px solid var(--nf-line); border-radius:8px; background:var(--nf-chrome-solid,#1c1c1c); box-shadow:var(--nf-shadow); } .fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:7px 10px; margin:0 0 10px; } .fields label { display:grid; gap:3px; color:var(--nf-muted); font-size:11px; } .fields input,.fields select { height:28px; width:100%; font-size:12px; } .time-fields button { justify-self:start; } .display-settings { padding-top:8px; border-top:1px solid var(--nf-line); } .group-title { display:block; margin-bottom:6px; font-size:12px; } .actions,.checks,.legend,.cursor { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; } .checks { margin:0 0 6px; } .checks label,.legend label { display:flex; align-items:center; gap:4px; font-size:11px; } .legend { margin:4px 0 0; } .legend i { display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0; } .legend label { max-width:100%; overflow-wrap:anywhere; } .plot { display:block; width:100%; touch-action:none; user-select:none; } .plot text { fill:var(--nf-muted); font:11px system-ui; } .grid { stroke:var(--nf-line); } h3 { font-size:11px; color:var(--nf-muted); margin:3px 0 0; } .chart-group { margin-bottom:4px; } .cursor { font-size:11px; align-items:baseline; border-top:1px solid var(--nf-line); padding-top:6px; } .cursor>b { color:var(--nf-muted); font-weight:normal; } .cursor span { overflow-wrap:anywhere; } .note,.error { font-size:12px; margin:6px 0; } .note { color:var(--nf-muted); } .error { color:#ffa5a5; } .table { overflow:auto; max-height:60vh; margin:8px 0; } table { width:100%; border-collapse:collapse; font-size:12px; } td,th { text-align:left; padding:5px; border-bottom:1px solid var(--nf-line); overflow-wrap:anywhere; } td:first-child { white-space:nowrap; } th { position:sticky; top:0; background:var(--nf-chrome-solid,#1c1c1c); } @media(max-width:500px) { header { padding:7px 9px; } header>div { display:grid; gap:1px; } h2 { font-size:14px; } .body { padding:7px 9px; } .toolbar { gap:4px 6px; } .presets { gap:2px; } .presets button { padding:3px 5px; } .settings-panel { padding:9px; } input[type=datetime-local] { font-size:11px; padding:3px; } } `]};customElements.get("nf-trend-dialog")||customElements.define("nf-trend-dialog",ht);async function _e(s,t,i){let r=zt(s,t);if(!r.length)return;let e=document.createElement("nf-trend-dialog");Object.assign(e,{hass:s,ids:r,label:i}),document.body.append(e);try{await e.open()}catch(n){throw e.remove(),n}}export{ht as NfTrendDialog,_e as openTrend}; /*! Bundled license information: @lit/reactive-element/css-tag.js: (** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause *) @lit/reactive-element/reactive-element.js: lit-html/lit-html.js: lit-element/lit-element.js: (** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause *) lit-html/is-server.js: (** * @license * Copyright 2022 Google LLC * SPDX-License-Identifier: BSD-3-Clause *) */