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

229 lines
88 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.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 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 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.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)}$`,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.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 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 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 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"},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?.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)};function bt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function xt(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function $t(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=bt,n=(e,n)=>bt(t(e),n),r=(e,n)=>t(e)-n):(e=t===bt||t===xt?t:wt,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 wt(){return 0}const Mt=$t(bt).right;function At(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]}$t(function(t){return null===t?NaN:+t}).center;const St=Math.sqrt(50),Tt=Math.sqrt(10),Ct=Math.sqrt(2);function Nt(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>=St?10:a>=Tt?5:a>=Ct?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?Nt(t,e,2*n):[o,c,l]}function Et(t,e,n){return Nt(t=+t,e=+e,n=+n)[2]}function kt(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?Et(e,t,n):Et(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function Ut(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Dt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Pt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Ot(){}var Ft=.7,Ht=1/Ft,Lt="\\s*([+-]?\\d+)\\s*",zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",jt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rt=/^#([0-9a-f]{3,8})$/,Yt=new RegExp(`^rgb\\(${Lt},${Lt},${Lt}\\)$`),qt=new RegExp(`^rgb\\(${jt},${jt},${jt}\\)$`),It=new RegExp(`^rgba\\(${Lt},${Lt},${Lt},${zt}\\)$`),Wt=new RegExp(`^rgba\\(${jt},${jt},${jt},${zt}\\)$`),Zt=new RegExp(`^hsl\\(${zt},${jt},${jt}\\)$`),Vt=new RegExp(`^hsla\\(${zt},${jt},${jt},${zt}\\)$`),Bt={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 Gt(){return this.rgb().formatHex()}function Xt(){return this.rgb().formatRgb()}function Jt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Rt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Qt(e):3===n?new ee(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Kt(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Kt(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=Yt.exec(t))?new ee(e[1],e[2],e[3],1):(e=qt.exec(t))?new ee(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=It.exec(t))?Kt(e[1],e[2],e[3],e[4]):(e=Wt.exec(t))?Kt(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Zt.exec(t))?oe(e[1],e[2]/100,e[3]/100,1):(e=Vt.exec(t))?oe(e[1],e[2]/100,e[3]/100,e[4]):Bt.hasOwnProperty(t)?Qt(Bt[t]):"transparent"===t?new ee(NaN,NaN,NaN,0):null}function Qt(t){return new ee(t>>16&255,t>>8&255,255&t,1)}function Kt(t,e,n,r){return r<=0&&(t=e=n=NaN),new ee(t,e,n,r)}function te(t,e,n,r){return 1===arguments.length?function(t){return t instanceof Ot||(t=Jt(t)),t?new ee((t=t.rgb()).r,t.g,t.b,t.opacity):new ee}(t):new ee(t,e,n,null==r?1:r)}function ee(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ne(){return`#${se(this.r)}${se(this.g)}${se(this.b)}`}function re(){const t=ie(this.opacity);return`${1===t?"rgb(":"rgba("}${ae(this.r)}, ${ae(this.g)}, ${ae(this.b)}${1===t?")":`, ${t})`}`}function ie(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ae(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function se(t){return((t=ae(t))<16?"0":"")+t.toString(16)}function oe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new le(t,e,n,r)}function ce(t){if(t instanceof le)return new le(t.h,t.s,t.l,t.opacity);if(t instanceof Ot||(t=Jt(t)),!t)return new le;if(t instanceof le)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 le(s,o,c,t.opacity)}function le(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function he(t){return(t=(t||0)%360)<0?t+360:t}function ue(t){return Math.max(0,Math.min(1,t||0))}function de(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Dt(Ot,Jt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Gt,formatHex:Gt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ce(this).formatHsl()},formatRgb:Xt,toString:Xt}),Dt(ee,te,Pt(Ot,{brighter(t){return t=null==t?Ht:Math.pow(Ht,t),new ee(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Ft:Math.pow(Ft,t),new ee(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ee(ae(this.r),ae(this.g),ae(this.b),ie(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:ne,formatHex:ne,formatHex8:function(){return`#${se(this.r)}${se(this.g)}${se(this.b)}${se(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:re,toString:re})),Dt(le,function(t,e,n,r){return 1===arguments.length?ce(t):new le(t,e,n,null==r?1:r)},Pt(Ot,{brighter(t){return t=null==t?Ht:Math.pow(Ht,t),new le(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Ft:Math.pow(Ft,t),new le(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 ee(de(t>=240?t-240:t+120,i,r),de(t,i,r),de(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new le(he(this.h),ue(this.s),ue(this.l),ie(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=ie(this.opacity);return`${1===t?"hsl(":"hsla("}${he(this.h)}, ${100*ue(this.s)}%, ${100*ue(this.l)}%${1===t?")":`, ${t})`}`}}));var pe=t=>()=>t;function fe(t){return 1===(t=+t)?ge: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):pe(isNaN(e)?n:e)}}function ge(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):pe(isNaN(t)?e:t)}var me=function t(e){var n=fe(e);function r(t,e){var r=n((t=te(t)).r,(e=te(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),s=ge(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 _e(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 ye(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]=Ae(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 ve(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function be(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function xe(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]=Ae(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var $e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,we=new RegExp($e.source,"g");function Me(t,e){var n,r,i,a=$e.lastIndex=we.lastIndex=0,s=-1,o=[],c=[];for(t+="",e+="";(n=$e.exec(t))&&(r=we.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:be(n,r)})),a=we.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 Ae(t,e){var n,r=typeof e;return null==e||"boolean"===r?pe(e):("number"===r?be:"string"===r?(n=Jt(e))?(e=n,me):Me:e instanceof Jt?me:e instanceof Date?ve:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?_e:Array.isArray(e)?ye:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?xe:be)(t,e)}function Se(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Te(t){return+t}var Ce=[0,1];function Ne(t){return t}function Ee(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function ke(t,e,n){var r=t[0],i=t[1],a=e[0],s=e[1];return i<r?(r=Ee(i,r),a=n(s,a)):(r=Ee(r,i),a=n(a,s)),function(t){return a(r(t))}}function Ue(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]=Ee(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(e){var n=Mt(t,e,1,r)-1;return a[n](i[n](e))}}function De(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Pe(){var t,e,n,r,i,a,s=Ce,o=Ce,c=Ae,l=Ne;function h(){var t=Math.min(s.length,o.length);return l!==Ne&&(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?Ue:ke,i=a=null,u}function u(e){return null==e||isNaN(e=+e)?n:(i||(i=r(s.map(t),o,c)))(t(l(e)))}return u.invert=function(n){return l(e((a||(a=r(o,s.map(t),be)))(n)))},u.domain=function(t){return arguments.length?(s=Array.from(t,Te),h()):s.slice()},u.range=function(t){return arguments.length?(o=Array.from(t),h()):o.slice()},u.rangeRound=function(t){return o=Array.from(t),c=Se,h()},u.clamp=function(t){return arguments.length?(l=!!t||Ne,h()):l!==Ne},u.interpolate=function(t){return arguments.length?(c=t,h()):c},u.unknown=function(t){return arguments.length?(n=t,u):n},function(n,r){return t=n,e=r,h()}}function Oe(){return Pe()(Ne,Ne)}function Fe(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 He(t){return(t=Fe(Math.abs(t)))?t[1]:NaN}var Le,ze=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function je(t){if(!(e=ze.exec(t)))throw new Error("invalid format: "+t);var e;return new Re({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 Re(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 Ye(t,e){var n=Fe(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")}je.prototype=Re.prototype,Re.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 qe={"%":(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)=>Ye(100*t,e),r:Ye,s:function(t,e){var n=Fe(t,e);if(!n)return Le=void 0,t.toPrecision(e);var r=n[0],i=n[1],a=i-(Le=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")+Fe(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ie(t){return t}var We,Ze,Ve,Be=Array.prototype.map,Ge=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xe(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ie:(e=Be.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?Ie:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Be.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function u(t,e){var n=(t=je(t)).fill,u=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"):qe[v]||(void 0===_&&(_=12),y=!0,v="g"),(f||"0"===n&&"="===u)&&(f=!0,n="0",u="=");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:""),$=qe[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)?h:$(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===Le?"":Ge[8+Le/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=""),u){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:u,formatPrefix:function(t,e){var n=3*Math.max(-8,Math.min(8,Math.floor(He(e)/3))),r=Math.pow(10,-n),i=u(((t=je(t)).type="f",t),{suffix:Ge[8+n/3]});return function(t){return i(r*t)}}}}function Je(t,e,n,r){var i,a=kt(t,e,n);switch((r=je(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(He(e)/3)))-He(Math.abs(t)))}(a,s))||(r.precision=i),Ve(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,He(e)-He(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,-He(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Ze(r)}function Qe(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?Nt(e,t,n):Nt(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 Je(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],h=10;for(l<c&&(i=c,c=l,l=i,i=s,s=o,o=i);h-- >0;){if((i=Et(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 Ke(){var t=Oe();return t.copy=function(){return De(t,Ke())},Ut.apply(t,arguments),Qe(t)}We=Xe({thousands:",",grouping:[3],currency:["$",""]}),Ze=We.format,Ve=We.formatPrefix;const tn=new Date,en=new Date;function nn(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=>nn(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)=>(tn.setTime(+e),en.setTime(+r),t(tn),t(en),Math.floor(n(tn,en))),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 rn=nn(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);rn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?nn(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):rn:null),rn.range;const an=1e3,sn=6e4,on=36e5,cn=864e5,ln=6048e5,hn=2592e6,un=31536e6,dn=nn(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*an)},(t,e)=>(e-t)/an,t=>t.getUTCSeconds());dn.range;const pn=nn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*an)},(t,e)=>{t.setTime(+t+e*sn)},(t,e)=>(e-t)/sn,t=>t.getMinutes());pn.range;const fn=nn(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*sn)},(t,e)=>(e-t)/sn,t=>t.getUTCMinutes());fn.range;const gn=nn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*an-t.getMinutes()*sn)},(t,e)=>{t.setTime(+t+e*on)},(t,e)=>(e-t)/on,t=>t.getHours());gn.range;const mn=nn(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*on)},(t,e)=>(e-t)/on,t=>t.getUTCHours());mn.range;const _n=nn(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*sn)/cn,t=>t.getDate()-1);_n.range;const yn=nn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/cn,t=>t.getUTCDate()-1);yn.range;const vn=nn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/cn,t=>Math.floor(t/cn));function bn(t){return nn(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())*sn)/ln)}vn.range;const xn=bn(0),$n=bn(1),wn=bn(2),Mn=bn(3),An=bn(4),Sn=bn(5),Tn=bn(6);function Cn(t){return nn(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)/ln)}xn.range,$n.range,wn.range,Mn.range,An.range,Sn.range,Tn.range;const Nn=Cn(0),En=Cn(1),kn=Cn(2),Un=Cn(3),Dn=Cn(4),Pn=Cn(5),On=Cn(6);Nn.range,En.range,kn.range,Un.range,Dn.range,Pn.range,On.range;const Fn=nn(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());Fn.range;const Hn=nn(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());Hn.range;const Ln=nn(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());Ln.every=t=>isFinite(t=Math.floor(t))&&t>0?nn(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,Ln.range;const zn=nn(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?nn(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[jn,Rn]=function(t,e,n,r,i,a){const s=[[dn,1,an],[dn,5,5e3],[dn,15,15e3],[dn,30,3e4],[a,1,sn],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,on],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,cn],[r,2,1728e5],[n,1,ln],[e,1,hn],[e,3,7776e6],[t,1,un]];function o(e,n,r){const i=Math.abs(n-e)/r,a=$t(([,,t])=>t).right(s,i);if(a===s.length)return t.every(kt(e/un,n/un,r));if(0===a)return rn.every(Math.max(kt(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]}(Ln,Fn,xn,_n,gn,pn);function Yn(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 qn(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 In(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var Wn,Zn,Vn={"-":"",_:" ",0:"0"},Bn=/^\s*\d+/,Gn=/^%/,Xn=/[\\^$*+?|[\]().{}]/g;function Jn(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 Qn(t){return t.replace(Xn,"\\$&")}function Kn(t){return new RegExp("^(?:"+t.map(Qn).join("|")+")","i")}function tr(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function er(t,e,n){var r=Bn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function nr(t,e,n){var r=Bn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function rr(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ir(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function ar(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function sr(t,e,n){var r=Bn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function or(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function cr(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 lr(t,e,n){var r=Bn.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function hr(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ur(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function dr(t,e,n){var r=Bn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function pr(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function fr(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function gr(t,e,n){var r=Bn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function mr(t,e,n){var r=Bn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function _r(t,e,n){var r=Bn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function yr(t,e,n){var r=Gn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function vr(t,e,n){var r=Bn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function br(t,e,n){var r=Bn.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function xr(t,e){return Jn(t.getDate(),e,2)}function $r(t,e){return Jn(t.getHours(),e,2)}function wr(t,e){return Jn(t.getHours()%12||12,e,2)}function Mr(t,e){return Jn(1+_n.count(Ln(t),t),e,3)}function Ar(t,e){return Jn(t.getMilliseconds(),e,3)}function Sr(t,e){return Ar(t,e)+"000"}function Tr(t,e){return Jn(t.getMonth()+1,e,2)}function Cr(t,e){return Jn(t.getMinutes(),e,2)}function Nr(t,e){return Jn(t.getSeconds(),e,2)}function Er(t){var e=t.getDay();return 0===e?7:e}function kr(t,e){return Jn(xn.count(Ln(t)-1,t),e,2)}function Ur(t){var e=t.getDay();return e>=4||0===e?An(t):An.ceil(t)}function Dr(t,e){return t=Ur(t),Jn(An.count(Ln(t),t)+(4===Ln(t).getDay()),e,2)}function Pr(t){return t.getDay()}function Or(t,e){return Jn($n.count(Ln(t)-1,t),e,2)}function Fr(t,e){return Jn(t.getFullYear()%100,e,2)}function Hr(t,e){return Jn((t=Ur(t)).getFullYear()%100,e,2)}function Lr(t,e){return Jn(t.getFullYear()%1e4,e,4)}function zr(t,e){var n=t.getDay();return Jn((t=n>=4||0===n?An(t):An.ceil(t)).getFullYear()%1e4,e,4)}function jr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Jn(e/60|0,"0",2)+Jn(e%60,"0",2)}function Rr(t,e){return Jn(t.getUTCDate(),e,2)}function Yr(t,e){return Jn(t.getUTCHours(),e,2)}function qr(t,e){return Jn(t.getUTCHours()%12||12,e,2)}function Ir(t,e){return Jn(1+yn.count(zn(t),t),e,3)}function Wr(t,e){return Jn(t.getUTCMilliseconds(),e,3)}function Zr(t,e){return Wr(t,e)+"000"}function Vr(t,e){return Jn(t.getUTCMonth()+1,e,2)}function Br(t,e){return Jn(t.getUTCMinutes(),e,2)}function Gr(t,e){return Jn(t.getUTCSeconds(),e,2)}function Xr(t){var e=t.getUTCDay();return 0===e?7:e}function Jr(t,e){return Jn(Nn.count(zn(t)-1,t),e,2)}function Qr(t){var e=t.getUTCDay();return e>=4||0===e?Dn(t):Dn.ceil(t)}function Kr(t,e){return t=Qr(t),Jn(Dn.count(zn(t),t)+(4===zn(t).getUTCDay()),e,2)}function ti(t){return t.getUTCDay()}function ei(t,e){return Jn(En.count(zn(t)-1,t),e,2)}function ni(t,e){return Jn(t.getUTCFullYear()%100,e,2)}function ri(t,e){return Jn((t=Qr(t)).getUTCFullYear()%100,e,2)}function ii(t,e){return Jn(t.getUTCFullYear()%1e4,e,4)}function ai(t,e){var n=t.getUTCDay();return Jn((t=n>=4||0===n?Dn(t):Dn.ceil(t)).getUTCFullYear()%1e4,e,4)}function si(){return"+0000"}function oi(){return"%"}function ci(t){return+t}function li(t){return Math.floor(+t/1e3)}function hi(t){return new Date(t)}function ui(t){return t instanceof Date?+t:+new Date(+t)}function di(t,e,n,r,i,a,s,o,c,l){var h=Oe(),u=h.invert,d=h.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 h.invert=function(t){return new Date(u(t))},h.domain=function(t){return arguments.length?d(Array.from(t,ui)):d().map(hi)},h.ticks=function(e){var n=d();return t(n[0],n[n.length-1],null==e?10:e)},h.tickFormat=function(t,e){return null==e?x:l(e)},h.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)):h},h.copy=function(){return De(h,di(t,e,n,r,i,a,s,o,c,l))},h}function pi(){return Ut.apply(di(jn,Rn,Ln,Fn,xn,_n,gn,pn,dn,Zn).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function fi(t){return function(){return t}}!function(t){Wn=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=Kn(i),h=tr(i),u=Kn(a),d=tr(a),p=Kn(s),f=tr(s),g=Kn(o),m=tr(o),_=Kn(c),y=tr(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:xr,e:xr,f:Sr,g:Hr,G:zr,H:$r,I:wr,j:Mr,L:Ar,m:Tr,M:Cr,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ci,s:li,S:Nr,u:Er,U:kr,V:Dr,w:Pr,W:Or,x:null,X:null,y:Fr,Y:Lr,Z:jr,"%":oi},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:Rr,e:Rr,f:Zr,g:ri,G:ai,H:Yr,I:qr,j:Ir,L:Wr,m:Vr,M:Br,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ci,s:li,S:Gr,u:Xr,U:Jr,V:Kr,w:ti,W:ei,x:null,X:null,y:ni,Y:ii,Z:si,"%":oi},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=u.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:ur,e:ur,f:_r,g:or,G:sr,H:pr,I:pr,j:dr,L:mr,m:hr,M:fr,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=h.get(r[0].toLowerCase()),n+r[0].length):-1},q:lr,Q:vr,s:br,S:gr,u:nr,U:rr,V:ir,w:er,W:ar,x:function(t,e,r){return M(t,n,e,r)},X:function(t,e,n){return M(t,r,e,n)},y:or,Y:sr,Z:cr,"%":yr};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=Vn[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=In(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=qn(In(a.y,0,1))).getUTCDay(),r=i>4||0===i?En.ceil(r):En(r),r=yn.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=Yn(In(a.y,0,1))).getDay(),r=i>4||0===i?$n.ceil(r):$n(r),r=_n.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?qn(In(a.y,0,1)).getUTCDay():Yn(In(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,qn(a)):Yn(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 Vn?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),Zn=Wn.format,Wn.parse,Wn.utcFormat,Wn.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 gi=Math.PI,mi=2*gi,_i=1e-6,yi=mi-_i;function vi(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class bi{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?vi:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return vi;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,h=s-e,u=l*l+h*h;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(u>_i)if(Math.abs(h*o-c*l)>_i&&i){let d=n-a,p=r-s,f=o*o+c*c,g=d*d+p*p,m=Math.sqrt(f),_=Math.sqrt(u),y=i*Math.tan((gi-Math.acos((f+u-g)/(2*m*_)))/2),v=y/_,b=y/m;Math.abs(v-1)>_i&&this._append`L${t+v*l},${e+v*h}`,this._append`A${i},${i},0,0,${+(h*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,h=1^a,u=a?r-i:i-r;null===this._x1?this._append`M${c},${l}`:(Math.abs(this._x1-c)>_i||Math.abs(this._y1-l)>_i)&&this._append`L${c},${l}`,n&&(u<0&&(u=u%mi+mi),u>yi?this._append`A${n},${n},0,1,${h},${t-s},${e-o}A${n},${n},0,1,${h},${this._x1=c},${this._y1=l}`:u>_i&&this._append`A${n},${n},0,${+(u>=gi)},${h},${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 xi(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 bi(e)}function $i(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function wi(t){this._context=t}function Mi(t){return new wi(t)}function Ai(t){return t[0]}function Si(t){return t[1]}function Ti(t,e){var n=fi(!0),r=null,i=Mi,a=null,s=xi(o);function o(o){var c,l,h,u=(o=$i(o)).length,d=!1;for(null==r&&(a=i(h=s())),c=0;c<=u;++c)!(c<u&&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(h)return a=null,h+""||null}return t="function"==typeof t?t:void 0===t?Ai:fi(t),e="function"==typeof e?e:void 0===e?Si:fi(e),o.x=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),o):t},o.y=function(t){return arguments.length?(e="function"==typeof t?t:fi(+t),o):e},o.defined=function(t){return arguments.length?(n="function"==typeof t?t:fi(!!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 Ci(t,e,n){var r=null,i=fi(!0),a=null,s=Mi,o=null,c=xi(l);function l(l){var h,u,d,p,f,g=(l=$i(l)).length,m=!1,_=new Array(g),y=new Array(g);for(null==a&&(o=s(f=c())),h=0;h<=g;++h){if(!(h<g&&i(p=l[h],h,l))===m)if(m=!m)u=h,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),d=h-1;d>=u;--d)o.point(_[d],y[d]);o.lineEnd(),o.areaEnd()}m&&(_[h]=+t(p,h,l),y[h]=+e(p,h,l),o.point(r?+r(p,h,l):_[h],n?+n(p,h,l):y[h]))}if(f)return o=null,f+""||null}function h(){return Ti().defined(i).curve(s).context(a)}return t="function"==typeof t?t:void 0===t?Ai:fi(+t),e="function"==typeof e?e:fi(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Si:fi(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:fi(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:fi(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:fi(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:fi(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:fi(+t),l):n},l.lineX0=l.lineY0=function(){return h().x(t).y(e)},l.lineY1=function(){return h().x(t).y(n)},l.lineX1=function(){return h().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:fi(!!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 Ni(t){return t<0?-1:1}function Ei(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(Ni(a)+Ni(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function ki(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Ui(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 Di(t){this._context=t}function Pi(t){return new Di(t)}function Oi(t,e){this._context=t,this._t=e}function Fi(t){return new Oi(t,1)}wi.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)}}},Di.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:Ui(this,this._t0,ki(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,Ui(this,ki(this,n=Ei(this,t,e)),n);break;default:Ui(this,this._t0,n=Ei(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},Object.create(Di.prototype).point=function(t,e){Di.prototype.point.call(this,e,t)},Oi.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 Hi=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}.last-updated{font-size:.75rem;color:var(--secondary-text-color);margin-top:4px}.place-name-container{display:flex;align-items:baseline;gap:6px}.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}.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}.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 .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}`,Li="sea-temperatures-card",zi=`${Li}-editor`;class ji extends ht{constructor(){super(...arguments),this._chartData={},this._chartWidth=400,this._chartSources={}}setConfig(t){if(!t||!t.places||!Array.isArray(t.places)||0===t.places.length)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 Zi}),document.createElement(zi)}static getStubConfig(){return{title:"Sea Temperatures",places:[]}}getCardSize(){return(this._config?.places?.length||1)*this._rowsPerPlace()}_rowsPerPlace(){let t=1;return!1!==this._config?.show_stats&&(t+=1),!1!==this._config?.show_chart&&(t+=3),t}getGridOptions(){return{rows:(this._config?.places?.length||1)*this._rowsPerPlace(),columns:12,min_rows:2,min_columns:6}}_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}_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=t.states[a];if(c)o=t.entities[a]?.device_id;else{o=a;const e=r.filter(e=>t.entities[e.entity_id]?.device_id===o&&e.entity_id.startsWith("sensor."));if(0===e.length)return;c=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(c){const r=c.attributes,i="unavailable"===c.state||"unknown"===c.state,a=o?t.devices[o]:void 0,l=a?.name_by_user||a?.name||r.friendly_name||"Unknown",h="°F"===r.unit_of_measurement||"F"===r.unit_of_measurement,u=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||l,country:e.show_country&&r.country?String(r.country):void 0,temperature:c.state,yesterday:u(r.yesterday),last_week:u(r.last_week),date:r.date?String(r.date):void 0,average_min:u(r.average_min),average_max:u(r.average_max),average_avg:u(r.average_avg),unit:r.unit_of_measurement||"°C",entity_id:c.entity_id,unavailable:i})}}),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=>`${new Intl.NumberFormat(this.hass?.language).format(t)}${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=new Intl.NumberFormat(this.hass?.language,{minimumFractionDigits:1,maximumFractionDigits:1}).format(Math.abs(a));return W`<div class="stat-delta ${t?"pos":"neg"} current-trend">
${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"
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>`:""}
</div>
<div class="current-temp">
${t.unavailable?W`<span class="temp-value unavailable" title=${t.temperature}>&mdash;</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>
`:""}
${!1!==this._config.show_chart?this._renderChart(t):""}
</div>
`)}
</div>
</ha-card>
`}_renderStat(t,e,n){if(!e||"unknown"===e||"unavailable"===e)return W``;const r=Number(e),i=isNaN(r)?e:new Intl.NumberFormat(this.hass?.language).format(r);return W`
<div class="stat-item">
<span class="stat-label">${t}</span>
<span class="stat-value">${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()),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="${l}"
x2="${r-o}"
y1="${c}"
y2="${c}"
></line>
${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="${h($.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="${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>`:""}
${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,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[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")],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
.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._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=${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="medium">
<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(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};