185 files
This commit is contained in:
1 parent
5f9330abd7
commit
a718af6423
185 files changed
+16868
-3088
No files matched your search
@@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -81,7 +80,7 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
||||
try:
|
||||
_LOGGER.info("Registering lovelace resource: %s", new_url)
|
||||
await resources.async_create_item({"res_type": "module", "url": new_url})
|
||||
except Exception as e:
|
||||
except Exception as e: # noqa: BLE001 - resource registration must never break setup
|
||||
_LOGGER.warning("Failed to register lovelace resource: %s", e)
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,7 +4,6 @@ import logging
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class SeaTemperatureConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
parts = [p for p in path.split("/") if p]
|
||||
if parts:
|
||||
continents_set.add(self._get_continent_name(parts[0]))
|
||||
self._continents = sorted(list(continents_set))
|
||||
self._continents = sorted(continents_set)
|
||||
|
||||
if user_input is not None:
|
||||
self._data[CONF_CONTINENT] = user_input[CONF_CONTINENT]
|
||||
@@ -79,10 +79,13 @@ class SeaTemperatureConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
for loc in self._locations_data.values():
|
||||
path = loc.get("path", "")
|
||||
parts = [p for p in path.split("/") if p]
|
||||
if parts and self._get_continent_name(parts[0]) == selected_continent:
|
||||
if loc.get("country"):
|
||||
countries_set.add(loc["country"])
|
||||
self._countries = sorted(list(countries_set))
|
||||
if (
|
||||
parts
|
||||
and self._get_continent_name(parts[0]) == selected_continent
|
||||
and loc.get("country")
|
||||
):
|
||||
countries_set.add(loc["country"])
|
||||
self._countries = sorted(countries_set)
|
||||
|
||||
if user_input is not None:
|
||||
self._data[CONF_COUNTRY] = user_input[CONF_COUNTRY]
|
||||
@@ -143,7 +146,7 @@ class SeaTemperatureConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
data_schema = vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_PLACE): vol.In(
|
||||
sorted(list(self._places.keys())) if self._places else []
|
||||
sorted(self._places.keys()) if self._places else []
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
"iot_class": "cloud_polling",
|
||||
"issue_tracker": "https://github.com/timmaurice/sea-temperatures/issues",
|
||||
"requirements": [],
|
||||
"version": "3.1.0"
|
||||
"version": "3.2.0"
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime
|
||||
from html import unescape
|
||||
import json
|
||||
import logging
|
||||
import posixpath
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime
|
||||
from html import unescape
|
||||
from typing import Any
|
||||
from urllib.parse import unquote, urlsplit
|
||||
|
||||
@@ -158,7 +158,7 @@ def _parse_page_date(html: str) -> str | None:
|
||||
|
||||
page_date = re.sub(r"(\d+)(st|nd|rd|th)", r"\1", match.group(1))
|
||||
try:
|
||||
return datetime.strptime(page_date, "%A %d %B, %Y").date().isoformat()
|
||||
return datetime.strptime(page_date, "%A %d %B, %Y").date().isoformat() # noqa: DTZ007 - date-only value, timezone is irrelevant
|
||||
except ValueError:
|
||||
_LOGGER.debug("Failed to parse page date from %s", page_date)
|
||||
return None
|
||||
@@ -194,7 +194,8 @@ def _parse_trend_chart(html: str) -> tuple[list[str] | None, list[float] | None,
|
||||
return None, None, None
|
||||
|
||||
points.sort(key=lambda point: point[0])
|
||||
labels = [datetime.fromtimestamp(ts, UTC).strftime("%m-%d") for ts, _ in points]
|
||||
# ISO calendar dates: the card must not have to guess the year from "MM-DD".
|
||||
labels = [datetime.fromtimestamp(ts, UTC).strftime("%Y-%m-%d") for ts, _ in points]
|
||||
temps = [temp for _, temp in points]
|
||||
|
||||
latest_timestamp = points[-1][0]
|
||||
|
||||
@@ -1,79 +1,86 @@
|
||||
function t(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}console.groupCollapsed("%c🌊 SEA TEMPERATURES CARD%cv3.1.0","color: orange; font-weight: bold; background: black; padding: 2px 4px; border-radius: 2px 0 0 2px;","color: white; font-weight: bold; background: dimgray; padding: 2px 4px; border-radius: 0 2px 2px 0;"),console.info("A Lovelace card to display sea temperatures."),console.info("Github: https://github.com/timmaurice/sea-temperatures.git"),console.info("Sponsor: https://buymeacoffee.com/timmaurice"),console.groupEnd(),"function"==typeof SuppressedError&&SuppressedError;
|
||||
function t(t,e,n,r){var i,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(s=(a<3?i(s):a>3?i(e,n,s):i(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}console.groupCollapsed("%c🌊 SEA TEMPERATURES CARD%cv3.2.0","color: orange; font-weight: bold; background: black; padding: 2px 4px; border-radius: 2px 0 0 2px;","color: white; font-weight: bold; background: dimgray; padding: 2px 4px; border-radius: 0 2px 2px 0;"),console.info("A Lovelace card to display sea temperatures."),console.info("Github: https://github.com/timmaurice/sea-temperatures.git"),console.info("Sponsor: https://buymeacoffee.com/timmaurice"),console.groupEnd(),"function"==typeof SuppressedError&&SuppressedError;
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const e=globalThis,n=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let o=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(e,t))}return t}toString(){return this.cssText}};const a=t=>new o("string"==typeof t?t:t+"",void 0,r),s=(t,...e)=>{const n=1===t.length?t[0]:e.reduce((e,n,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[r+1],t[0]);return new o(n,t,r)},l=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return a(e)})(t):t,{is:u,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:f,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,g=globalThis,_=g.trustedTypes,m=_?_.emptyScript:"",y=g.reactiveElementPolyfillSupport,v=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},x=(t,e)=>!u(t,e),b={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:x};
|
||||
const e=globalThis,n=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let a=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(e,t))}return t}toString(){return this.cssText}};const s=t=>new a("string"==typeof t?t:t+"",void 0,r),o=(t,...e)=>{const n=1===t.length?t[0]:e.reduce((e,n,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[r+1],t[0]);return new a(n,t,r)},c=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return s(e)})(t):t,{is:l,defineProperty:h,getOwnPropertyDescriptor:u,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:f}=Object,g=globalThis,m=g.trustedTypes,_=m?m.emptyScript:"",y=g.reactiveElementPolyfillSupport,v=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},x=(t,e)=>!l(t,e),$={attribute:!0,type:String,converter:b,reflect:!1,useDefault:!1,hasChanged:x};
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let $=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,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&c(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){const{get:r,set:i}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const o=r?.call(this);i?.call(this,e),this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...f(t),...d(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?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),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,r)=>{if(n)t.adoptedStyleSheets=r.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const n of r){const r=document.createElement("style"),i=e.litNonce;void 0!==i&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}})(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,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(e,n.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=n.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=r;const o=i.fromAttribute(e,t.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(t,e,n,r=!1,i){if(void 0!==t){const o=this.constructor;if(!1===r&&(i=this[t]),n??=o.getPropertyOptions(t),!((n.hasChanged??x)(i,e)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:r,wrapped:i},o){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==i||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,n,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hosLine truncated
|
||||
*/Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let w=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,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&h(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){const{get:r,set:i}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const a=r?.call(this);i?.call(this,e),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...d(t),...p(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?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),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,r)=>{if(n)t.adoptedStyleSheets=r.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const n of r){const r=document.createElement("style"),i=e.litNonce;void 0!==i&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}})(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,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:b).toAttribute(e,n.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=n.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:b;this._$Em=r;const a=i.fromAttribute(e,t.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,n,r=!1,i){if(void 0!==t){const a=this.constructor;if(!1===r&&(i=this[t]),n??=a.getPropertyOptions(t),!((n.hasChanged??x)(i,e)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(a._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==i||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,n,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hosLine truncated
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const A=globalThis,M=t=>t,S=A.trustedTypes,C=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,T="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+E,k=`<${N}>`,D=document,U=()=>D.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,F="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,z=/>/g,j=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,R=/"/g,q=/^(?:script|style|textarea|title)$/i,I=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),W=I(1),X=I(2),V=Symbol.for("lit-noChange"),B=Symbol.for("lit-nothing"),Z=new WeakMap,G=D.createTreeWalker(D,129);function J(t,e){if(!O(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(e):e}const Q=(t,e)=>{const n=t.length-1,r=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=H;for(let e=0;e<n;e++){const n=t[e];let s,l,u=-1,c=0;for(;c<n.length&&(a.lastIndex=c,l=a.exec(n),null!==l);)c=a.lastIndex,a===H?"!--"===l[1]?a=L:void 0!==l[1]?a=z:void 0!==l[2]?(q.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=j):void 0!==l[3]&&(a=j):a===j?">"===l[0]?(a=i??H,u=-1):void 0===l[1]?u=-2:(u=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?j:'"'===l[3]?R:Y):a===R||a===Y?a=j:a===L||a===z?a=H:(a=j,i=void 0);const h=a===j&&t[e+1].startsWith("/>")?" ":"";o+=a===H?n+k:u>=0?(r.push(s),n.slice(0,u)+T+n.slice(u)+E+h):n+E+(-2===u?e:h)}return[J(t,o+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class K{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,o=0;const a=t.length-1,s=this.parts,[l,u]=Q(t,e);if(this.el=K.createElement(l,n),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=G.nextNode())&&s.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(T)){const e=u[o++],n=r.getAttribute(t).split(E),a=/([.?@])?(.*)/.exec(e);s.push({type:1,index:i,name:a[2],strings:n,ctor:"."===a[1]?it:"?"===a[1]?ot:"@"===a[1]?at:rt}),r.removeAttribute(t)}else t.startsWith(E)&&(s.push({type:6,index:i}),r.removeAttribute(t));if(q.test(r.tagName)){const t=r.textContent.split(E),e=t.length-1;if(e>0){r.textContent=S?S.emptyScript:"";for(let n=0;n<e;n++)r.append(t[n],U()),G.nextNode(),s.push({type:2,index:++i});r.append(t[e],U())}}}else if(8===r.nodeType)if(r.data===N)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(E,t+1));)s.push({type:7,index:i}),t+=E.length-1}i++}}static createElement(t,e){const n=D.createElement("template");return n.innerHTML=t,n}}function tt(t,e,n=t,r){if(e===V)return e;let i=void 0!==r?n._$Co?.[r]:n._$Cl;const o=P(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,n,r)),void 0!==r?(n._$Co??=[])[r]=i:n._$Cl=i),void 0!==i&&(e=tt(t,i._$AS(t,e.values),i,r)),e}class et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,r=(t?.creationScope??D).importNode(e,!0);G.currentNode=r;let i=G.nextNode(),o=0,a=0,s=n[0];for(;void 0!==s;){if(o===s.index){let e;2===s.type?e=new nt(i,i.nextSibling,this,t):1===s.type?e=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(e=new st(i,this,t)),this._$AV.push(e),s=n[++a]}o!==s?.index&&(i=G.nextNode(),o++)}return G.currentNode=D,r}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=B,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=tt(this,t,e),P(t)?t===B||null==t||""===t?(this._$AH!==B&&this._$AR(),this._$AH=B):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>O(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==B&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=K.createElement(J(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new et(r,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new K(t)),e}k(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const i of t)r===e.length?e.push(n=new nt(this.O(U()),this.O(U()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.Line truncated
|
||||
const M=globalThis,A=t=>t,S=M.trustedTypes,T=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",N=`lit$${Math.random().toFixed(9).slice(2)}$`,E="?"+N,k=`<${E}>`,U=document,D=()=>U.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,F="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,z=/>/g,j=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),R=/'/g,Y=/"/g,q=/^(?:script|style|textarea|title)$/i,I=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),W=I(1),Z=I(2),V=Symbol.for("lit-noChange"),B=Symbol.for("lit-nothing"),G=new WeakMap,X=U.createTreeWalker(U,129);function J(t,e){if(!O(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}const Q=(t,e)=>{const n=t.length-1,r=[];let i,a=2===e?"<svg>":3===e?"<math>":"",s=H;for(let e=0;e<n;e++){const n=t[e];let o,c,l=-1,h=0;for(;h<n.length&&(s.lastIndex=h,c=s.exec(n),null!==c);)h=s.lastIndex,s===H?"!--"===c[1]?s=L:void 0!==c[1]?s=z:void 0!==c[2]?(q.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=j):void 0!==c[3]&&(s=j):s===j?">"===c[0]?(s=i??H,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,o=c[1],s=void 0===c[3]?j:'"'===c[3]?Y:R):s===Y||s===R?s=j:s===L||s===z?s=H:(s=j,i=void 0);const u=s===j&&t[e+1].startsWith("/>")?" ":"";a+=s===H?n+k:l>=0?(r.push(o),n.slice(0,l)+C+n.slice(l)+N+u):n+N+(-2===l?e:u)}return[J(t,a+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class K{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,a=0;const s=t.length-1,o=this.parts,[c,l]=Q(t,e);if(this.el=K.createElement(c,n),X.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=X.nextNode())&&o.length<s;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(C)){const e=l[a++],n=r.getAttribute(t).split(N),s=/([.?@])?(.*)/.exec(e);o.push({type:1,index:i,name:s[2],strings:n,ctor:"."===s[1]?it:"?"===s[1]?at:"@"===s[1]?st:rt}),r.removeAttribute(t)}else t.startsWith(N)&&(o.push({type:6,index:i}),r.removeAttribute(t));if(q.test(r.tagName)){const t=r.textContent.split(N),e=t.length-1;if(e>0){r.textContent=S?S.emptyScript:"";for(let n=0;n<e;n++)r.append(t[n],D()),X.nextNode(),o.push({type:2,index:++i});r.append(t[e],D())}}}else if(8===r.nodeType)if(r.data===E)o.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(N,t+1));)o.push({type:7,index:i}),t+=N.length-1}i++}}static createElement(t,e){const n=U.createElement("template");return n.innerHTML=t,n}}function tt(t,e,n=t,r){if(e===V)return e;let i=void 0!==r?n._$Co?.[r]:n._$Cl;const a=P(e)?void 0:e._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(t),i._$AT(t,n,r)),void 0!==r?(n._$Co??=[])[r]=i:n._$Cl=i),void 0!==i&&(e=tt(t,i._$AS(t,e.values),i,r)),e}class et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,r=(t?.creationScope??U).importNode(e,!0);X.currentNode=r;let i=X.nextNode(),a=0,s=0,o=n[0];for(;void 0!==o;){if(a===o.index){let e;2===o.type?e=new nt(i,i.nextSibling,this,t):1===o.type?e=new o.ctor(i,o.name,o.strings,this,t):6===o.type&&(e=new ot(i,this,t)),this._$AV.push(e),o=n[++s]}a!==o?.index&&(i=X.nextNode(),a++)}return X.currentNode=U,r}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=B,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=tt(this,t,e),P(t)?t===B||null==t||""===t?(this._$AH!==B&&this._$AR(),this._$AH=B):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>O(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==B&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(U.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=K.createElement(J(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new et(r,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new K(t)),e}k(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const i of t)r===e.length?e.push(n=new nt(this.O(D()),this.O(D()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.Line truncated
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/class ct extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const r=n?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=n?.renderBefore??null;r._$litPart$=i=new nt(e.insertBefore(U(),t),t,void 0,n??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}ct._$litElement$=!0,ct.finalized=!0,ut.litElementHydrateSupport?.({LitElement:ct});const ht=ut.litElementPolyfillSupport;ht?.({LitElement:ct}),(ut.litElementVersions??=[]).push("4.2.2");
|
||||
*/class ht extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const r=n?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=n?.renderBefore??null;r._$litPart$=i=new nt(e.insertBefore(D(),t),t,void 0,n??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}ht._$litElement$=!0,ht.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ht});const ut=lt.litElementPolyfillSupport;ut?.({LitElement:ht}),(lt.litElementVersions??=[]).push("4.2.2");
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const ft={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},dt=(t=ft,e,n)=>{const{kind:r,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),o.set(n.name,t),"accessor"===r){const{name:r}=n;return{set(n){const i=e.get.call(this);e.set.call(this,n),this.requestUpdate(r,i,t,!0,n)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=n;return function(n){const i=this[r];e.call(this,n),this.requestUpdate(r,i,t,!0,n)}}throw Error("Unsupported decorator location: "+r)};
|
||||
const dt={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:x},pt=(t=dt,e,n)=>{const{kind:r,metadata:i}=n;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),a.set(n.name,t),"accessor"===r){const{name:r}=n;return{set(n){const i=e.get.call(this);e.set.call(this,n),this.requestUpdate(r,i,t,!0,n)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=n;return function(n){const i=this[r];e.call(this,n),this.requestUpdate(r,i,t,!0,n)}}throw Error("Unsupported decorator location: "+r)};
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/function pt(t){return(e,n)=>"object"==typeof n?dt(t,e,n):((t,e,n)=>{const r=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),r?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}
|
||||
*/function ft(t){return(e,n)=>"object"==typeof n?pt(t,e,n):((t,e,n)=>{const r=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),r?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/function gt(t){return pt({...t,state:!0,attribute:!1})}
|
||||
*/function gt(t){return ft({...t,state:!0,attribute:!1})}
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/const _t={en:{editor:{groups:{display:"Display"},title:"Title (Optional)",places:"Places",show_trend:"Show trend indicators (vs Yesterday)",show_last_updated:"Show last updated",show_stats:"Show statistics (Yesterday, Last Week, 10-Year Avg)",show_chart:"Show historical chart (30d)",show_country:"Append country to place name",chart_smoothing:"Chart smoothing",chart_smoothing_options:{smooth:"Smooth",linear:"Linear",step:"Step"},sort_by:"Sort places by",sort_by_options:{default:"Default (Manual)",name:"Name (A-Z)",temp_asc:"Temperature (Coldest First)",temp_desc:"Temperature (Warmest First)"},add_place:"Add Place"},card:{yesterday:"Yesterday",last_week:"Last Week",average_avg:"10-Year Avg",averages:"Averages",min:"Min",max:"Max",avg:"Avg"},common:{errors:{no_places:"You need to define at least one place.",duplicate_place:"This place is already in your list."}}},de:{editor:{groups:{display:"Anzeige"},title:"Titel (Optional)",places:"Orte",show_trend:"Zeige Trend-Indikatoren (vs Gestern)",show_last_updated:"Zuletzt aktualisiert anzeigen",show_stats:"Statistiken anzeigen (Gestern, Letzte Woche, 10-Jahres-Ø)",show_chart:"Historisches Diagramm anzeigen (30t)",show_country:"Land an den Ortsnamen anhängen",chart_smoothing:"Kurvenglättung",chart_smoothing_options:{smooth:"Weich",linear:"Linear",step:"Stufen"},sort_by:"Orte sortieren nach",sort_by_options:{default:"Standard (Manuell)",name:"Name (A-Z)",temp_asc:"Temperatur (Kälteste zuerst)",temp_desc:"Temperatur (Wärmste zuerst)"},add_place:"Ort hinzufügen"},card:{yesterday:"Gestern",last_week:"Letzte Woche",average_avg:"10-Jahres-Ø",averages:"Durchschnitte",min:"Min",max:"Max",avg:"Ø"},common:{errors:{no_places:"Du musst mindestens einen Ort definieren.",duplicate_place:"Dieser Ort ist bereits in deiner Liste."}}},fr:{editor:{groups:{display:"Affichage"},title:"Titre (Optionnel)",places:"Lieux",show_trend:"Afficher les indicateurs de tendance (vs Hier)",show_last_updated:"Afficher la dernière mise à jour",show_stats:"Afficher les statistiques (Hier, La semaine dernière, Moy. 10 ans)",show_chart:"Afficher le graphique historique (30j)",show_country:"Ajouter le pays au nom du lieu",chart_smoothing:"Lissage du graphique",chart_smoothing_options:{smooth:"Lisse",linear:"Linéaire",step:"En escalier"},sort_by:"Trier les lieux par",sort_by_options:{default:"Défaut (Manuel)",name:"Nom (A-Z)",temp_asc:"Température (Le plus froid d'abord)",temp_desc:"Température (Le plus chaud d'abord)"},add_place:"Ajouter un lieu"},card:{yesterday:"Hier",last_week:"La semaine dernière",average_avg:"Moy. 10 ans",averages:"Moyennes",min:"Min",max:"Max",avg:"Moy"},common:{errors:{no_places:"Vous devez définir au moins un lieu.",duplicate_place:"Ce lieu est déjà dans votre liste."}}},es:{editor:{groups:{display:"Pantalla"},title:"Título (Opcional)",places:"Lugares",show_trend:"Mostrar indicadores de tendencia (vs Ayer)",show_last_updated:"Mostrar última actualización",show_stats:"Mostrar estadísticas (Ayer, Semana pasada, Media 10 años)",show_chart:"Mostrar gráfico histórico (30d)",show_country:"Añadir el país al nombre del lugar",chart_smoothing:"Suavizado del gráfico",chart_smoothing_options:{smooth:"Suave",linear:"Lineal",step:"Escalonado"},sort_by:"Ordenar lugares por",sort_by_options:{default:"Por defecto (Manual)",name:"Nombre (A-Z)",temp_asc:"Temperatura (Más frío primero)",temp_desc:"Temperatura (Más cálido primero)"},add_place:"Añadir Lugar"},card:{yesterday:"Ayer",last_week:"Semana Pasada",average_avg:"Media 10 años",averages:"Medias",min:"Mín",max:"Máx",avg:"Med"},common:{errors:{no_places:"Debes definir al menos un lugar.",duplicate_place:"Este lugar ya está en tu lista."}}},it:{editor:{groups:{display:"Visualizzazione"},title:"Titolo (Opzionale)",places:"Luoghi",show_trend:"Mostra indicatori di tendenza (vs Ieri)",show_last_updated:"Mostra ultimo aggiornamento",show_stats:"Mostra statistiche (Ieri, Settimana scorsa, Media 10 anni)",show_chart:"Mostra grafico storico (30g)",show_country:"Aggiungi il paese al nome del luogo",chart_smoothing:"Arrotondamento grafico",chart_smoothing_options:{smooth:"Morbido",linear:"Lineare",step:"A gradini"},sort_by:"Ordina luoghi per",sort_by_options:{default:"Predefinito (Manuale)",name:"Nome (A-Z)",temp_asc:"Temperatura (Più freddo prima)",temp_desc:"Temperatura (Più caldo prima)"},add_place:"Aggiungi Luogo"},card:{yesterday:"Ieri",last_week:"Settimana Scorsa",average_avg:"Media 10 anni",averages:"Medie",min:"Min",max:"Max",avg:"Med"},common:{errors:{no_places:"Devi definire almeno un luogo.",duplicate_place:"Questo luogo è già nella tua lista."}}}};function mt(t,e){let n=_t[t];for(const t of e){if("object"!=typeof n||null===n)return;n=n[t]}return"string"==typeof n?n:void 0}function yt(t,e,n={}){const r=t?.language||"en",i=e.replace("component.sea-temperatures-card.","").split("."),o=mt(r,i)??mt("en",i);if("string"==typeof o){let t=o;for(const e in n)t=t.replace(`{${e}}`,String(n[e]));return t}return e}cLine truncated
|
||||
*/const mt={en:{editor:{groups:{display:"Display"},title:"Title (Optional)",places:"Places",show_trend:"Show trend indicators (vs Yesterday)",show_last_updated:"Show last updated",show_stats:"Show statistics (Yesterday, Last Week, 10-Year Avg)",show_chart:"Show historical chart (30d)",show_country:"Append country to place name",chart_smoothing:"Chart smoothing",chart_smoothing_options:{smooth:"Smooth",linear:"Linear",step:"Step"},sort_by:"Sort places by",sort_by_options:{default:"Default (Manual)",name:"Name (A-Z)",temp_asc:"Temperature (Coldest First)",temp_desc:"Temperature (Warmest First)"},add_place:"Add Place"},card:{yesterday:"Yesterday",last_week:"Last Week",average_avg:"10-Year Avg",averages:"Averages",min:"Min",max:"Max",avg:"Avg",chart_description:"30-day trend"},common:{errors:{no_places:"You need to define at least one place.",duplicate_place:"This place is already in your list."}}},de:{editor:{groups:{display:"Anzeige"},title:"Titel (Optional)",places:"Orte",show_trend:"Zeige Trend-Indikatoren (vs Gestern)",show_last_updated:"Zuletzt aktualisiert anzeigen",show_stats:"Statistiken anzeigen (Gestern, Letzte Woche, 10-Jahres-Ø)",show_chart:"Historisches Diagramm anzeigen (30t)",show_country:"Land an den Ortsnamen anhängen",chart_smoothing:"Kurvenglättung",chart_smoothing_options:{smooth:"Weich",linear:"Linear",step:"Stufen"},sort_by:"Orte sortieren nach",sort_by_options:{default:"Standard (Manuell)",name:"Name (A-Z)",temp_asc:"Temperatur (Kälteste zuerst)",temp_desc:"Temperatur (Wärmste zuerst)"},add_place:"Ort hinzufügen"},card:{yesterday:"Gestern",last_week:"Letzte Woche",average_avg:"10-Jahres-Ø",averages:"Durchschnitte",min:"Min",max:"Max",avg:"Ø",chart_description:"30-Tage-Trend"},common:{errors:{no_places:"Du musst mindestens einen Ort definieren.",duplicate_place:"Dieser Ort ist bereits in deiner Liste."}}},fr:{editor:{groups:{display:"Affichage"},title:"Titre (Optionnel)",places:"Lieux",show_trend:"Afficher les indicateurs de tendance (vs Hier)",show_last_updated:"Afficher la dernière mise à jour",show_stats:"Afficher les statistiques (Hier, La semaine dernière, Moy. 10 ans)",show_chart:"Afficher le graphique historique (30j)",show_country:"Ajouter le pays au nom du lieu",chart_smoothing:"Lissage du graphique",chart_smoothing_options:{smooth:"Lisse",linear:"Linéaire",step:"En escalier"},sort_by:"Trier les lieux par",sort_by_options:{default:"Défaut (Manuel)",name:"Nom (A-Z)",temp_asc:"Température (Le plus froid d'abord)",temp_desc:"Température (Le plus chaud d'abord)"},add_place:"Ajouter un lieu"},card:{yesterday:"Hier",last_week:"La semaine dernière",average_avg:"Moy. 10 ans",averages:"Moyennes",min:"Min",max:"Max",avg:"Moy",chart_description:"Tendance sur 30 jours"},common:{errors:{no_places:"Vous devez définir au moins un lieu.",duplicate_place:"Ce lieu est déjà dans votre liste."}}},es:{editor:{groups:{display:"Pantalla"},title:"Título (Opcional)",places:"Lugares",show_trend:"Mostrar indicadores de tendencia (vs Ayer)",show_last_updated:"Mostrar última actualización",show_stats:"Mostrar estadísticas (Ayer, Semana pasada, Media 10 años)",show_chart:"Mostrar gráfico histórico (30d)",show_country:"Añadir el país al nombre del lugar",chart_smoothing:"Suavizado del gráfico",chart_smoothing_options:{smooth:"Suave",linear:"Lineal",step:"Escalonado"},sort_by:"Ordenar lugares por",sort_by_options:{default:"Por defecto (Manual)",name:"Nombre (A-Z)",temp_asc:"Temperatura (Más frío primero)",temp_desc:"Temperatura (Más cálido primero)"},add_place:"Añadir Lugar"},card:{yesterday:"Ayer",last_week:"Semana Pasada",average_avg:"Media 10 años",averages:"Medias",min:"Mín",max:"Máx",avg:"Med",chart_description:"Tendencia de 30 días"},common:{errors:{no_places:"Debes definir al menos un lugar.",duplicate_place:"Este lugar ya está en tu lista."}}},it:{editor:{groups:{display:"Visualizzazione"},title:"Titolo (Opzionale)",places:"Luoghi",show_trend:"Mostra indicatori di tendenza (vs Ieri)",show_last_updated:"Mostra ultimo aggiornamento",show_stats:"Mostra statistiche (Ieri, Settimana scorsa, Media 10 anni)",show_chart:"Mostra grafico storico (30g)",show_country:"Aggiungi il paese al nome del luogo",chart_smoothing:"Arrotondamento grafico",chart_smoothing_options:{smooth:"Morbido",linear:"Lineare",step:"A gradini"},sort_by:"Ordina luoghi per",sort_by_options:{default:"Predefinito (Manuale)",name:"Nome (A-Z)",temp_asc:"Temperatura (Più freddo prima)",temp_desc:"Temperatura (Più caldo prima)"},add_place:"Aggiungi Luogo"},card:{yesterday:"Ieri",last_week:"Settimana Scorsa",average_avg:"Media 10 anni",averages:"Medie",min:"Min",max:"Max",avg:"Med",chart_description:"Andamento a 30 giorni"},common:{errors:{no_places:"Devi definire almeno un luogo.",duplicate_place:"Questo luogo è già nella tua lista."}}}};function _t(t,e){let n=mt[t];for(const t of e){if("object"!=typeof n||null===n)return;n=n[t]}return"string"==typeof n?n:void 0}function yt(t,e,n={}){const r=t?.languageLine truncated
|
||||
${t?"↑":"↓"} ${t?"+":"-"}${e}${n}
|
||||
</div>`}return W`<div class="stat-delta neu current-trend">→ 0.0${n}</div>`}render(){if(!this._config||!this.hass)return W``;const t=this._getPlacesData(this.hass,this._config),e=this._chartWidth<360;return W`
|
||||
<ha-card .header=${this._config.title} tabindex="0" class="${e?"narrow":""}">
|
||||
<div class="card-content">
|
||||
${t.map(t=>W`
|
||||
<div class="place-row">
|
||||
<div class="place-header" @click=${()=>this._handleMoreInfo(t.entity_id)}>
|
||||
<div
|
||||
class="place-header"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label=${this._placeAriaLabel(t)}
|
||||
@click=${()=>this._handleMoreInfo(t.entity_id)}
|
||||
@keydown=${e=>this._handleHeaderKeydown(e,t.entity_id)}
|
||||
>
|
||||
<div class="place-info">
|
||||
<div class="place-name-container">
|
||||
<span class="place-name">${t.name}</span>
|
||||
${t.country?W`<span class="place-country">${t.country}</span>`:""}
|
||||
</div>
|
||||
${this._config.show_last_updated?W`<div class="last-updated">
|
||||
${this.hass.states[t.entity_id]?new Date(this.hass.states[t.entity_id].last_updated).toLocaleString(this.hass.language||void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}
|
||||
</div>`:""}
|
||||
${this.hass.states[t.entity_id]?new Date(this.hass.states[t.entity_id].last_updated).toLocaleString(this.hass.language||void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}
|
||||
</div>`:""}
|
||||
</div>
|
||||
<div class="current-temp">
|
||||
<span class="temp-value"
|
||||
>${isNaN(Number(t.temperature))?t.temperature:new Intl.NumberFormat(this.hass?.language).format(Number(t.temperature))}</span
|
||||
>
|
||||
<span class="temp-unit">${t.unit}</span>
|
||||
${this._renderTrend(t.yesterday,t.temperature,t.unit)}
|
||||
${t.unavailable?W`<span class="temp-value unavailable" title=${t.temperature}>—</span>`:W`<span class="temp-value"
|
||||
>${isNaN(Number(t.temperature))?t.temperature:new Intl.NumberFormat(this.hass?.language).format(Number(t.temperature))}</span
|
||||
>
|
||||
<span class="temp-unit">${t.unit}</span>
|
||||
${this._renderTrend(t.yesterday,t.temperature,t.unit)}`}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${!1!==this._config.show_stats?W`
|
||||
<div class="stats-grid">
|
||||
${this._renderStat(yt(this.hass,"card.yesterday"),t.yesterday,t.unit)}
|
||||
${this._renderStat(yt(this.hass,"card.last_week"),t.last_week,t.unit)}
|
||||
${this._renderStat(yt(this.hass,"card.average_avg"),t.average_avg,t.unit)}
|
||||
</div>
|
||||
`:""}
|
||||
<div class="stats-grid">
|
||||
${this._renderStat(yt(this.hass,"card.yesterday"),t.yesterday,t.unit)}
|
||||
${this._renderStat(yt(this.hass,"card.last_week"),t.last_week,t.unit)}
|
||||
${this._renderStat(yt(this.hass,"card.average_avg"),t.average_avg,t.unit)}
|
||||
</div>
|
||||
`:""}
|
||||
${!1!==this._config.show_chart?this._renderChart(t):""}
|
||||
</div>
|
||||
`)}
|
||||
@@ -90,49 +97,51 @@ const ft={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},dt=(t=ft
|
||||
viewBox="0 0 ${this._chartWidth} 120"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
id="chart-${t.entity_id.replace(/\./g,"-")}"
|
||||
role="img"
|
||||
aria-label=${this._chartAriaLabel(t,e)}
|
||||
>
|
||||
${this._drawChart(t.entity_id,e,t)}
|
||||
</svg>
|
||||
</div>
|
||||
`}_handleMouseMove(t,e,n,r,i,o){const a=t.currentTarget.ownerSVGElement;if(!a)return;const s=a.createSVGPoint();s.x=t.clientX,s.y=t.clientY;const l=a.getScreenCTM();if(!l)return;const u=s.matrixTransform(l.inverse()),c=r.invert(u.x),h=bt(t=>t.date).left,f=h(n,c,1),d=n[f-1],p=n[f];let g=d;if(d&&p?g=c.getTime()-d.date.getTime()>p.date.getTime()-c.getTime()?p:d:p&&(g=p),!g)return;const _=a.querySelector(".hover-group");if(!_)return;_.style.opacity="1";const m=r(g.date),y=i(g.value),v=_.querySelector(".hover-line");v.setAttribute("x1",String(m)),v.setAttribute("x2",String(m));const w=_.querySelector(".hover-point");w.setAttribute("cx",String(m)),w.setAttribute("cy",String(y));const x=_.querySelector(".hover-tooltip-bg"),b=_.querySelector(".hover-tooltip-text"),$=_.querySelector(".hover-tooltip-date"),A=this._chartWidth,M=Math.max(0,Math.min(m-35,A-70)),S=M+35,C="middle",T=Math.max(0,y-34),E=T+11,N=T+23;x.setAttribute("x",String(M)),x.setAttribute("y",String(T)),b.setAttribute("x",String(S)),b.setAttribute("y",String(E)),b.setAttribute("text-anchor",C);const k=new Intl.NumberFormat(this.hass?.language).format(g.value);b.textContent=`${k}${o}`,$.setAttribute("x",String(S)),$.setAttribute("y",String(N)),$.setAttribute("text-anchor",C),$.textContent=g.date.toLocaleDateString(this.hass?.language||void 0,{month:"short",day:"numeric"})}_handleMouseLeave(t){const e=t.currentTarget.ownerSVGElement;if(!e)return;const n=e.querySelector(".hover-group");n&&(n.style.opacity="0")}_drawChart(t,e,n){const r=this._chartWidth,i=120,o=r<360,a=15,s=o?48:65,l=25,u=10,c=La().domain(Mt(e,t=>t.date)).range([u,r-s]),h=[...e.map(t=>t.value)];n.average_min&&h.push(parseFloat(n.average_min)),n.average_max&&h.push(parseFloat(n.average_max));const f=Mt(h),d=.1*(f[1]-f[0])||1,p=Ai().domain([f[0]-d,f[1]+d]).range([i-l,a]);let g=Ka;"linear"===this._config.chart_smoothing&&(g=qa),"step"===this._config.chart_smoothing&&(g=es);const _=Xa().x(t=>c(t.date)).y(t=>p(t.value)).curve(g),m=Va().x(t=>c(t.date)).y0(i-l).y1(t=>p(t.value)).curve(g),y=(t,e,i)=>{if(!t)return null;const a=parseFloat(t);if(isNaN(a))return null;const l=p(a),c=n.unit||"°C",h=i?o?`${a.toFixed(1)}${c}`:`${i} ${a.toFixed(1)}${c}`:"";return X`
|
||||
`}_handlePointerMove(t,e,n,r,i,a){if("mouse"!==t.pointerType&&"pointermove"===t.type&&0===t.buttons)return;const s=t.currentTarget.ownerSVGElement;if(!s)return;const o=s.createSVGPoint();o.x=t.clientX,o.y=t.clientY;const c=s.getScreenCTM();if(!c)return;const l=o.matrixTransform(c.inverse()),h=r.invert(l.x),u=$t(t=>t.date).left,d=u(n,h,1),p=n[d-1],f=n[d];let g=p;if(p&&f?g=h.getTime()-p.date.getTime()>f.date.getTime()-h.getTime()?f:p:f&&(g=f),!g)return;const m=s.querySelector(".hover-group");if(!m)return;m.style.opacity="1";const _=r(g.date),y=i(g.value),v=m.querySelector(".hover-line");v.setAttribute("x1",String(_)),v.setAttribute("x2",String(_));const b=m.querySelector(".hover-point");b.setAttribute("cx",String(_)),b.setAttribute("cy",String(y));const x=m.querySelector(".hover-tooltip-bg"),$=m.querySelector(".hover-tooltip-text"),w=m.querySelector(".hover-tooltip-date"),M=this._chartWidth,A=Math.max(0,Math.min(_-35,M-70)),S=A+35,T="middle",C=Math.max(0,y-34),N=C+11,E=C+23;x.setAttribute("x",String(A)),x.setAttribute("y",String(C)),$.setAttribute("x",String(S)),$.setAttribute("y",String(N)),$.setAttribute("text-anchor",T);const k=new Intl.NumberFormat(this.hass?.language).format(g.value);$.textContent=`${k}${a}`,w.setAttribute("x",String(S)),w.setAttribute("y",String(E)),w.setAttribute("text-anchor",T),w.textContent=g.date.toLocaleDateString(this.hass?.language||void 0,{month:"short",day:"numeric"})}_handlePointerLeave(t){const e=t.currentTarget.ownerSVGElement;if(!e)return;const n=e.querySelector(".hover-group");n&&(n.style.opacity="0")}_drawChart(t,e,n){const r=this._chartWidth,i=120,a=r<360,s=15,o=a?48:65,c=25,l=10,h=pi().domain(At(e,t=>t.date)).range([l,r-o]),u=[...e.map(t=>t.value)];n.average_min&&u.push(parseFloat(n.average_min)),n.average_max&&u.push(parseFloat(n.average_max));const d=At(u),p=.1*(d[1]-d[0])||1,f=Ke().domain([d[0]-p,d[1]+p]).range([i-c,s]);let g=Pi;"linear"===this._config.chart_smoothing&&(g=Mi),"step"===this._config.chart_smoothing&&(g=Fi);const m=Ti().x(t=>h(t.date)).y(t=>f(t.value)).curve(g),_=Ci().x(t=>h(t.date)).y0(i-c).y1(t=>f(t.value)).curve(g),y=(t,e,i)=>{if(!t)return null;const s=parseFloat(t);if(isNaN(s))return null;const c=f(s),h=n.unit||"°C",u=i?a?`${s.toFixed(1)}${h}`:`${i} ${s.toFixed(1)}${h}`:"";return Z`
|
||||
<line
|
||||
class="ref-line ${e}"
|
||||
x1="${u}"
|
||||
x2="${r-s}"
|
||||
y1="${l}"
|
||||
y2="${l}"
|
||||
x1="${l}"
|
||||
x2="${r-o}"
|
||||
y1="${c}"
|
||||
y2="${c}"
|
||||
></line>
|
||||
${h?X`<text class="ref-label ${e}" x="${r-s+4}" y="${l}" text-anchor="start">${h}</text>`:""}
|
||||
`},v=t=>t.toLocaleDateString(this.hass?.language||void 0,{month:"short",day:"numeric"}),w=c.domain()[0],x=c.domain()[1],b=e[e.length-1],$=b?X`
|
||||
${u?Z`<text class="ref-label ${e}" x="${r-o+4}" y="${c}" text-anchor="start">${u}</text>`:""}
|
||||
`},v=t=>t.toLocaleDateString(this.hass?.language||void 0,{month:"short",day:"numeric"}),b=h.domain()[0],x=h.domain()[1],$=e[e.length-1],w=$?Z`
|
||||
<circle
|
||||
class="now-dot"
|
||||
cx="${c(b.date)}"
|
||||
cy="${p(b.value)}"
|
||||
cx="${h($.date)}"
|
||||
cy="${f($.value)}"
|
||||
r="3"
|
||||
fill="var(--primary-color, #0077be)"
|
||||
></circle>
|
||||
`:"",A=e.reduce((t,e)=>e.value<t.value?e:t,e[0]),M=e.reduce((t,e)=>e.value>t.value?e:t,e[0]),S=n.unit||"°C",C=X`
|
||||
`:"",M=e.reduce((t,e)=>e.value<t.value?e:t,e[0]),A=e.reduce((t,e)=>e.value>t.value?e:t,e[0]),S=n.unit||"°C",T=Z`
|
||||
<g class="hover-group" style="opacity: 0;">
|
||||
<line class="hover-line" x1="0" x2="0" y1="${a}" y2="${i-l}"></line>
|
||||
<line class="hover-line" x1="0" x2="0" y1="${s}" y2="${i-c}"></line>
|
||||
<circle class="hover-point" cx="0" cy="0" r="4"></circle>
|
||||
<rect class="hover-tooltip-bg" x="0" y="0" width="70" height="28" rx="4"></rect>
|
||||
<text class="hover-tooltip-text" x="0" y="0" text-anchor="middle"></text>
|
||||
<text class="hover-tooltip-date" x="0" y="0" text-anchor="middle"></text>
|
||||
</g>
|
||||
`;return X`
|
||||
`;return Z`
|
||||
<defs>
|
||||
<linearGradient id="gradient-${t.replace(/\./g,"-")}" x1="0%" y1="100%" x2="0%" y2="0%">
|
||||
<stop offset="0%" style="stop-color: var(--primary-color, #0077be); stop-opacity: 0.1"></stop>
|
||||
<stop offset="100%" style="stop-color: var(--error-color, #db4437); stop-opacity: 0.4"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<text class="axis-label start" x="${u}" y="${115}">${v(w)}</text>
|
||||
<text class="axis-label end" x="${r-s}" y="${115}" text-anchor="end">${v(x)}</text>
|
||||
<text class="axis-label start" x="${l}" y="${115}">${v(b)}</text>
|
||||
<text class="axis-label end" x="${r-o}" y="${115}" text-anchor="end">${v(x)}</text>
|
||||
|
||||
<path class="chart-area" d="${m(e)||""}" fill="url(#gradient-${t.replace(/\./g,"-")})"></path>
|
||||
<path class="chart-area" d="${_(e)||""}" fill="url(#gradient-${t.replace(/\./g,"-")})"></path>
|
||||
<path
|
||||
class="chart-line"
|
||||
d="${_(e)||""}"
|
||||
d="${m(e)||""}"
|
||||
fill="none"
|
||||
stroke="var(--primary-color, #0077be)"
|
||||
stroke-width="2"
|
||||
@@ -142,29 +151,32 @@ const ft={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},dt=(t=ft
|
||||
${y(n.average_max,"max",yt(this.hass,"card.max"))}
|
||||
${y(n.average_avg,"avg",yt(this.hass,"card.avg"))}
|
||||
|
||||
${A?X`<circle class="extrema-dot min" cx="${c(A.date)}" cy="${p(A.value)}" r="3"></circle>`:""}
|
||||
${M?X`<circle class="extrema-dot max" cx="${c(M.date)}" cy="${p(M.value)}" r="3"></circle>`:""}
|
||||
${M?Z`<circle class="extrema-dot min" cx="${h(M.date)}" cy="${f(M.value)}" r="3"></circle>`:""}
|
||||
${A?Z`<circle class="extrema-dot max" cx="${h(A.date)}" cy="${f(A.value)}" r="3"></circle>`:""}
|
||||
|
||||
${$}
|
||||
${C}
|
||||
${w}
|
||||
${T}
|
||||
|
||||
<rect
|
||||
class="hover-overlay"
|
||||
x="${u}"
|
||||
y="${a}"
|
||||
width="${r-u-s}"
|
||||
height="${i-a-l}"
|
||||
x="${l}"
|
||||
y="${s}"
|
||||
width="${r-l-o}"
|
||||
height="${i-s-c}"
|
||||
fill="transparent"
|
||||
@mousemove="${n=>this._handleMouseMove(n,t,e,c,p,S)}"
|
||||
@mouseleave="${t=>this._handleMouseLeave(t)}"
|
||||
@pointerdown="${n=>this._handlePointerMove(n,t,e,h,f,S)}"
|
||||
@pointermove="${n=>this._handlePointerMove(n,t,e,h,f,S)}"
|
||||
@pointerleave="${t=>this._handlePointerLeave(t)}"
|
||||
@pointercancel="${t=>this._handlePointerLeave(t)}"
|
||||
@pointerup="${t=>this._handlePointerLeave(t)}"
|
||||
></rect>
|
||||
`}static get styles(){return[a(rs)]}}t([pt({attribute:!1})],as.prototype,"hass",void 0),t([
|
||||
`}static get styles(){return[s(Hi)]}}t([ft({attribute:!1})],ji.prototype,"hass",void 0),t([
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
function(t){return(e,n,r)=>((t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,n),n))(e,n,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}("ha-card")],as.prototype,"_card",void 0),t([gt()],as.prototype,"_config",void 0),t([gt()],as.prototype,"_chartData",void 0),t([gt()],as.prototype,"_chartWidth",void 0),customElements.get(is)||customElements.define(is,as),window.customCards=window.customCards||[],window.customCards.push({type:is,name:"Sea Temperatures Card",description:"Display current and historical sea temperatures.",preview:!0,documentationURL:"https://github.com/timmaurice/sea-temperatures",getEntitySuggestion:(t,e)=>e.startsWith("sensor.seatemperatures_")&&t.states[e]?{config:{type:`custom:${is}`,places:[e]}}:null});const ss=s`.card-config{display:flex;flex-direction:column;gap:12px}.group{border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius, 12px);margin-top:0;padding:16px}.group-header{color:var(--primary-text-color);font-size:16px;font-weight:500;margin-bottom:12px}ha-form{display:block}.places-list{border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius, 12px);padding:16px;margin-bottom:12px}.places-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.places-header h3{margin:0;font-size:16px;font-weight:500;color:var(--primary-text-color)}.places{display:flex;flex-direction:column;gap:8px}.place-item{display:flex;align-items:center;gap:8px}.place-item ha-selector{flex:1}.handle{cursor:grab;color:var(--secondary-text-color);display:flex;align-items:center;justify-content:center}.handle:active{cursor:grabbing}.add-place-container{display:flex;justify-content:flex-end;margin-top:8px}`,ls=[{name:"title",selector:{text:{}}}],us=[{name:"sort_by",selector:{select:{options:[{value:"default",label:"Default"},{value:"name",label:"Name"},{value:"temp_asc",label:"Temperature Asc"},{value:"temp_desc",label:"Temperature Desc"}]}}},{type:"expandable",title:"groups.display",schema:[{name:"show_last_updated",selector:{boolean:{}}},{name:"show_trend",selector:{boolean:{}}},{name:"show_stats",selector:{boolean:{}}},{name:"show_chart",selector:{boolean:{}}},{name:"show_country",selector:{boolean:{}}},{name:"chart_smoothing",selector:{select:{options:["smooth","linear","step"]}}}]}];let cs=class extends ct{setConfig(t){this._config={sort_by:"default",show_trend:!0,show_last_updated:!0,show_stats:!0,show_chart:!0,show_country:!1,chart_smoothing:"smooth",...t}}_valueChanged(t){this.hass&&this._config&&vt(this,"config-changed",{config:{...this._config,...t.detail.value}})}_placeMoved(t){t.stopPropagation();const{oldIndex:e,newIndex:n}=t.detail;if(e===n)return;const r=[...this._config.places||[]],i=r.splice(e,1)[0];r.splice(n,0,i),this._config={...this._config,places:r},vt(this,"config-changed",{config:this._config})}_placeChanged(t,e){if(!e)return void this._removePlace(t);const n=[...this._config.places||[]],r="string"==typeof e?e:e.device,i=n.some((e,n)=>{if(n===t||!e)return!1;return("string"==typeof e?e:e.device)===r});if(i)return vt(this,"hass-notification",{message:yt(this.hass,"common.errors.duplicate_place")}),void this.requestUpdate();n[t]=e,this._config={...this._config,places:n},vt(this,"config-changed",{config:this._config})}_removePlace(t){const e=[...this._config.places||[]];e.splice(t,1),this._config={...this._config,places:e},vt(this,"config-changed",{config:this._config})}_addPlace(){const t=[...this._config.places||[],""];this._config={...this._config,places:t},vt(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return W``;const t=t=>t.map(t=>{const e={...t};return"sort_by"===e.name&&(e.selector={select:{options:[{value:"default",label:yt(this.hass,"editor.sort_by_options.default")},{value:"name",label:yt(this.hass,"editor.sort_by_options.name")},{value:"temp_asc",label:yt(this.hass,"editor.sort_by_options.temp_asc")},{value:"temp_desc",label:yt(this.hass,"editor.sort_by_options.temp_desc")}]}}),"chart_smoothing"===e.name&&(e.selector={select:{options:[{value:"smooth",label:yt(this.hass,"editor.chart_smoothing_options.smooth")},{value:"linear",label:yt(this.hass,"editor.chart_smoothing_options.linear")},{value:"step",label:yt(this.hass,"editor.chart_smoothing_options.step")}]}}),"expandable"===e.type&&Array.isArray(e.schema)&&(e.title=yt(this.hass,`editor.${e.title}`),e.schema=e.schema.map(t=>({...t}))),e}),e=t(ls),n=t(us);return W`
|
||||
function(t){return(e,n,r)=>((t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,n),n))(e,n,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}("ha-card")],ji.prototype,"_card",void 0),t([gt()],ji.prototype,"_config",void 0),t([gt()],ji.prototype,"_chartData",void 0),t([gt()],ji.prototype,"_chartWidth",void 0),customElements.get(Li)||customElements.define(Li,ji),window.customCards=window.customCards||[],window.customCards.push({type:Li,name:"Sea Temperatures Card",description:"Display current and historical sea temperatures.",preview:!0,documentationURL:"https://github.com/timmaurice/sea-temperatures",getEntitySuggestion:(t,e)=>e.startsWith("sensor.seatemperatures_")&&t.states[e]?{config:{type:`custom:${Li}`,places:[e]}}:null});const Ri=o`.card-config{display:flex;flex-direction:column;gap:12px}.group{border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius, 12px);margin-top:0;padding:16px}.group-header{color:var(--primary-text-color);font-size:16px;font-weight:500;margin-bottom:12px}ha-form{display:block}.places-list{border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius, 12px);padding:16px;margin-bottom:12px}.places-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.places-header h3{margin:0;font-size:16px;font-weight:500;color:var(--primary-text-color)}.places{display:flex;flex-direction:column;gap:8px}.place-item{display:flex;align-items:center;gap:8px}.place-item ha-selector{flex:1}.handle{cursor:grab;color:var(--secondary-text-color);display:flex;align-items:center;justify-content:center}.handle:active{cursor:grabbing}.add-place-container{display:flex;justify-content:flex-end;margin-top:8px}`;var Yi;const qi=[{name:"title",selector:{text:{}}}],Ii=[{name:"sort_by",selector:{select:{options:[{value:"default",label:"Default"},{value:"name",label:"Name"},{value:"temp_asc",label:"Temperature Asc"},{value:"temp_desc",label:"Temperature Desc"}]}}},{type:"expandable",title:"groups.display",schema:[{name:"show_last_updated",selector:{boolean:{}}},{name:"show_trend",selector:{boolean:{}}},{name:"show_stats",selector:{boolean:{}}},{name:"show_chart",selector:{boolean:{}}},{name:"show_country",selector:{boolean:{}}},{name:"chart_smoothing",selector:{select:{options:["smooth","linear","step"]}}}]}];let Wi=class extends ht{static{Yi=this}setConfig(t){this._config={sort_by:"default",show_trend:!0,show_last_updated:!0,show_stats:!0,show_chart:!0,show_country:!1,chart_smoothing:"smooth",...t}}_valueChanged(t){this.hass&&this._config&&vt(this,"config-changed",{config:{...this._config,...t.detail.value}})}_placeMoved(t){t.stopPropagation();const{oldIndex:e,newIndex:n}=t.detail;if(e===n)return;const r=[...this._config.places||[]],i=r.splice(e,1)[0];r.splice(n,0,i),this._config={...this._config,places:r},vt(this,"config-changed",{config:this._config})}static _targetOf(t){return t?"string"==typeof t?t:t.device||"":""}static _nameOf(t){return t&&"string"!=typeof t&&t.name||""}static _isEntityTarget(t){return t.includes(".")}static _buildPlace(t,e){return e?{device:t,name:e}:t}_commitPlace(t,e){const n=[...this._config.places||[]];n[t]=e,this._config={...this._config,places:n},vt(this,"config-changed",{config:this._config})}_placeChanged(t,e){const n=Yi._targetOf(e);if(!n)return void this._removePlace(t);const r=[...this._config.places||[]],i=r.some((e,r)=>r!==t&&e&&Yi._targetOf(e)===n);if(i)return vt(this,"hass-notification",{message:yt(this.hass,"common.errors.duplicate_place")}),void this.requestUpdate();const a=Yi._nameOf(r[t]);this._commitPlace(t,Yi._buildPlace(n,a))}_removePlace(t){const e=[...this._config.places||[]];e.splice(t,1),this._config={...this._config,places:e},vt(this,"config-changed",{config:this._config})}_addPlace(){const t=[...this._config.places||[],""];this._config={...this._config,places:t},vt(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return W``;const t=t=>t.map(t=>{const e={...t};return"sort_by"===e.name&&(e.selector={select:{options:[{value:"default",label:yt(this.hass,"editor.sort_by_options.default")},{value:"name",label:yt(this.hass,"editor.sort_by_options.name")},{value:"temp_asc",label:yt(this.hass,"editor.sort_by_options.temp_asc")},{value:"temp_desc",label:yt(this.hass,"editor.sort_by_options.temp_desc")}]}}),"chart_smoothing"===e.name&&(e.selector={select:{options:[{value:"smooth",label:yt(this.hass,"editor.chart_smoothing_options.smooth")},{value:"linear",label:yt(this.hass,"editor.chart_smoothing_options.linear")},{value:"step",label:yt(this.hass,"editor.chart_smoothing_options.step")}]}}),"expandable"===e.type&&Array.isArray(e.schema)&&(e.title=yt(this.hass,`editor.${e.title}`),e.schema=e.schema.map(t=>({...t}))),e}),e=t(qi),n=t(Ii);return W`
|
||||
<ha-card>
|
||||
<div class="card-content card-config">
|
||||
<ha-form
|
||||
@@ -180,19 +192,19 @@ function(t){return(e,n,r)=>((t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.
|
||||
</div>
|
||||
<ha-sortable handle-selector=".handle" @item-moved=${this._placeMoved}>
|
||||
<div class="places">
|
||||
${this._config.places?.map((t,e)=>W`
|
||||
${this._config.places?.map((t,e)=>{const n=Yi._targetOf(t),r=Yi._isEntityTarget(n)?{entity:{integration:"seatemperatures"}}:{device:{integration:"seatemperatures"}};return W`
|
||||
<div class="place-item">
|
||||
<div class="handle">
|
||||
<ha-icon icon="mdi:drag"></ha-icon>
|
||||
</div>
|
||||
<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${{device:{integration:"seatemperatures"}}}
|
||||
.value=${"string"==typeof t?t:t.device}
|
||||
.selector=${r}
|
||||
.value=${n}
|
||||
@value-changed=${t=>this._placeChanged(e,t.detail.value)}
|
||||
></ha-selector>
|
||||
</div>
|
||||
`)}
|
||||
`})}
|
||||
</div>
|
||||
</ha-sortable>
|
||||
<div class="add-place-container">
|
||||
@@ -211,6 +223,6 @@ function(t){return(e,n,r)=>((t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.
|
||||
></ha-form>
|
||||
</div>
|
||||
</ha-card>
|
||||
`}static{this.styles=s`
|
||||
${a(ss)}
|
||||
`}};t([pt({attribute:!1})],cs.prototype,"hass",void 0),t([gt()],cs.prototype,"_config",void 0),cs=t([(t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("sea-temperatures-card-editor")],cs);var hs=Object.freeze({__proto__:null,get SeaTemperaturesCardEditor(){return cs}});export{as as SeaTemperaturesCard};
|
||||
`}static{this.styles=o`
|
||||
${s(Ri)}
|
||||
`}};t([ft({attribute:!1})],Wi.prototype,"hass",void 0),t([gt()],Wi.prototype,"_config",void 0),Wi=Yi=t([(t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("sea-temperatures-card-editor")],Wi);var Zi=Object.freeze({__proto__:null,get SeaTemperaturesCardEditor(){return Wi}});export{ji as SeaTemperaturesCard};
|
||||
@@ -56,8 +56,8 @@ async def test_parse_location_page_from_copenhagen_fixture() -> None:
|
||||
assert data.average_max == pytest.approx(13.67)
|
||||
assert data.last_week == pytest.approx(10.31)
|
||||
assert data.trend_labels is not None
|
||||
assert data.trend_labels[0] == "04-22"
|
||||
assert data.trend_labels[-1] == "05-21"
|
||||
assert data.trend_labels[0] == "2026-04-22"
|
||||
assert data.trend_labels[-1] == "2026-05-21"
|
||||
assert data.trend_temps_c is not None
|
||||
assert data.trend_temps_c[-1] == pytest.approx(11.83)
|
||||
|
||||
@@ -197,7 +197,7 @@ async def test_get_temperatures_from_location_page(mock_hass) -> None:
|
||||
assert result["sst"]["yesterday"] == pytest.approx(11.7)
|
||||
assert result["sst"]["last_week"] == pytest.approx(10.31)
|
||||
assert result["sst"]["average"]["avg"] == pytest.approx(12.126000000000001)
|
||||
assert result["charts"]["last_thirty"]["labels"][-1] == "05-21"
|
||||
assert result["charts"]["last_thirty"]["labels"][-1] == "2026-05-21"
|
||||
|
||||
|
||||
async def test_get_location_by_place_id_uses_map_locations(mock_hass) -> None:
|
||||
|
||||
Reference in new issue
Block a user