Files
HomeAssistantVS/custom_components/seatemperatures/sea-temperatures-card.js
T

233 lines
92 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.3.1","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 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:u,getOwnPropertyDescriptor:h,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 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&&u(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 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.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(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[v("elementProperties")]=new Map,w[v("finalized")]=new Map,y?.({ReactiveElement:w}),(g.reactiveElementVersions??=[]).push("2.1.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
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)}$`,k="?"+N,E=`<${k}>`,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"),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=D.createTreeWalker(D,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,u=0;for(;u<n.length&&(s.lastIndex=u,c=s.exec(n),null!==c);)u=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 h=s===j&&t[e+1].startsWith("/>")?" ":"";a+=s===H?n+E:l>=0?(r.push(o),n.slice(0,l)+C+n.slice(l)+N+h):n+N+(-2===l?e:h)}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],U()),X.nextNode(),o.push({type:2,index:++i});r.append(t[e],U())}}}else if(8===r.nodeType)if(r.data===k)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=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 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??D).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=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=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(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.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=A(t).nextSibling;A(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,r,i){this.type=1,this._$AH=B,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=B}_$AI(t,e=this,n,r){const i=this.strings;let a=!1;if(void 0===i)t=tt(this,t,e,0),a=!P(t)||t!==this._$AH&&t!==V,a&&(this._$AH=t);else{const r=t;let s,o;for(t=i[0],s=0;s<i.length-1;s++)o=tt(this,r[n+s],e,s),o===V&&(o=this._$AH[s]),a||=!P(o)||o!==this._$AH[s],o===B?t=B:t!==B&&(t+=(o??"")+i[s+1]),this._$AH[s]=o}a&&!r&&this.j(t)}j(t){t===B?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class it extends rt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===B?void 0:t}}class at extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==B)}}class st extends rt{constructor(t,e,n,r,i){super(t,e,n,r,i),this.type=5}_$AI(t,e=this){if((t=tt(this,t,e,0)??B)===V)return;const n=this._$AH,r=t===B&&n!==B||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==B&&(n===B||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ot{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){tt(this,t)}}const ct=M.litHtmlPolyfillSupport;ct?.(K,nt),(M.litHtmlVersions??=[]).push("3.3.3");const lt=globalThis;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class ut 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(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}}ut._$litElement$=!0,ut.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ut});const ht=lt.litElementPolyfillSupport;ht?.({LitElement:ut}),(lt.litElementVersions??=[]).push("4.2.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
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)};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 ft({...t,state:!0,attribute:!1})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/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",entity_problem:{not_found:"Entity {entity} was not found.",wrong_domain:"{entity} is not a sensor.",not_numeric:"{entity} does not report a temperature.",unavailable:"{entity} is unavailable."}},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",entity_problem:{not_found:"Entität {entity} wurde nicht gefunden.",wrong_domain:"{entity} ist kein Sensor.",not_numeric:"{entity} liefert keine Temperatur.",unavailable:"{entity} ist nicht verfügbar."}},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",entity_problem:{not_found:"L'entité {entity} est introuvable.",wrong_domain:"{entity} n'est pas un capteur.",not_numeric:"{entity} ne fournit pas de température.",unavailable:"{entity} est indisponible."}},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",entity_problem:{not_found:"No se encontró la entidad {entity}.",wrong_domain:"{entity} no es un sensor.",not_numeric:"{entity} no proporciona una temperatura.",unavailable:"{entity} no está disponible."}},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",entity_problem:{not_found:"L'entità {entity} non è stata trovata.",wrong_domain:"{entity} non è un sensore.",not_numeric:"{entity} non fornisce una temperatura.",unavailable:"{entity} non è disponibile."}},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?.language||"en",i=e.replace("component.sea-temperatures-card.","").split("."),a=_t(r,i)??_t("en",i);if("string"==typeof a){let t=a;for(const e in n)t=t.replace(`{${e}}`,String(n[e]));return t}return e}const vt=(t,e,n,r)=>{const i=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,...r,detail:n});t.dispatchEvent(i)},bt=new Set(["unavailable","unknown",""]);function xt(t,e,n={}){const r=(e??"").trim();if(!r)return{ok:!1,reason:"not_found",target:r};const i=r.indexOf(".");if(i<0)return{ok:!1,reason:"not_found",target:r};if(n.domain&&r.slice(0,i)!==n.domain)return{ok:!1,reason:"wrong_domain",target:r};const a=t?.states?.[r];return a?bt.has(a.state)?{ok:!1,reason:"unavailable",target:r}:n.numeric&&isNaN(parseFloat(a.state))?{ok:!1,reason:"not_numeric",target:r}:{ok:!0,entity:a}:{ok:!1,reason:"not_found",target:r}}const $t={comma_decimal:"en-US",decimal_comma:"de-DE",space_comma:"fr-FR",system:void 0};function wt(t,e,n){if(isNaN(t))return String(t);if("none"===e?.locale?.number_format)return String(t);try{return new Intl.NumberFormat(function(t){const e=t?.locale?.number_format;return e&&e in $t?$t[e]:t?.locale?.language||t?.language||void 0}(e),n).format(t)}catch{return String(t)}}function Mt(t,e,n){if(isNaN(t.getTime()))return"";try{return new Intl.DateTimeFormat(e?.language||void 0,n).format(t)}catch{return t.toISOString()}}function At(t,e){return Mt(t,e,{month:"short",day:"numeric"})}function St(t){return!isNaN(parseFloat(String(t)))}function Tt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ct(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Nt(t){let e,n,r;function i(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<0?i=e+1:a=e}while(i<a)}return i}return 2!==t.length?(e=Tt,n=(e,n)=>Tt(t(e),n),r=(e,n)=>t(e)-n):(e=t===Tt||t===Ct?t:kt,n=t,r=t),{left:i,center:function(t,e,n=0,a=t.length){const s=i(t,e,n,a-1);return s>n&&r(t[s-1],e)>-r(t[s],e)?s-1:s},right:function(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<=0?i=e+1:a=e}while(i<a)}return i}}}function kt(){return 0}const Et=Nt(Tt).right;function Dt(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(void 0===n?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}Nt(function(t){return null===t?NaN:+t}).center;const Ut=Math.sqrt(50),Pt=Math.sqrt(10),Ot=Math.sqrt(2);function Ft(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),s=a>=Ut?10:a>=Pt?5:a>=Ot?2:1;let o,c,l;return i<0?(l=Math.pow(10,-i)/s,o=Math.round(t*l),c=Math.round(e*l),o/l<t&&++o,c/l>e&&--c,l=-l):(l=Math.pow(10,i)*s,o=Math.round(t/l),c=Math.round(e/l),o*l<t&&++o,c*l>e&&--c),c<o&&.5<=n&&n<2?Ft(t,e,2*n):[o,c,l]}function Ht(t,e,n){return Ft(t=+t,e=+e,n=+n)[2]}function Lt(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?Ht(e,t,n):Ht(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function zt(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function jt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Rt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Yt(){}var qt=.7,It=1/qt,Wt="\\s*([+-]?\\d+)\\s*",Zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Bt=/^#([0-9a-f]{3,8})$/,Gt=new RegExp(`^rgb\\(${Wt},${Wt},${Wt}\\)$`),Xt=new RegExp(`^rgb\\(${Vt},${Vt},${Vt}\\)$`),Jt=new RegExp(`^rgba\\(${Wt},${Wt},${Wt},${Zt}\\)$`),Qt=new RegExp(`^rgba\\(${Vt},${Vt},${Vt},${Zt}\\)$`),Kt=new RegExp(`^hsl\\(${Zt},${Vt},${Vt}\\)$`),te=new RegExp(`^hsla\\(${Zt},${Vt},${Vt},${Zt}\\)$`),ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ne(){return this.rgb().formatHex()}function re(){return this.rgb().formatRgb()}function ie(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Bt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?ae(e):3===n?new ce(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?se(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?se(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Gt.exec(t))?new ce(e[1],e[2],e[3],1):(e=Xt.exec(t))?new ce(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Jt.exec(t))?se(e[1],e[2],e[3],e[4]):(e=Qt.exec(t))?se(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Kt.exec(t))?fe(e[1],e[2]/100,e[3]/100,1):(e=te.exec(t))?fe(e[1],e[2]/100,e[3]/100,e[4]):ee.hasOwnProperty(t)?ae(ee[t]):"transparent"===t?new ce(NaN,NaN,NaN,0):null}function ae(t){return new ce(t>>16&255,t>>8&255,255&t,1)}function se(t,e,n,r){return r<=0&&(t=e=n=NaN),new ce(t,e,n,r)}function oe(t,e,n,r){return 1===arguments.length?function(t){return t instanceof Yt||(t=ie(t)),t?new ce((t=t.rgb()).r,t.g,t.b,t.opacity):new ce}(t):new ce(t,e,n,null==r?1:r)}function ce(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function le(){return`#${pe(this.r)}${pe(this.g)}${pe(this.b)}`}function ue(){const t=he(this.opacity);return`${1===t?"rgb(":"rgba("}${de(this.r)}, ${de(this.g)}, ${de(this.b)}${1===t?")":`, ${t})`}`}function he(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function de(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function pe(t){return((t=de(t))<16?"0":"")+t.toString(16)}function fe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new me(t,e,n,r)}function ge(t){if(t instanceof me)return new me(t.h,t.s,t.l,t.opacity);if(t instanceof Yt||(t=ie(t)),!t)return new me;if(t instanceof me)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),s=NaN,o=a-i,c=(a+i)/2;return o?(s=e===a?(n-r)/o+6*(n<r):n===a?(r-e)/o+2:(e-n)/o+4,o/=c<.5?a+i:2-a-i,s*=60):o=c>0&&c<1?0:s,new me(s,o,c,t.opacity)}function me(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function _e(t){return(t=(t||0)%360)<0?t+360:t}function ye(t){return Math.max(0,Math.min(1,t||0))}function ve(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}jt(Yt,ie,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ne,formatHex:ne,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ge(this).formatHsl()},formatRgb:re,toString:re}),jt(ce,oe,Rt(Yt,{brighter(t){return t=null==t?It:Math.pow(It,t),new ce(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?qt:Math.pow(qt,t),new ce(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ce(de(this.r),de(this.g),de(this.b),he(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:le,formatHex:le,formatHex8:function(){return`#${pe(this.r)}${pe(this.g)}${pe(this.b)}${pe(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ue,toString:ue})),jt(me,function(t,e,n,r){return 1===arguments.length?ge(t):new me(t,e,n,null==r?1:r)},Rt(Yt,{brighter(t){return t=null==t?It:Math.pow(It,t),new me(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?qt:Math.pow(qt,t),new me(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new ce(ve(t>=240?t-240:t+120,i,r),ve(t,i,r),ve(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new me(_e(this.h),ye(this.s),ye(this.l),he(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=he(this.opacity);return`${1===t?"hsl(":"hsla("}${_e(this.h)}, ${100*ye(this.s)}%, ${100*ye(this.l)}%${1===t?")":`, ${t})`}`}}));var be=t=>()=>t;function xe(t){return 1===(t=+t)?$e:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):be(isNaN(e)?n:e)}}function $e(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):be(isNaN(t)?e:t)}var we=function t(e){var n=xe(e);function r(t,e){var r=n((t=oe(t)).r,(e=oe(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),s=$e(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function Me(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(a){for(n=0;n<r;++n)i[n]=t[n]*(1-a)+e[n]*a;return i}}function Ae(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),s=new Array(r);for(n=0;n<i;++n)a[n]=De(t[n],e[n]);for(;n<r;++n)s[n]=e[n];return function(t){for(n=0;n<i;++n)s[n]=a[n](t);return s}}function Se(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Te(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Ce(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=De(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var Ne=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ke=new RegExp(Ne.source,"g");function Ee(t,e){var n,r,i,a=Ne.lastIndex=ke.lastIndex=0,s=-1,o=[],c=[];for(t+="",e+="";(n=Ne.exec(t))&&(r=ke.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),o[s]?o[s]+=i:o[++s]=i),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,c.push({i:s,x:Te(n,r)})),a=ke.lastIndex;return a<e.length&&(i=e.slice(a),o[s]?o[s]+=i:o[++s]=i),o.length<2?c[0]?function(t){return function(e){return t(e)+""}}(c[0].x):function(t){return function(){return t}}(e):(e=c.length,function(t){for(var n,r=0;r<e;++r)o[(n=c[r]).i]=n.x(t);return o.join("")})}function De(t,e){var n,r=typeof e;return null==e||"boolean"===r?be(e):("number"===r?Te:"string"===r?(n=ie(e))?(e=n,we):Ee:e instanceof ie?we:e instanceof Date?Se:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Me:Array.isArray(e)?Ae:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Ce:Te)(t,e)}function Ue(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Pe(t){return+t}var Oe=[0,1];function Fe(t){return t}function He(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Le(t,e,n){var r=t[0],i=t[1],a=e[0],s=e[1];return i<r?(r=He(i,r),a=n(s,a)):(r=He(r,i),a=n(a,s)),function(t){return a(r(t))}}function ze(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=He(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(e){var n=Et(t,e,1,r)-1;return a[n](i[n](e))}}function je(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Re(){var t,e,n,r,i,a,s=Oe,o=Oe,c=De,l=Fe;function u(){var t=Math.min(s.length,o.length);return l!==Fe&&(l=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(s[0],s[t-1])),r=t>2?ze:Le,i=a=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(s.map(t),o,c)))(t(l(e)))}return h.invert=function(n){return l(e((a||(a=r(o,s.map(t),Te)))(n)))},h.domain=function(t){return arguments.length?(s=Array.from(t,Pe),u()):s.slice()},h.range=function(t){return arguments.length?(o=Array.from(t),u()):o.slice()},h.rangeRound=function(t){return o=Array.from(t),c=Ue,u()},h.clamp=function(t){return arguments.length?(l=!!t||Fe,u()):l!==Fe},h.interpolate=function(t){return arguments.length?(c=t,u()):c},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}function Ye(){return Re()(Fe,Fe)}function qe(t,e){if(!isFinite(t)||0===t)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ie(t){return(t=qe(Math.abs(t)))?t[1]:NaN}var We,Ze=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ve(t){if(!(e=Ze.exec(t)))throw new Error("invalid format: "+t);var e;return new Be({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Be(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Ge(t,e){var n=qe(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Ve.prototype=Be.prototype,Be.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Xe={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ge(100*t,e),r:Ge,s:function(t,e){var n=qe(t,e);if(!n)return We=void 0,t.toPrecision(e);var r=n[0],i=n[1],a=i-(We=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return a===s?r:a>s?r+new Array(a-s+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+qe(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Je(t){return t}var Qe,Ke,tn,en=Array.prototype.map,nn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function rn(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Je:(e=en.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],s=0,o=e[0],c=0;i>0&&o>0&&(c+o+1>r&&(o=Math.max(1,r-c)),a.push(t.substring(i-=o,i+o)),!((c+=o+1)>r));)o=e[s=(s+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",s=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Je:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(en.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t,e){var n=(t=Ve(t)).fill,h=t.align,d=t.sign,p=t.symbol,f=t.zero,g=t.width,m=t.comma,_=t.precision,y=t.trim,v=t.type;"n"===v?(m=!0,v="g"):Xe[v]||(void 0===_&&(_=12),y=!0,v="g"),(f||"0"===n&&"="===h)&&(f=!0,n="0",h="=");var b=(e&&void 0!==e.prefix?e.prefix:"")+("$"===p?i:"#"===p&&/[boxX]/.test(v)?"0"+v.toLowerCase():""),x=("$"===p?a:/[%p]/.test(v)?c:"")+(e&&void 0!==e.suffix?e.suffix:""),$=Xe[v],w=/[defgprs%]/.test(v);function M(t){var e,i,a,c=b,p=x;if("c"===v)p=$(t)+p,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:$(Math.abs(t),_),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),M&&0===+t&&"+"!==d&&(M=!1),c=(M?"("===d?d:l:"-"===d||"("===d?"":d)+c,p=("s"!==v||isNaN(t)||void 0===We?"":nn[8+We/3])+p+(M&&"("===d?")":""),w)for(e=-1,i=t.length;++e<i;)if(48>(a=t.charCodeAt(e))||a>57){p=(46===a?s+t.slice(e+1):t.slice(e))+p,t=t.slice(0,e);break}}m&&!f&&(t=r(t,1/0));var A=c.length+t.length+p.length,S=A<g?new Array(g-A+1).join(n):"";switch(m&&f&&(t=r(S+t,S.length?g-p.length:1/0),S=""),h){case"<":t=c+t+p+S;break;case"=":t=c+S+t+p;break;case"^":t=S.slice(0,A=S.length>>1)+c+t+p+S.slice(A);break;default:t=S+c+t+p}return o(t)}return _=void 0===_?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,e){var n=3*Math.max(-8,Math.min(8,Math.floor(Ie(e)/3))),r=Math.pow(10,-n),i=h(((t=Ve(t)).type="f",t),{suffix:nn[8+n/3]});return function(t){return i(r*t)}}}}function an(t,e,n,r){var i,a=Lt(t,e,n);switch((r=Ve(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ie(e)/3)))-Ie(Math.abs(t)))}(a,s))||(r.precision=i),tn(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ie(e)-Ie(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Ie(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Ke(r)}function sn(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[i,a,s]=r?Ft(e,t,n):Ft(t,e,n);if(!(a>=i))return[];const o=a-i+1,c=new Array(o);if(r)if(s<0)for(let t=0;t<o;++t)c[t]=(a-t)/-s;else for(let t=0;t<o;++t)c[t]=(a-t)*s;else if(s<0)for(let t=0;t<o;++t)c[t]=(i+t)/-s;else for(let t=0;t<o;++t)c[t]=(i+t)*s;return c}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return an(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,a=e(),s=0,o=a.length-1,c=a[s],l=a[o],u=10;for(l<c&&(i=c,c=l,l=i,i=s,s=o,o=i);u-- >0;){if((i=Ht(c,l,n))===r)return a[s]=c,a[o]=l,e(a);if(i>0)c=Math.floor(c/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;c=Math.ceil(c*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function on(){var t=Ye();return t.copy=function(){return je(t,on())},zt.apply(t,arguments),sn(t)}Qe=rn({thousands:",",grouping:[3],currency:["$",""]}),Ke=Qe.format,tn=Qe.formatPrefix;const cn=new Date,ln=new Date;function un(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,a)=>{const s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return s;let o;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o<n&&n<r);return s},i.filter=n=>un(e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},(t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}),n&&(i.count=(e,r)=>(cn.setTime(+e),ln.setTime(+r),t(cn),t(ln),Math.floor(n(cn,ln))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t===0:e=>i.count(0,e)%t===0):i:null)),i}const hn=un(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);hn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?un(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):hn:null),hn.range;const dn=1e3,pn=6e4,fn=36e5,gn=864e5,mn=6048e5,_n=2592e6,yn=31536e6,vn=un(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*dn)},(t,e)=>(e-t)/dn,t=>t.getUTCSeconds());vn.range;const bn=un(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*dn)},(t,e)=>{t.setTime(+t+e*pn)},(t,e)=>(e-t)/pn,t=>t.getMinutes());bn.range;const xn=un(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*pn)},(t,e)=>(e-t)/pn,t=>t.getUTCMinutes());xn.range;const $n=un(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*dn-t.getMinutes()*pn)},(t,e)=>{t.setTime(+t+e*fn)},(t,e)=>(e-t)/fn,t=>t.getHours());$n.range;const wn=un(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*fn)},(t,e)=>(e-t)/fn,t=>t.getUTCHours());wn.range;const Mn=un(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pn)/gn,t=>t.getDate()-1);Mn.range;const An=un(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/gn,t=>t.getUTCDate()-1);An.range;const Sn=un(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/gn,t=>Math.floor(t/gn));function Tn(t){return un(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pn)/mn)}Sn.range;const Cn=Tn(0),Nn=Tn(1),kn=Tn(2),En=Tn(3),Dn=Tn(4),Un=Tn(5),Pn=Tn(6);function On(t){return un(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/mn)}Cn.range,Nn.range,kn.range,En.range,Dn.range,Un.range,Pn.range;const Fn=On(0),Hn=On(1),Ln=On(2),zn=On(3),jn=On(4),Rn=On(5),Yn=On(6);Fn.range,Hn.range,Ln.range,zn.range,jn.range,Rn.range,Yn.range;const qn=un(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),t=>t.getMonth());qn.range;const In=un(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth());In.range;const Wn=un(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Wn.every=t=>isFinite(t=Math.floor(t))&&t>0?un(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}):null,Wn.range;const Zn=un(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Zn.every=t=>isFinite(t=Math.floor(t))&&t>0?un(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null,Zn.range;const[Vn,Bn]=function(t,e,n,r,i,a){const s=[[vn,1,dn],[vn,5,5e3],[vn,15,15e3],[vn,30,3e4],[a,1,pn],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,fn],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,gn],[r,2,1728e5],[n,1,mn],[e,1,_n],[e,3,7776e6],[t,1,yn]];function o(e,n,r){const i=Math.abs(n-e)/r,a=Nt(([,,t])=>t).right(s,i);if(a===s.length)return t.every(Lt(e/yn,n/yn,r));if(0===a)return hn.every(Math.max(Lt(e,n,r),1));const[o,c]=s[i/s[a-1][2]<s[a][2]/i?a-1:a];return o.every(c)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:o(t,e,n),a=i?i.range(t,+e+1):[];return r?a.reverse():a},o]}(Wn,qn,Cn,Mn,$n,bn);function Gn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Xn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Jn(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var Qn,Kn,tr={"-":"",_:" ",0:"0"},er=/^\s*\d+/,nr=/^%/,rr=/[\\^$*+?|[\]().{}]/g;function ir(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function ar(t){return t.replace(rr,"\\$&")}function sr(t){return new RegExp("^(?:"+t.map(ar).join("|")+")","i")}function or(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function cr(t,e,n){var r=er.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function lr(t,e,n){var r=er.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ur(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function hr(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function dr(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function pr(t,e,n){var r=er.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function fr(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function gr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function mr(t,e,n){var r=er.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function _r(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function yr(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function vr(t,e,n){var r=er.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function br(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function xr(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=er.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function wr(t,e,n){var r=er.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Mr(t,e,n){var r=er.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ar(t,e,n){var r=nr.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Sr(t,e,n){var r=er.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Tr(t,e,n){var r=er.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Cr(t,e){return ir(t.getDate(),e,2)}function Nr(t,e){return ir(t.getHours(),e,2)}function kr(t,e){return ir(t.getHours()%12||12,e,2)}function Er(t,e){return ir(1+Mn.count(Wn(t),t),e,3)}function Dr(t,e){return ir(t.getMilliseconds(),e,3)}function Ur(t,e){return Dr(t,e)+"000"}function Pr(t,e){return ir(t.getMonth()+1,e,2)}function Or(t,e){return ir(t.getMinutes(),e,2)}function Fr(t,e){return ir(t.getSeconds(),e,2)}function Hr(t){var e=t.getDay();return 0===e?7:e}function Lr(t,e){return ir(Cn.count(Wn(t)-1,t),e,2)}function zr(t){var e=t.getDay();return e>=4||0===e?Dn(t):Dn.ceil(t)}function jr(t,e){return t=zr(t),ir(Dn.count(Wn(t),t)+(4===Wn(t).getDay()),e,2)}function Rr(t){return t.getDay()}function Yr(t,e){return ir(Nn.count(Wn(t)-1,t),e,2)}function qr(t,e){return ir(t.getFullYear()%100,e,2)}function Ir(t,e){return ir((t=zr(t)).getFullYear()%100,e,2)}function Wr(t,e){return ir(t.getFullYear()%1e4,e,4)}function Zr(t,e){var n=t.getDay();return ir((t=n>=4||0===n?Dn(t):Dn.ceil(t)).getFullYear()%1e4,e,4)}function Vr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ir(e/60|0,"0",2)+ir(e%60,"0",2)}function Br(t,e){return ir(t.getUTCDate(),e,2)}function Gr(t,e){return ir(t.getUTCHours(),e,2)}function Xr(t,e){return ir(t.getUTCHours()%12||12,e,2)}function Jr(t,e){return ir(1+An.count(Zn(t),t),e,3)}function Qr(t,e){return ir(t.getUTCMilliseconds(),e,3)}function Kr(t,e){return Qr(t,e)+"000"}function ti(t,e){return ir(t.getUTCMonth()+1,e,2)}function ei(t,e){return ir(t.getUTCMinutes(),e,2)}function ni(t,e){return ir(t.getUTCSeconds(),e,2)}function ri(t){var e=t.getUTCDay();return 0===e?7:e}function ii(t,e){return ir(Fn.count(Zn(t)-1,t),e,2)}function ai(t){var e=t.getUTCDay();return e>=4||0===e?jn(t):jn.ceil(t)}function si(t,e){return t=ai(t),ir(jn.count(Zn(t),t)+(4===Zn(t).getUTCDay()),e,2)}function oi(t){return t.getUTCDay()}function ci(t,e){return ir(Hn.count(Zn(t)-1,t),e,2)}function li(t,e){return ir(t.getUTCFullYear()%100,e,2)}function ui(t,e){return ir((t=ai(t)).getUTCFullYear()%100,e,2)}function hi(t,e){return ir(t.getUTCFullYear()%1e4,e,4)}function di(t,e){var n=t.getUTCDay();return ir((t=n>=4||0===n?jn(t):jn.ceil(t)).getUTCFullYear()%1e4,e,4)}function pi(){return"+0000"}function fi(){return"%"}function gi(t){return+t}function mi(t){return Math.floor(+t/1e3)}function _i(t){return new Date(t)}function yi(t){return t instanceof Date?+t:+new Date(+t)}function vi(t,e,n,r,i,a,s,o,c,l){var u=Ye(),h=u.invert,d=u.domain,p=l(".%L"),f=l(":%S"),g=l("%I:%M"),m=l("%I %p"),_=l("%a %d"),y=l("%b %d"),v=l("%B"),b=l("%Y");function x(t){return(c(t)<t?p:o(t)<t?f:s(t)<t?g:a(t)<t?m:r(t)<t?i(t)<t?_:y:n(t)<t?v:b)(t)}return u.invert=function(t){return new Date(h(t))},u.domain=function(t){return arguments.length?d(Array.from(t,yi)):d().map(_i)},u.ticks=function(e){var n=d();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?x:l(e)},u.nice=function(t){var n=d();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?d(function(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],s=t[i];return s<a&&(n=r,r=i,i=n,n=a,a=s,s=n),t[r]=e.floor(a),t[i]=e.ceil(s),t}(n,t)):u},u.copy=function(){return je(u,vi(t,e,n,r,i,a,s,o,c,l))},u}function bi(){return zt.apply(vi(Vn,Bn,Wn,qn,Cn,Mn,$n,bn,vn,Kn).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function xi(t){return function(){return t}}!function(t){Qn=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,s=t.shortDays,o=t.months,c=t.shortMonths,l=sr(i),u=or(i),h=sr(a),d=or(a),p=sr(s),f=or(s),g=sr(o),m=or(o),_=sr(c),y=or(c),v={a:function(t){return s[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Cr,e:Cr,f:Ur,g:Ir,G:Zr,H:Nr,I:kr,j:Er,L:Dr,m:Pr,M:Or,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:gi,s:mi,S:Fr,u:Hr,U:Lr,V:jr,w:Rr,W:Yr,x:null,X:null,y:qr,Y:Wr,Z:Vr,"%":fi},b={a:function(t){return s[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:Br,e:Br,f:Kr,g:ui,G:di,H:Gr,I:Xr,j:Jr,L:Qr,m:ti,M:ei,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:gi,s:mi,S:ni,u:ri,U:ii,V:si,w:oi,W:ci,x:null,X:null,y:li,Y:hi,Z:pi,"%":fi},x={a:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=_.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return M(t,e,n,r)},d:yr,e:yr,f:Mr,g:fr,G:pr,H:br,I:br,j:vr,L:wr,m:_r,M:xr,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:mr,Q:Sr,s:Tr,S:$r,u:lr,U:ur,V:hr,w:cr,W:dr,x:function(t,e,r){return M(t,n,e,r)},X:function(t,e,n){return M(t,r,e,n)},y:fr,Y:pr,Z:gr,"%":Ar};function $(t,e){return function(n){var r,i,a,s=[],o=-1,c=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++o<l;)37===t.charCodeAt(o)&&(s.push(t.slice(c,o)),null!=(i=tr[r=t.charAt(++o)])?r=t.charAt(++o):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),s.push(r),c=o+1);return s.push(t.slice(c,o)),s.join("")}}function w(t,e){return function(n){var r,i,a=Jn(1900,void 0,1);if(M(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(e&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=Xn(Jn(a.y,0,1))).getUTCDay(),r=i>4||0===i?Hn.ceil(r):Hn(r),r=An.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=Gn(Jn(a.y,0,1))).getDay(),r=i>4||0===i?Nn.ceil(r):Nn(r),r=Mn.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?Xn(Jn(a.y,0,1)).getUTCDay():Gn(Jn(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Xn(a)):Gn(a)}}function M(t,e,n,r){for(var i,a,s=0,o=e.length,c=n.length;s<o;){if(r>=c)return-1;if(37===(i=e.charCodeAt(s++))){if(i=e.charAt(s++),!(a=x[i in tr?e.charAt(s++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return v.x=$(n,v),v.X=$(r,v),v.c=$(e,v),b.x=$(n,b),b.X=$(r,b),b.c=$(e,b),{format:function(t){var e=$(t+="",v);return e.toString=function(){return t},e},parse:function(t){var e=w(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=$(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=w(t+="",!0);return e.toString=function(){return t},e}}}(t),Kn=Qn.format,Qn.parse,Qn.utcFormat,Qn.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});const $i=Math.PI,wi=2*$i,Mi=1e-6,Ai=wi-Mi;function Si(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class Ti{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Si:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Si;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,a){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let a=this._x1,s=this._y1,o=n-t,c=r-e,l=a-t,u=s-e,h=l*l+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>Mi)if(Math.abs(u*o-c*l)>Mi&&i){let d=n-a,p=r-s,f=o*o+c*c,g=d*d+p*p,m=Math.sqrt(f),_=Math.sqrt(h),y=i*Math.tan(($i-Math.acos((f+h-g)/(2*m*_)))/2),v=y/_,b=y/m;Math.abs(v-1)>Mi&&this._append`L${t+v*l},${e+v*u}`,this._append`A${i},${i},0,0,${+(u*d>l*p)},${this._x1=t+b*o},${this._y1=e+b*c}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,a){if(t=+t,e=+e,a=!!a,(n=+n)<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(r),o=n*Math.sin(r),c=t+s,l=e+o,u=1^a,h=a?r-i:i-r;null===this._x1?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Mi||Math.abs(this._y1-l)>Mi)&&this._append`L${c},${l}`,n&&(h<0&&(h=h%wi+wi),h>Ai?this._append`A${n},${n},0,1,${u},${t-s},${e-o}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:h>Mi&&this._append`A${n},${n},0,${+(h>=$i)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}}function Ci(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ti(e)}function Ni(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ki(t){this._context=t}function Ei(t){return new ki(t)}function Di(t){return t[0]}function Ui(t){return t[1]}function Pi(t,e){var n=xi(!0),r=null,i=Ei,a=null,s=Ci(o);function o(o){var c,l,u,h=(o=Ni(o)).length,d=!1;for(null==r&&(a=i(u=s())),c=0;c<=h;++c)!(c<h&&n(l=o[c],c,o))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+t(l,c,o),+e(l,c,o));if(u)return a=null,u+""||null}return t="function"==typeof t?t:void 0===t?Di:xi(t),e="function"==typeof e?e:void 0===e?Ui:xi(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:xi(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:xi(+t),o):e},o.defined=function(t){return arguments.length?(n="function"==typeof t?t:xi(!!t),o):n},o.curve=function(t){return arguments.length?(i=t,null!=r&&(a=i(r)),o):i},o.context=function(t){return arguments.length?(null==t?r=a=null:a=i(r=t),o):r},o}function Oi(t,e,n){var r=null,i=xi(!0),a=null,s=Ei,o=null,c=Ci(l);function l(l){var u,h,d,p,f,g=(l=Ni(l)).length,m=!1,_=new Array(g),y=new Array(g);for(null==a&&(o=s(f=c())),u=0;u<=g;++u){if(!(u<g&&i(p=l[u],u,l))===m)if(m=!m)h=u,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),d=u-1;d>=h;--d)o.point(_[d],y[d]);o.lineEnd(),o.areaEnd()}m&&(_[u]=+t(p,u,l),y[u]=+e(p,u,l),o.point(r?+r(p,u,l):_[u],n?+n(p,u,l):y[u]))}if(f)return o=null,f+""||null}function u(){return Pi().defined(i).curve(s).context(a)}return t="function"==typeof t?t:void 0===t?Di:xi(+t),e="function"==typeof e?e:xi(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Ui:xi(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:xi(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:xi(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:xi(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:xi(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:xi(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:xi(+t),l):n},l.lineX0=l.lineY0=function(){return u().x(t).y(e)},l.lineY1=function(){return u().x(t).y(n)},l.lineX1=function(){return u().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:xi(!!t),l):i},l.curve=function(t){return arguments.length?(s=t,null!=a&&(o=s(a)),l):s},l.context=function(t){return arguments.length?(null==t?a=o=null:o=s(a=t),l):a},l}function Fi(t){return t<0?-1:1}function Hi(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(Fi(a)+Fi(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function Li(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function zi(t,e,n){var r=t._x0,i=t._y0,a=t._x1,s=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*e,a-o,s-o*n,a,s)}function ji(t){this._context=t}function Ri(t){return new ji(t)}function Yi(t,e){this._context=t,this._t=e}function qi(t){return new Yi(t,1)}ki.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},ji.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:zi(this,this._t0,Li(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,zi(this,Li(this,n=Hi(this,t,e)),n);break;default:zi(this,this._t0,n=Hi(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},Object.create(ji.prototype).point=function(t,e){ji.prototype.point.call(this,e,t)},Yi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};const Ii=o`:host{display:block}:host ::slotted(.card-content),.card-content{display:flex;flex-direction:column;gap:12px;padding:16px}.place-row{padding-bottom:16px;border-bottom:1px solid var(--divider-color, #eee)}.place-row:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0}.place-row .chart-container{margin-top:16px;width:100%;height:120px;background:rgba(var(--rgb-primary-color, 0, 119, 190), 0.03);border-radius:8px;overflow:hidden}.place-row svg{width:100%;height:100%;display:block}.place-row .ref-line{stroke-dasharray:4,4;stroke-width:1;opacity:.5}.place-row .ref-line.min{stroke:#41bdf5}.place-row .ref-line.max{stroke:#ff9800}.place-row .ref-line.avg{stroke:var(--primary-color, #0077be);stroke-dasharray:none;opacity:.3}.place-row .chart-line{stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 2px 4px rgba(var(--rgb-primary-color, 0, 119, 190), 0.2))}.place-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;cursor:pointer;transition:opacity .2s ease;border-radius:6px}.place-header:hover{opacity:.7}.place-header:focus-visible{outline:2px solid var(--primary-color, #0077be);outline-offset:2px}.place-info{display:flex;flex-direction:column;min-width:0}.last-updated{font-size:.75rem;color:var(--secondary-text-color);margin-top:4px}.place-name-container{display:flex;align-items:baseline;gap:6px;min-width:0}.place-name{font-size:1.2rem;font-weight:500;color:var(--primary-text-color)}.place-country{font-size:.85rem;color:var(--secondary-text-color);font-weight:400}.current-temp{display:flex;align-items:baseline;gap:4px;flex:0 0 auto;white-space:nowrap}.temp-value{font-size:2rem;font-weight:700;color:var(--primary-color, #0077be)}.temp-value.unavailable{color:var(--disabled-text-color, var(--secondary-text-color))}.temp-unit{font-size:1rem;font-weight:500;color:var(--secondary-text-color)}.stats-grid,.averages-grid{display:grid;grid-template-columns:repeat(3, 1fr);gap:8px;margin-top:8px}.stat-item{display:flex;flex-direction:column;align-items:center;background:var(--card-background-color);padding:8px;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,.05)}.stat-label{font-size:.75rem;text-transform:uppercase;color:var(--secondary-text-color);margin-bottom:4px}.stat-value{font-size:.9rem;font-weight:600}.stat-delta{font-size:.75rem;font-weight:500;margin-top:2px}.stat-delta.pos{color:var(--success-color, #4caf50)}.stat-delta.neg{color:var(--error-color, #db4437)}.stat-delta.neu{color:var(--secondary-text-color)}.averages-section{margin-top:16px;padding-top:12px;border-top:1px dashed var(--divider-color)}.averages-header{font-size:.85rem;font-weight:600;color:var(--secondary-text-color);margin-bottom:8px;text-align:center}.current-trend{font-size:1rem;margin-left:8px;margin-top:0}.warning{color:var(--error-color);padding:8px;text-align:center}.entity-warning{display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;color:var(--warning-color, #ffa600);font-size:.9rem;text-align:center}.entity-warning ha-icon{flex:0 0 auto;--mdc-icon-size: 20px}.ref-label{font-size:8px;font-weight:500;fill:var(--secondary-text-color);dominant-baseline:middle}.ref-label.min{fill:#41bdf5}.ref-label.max{fill:#ff9800}.ref-label.avg{fill:var(--primary-color, #0077be)}.axis-label{font-size:8px;fill:var(--secondary-text-color);opacity:.7}.now-dot{filter:drop-shadow(0 1px 2px rgba(var(--rgb-primary-color, 0, 119, 190), 0.3))}.extrema-dot{filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2))}.extrema-dot.min{fill:#41bdf5}.extrema-dot.max{fill:#ff9800}.hover-group{pointer-events:none;transition:opacity .2s ease-in-out}.hover-line{stroke:var(--secondary-text-color);stroke-width:1;stroke-dasharray:2,2;opacity:.5}.hover-point{fill:var(--card-background-color);stroke:var(--primary-color, #0077be);stroke-width:2}.hover-tooltip-bg{fill:var(--card-background-color);stroke:var(--divider-color, #eee);stroke-width:1;opacity:.95;filter:drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))}.hover-tooltip-text{fill:var(--primary-text-color);font-size:10px;font-weight:bold}.hover-tooltip-date{fill:var(--secondary-text-color);font-size:8px}.hover-overlay{cursor:crosshair;touch-action:pan-y}ha-card.narrow .card-content{padding:12px;gap:8px}ha-card.narrow .place-row{padding-bottom:12px}ha-card.narrow .place-row .chart-container{margin-top:12px}ha-card.narrow .place-name{font-size:1.05rem}ha-card.narrow .place-name-container{flex-wrap:wrap;overflow-wrap:anywhere}ha-card.narrow .current-trend{margin-left:4px}ha-card.narrow .temp-value{font-size:1.6rem}ha-card.narrow .stats-grid{gap:6px;margin-top:6px}ha-card.narrow .stat-item{padding:6px 4px;border-radius:6px}ha-card.narrow .stat-label{font-size:.65rem;margin-bottom:2px}ha-card.narrow .stat-value{font-size:.8rem}ha-card.narrow .ref-label{font-size:7px}ha-card.narrow .axis-label{font-size:7px}`,Wi="sea-temperatures-card",Zi=`${Wi}-editor`;class Vi extends ut{constructor(){super(...arguments),this._chartData={},this._chartWidth=400,this._chartSources={}}setConfig(t){if(!t||!Array.isArray(t.places))throw new Error("You need to define at least one place.");this._config={show_last_updated:!0,show_trend:!0,show_stats:!0,show_chart:!0,show_country:!1,chart_smoothing:"smooth",...t}}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{for(const e of t)if(e.contentRect.width>0){const t=Math.max(200,e.contentRect.width-32);this._chartWidth!==t&&(this._chartWidth=t)}}),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect()}static async getConfigElement(){return await Promise.resolve().then(function(){return ea}),document.createElement(Zi)}static getStubConfig(t,e){const n=[...e??[],...Object.keys(t?.states??{})].find(e=>Vi._isSuitablePlace(t,e));return{places:n?[n]:[]}}static _isSuitablePlace(t,e){const n=xt(t,e,{domain:"sensor",numeric:!0});if(!n.ok)return!1;const r=n.entity.attributes;return void 0!==r.yesterday||void 0!==r.charts}getCardSize(){return Math.max(1,Math.ceil(this._contentHeight()/50))}getGridOptions(){return{columns:"full",min_columns:6,rows:"auto",min_rows:2}}_contentHeight(){const t=this._config;if(!t)return 94;const e=this.hass?this._getPlacesData(this.hass,t):void 0,n=Math.max(e?.length??t.places?.length??1,1);let r=32;t.title&&(r+=68);for(let i=0;i<n;i++){const n=e?.[i];i>0&&(r+=28),n?.problem?r+=40:(r+=62,!1!==t.show_stats&&this._hasStats(n)&&(r+=57),!1!==t.show_chart&&this._hasChart(n)&&(r+=136))}return r}_hasStats(t){return!t||[t.yesterday,t.last_week,t.average_avg].some(t=>void 0!==t)}_hasChart(t){if(!t)return!0;const e=this._chartData[t.entity_id];if(e)return e.length>=2;const n=this.hass?.states[t.entity_id]?.attributes?.charts;return(n?.last_thirty?.labels?.length??0)>=2}_getPlacesData(t,e){const n=this._placesMemo;if(n&&n.states===t.states&&n.entities===t.entities&&n.devices===t.devices&&n.config===e)return n.places;const r=this._computePlacesData(t,e);return this._placesMemo={states:t.states,entities:t.entities,devices:t.devices,config:e,places:r},r}_problemPlace(t,e,n){return{name:e||t,temperature:"",entity_id:t,unavailable:!0,problem:n}}_computePlacesData(t,e){const n=[],r=Object.values(t.states);return e.places.forEach(i=>{const a="string"==typeof i?i:i.device,s="object"==typeof i?i.name:void 0;let o,c;if(a&&a.includes(".")){const e=xt(t,a,{domain:"sensor",numeric:!0});if(!e.ok&&"unavailable"!==e.reason)return void n.push(this._problemPlace(a,s,e.reason));o=t.states[a],c=t.entities[a]?.device_id}else{c=a;const e=r.filter(e=>t.entities[e.entity_id]?.device_id===c&&e.entity_id.startsWith("sensor."));if(0===e.length)return void n.push(this._problemPlace(a,s,"not_found"));o=e.find(t=>void 0!==t.attributes.yesterday)||e.find(t=>"°C"===t.attributes.unit_of_measurement||"°F"===t.attributes.unit_of_measurement)||e[0]}if(o){const r=xt(t,o.entity_id,{domain:"sensor",numeric:!0});if(!r.ok&&"unavailable"!==r.reason)return void n.push(this._problemPlace(o.entity_id,s,r.reason));const i=o.attributes,a="unavailable"===o.state||"unknown"===o.state,l=c?t.devices[c]:void 0,u=l?.name_by_user||l?.name||i.friendly_name||"Unknown",h="°F"===i.unit_of_measurement||"F"===i.unit_of_measurement,d=t=>{if(null==t||isNaN(parseFloat(String(t))))return;const e=parseFloat(String(t));return String(h?Math.round(100*(1.8*e+32))/100:e)};n.push({name:s||u,country:e.show_country&&i.country?String(i.country):void 0,temperature:o.state,yesterday:d(i.yesterday),last_week:d(i.last_week),date:i.date?String(i.date):void 0,average_min:d(i.average_min),average_max:d(i.average_max),average_avg:d(i.average_avg),unit:i.unit_of_measurement||"°C",entity_id:o.entity_id,unavailable:a})}}),e.sort_by&&n.sort((t,n)=>{if("name"===e.sort_by)return t.name.localeCompare(n.name);if("temp_asc"===e.sort_by||"temp_desc"===e.sort_by){const r=parseFloat(t.temperature),i=parseFloat(n.temperature),a=isNaN(r)?null:r,s=isNaN(i)?null:i;return null===a||null===s?a===s?0:null===a?1:-1:"temp_asc"===e.sort_by?a-s:s-a}return 0}),n}willUpdate(){this.hass&&this._config&&this._chartSourcesChanged()&&this._fetchChartData()}_chartSourcesChanged(){if(!this._config?.places)return!1;const t=this._getPlacesData(this.hass,this._config);return 0!==t.length&&(!!t.some(t=>this._chartSources[t.entity_id]!==this.hass.states[t.entity_id]?.attributes?.charts)||Object.keys(this._chartSources).some(e=>!t.some(t=>t.entity_id===e)))}shouldUpdate(t){if(t.has("_config"))return!0;const e=t.get("hass");if(e){const n=this._getPlacesData(this.hass,this._config).some(t=>e.states[t.entity_id]!==this.hass.states[t.entity_id]);return n||e.language!==this.hass.language||t.has("_chartData")||t.has("_chartWidth")||this._chartSourcesChanged()}return!0}_parseChartLabel(t,e){const n=String(t).split("-");if(3===n.length){const[t,e,r]=n.map(t=>parseInt(t,10));if(isNaN(t)||isNaN(e)||isNaN(r))return;return new Date(t,e-1,r)}if(2===n.length){const t=parseInt(n[0],10),r=parseInt(n[1],10);if(isNaN(t)||isNaN(r))return;const i=new Date(e.getFullYear(),t-1,r);return i.getTime()>e.getTime()&&i.setFullYear(i.getFullYear()-1),i}}_fetchChartData(){if(!this.hass||!this._config.places)return;const t=this._getPlacesData(this.hass,this._config),e={},n={},r=new Date;t.forEach(({entity_id:t})=>{const i=this.hass?.states[t],a=i?.attributes?.charts;n[t]=i?.attributes?.charts;const s=a?.last_thirty?.labels,o=a?.last_thirty?.series;if(!Array.isArray(s)||!Array.isArray(o)||s.length!==o.length)return;const c="°F"===i?.attributes?.unit_of_measurement||"F"===i?.attributes?.unit_of_measurement,l=s.map((t,e)=>{const n=this._parseChartLabel(t,r);if(!n)return;let i=parseFloat(String(o[e]));return isNaN(i)?void 0:(c&&(i=Math.round(100*(1.8*i+32))/100),{date:n,value:i})}).filter(t=>void 0!==t).sort((t,e)=>t.date.getTime()-e.date.getTime());l.length>0&&(e[t]=l)}),this._chartSources=n,this._chartData=e}_handleHeaderKeydown(t,e){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this._handleMoreInfo(e))}_placeAriaLabel(t){const e=[t.name];return t.country&&e.push(t.country),e.push(t.unavailable?t.temperature:`${t.temperature}${t.unit??""}`),e.join(", ")}_chartAriaLabel(t,e){const n=e.map(t=>t.value),r=t.unit??"",i=t=>`${wt(t,this.hass)}${r}`;return[t.name,yt(this.hass,"card.chart_description"),`${yt(this.hass,"card.min")} ${i(Math.min(...n))}`,`${yt(this.hass,"card.max")} ${i(Math.max(...n))}`].join(", ")}_handleMoreInfo(t){vt(this,"hass-more-info",{entityId:t})}_renderTrend(t,e,n=""){if(!this._config.show_trend)return W``;const r=t;if(void 0===r||isNaN(parseFloat(e))||isNaN(parseFloat(r)))return W``;const i=parseFloat(e)-parseFloat(r),a=Math.round(10*i)/10;if(Math.abs(a)>0){const t=a>0,e=wt(Math.abs(a),this.hass,{minimumFractionDigits:1,maximumFractionDigits:1});return W`<div class="stat-delta ${t?"pos":"neg"} current-trend">
${t?"↑":"↓"} ${t?"+":"-"}${e}${n}
</div>`}const s=wt(0,this.hass,{minimumFractionDigits:1,maximumFractionDigits:1});return W`<div class="stat-delta neu current-trend">→ ${s}${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">
${0===t.length?W`<div class="entity-warning" role="status">
<ha-icon icon="mdi:water-off-outline"></ha-icon>
<span>${yt(this.hass,"common.errors.no_places")}</span>
</div>`:""}
${t.map(t=>{return t.problem?W`<div class="place-row">${e=this.hass,n=t.problem,r=t.entity_id,W`
<div class="entity-warning" role="status">
<ha-icon icon="mdi:alert-outline"></ha-icon>
<span>${yt(e,`card.entity_problem.${n}`,{entity:r})}</span>
</div>
`}</div>`:W`
<div class="place-row">
<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]?function(t,e){const n=function(t){switch(t?.locale?.time_format){case"12":case"am_pm":return!0;case"24":return!1;default:return}}(e);return Mt(t,e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",...void 0===n?{}:{hour12:n}})}(new Date(this.hass.states[t.entity_id].last_updated),this.hass):""}
</div>`:""}
</div>
<div class="current-temp">
${t.unavailable?W`<span class="temp-value unavailable" title=${t.temperature}>&mdash;</span>`:W`<span class="temp-value"
>${St(t.temperature)?wt(Number(t.temperature),this.hass):t.temperature}</span
>
${St(t.temperature)?W`<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>
`:""}
${!1!==this._config.show_chart?this._renderChart(t):""}
</div>
`;var e,n,r})}
</div>
</ha-card>
`}_renderStat(t,e,n){if(!e||"unknown"===e||"unavailable"===e)return W``;const r=Number(e),i=!isNaN(r),a=i?wt(r,this.hass):e;return W`
<div class="stat-item">
<span class="stat-label">${t}</span>
<span class="stat-value">${a}${i?n:""}</span>
</div>
`}_renderChart(t){const e=this._chartData[t.entity_id];return!e||e.length<2?W``:W`
<div class="chart-container">
<svg
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>
`}_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()),u=r.invert(l.x),h=Nt(t=>t.date).left,d=h(n,u,1),p=n[d-1],f=n[d];let g=p;if(p&&f?g=u.getTime()-p.date.getTime()>f.date.getTime()-u.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,k=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 E=wt(g.value,this.hass);$.textContent=`${E}${a}`,w.setAttribute("x",String(S)),w.setAttribute("y",String(k)),w.setAttribute("text-anchor",T),w.textContent=At(g.date,this.hass)}_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,u=bi().domain(Dt(e,t=>t.date)).range([l,r-o]),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 d=Dt(h),p=.1*(d[1]-d[0])||1,f=on().domain([d[0]-p,d[1]+p]).range([i-c,s]);let g=Ri;"linear"===this._config.chart_smoothing&&(g=Ei),"step"===this._config.chart_smoothing&&(g=qi);const m=Pi().x(t=>u(t.date)).y(t=>f(t.value)).curve(g),_=Oi().x(t=>u(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),u=n.unit||"°C",h=wt(s,this.hass,{minimumFractionDigits:1,maximumFractionDigits:1}),d=i?a?`${h}${u}`:`${i} ${h}${u}`:"";return Z`
<line
class="ref-line ${e}"
x1="${l}"
x2="${r-o}"
y1="${c}"
y2="${c}"
></line>
${d?Z`<text class="ref-label ${e}" x="${r-o+4}" y="${c}" text-anchor="start">${d}</text>`:""}
`},v=t=>At(t,this.hass),b=u.domain()[0],x=u.domain()[1],$=e[e.length-1],w=$?Z`
<circle
class="now-dot"
cx="${u($.date)}"
cy="${f($.value)}"
r="3"
fill="var(--primary-color, #0077be)"
></circle>
`:"",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="${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 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="${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="${_(e)||""}" fill="url(#gradient-${t.replace(/\./g,"-")})"></path>
<path
class="chart-line"
d="${m(e)||""}"
fill="none"
stroke="var(--primary-color, #0077be)"
stroke-width="2"
></path>
${y(n.average_min,"min",yt(this.hass,"card.min"))}
${y(n.average_max,"max",yt(this.hass,"card.max"))}
${y(n.average_avg,"avg",yt(this.hass,"card.avg"))}
${M?Z`<circle class="extrema-dot min" cx="${u(M.date)}" cy="${f(M.value)}" r="3"></circle>`:""}
${A?Z`<circle class="extrema-dot max" cx="${u(A.date)}" cy="${f(A.value)}" r="3"></circle>`:""}
${w}
${T}
<rect
class="hover-overlay"
x="${l}"
y="${s}"
width="${r-l-o}"
height="${i-s-c}"
fill="transparent"
@pointerdown="${n=>this._handlePointerMove(n,t,e,u,f,S)}"
@pointermove="${n=>this._handlePointerMove(n,t,e,u,f,S)}"
@pointerleave="${t=>this._handlePointerLeave(t)}"
@pointercancel="${t=>this._handlePointerLeave(t)}"
@pointerup="${t=>this._handlePointerLeave(t)}"
></rect>
`}static get styles(){return[s(Ii)]}}t([ft({attribute:!1})],Vi.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")],Vi.prototype,"_card",void 0),t([gt()],Vi.prototype,"_config",void 0),t([gt()],Vi.prototype,"_chartData",void 0),t([gt()],Vi.prototype,"_chartWidth",void 0),customElements.get(Wi)||customElements.define(Wi,Vi),window.customCards=window.customCards||[],window.customCards.some(t=>t.type===Wi)||window.customCards.push({type:Wi,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:${Wi}`,places:[e]}}:null});const Bi=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}`,Gi=[{name:"title",selector:{text:{}}}],Xi=[{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"]}}}]}],Ji={sort_by:"default",show_trend:!0,show_last_updated:!0,show_stats:!0,show_chart:!0,show_country:!1,chart_smoothing:"smooth"};function Qi(t){const e={...t};for(const[t,n]of Object.entries(Ji))e[t]===n&&delete e[t];return""===e.title&&delete e.title,Array.isArray(e.places)&&(e.places=e.places.filter(t=>""!==Ki._targetOf(t))),e}class Ki extends ut{constructor(){super(...arguments),this._draftPlace=!1}setConfig(t){this._config={...Ji,...t}}_emit(t){vt(this,"config-changed",{config:Qi(t)})}_valueChanged(t){this.hass&&this._config&&this._emit({...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},this._emit(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},this._emit(this._config)}_placeChanged(t,e){const n=Ki._targetOf(e);if(!n)return t>=(this._config.places?.length??0)?void(this._draftPlace=!1):void this._removePlace(t);const r=[...this._config.places||[]],i=r.some((e,r)=>r!==t&&e&&Ki._targetOf(e)===n);if(i)return vt(this,"hass-notification",{message:yt(this.hass,"common.errors.duplicate_place")}),void this.requestUpdate();const a=Ki._nameOf(r[t]);this._draftPlace=!1,this._commitPlace(t,Ki._buildPlace(n,a))}_removePlace(t){const e=[...this._config.places||[]];e.splice(t,1),this._config={...this._config,places:e},this._emit(this._config)}_addPlace(){this._draftPlace=!0}_placeRows(){const t=[...this._config.places??[]];return this._draftPlace&&t.push(""),t}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(Gi),n=t(Xi);return W`
<ha-card>
<div class="card-content card-config">
<ha-form
.schema=${e}
.hass=${this.hass}
.data=${this._config}
.computeLabel=${t=>yt(this.hass,`editor.${t.name}`)}
@value-changed=${this._valueChanged}
></ha-form>
<div class="places-list">
<div class="places-header">
<h3>${yt(this.hass,"editor.places")}</h3>
</div>
<ha-sortable handle-selector=".handle" @item-moved=${this._placeMoved}>
<div class="places">
${this._placeRows().map((t,e)=>{const n=Ki._targetOf(t),r=Ki._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=${r}
.value=${n}
@value-changed=${t=>this._placeChanged(e,t.detail.value)}
></ha-selector>
</div>
`})}
</div>
</ha-sortable>
<div class="add-place-container">
<ha-button @click=${this._addPlace} variant="brand" appearance="accent" size="m">
<ha-icon icon="mdi:plus"></ha-icon>
${yt(this.hass,"editor.add_place")}
</ha-button>
</div>
</div>
<ha-form
.schema=${n}
.hass=${this.hass}
.data=${this._config}
.computeLabel=${t=>yt(this.hass,`editor.${t.name}`)}
@value-changed=${this._valueChanged}
></ha-form>
</div>
</ha-card>
`}static{this.styles=o`
${s(Bi)}
`}}t([ft({attribute:!1})],Ki.prototype,"hass",void 0),t([gt()],Ki.prototype,"_config",void 0),t([gt()],Ki.prototype,"_draftPlace",void 0);const ta="sea-temperatures-card-editor";customElements.get(ta)||customElements.define(ta,Ki);var ea=Object.freeze({__proto__:null,SeaTemperaturesCardEditor:Ki});export{Vi as SeaTemperaturesCard};