function t(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}console.groupCollapsed("%c🌊 SEA TEMPERATURES CARD%cv3.1.0","color: orange; font-weight: bold; background: black; padding: 2px 4px; border-radius: 2px 0 0 2px;","color: white; font-weight: bold; background: dimgray; padding: 2px 4px; border-radius: 0 2px 2px 0;"),console.info("A Lovelace card to display sea temperatures."),console.info("Github:  https://github.com/timmaurice/sea-temperatures.git"),console.info("Sponsor: https://buymeacoffee.com/timmaurice"),console.groupEnd(),"function"==typeof SuppressedError&&SuppressedError;
/**
 * @license
 * Copyright 2019 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const e=globalThis,n=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let o=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=i.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(e,t))}return t}toString(){return this.cssText}};const a=t=>new o("string"==typeof t?t:t+"",void 0,r),s=(t,...e)=>{const n=1===t.length?t[0]:e.reduce((e,n,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[r+1],t[0]);return new o(n,t,r)},l=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return a(e)})(t):t,{is:u,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:f,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,g=globalThis,_=g.trustedTypes,m=_?_.emptyScript:"",y=g.reactiveElementPolyfillSupport,v=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},x=(t,e)=>!u(t,e),b={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:x};
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */Symbol.metadata??=Symbol("metadata"),g.litPropertyMetadata??=new WeakMap;let $=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&c(this.prototype,t,r)}}static getPropertyDescriptor(t,e,n){const{get:r,set:i}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const o=r?.call(this);i?.call(this,e),this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...f(t),...d(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,r)=>{if(n)t.adoptedStyleSheets=r.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const n of r){const r=document.createElement("style"),i=e.litNonce;void 0!==i&&r.setAttribute("nonce",i),r.textContent=n.cssText,t.appendChild(r)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(e,n.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=n.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=r;const o=i.fromAttribute(e,t.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(t,e,n,r=!1,i){if(void 0!==t){const o=this.constructor;if(!1===r&&(i=this[t]),n??=o.getPropertyOptions(t),!((n.hasChanged??x)(i,e)||n.useDefault&&n.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:r,wrapped:i},o){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==i||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,n,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.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){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[v("elementProperties")]=new Map,$[v("finalized")]=new Map,y?.({ReactiveElement:$}),(g.reactiveElementVersions??=[]).push("2.1.2");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const A=globalThis,M=t=>t,S=A.trustedTypes,C=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,T="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+E,k=`<${N}>`,D=document,U=()=>D.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,F="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,z=/>/g,j=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,R=/"/g,q=/^(?:script|style|textarea|title)$/i,I=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),W=I(1),X=I(2),V=Symbol.for("lit-noChange"),B=Symbol.for("lit-nothing"),Z=new WeakMap,G=D.createTreeWalker(D,129);function J(t,e){if(!O(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(e):e}const Q=(t,e)=>{const n=t.length-1,r=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=H;for(let e=0;e<n;e++){const n=t[e];let s,l,u=-1,c=0;for(;c<n.length&&(a.lastIndex=c,l=a.exec(n),null!==l);)c=a.lastIndex,a===H?"!--"===l[1]?a=L:void 0!==l[1]?a=z:void 0!==l[2]?(q.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=j):void 0!==l[3]&&(a=j):a===j?">"===l[0]?(a=i??H,u=-1):void 0===l[1]?u=-2:(u=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?j:'"'===l[3]?R:Y):a===R||a===Y?a=j:a===L||a===z?a=H:(a=j,i=void 0);const h=a===j&&t[e+1].startsWith("/>")?" ":"";o+=a===H?n+k:u>=0?(r.push(s),n.slice(0,u)+T+n.slice(u)+E+h):n+E+(-2===u?e:h)}return[J(t,o+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class K{constructor({strings:t,_$litType$:e},n){let r;this.parts=[];let i=0,o=0;const a=t.length-1,s=this.parts,[l,u]=Q(t,e);if(this.el=K.createElement(l,n),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=G.nextNode())&&s.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(T)){const e=u[o++],n=r.getAttribute(t).split(E),a=/([.?@])?(.*)/.exec(e);s.push({type:1,index:i,name:a[2],strings:n,ctor:"."===a[1]?it:"?"===a[1]?ot:"@"===a[1]?at:rt}),r.removeAttribute(t)}else t.startsWith(E)&&(s.push({type:6,index:i}),r.removeAttribute(t));if(q.test(r.tagName)){const t=r.textContent.split(E),e=t.length-1;if(e>0){r.textContent=S?S.emptyScript:"";for(let n=0;n<e;n++)r.append(t[n],U()),G.nextNode(),s.push({type:2,index:++i});r.append(t[e],U())}}}else if(8===r.nodeType)if(r.data===N)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(E,t+1));)s.push({type:7,index:i}),t+=E.length-1}i++}}static createElement(t,e){const n=D.createElement("template");return n.innerHTML=t,n}}function tt(t,e,n=t,r){if(e===V)return e;let i=void 0!==r?n._$Co?.[r]:n._$Cl;const o=P(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,n,r)),void 0!==r?(n._$Co??=[])[r]=i:n._$Cl=i),void 0!==i&&(e=tt(t,i._$AS(t,e.values),i,r)),e}class et{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,r=(t?.creationScope??D).importNode(e,!0);G.currentNode=r;let i=G.nextNode(),o=0,a=0,s=n[0];for(;void 0!==s;){if(o===s.index){let e;2===s.type?e=new nt(i,i.nextSibling,this,t):1===s.type?e=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(e=new st(i,this,t)),this._$AV.push(e),s=n[++a]}o!==s?.index&&(i=G.nextNode(),o++)}return G.currentNode=D,r}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,r){this.type=2,this._$AH=B,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=tt(this,t,e),P(t)?t===B||null==t||""===t?(this._$AH!==B&&this._$AR(),this._$AH=B):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>O(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==B&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=K.createElement(J(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new et(r,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=Z.get(t.strings);return void 0===e&&Z.set(t.strings,e=new K(t)),e}k(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,r=0;for(const i of t)r===e.length?e.push(n=new nt(this.O(U()),this.O(U()),this,this.options)):n=e[r],n._$AI(i),r++;r<e.length&&(this._$AR(n&&n._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=M(t).nextSibling;M(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 o=!1;if(void 0===i)t=tt(this,t,e,0),o=!P(t)||t!==this._$AH&&t!==V,o&&(this._$AH=t);else{const r=t;let a,s;for(t=i[0],a=0;a<i.length-1;a++)s=tt(this,r[n+a],e,a),s===V&&(s=this._$AH[a]),o||=!P(s)||s!==this._$AH[a],s===B?t=B:t!==B&&(t+=(s??"")+i[a+1]),this._$AH[a]=s}o&&!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 ot extends rt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==B)}}class at 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 st{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 lt=A.litHtmlPolyfillSupport;lt?.(K,nt),(A.litHtmlVersions??=[]).push("3.3.3");const ut=globalThis;
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */class ct extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const r=n?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=n?.renderBefore??null;r._$litPart$=i=new nt(e.insertBefore(U(),t),t,void 0,n??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}ct._$litElement$=!0,ct.finalized=!0,ut.litElementHydrateSupport?.({LitElement:ct});const ht=ut.litElementPolyfillSupport;ht?.({LitElement:ct}),(ut.litElementVersions??=[]).push("4.2.2");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const ft={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},dt=(t=ft,e,n)=>{const{kind:r,metadata:i}=n;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),o.set(n.name,t),"accessor"===r){const{name:r}=n;return{set(n){const i=e.get.call(this);e.set.call(this,n),this.requestUpdate(r,i,t,!0,n)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=n;return function(n){const i=this[r];e.call(this,n),this.requestUpdate(r,i,t,!0,n)}}throw Error("Unsupported decorator location: "+r)};
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */function pt(t){return(e,n)=>"object"==typeof n?dt(t,e,n):((t,e,n)=>{const r=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),r?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */function gt(t){return pt({...t,state:!0,attribute:!1})}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const _t={en:{editor:{groups:{display:"Display"},title:"Title (Optional)",places:"Places",show_trend:"Show trend indicators (vs Yesterday)",show_last_updated:"Show last updated",show_stats:"Show statistics (Yesterday, Last Week, 10-Year Avg)",show_chart:"Show historical chart (30d)",show_country:"Append country to place name",chart_smoothing:"Chart smoothing",chart_smoothing_options:{smooth:"Smooth",linear:"Linear",step:"Step"},sort_by:"Sort places by",sort_by_options:{default:"Default (Manual)",name:"Name (A-Z)",temp_asc:"Temperature (Coldest First)",temp_desc:"Temperature (Warmest First)"},add_place:"Add Place"},card:{yesterday:"Yesterday",last_week:"Last Week",average_avg:"10-Year Avg",averages:"Averages",min:"Min",max:"Max",avg:"Avg"},common:{errors:{no_places:"You need to define at least one place.",duplicate_place:"This place is already in your list."}}},de:{editor:{groups:{display:"Anzeige"},title:"Titel (Optional)",places:"Orte",show_trend:"Zeige Trend-Indikatoren (vs Gestern)",show_last_updated:"Zuletzt aktualisiert anzeigen",show_stats:"Statistiken anzeigen (Gestern, Letzte Woche, 10-Jahres-Ø)",show_chart:"Historisches Diagramm anzeigen (30t)",show_country:"Land an den Ortsnamen anhängen",chart_smoothing:"Kurvenglättung",chart_smoothing_options:{smooth:"Weich",linear:"Linear",step:"Stufen"},sort_by:"Orte sortieren nach",sort_by_options:{default:"Standard (Manuell)",name:"Name (A-Z)",temp_asc:"Temperatur (Kälteste zuerst)",temp_desc:"Temperatur (Wärmste zuerst)"},add_place:"Ort hinzufügen"},card:{yesterday:"Gestern",last_week:"Letzte Woche",average_avg:"10-Jahres-Ø",averages:"Durchschnitte",min:"Min",max:"Max",avg:"Ø"},common:{errors:{no_places:"Du musst mindestens einen Ort definieren.",duplicate_place:"Dieser Ort ist bereits in deiner Liste."}}},fr:{editor:{groups:{display:"Affichage"},title:"Titre (Optionnel)",places:"Lieux",show_trend:"Afficher les indicateurs de tendance (vs Hier)",show_last_updated:"Afficher la dernière mise à jour",show_stats:"Afficher les statistiques (Hier, La semaine dernière, Moy. 10 ans)",show_chart:"Afficher le graphique historique (30j)",show_country:"Ajouter le pays au nom du lieu",chart_smoothing:"Lissage du graphique",chart_smoothing_options:{smooth:"Lisse",linear:"Linéaire",step:"En escalier"},sort_by:"Trier les lieux par",sort_by_options:{default:"Défaut (Manuel)",name:"Nom (A-Z)",temp_asc:"Température (Le plus froid d'abord)",temp_desc:"Température (Le plus chaud d'abord)"},add_place:"Ajouter un lieu"},card:{yesterday:"Hier",last_week:"La semaine dernière",average_avg:"Moy. 10 ans",averages:"Moyennes",min:"Min",max:"Max",avg:"Moy"},common:{errors:{no_places:"Vous devez définir au moins un lieu.",duplicate_place:"Ce lieu est déjà dans votre liste."}}},es:{editor:{groups:{display:"Pantalla"},title:"Título (Opcional)",places:"Lugares",show_trend:"Mostrar indicadores de tendencia (vs Ayer)",show_last_updated:"Mostrar última actualización",show_stats:"Mostrar estadísticas (Ayer, Semana pasada, Media 10 años)",show_chart:"Mostrar gráfico histórico (30d)",show_country:"Añadir el país al nombre del lugar",chart_smoothing:"Suavizado del gráfico",chart_smoothing_options:{smooth:"Suave",linear:"Lineal",step:"Escalonado"},sort_by:"Ordenar lugares por",sort_by_options:{default:"Por defecto (Manual)",name:"Nombre (A-Z)",temp_asc:"Temperatura (Más frío primero)",temp_desc:"Temperatura (Más cálido primero)"},add_place:"Añadir Lugar"},card:{yesterday:"Ayer",last_week:"Semana Pasada",average_avg:"Media 10 años",averages:"Medias",min:"Mín",max:"Máx",avg:"Med"},common:{errors:{no_places:"Debes definir al menos un lugar.",duplicate_place:"Este lugar ya está en tu lista."}}},it:{editor:{groups:{display:"Visualizzazione"},title:"Titolo (Opzionale)",places:"Luoghi",show_trend:"Mostra indicatori di tendenza (vs Ieri)",show_last_updated:"Mostra ultimo aggiornamento",show_stats:"Mostra statistiche (Ieri, Settimana scorsa, Media 10 anni)",show_chart:"Mostra grafico storico (30g)",show_country:"Aggiungi il paese al nome del luogo",chart_smoothing:"Arrotondamento grafico",chart_smoothing_options:{smooth:"Morbido",linear:"Lineare",step:"A gradini"},sort_by:"Ordina luoghi per",sort_by_options:{default:"Predefinito (Manuale)",name:"Nome (A-Z)",temp_asc:"Temperatura (Più freddo prima)",temp_desc:"Temperatura (Più caldo prima)"},add_place:"Aggiungi Luogo"},card:{yesterday:"Ieri",last_week:"Settimana Scorsa",average_avg:"Media 10 anni",averages:"Medie",min:"Min",max:"Max",avg:"Med"},common:{errors:{no_places:"Devi definire almeno un luogo.",duplicate_place:"Questo luogo è già nella tua lista."}}}};function mt(t,e){let n=_t[t];for(const t of e){if("object"!=typeof n||null===n)return;n=n[t]}return"string"==typeof n?n:void 0}function yt(t,e,n={}){const r=t?.language||"en",i=e.replace("component.sea-temperatures-card.","").split("."),o=mt(r,i)??mt("en",i);if("string"==typeof o){let t=o;for(const e in n)t=t.replace(`{${e}}`,String(n[e]));return t}return e}const vt=(t,e,n,r)=>{const i=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,...r,detail:n});t.dispatchEvent(i)};function wt(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 bt(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<0?i=e+1:o=e}while(i<o)}return i}return 2!==t.length?(e=wt,n=(e,n)=>wt(t(e),n),r=(e,n)=>t(e)-n):(e=t===wt||t===xt?t:$t,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<=0?i=e+1:o=e}while(i<o)}return i}}}function $t(){return 0}const At=bt(wt).right;function Mt(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 o of t)null!=(o=e(o,++i,t))&&(void 0===n?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}bt(function(t){return null===t?NaN:+t}).center;const St=Math.sqrt(50),Ct=Math.sqrt(10),Tt=Math.sqrt(2);function Et(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=St?10:o>=Ct?5:o>=Tt?2:1;let s,l,u;return i<0?(u=Math.pow(10,-i)/a,s=Math.round(t*u),l=Math.round(e*u),s/u<t&&++s,l/u>e&&--l,u=-u):(u=Math.pow(10,i)*a,s=Math.round(t/u),l=Math.round(e/u),s*u<t&&++s,l*u>e&&--l),l<s&&.5<=n&&n<2?Et(t,e,2*n):[s,l,u]}function Nt(t,e,n){return Et(t=+t,e=+e,n=+n)[2]}function kt(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?Nt(e,t,n):Nt(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}var Dt={value:()=>{}};function Ut(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Pt(r)}function Pt(t){this._=t}function Ot(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Ft(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Dt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Pt.prototype=Ut.prototype={constructor:Pt,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Ft(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Ft(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Ot(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Pt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var Ht="http://www.w3.org/1999/xhtml",Lt={svg:"http://www.w3.org/2000/svg",xhtml:Ht,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function zt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Lt.hasOwnProperty(e)?{space:Lt[e],local:t}:t}function jt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ht&&e.documentElement.namespaceURI===Ht?e.createElement(t):e.createElementNS(n,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Rt(t){var e=zt(t);return(e.local?Yt:jt)(e)}function qt(){}function It(t){return null==t?qt:function(){return this.querySelector(t)}}function Wt(){return[]}function Xt(t){return null==t?Wt:function(){return this.querySelectorAll(t)}}function Vt(t){return function(){return function(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}(t.apply(this,arguments))}}function Bt(t){return function(){return this.matches(t)}}function Zt(t){return function(e){return e.matches(t)}}var Gt=Array.prototype.find;function Jt(){return this.firstElementChild}var Qt=Array.prototype.filter;function Kt(){return Array.from(this.children)}function te(t){return new Array(t.length)}function ee(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ne(t,e,n,r,i,o){for(var a,s=0,l=e.length,u=o.length;s<u;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new ee(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function re(t,e,n,r,i,o,a){var s,l,u,c=new Map,h=e.length,f=o.length,d=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(d[s]=u=a.call(l,l.__data__,s,e)+"",c.has(u)?i[s]=l:c.set(u,l));for(s=0;s<f;++s)u=a.call(t,o[s],s,o)+"",(l=c.get(u))?(r[s]=l,l.__data__=o[s],c.delete(u)):n[s]=new ee(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&c.get(d[s])===l&&(i[s]=l)}function ie(t){return t.__data__}function oe(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ae(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function se(t){return function(){this.removeAttribute(t)}}function le(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ue(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function he(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function fe(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function de(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function pe(t){return function(){this.style.removeProperty(t)}}function ge(t,e,n){return function(){this.style.setProperty(t,e,n)}}function _e(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function me(t,e){return t.style.getPropertyValue(e)||de(t).getComputedStyle(t,null).getPropertyValue(e)}function ye(t){return function(){delete this[t]}}function ve(t,e){return function(){this[t]=e}}function we(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function xe(t){return t.trim().split(/^|\s+/)}function be(t){return t.classList||new $e(t)}function $e(t){this._node=t,this._names=xe(t.getAttribute("class")||"")}function Ae(t,e){for(var n=be(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Me(t,e){for(var n=be(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Se(t){return function(){Ae(this,t)}}function Ce(t){return function(){Me(this,t)}}function Te(t,e){return function(){(e.apply(this,arguments)?Ae:Me)(this,t)}}function Ee(){this.textContent=""}function Ne(t){return function(){this.textContent=t}}function ke(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function De(){this.innerHTML=""}function Ue(t){return function(){this.innerHTML=t}}function Pe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Oe(){this.nextSibling&&this.parentNode.appendChild(this)}function Fe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function He(){return null}function Le(){var t=this.parentNode;t&&t.removeChild(this)}function ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Re(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function qe(t,e,n){var r=de(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ie(t,e){return function(){return qe(this,t,e)}}function We(t,e){return function(){return qe(this,t,e.apply(this,arguments))}}ee.prototype={constructor:ee,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},$e.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Xe=[null];function Ve(t,e){this._groups=t,this._parents=e}function Be(){return new Ve([[document.documentElement]],Xe)}function Ze(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ge(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Je(){}Ve.prototype=Be.prototype={constructor:Ve,select:function(t){"function"!=typeof t&&(t=It(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,u=r[i]=new Array(l),c=0;c<l;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),u[c]=a);return new Ve(r,this._parents)},selectAll:function(t){t="function"==typeof t?Vt(t):Xt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,u=0;u<l;++u)(a=s[u])&&(r.push(t.call(a,a.__data__,u,s)),i.push(a));return new Ve(r,i)},selectChild:function(t){return this.select(null==t?Jt:function(t){return function(){return Gt.call(this.children,t)}}("function"==typeof t?t:Zt(t)))},selectChildren:function(t){return this.selectAll(null==t?Kt:function(t){return function(){return Qt.call(this.children,t)}}("function"==typeof t?t:Zt(t)))},filter:function(t){"function"!=typeof t&&(t=Bt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new Ve(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,ie);var n=e?re:ne,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),u=0;u<o;++u){var c=r[u],h=i[u],f=h.length,d=oe(t.call(c,c&&c.__data__,u,r)),p=d.length,g=s[u]=new Array(p),_=a[u]=new Array(p);n(c,h,g,_,l[u]=new Array(f),d,e);for(var m,y,v=0,w=0;v<p;++v)if(m=g[v]){for(v>=w&&(w=v+1);!(y=_[w])&&++w<p;);m._next=y||null}}return(a=new Ve(a,r))._enter=s,a._exit=l,a},enter:function(){return new Ve(this._enter||this._groups.map(te),this._parents)},exit:function(){return new Ve(this._exit||this._groups.map(te),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var u,c=n[l],h=r[l],f=c.length,d=s[l]=new Array(f),p=0;p<f;++p)(u=c[p]||h[p])&&(d[p]=u);for(;l<i;++l)s[l]=n[l];return new Ve(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=ae);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,u=i[o]=new Array(l),c=0;c<l;++c)(a=s[c])&&(u[c]=a);u.sort(e)}return new Ve(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=zt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?le:se:"function"==typeof e?n.local?fe:he:n.local?ce:ue)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?pe:"function"==typeof e?_e:ge)(t,e,null==n?"":n)):me(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ye:"function"==typeof e?we:ve)(t,e)):this.node()[t]},classed:function(t,e){var n=xe(t+"");if(arguments.length<2){for(var r=be(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Te:e?Se:Ce)(n,e))},text:function(t){return arguments.length?this.each(null==t?Ee:("function"==typeof t?ke:Ne)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?De:("function"==typeof t?Pe:Ue)(t)):this.node().innerHTML},raise:function(){return this.each(Oe)},lower:function(){return this.each(Fe)},append:function(t){var e="function"==typeof t?t:Rt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Rt(t),r=null==e?He:"function"==typeof e?e:It(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Le)},clone:function(t){return this.select(t?je:ze)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Re:Ye,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(r=0,l=s[u];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?We:Ie)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Qe=.7,Ke=1/Qe,tn="\\s*([+-]?\\d+)\\s*",en="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",nn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rn=/^#([0-9a-f]{3,8})$/,on=new RegExp(`^rgb\\(${tn},${tn},${tn}\\)$`),an=new RegExp(`^rgb\\(${nn},${nn},${nn}\\)$`),sn=new RegExp(`^rgba\\(${tn},${tn},${tn},${en}\\)$`),ln=new RegExp(`^rgba\\(${nn},${nn},${nn},${en}\\)$`),un=new RegExp(`^hsl\\(${en},${nn},${nn}\\)$`),cn=new RegExp(`^hsla\\(${en},${nn},${nn},${en}\\)$`),hn={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 fn(){return this.rgb().formatHex()}function dn(){return this.rgb().formatRgb()}function pn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=rn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?gn(e):3===n?new yn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?_n(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?_n(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=on.exec(t))?new yn(e[1],e[2],e[3],1):(e=an.exec(t))?new yn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=sn.exec(t))?_n(e[1],e[2],e[3],e[4]):(e=ln.exec(t))?_n(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=un.exec(t))?An(e[1],e[2]/100,e[3]/100,1):(e=cn.exec(t))?An(e[1],e[2]/100,e[3]/100,e[4]):hn.hasOwnProperty(t)?gn(hn[t]):"transparent"===t?new yn(NaN,NaN,NaN,0):null}function gn(t){return new yn(t>>16&255,t>>8&255,255&t,1)}function _n(t,e,n,r){return r<=0&&(t=e=n=NaN),new yn(t,e,n,r)}function mn(t,e,n,r){return 1===arguments.length?function(t){return t instanceof Je||(t=pn(t)),t?new yn((t=t.rgb()).r,t.g,t.b,t.opacity):new yn}(t):new yn(t,e,n,null==r?1:r)}function yn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function vn(){return`#${$n(this.r)}${$n(this.g)}${$n(this.b)}`}function wn(){const t=xn(this.opacity);return`${1===t?"rgb(":"rgba("}${bn(this.r)}, ${bn(this.g)}, ${bn(this.b)}${1===t?")":`, ${t})`}`}function xn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function bn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function $n(t){return((t=bn(t))<16?"0":"")+t.toString(16)}function An(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Sn(t,e,n,r)}function Mn(t){if(t instanceof Sn)return new Sn(t.h,t.s,t.l,t.opacity);if(t instanceof Je||(t=pn(t)),!t)return new Sn;if(t instanceof Sn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Sn(a,s,l,t.opacity)}function Sn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Cn(t){return(t=(t||0)%360)<0?t+360:t}function Tn(t){return Math.max(0,Math.min(1,t||0))}function En(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Ze(Je,pn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:fn,formatHex:fn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Mn(this).formatHsl()},formatRgb:dn,toString:dn}),Ze(yn,mn,Ge(Je,{brighter(t){return t=null==t?Ke:Math.pow(Ke,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Qe:Math.pow(Qe,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new yn(bn(this.r),bn(this.g),bn(this.b),xn(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:vn,formatHex:vn,formatHex8:function(){return`#${$n(this.r)}${$n(this.g)}${$n(this.b)}${$n(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:wn,toString:wn})),Ze(Sn,function(t,e,n,r){return 1===arguments.length?Mn(t):new Sn(t,e,n,null==r?1:r)},Ge(Je,{brighter(t){return t=null==t?Ke:Math.pow(Ke,t),new Sn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Qe:Math.pow(Qe,t),new Sn(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 yn(En(t>=240?t-240:t+120,i,r),En(t,i,r),En(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Sn(Cn(this.h),Tn(this.s),Tn(this.l),xn(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=xn(this.opacity);return`${1===t?"hsl(":"hsla("}${Cn(this.h)}, ${100*Tn(this.s)}%, ${100*Tn(this.l)}%${1===t?")":`, ${t})`}`}}));var Nn=t=>()=>t;function kn(t){return 1===(t=+t)?Dn: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):Nn(isNaN(e)?n:e)}}function Dn(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Nn(isNaN(t)?e:t)}var Un=function t(e){var n=kn(e);function r(t,e){var r=n((t=mn(t)).r,(e=mn(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Dn(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Pn(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function On(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Rn(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function Fn(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Hn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Ln(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]=Rn(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var zn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jn=new RegExp(zn.source,"g");function Yn(t,e){var n,r,i,o=zn.lastIndex=jn.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=zn.exec(t))&&(r=jn.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Hn(n,r)})),o=jn.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function Rn(t,e){var n,r=typeof e;return null==e||"boolean"===r?Nn(e):("number"===r?Hn:"string"===r?(n=pn(e))?(e=n,Un):Yn:e instanceof pn?Un:e instanceof Date?Fn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Pn:Array.isArray(e)?On:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Ln:Hn)(t,e)}function qn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var In,Wn=180/Math.PI,Xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vn(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Wn,skewX:Math.atan(l)*Wn,scaleX:a,scaleY:s}}function Bn(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:Hn(t,i)},{i:l-2,x:Hn(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Hn(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Hn(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Hn(t,n)},{i:s-2,x:Hn(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Zn,Gn,Jn=Bn(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xn:Vn(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Qn=Bn(function(t){return null==t?Xn:(In||(In=document.createElementNS("http://www.w3.org/2000/svg","g")),In.setAttribute("transform",t),(t=In.transform.baseVal.consolidate())?Vn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Xn)},", ",")",")"),Kn=0,tr=0,er=0,nr=0,rr=0,ir=0,or="object"==typeof performance&&performance.now?performance:Date,ar="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function sr(){return rr||(ar(lr),rr=or.now()+ir)}function lr(){rr=0}function ur(){this._call=this._time=this._next=null}function cr(t,e,n){var r=new ur;return r.restart(t,e,n),r}function hr(){rr=(nr=or.now())+ir,Kn=tr=0;try{!function(){sr(),++Kn;for(var t,e=Zn;e;)(t=rr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Kn}()}finally{Kn=0,function(){var t,e,n=Zn,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Zn=e);Gn=t,dr(r)}(),rr=0}}function fr(){var t=or.now(),e=t-nr;e>1e3&&(ir-=e,nr=t)}function dr(t){Kn||(tr&&(tr=clearTimeout(tr)),t-rr>24?(t<1/0&&(tr=setTimeout(hr,t-or.now()-ir)),er&&(er=clearInterval(er))):(er||(nr=or.now(),er=setInterval(fr,1e3)),Kn=1,ar(hr)))}function pr(t,e,n){var r=new ur;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}ur.prototype=cr.prototype={constructor:ur,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?sr():+n)+(null==e?0:+e),this._next||Gn===this||(Gn?Gn._next=this:Zn=this,Gn=this),this._call=t,this._time=n,dr()},stop:function(){this._call&&(this._call=null,this._time=1/0,dr())}};var gr=Ut("start","end","cancel","interrupt"),_r=[];function mr(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,c,h,f;if(1!==n.state)return l();for(u in i)if((f=i[u]).name===n.name){if(3===f.state)return pr(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[u]):+u<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[u])}if(pr(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),u=0,c=-1;u<h;++u)(f=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);r.length=c+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=cr(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:gr,tween:_r,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function yr(t,e){var n=wr(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function vr(t,e){var n=wr(t,e);if(n.state>3)throw new Error("too late; already running");return n}function wr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function xr(t,e){var n,r;return function(){var i=vr(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function br(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=vr(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===e){i[l]=s;break}l===u&&i.push(s)}o.tween=i}}function $r(t,e,n){var r=t._id;return t.each(function(){var t=vr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return wr(t,r).value[e]}}function Ar(t,e){var n;return("number"==typeof e?Hn:e instanceof pn?Un:(n=pn(e))?(e=n,Un):Yn)(t,e)}function Mr(t){return function(){this.removeAttribute(t)}}function Sr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Cr(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Tr(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function Er(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Nr(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function kr(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Dr(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ur(t,e){return function(){yr(this,t).delay=+e.apply(this,arguments)}}function Pr(t,e){return e=+e,function(){yr(this,t).delay=e}}function Or(t,e){return function(){vr(this,t).duration=+e.apply(this,arguments)}}function Fr(t,e){return e=+e,function(){vr(this,t).duration=e}}var Hr=Be.prototype.constructor;function Lr(t){return function(){this.style.removeProperty(t)}}var zr=0;function jr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Yr(){return++zr}var Rr=Be.prototype;jr.prototype={constructor:jr,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=It(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,u=r[a],c=u.length,h=o[a]=new Array(c),f=0;f<c;++f)(s=u[f])&&(l=t.call(s,s.__data__,f,u))&&("__data__"in s&&(l.__data__=s.__data__),h[f]=l,mr(h[f],e,n,f,h,wr(s,n)));return new jr(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Xt(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,u=r[s],c=u.length,h=0;h<c;++h)if(l=u[h]){for(var f,d=t.call(l,l.__data__,h,u),p=wr(l,n),g=0,_=d.length;g<_;++g)(f=d[g])&&mr(f,e,n,g,d,p);o.push(d),a.push(l)}return new jr(o,a,e,n)},selectChild:Rr.selectChild,selectChildren:Rr.selectChildren,filter:function(t){"function"!=typeof t&&(t=Bt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new jr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,u=e[s],c=n[s],h=u.length,f=a[s]=new Array(h),d=0;d<h;++d)(l=u[d]||c[d])&&(f[d]=l);for(;s<r;++s)a[s]=e[s];return new jr(a,this._parents,this._name,this._id)},selection:function(){return new Hr(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Yr(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,u=0;u<l;++u)if(a=s[u]){var c=wr(a,e);mr(a,t,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new jr(r,this._parents,t,n)},call:Rr.call,nodes:Rr.nodes,node:Rr.node,size:Rr.size,empty:Rr.empty,each:Rr.each,on:function(t,e){var n=this._id;return arguments.length<2?wr(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?yr:vr;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=zt(t),r="transform"===n?Qn:Ar;return this.attrTween(t,"function"==typeof e?(n.local?Nr:Er)(n,r,$r(this,"attr."+t,e)):null==e?(n.local?Sr:Mr)(n):(n.local?Tr:Cr)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=zt(t);return this.tween(n,(r.local?kr:Dr)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Jn:Ar;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=me(this,t),a=(this.style.removeProperty(t),me(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,Lr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=me(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=me(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,$r(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=vr(this,t),u=l.on,c=null==l.value[a]?o||(o=Lr(e)):void 0;u===n&&i===c||(r=(n=u).copy()).on(s,i=c),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=me(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}($r(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=wr(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?xr:br)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ur:Pr)(e,t)):wr(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Or:Fr)(e,t)):wr(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){vr(this,t).ease=e}}(e,t)):wr(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;vr(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},l={value:function(){0===--i&&o()}};n.each(function(){var n=vr(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e}),0===i&&o()})},[Symbol.iterator]:Rr[Symbol.iterator]};var qr={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Ir(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}Be.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)})},Be.prototype.transition=function(t){var e,n;t instanceof jr?(e=t._id,t=t._name):(e=Yr(),(n=qr).time=sr(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,u=0;u<l;++u)(a=s[u])&&mr(a,t,e,u,s,n||Ir(a,e));return new jr(r,this._parents,t,e)};const Wr=Math.PI,Xr=2*Wr,Vr=1e-6,Br=Xr-Vr;function Zr(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}class Gr{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Zr:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Zr;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,o){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+o}`}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 o=this._x1,a=this._y1,s=n-t,l=r-e,u=o-t,c=a-e,h=u*u+c*c;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>Vr)if(Math.abs(c*s-l*u)>Vr&&i){let f=n-o,d=r-a,p=s*s+l*l,g=f*f+d*d,_=Math.sqrt(p),m=Math.sqrt(h),y=i*Math.tan((Wr-Math.acos((p+h-g)/(2*_*m)))/2),v=y/m,w=y/_;Math.abs(v-1)>Vr&&this._append`L${t+v*u},${e+v*c}`,this._append`A${i},${i},0,0,${+(c*f>u*d)},${this._x1=t+w*s},${this._y1=e+w*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),s=n*Math.sin(r),l=t+a,u=e+s,c=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Vr||Math.abs(this._y1-u)>Vr)&&this._append`L${l},${u}`,n&&(h<0&&(h=h%Xr+Xr),h>Br?this._append`A${n},${n},0,1,${c},${t-a},${e-s}A${n},${n},0,1,${c},${this._x1=l},${this._y1=u}`:h>Vr&&this._append`A${n},${n},0,${+(h>=Wr)},${c},${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 Jr(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 Qr(t){return(t=Jr(Math.abs(t)))?t[1]:NaN}var Kr,ti=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ei(t){if(!(e=ti.exec(t)))throw new Error("invalid format: "+t);var e;return new ni({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 ni(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 ri(t,e){var n=Jr(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")}ei.prototype=ni.prototype,ni.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 ii={"%":(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)=>ri(100*t,e),r:ri,s:function(t,e){var n=Jr(t,e);if(!n)return Kr=void 0,t.toPrecision(e);var r=n[0],i=n[1],o=i-(Kr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Jr(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function oi(t){return t}var ai,si,li,ui=Array.prototype.map,ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function hi(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?oi:(e=ui.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?oi:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(ui.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t,e){var n=(t=ei(t)).fill,h=t.align,f=t.sign,d=t.symbol,p=t.zero,g=t.width,_=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(_=!0,v="g"):ii[v]||(void 0===m&&(m=12),y=!0,v="g"),(p||"0"===n&&"="===h)&&(p=!0,n="0",h="=");var w=(e&&void 0!==e.prefix?e.prefix:"")+("$"===d?i:"#"===d&&/[boxX]/.test(v)?"0"+v.toLowerCase():""),x=("$"===d?o:/[%p]/.test(v)?l:"")+(e&&void 0!==e.suffix?e.suffix:""),b=ii[v],$=/[defgprs%]/.test(v);function A(t){var e,i,o,l=w,d=x;if("c"===v)d=b(t)+d,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),m),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)),A&&0===+t&&"+"!==f&&(A=!1),l=(A?"("===f?f:u:"-"===f||"("===f?"":f)+l,d=("s"!==v||isNaN(t)||void 0===Kr?"":ci[8+Kr/3])+d+(A&&"("===f?")":""),$)for(e=-1,i=t.length;++e<i;)if(48>(o=t.charCodeAt(e))||o>57){d=(46===o?a+t.slice(e+1):t.slice(e))+d,t=t.slice(0,e);break}}_&&!p&&(t=r(t,1/0));var M=l.length+t.length+d.length,S=M<g?new Array(g-M+1).join(n):"";switch(_&&p&&(t=r(S+t,S.length?g-d.length:1/0),S=""),h){case"<":t=l+t+d+S;break;case"=":t=l+S+t+d;break;case"^":t=S.slice(0,M=S.length>>1)+l+t+d+S.slice(M);break;default:t=S+l+t+d}return s(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),A.toString=function(){return t+""},A}return{format:h,formatPrefix:function(t,e){var n=3*Math.max(-8,Math.min(8,Math.floor(Qr(e)/3))),r=Math.pow(10,-n),i=h(((t=ei(t)).type="f",t),{suffix:ci[8+n/3]});return function(t){return i(r*t)}}}}function fi(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function di(t){return+t}ai=hi({thousands:",",grouping:[3],currency:["$",""]}),si=ai.format,li=ai.formatPrefix;var pi=[0,1];function gi(t){return t}function _i(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function mi(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=_i(i,r),o=n(a,o)):(r=_i(r,i),o=n(o,a)),function(t){return o(r(t))}}function yi(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=_i(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=At(t,e,1,r)-1;return o[n](i[n](e))}}function vi(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function wi(){var t,e,n,r,i,o,a=pi,s=pi,l=Rn,u=gi;function c(){var t=Math.min(a.length,s.length);return u!==gi&&(u=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?yi:mi,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(u(e)))}return h.invert=function(n){return u(e((o||(o=r(s,a.map(t),Hn)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,di),c()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=qn,c()},h.clamp=function(t){return arguments.length?(u=!!t||gi,c()):u!==gi},h.interpolate=function(t){return arguments.length?(l=t,c()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,c()}}function xi(){return wi()(gi,gi)}function bi(t,e,n,r){var i,o=kt(t,e,n);switch((r=ei(null==r?",f":r)).type){case"s":var a=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(Qr(e)/3)))-Qr(Math.abs(t)))}(o,a))||(r.precision=i),li(r,a);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,Qr(e)-Qr(t))+1}(o,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,-Qr(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return si(r)}function $i(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,o,a]=r?Et(e,t,n):Et(t,e,n);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return bi(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],u=o[s],c=10;for(u<l&&(i=l,l=u,u=i,i=a,a=s,s=i);c-- >0;){if((i=Nt(l,u,n))===r)return o[a]=l,o[s]=u,e(o);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i}r=i}return t},t}function Ai(){var t=xi();return t.copy=function(){return vi(t,Ai())},fi.apply(t,arguments),$i(t)}const Mi=new Date,Si=new Date;function Ci(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,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<r);return a},i.filter=n=>Ci(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)=>(Mi.setTime(+e),Si.setTime(+r),t(Mi),t(Si),Math.floor(n(Mi,Si))),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 Ti=Ci(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ti.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Ci(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Ti:null),Ti.range;const Ei=1e3,Ni=6e4,ki=36e5,Di=864e5,Ui=6048e5,Pi=2592e6,Oi=31536e6,Fi=Ci(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Ei)},(t,e)=>(e-t)/Ei,t=>t.getUTCSeconds());Fi.range;const Hi=Ci(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Ei)},(t,e)=>{t.setTime(+t+e*Ni)},(t,e)=>(e-t)/Ni,t=>t.getMinutes());Hi.range;const Li=Ci(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Ni)},(t,e)=>(e-t)/Ni,t=>t.getUTCMinutes());Li.range;const zi=Ci(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Ei-t.getMinutes()*Ni)},(t,e)=>{t.setTime(+t+e*ki)},(t,e)=>(e-t)/ki,t=>t.getHours());zi.range;const ji=Ci(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ki)},(t,e)=>(e-t)/ki,t=>t.getUTCHours());ji.range;const Yi=Ci(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Ni)/Di,t=>t.getDate()-1);Yi.range;const Ri=Ci(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Di,t=>t.getUTCDate()-1);Ri.range;const qi=Ci(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Di,t=>Math.floor(t/Di));function Ii(t){return Ci(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())*Ni)/Ui)}qi.range;const Wi=Ii(0),Xi=Ii(1),Vi=Ii(2),Bi=Ii(3),Zi=Ii(4),Gi=Ii(5),Ji=Ii(6);function Qi(t){return Ci(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)/Ui)}Wi.range,Xi.range,Vi.range,Bi.range,Zi.range,Gi.range,Ji.range;const Ki=Qi(0),to=Qi(1),eo=Qi(2),no=Qi(3),ro=Qi(4),io=Qi(5),oo=Qi(6);Ki.range,to.range,eo.range,no.range,ro.range,io.range,oo.range;const ao=Ci(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());ao.range;const so=Ci(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());so.range;const lo=Ci(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());lo.every=t=>isFinite(t=Math.floor(t))&&t>0?Ci(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,lo.range;const uo=Ci(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());uo.every=t=>isFinite(t=Math.floor(t))&&t>0?Ci(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,uo.range;const[co,ho]=function(t,e,n,r,i,o){const a=[[Fi,1,Ei],[Fi,5,5e3],[Fi,15,15e3],[Fi,30,3e4],[o,1,Ni],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,ki],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,Di],[r,2,1728e5],[n,1,Ui],[e,1,Pi],[e,3,7776e6],[t,1,Oi]];function s(e,n,r){const i=Math.abs(n-e)/r,o=bt(([,,t])=>t).right(a,i);if(o===a.length)return t.every(kt(e/Oi,n/Oi,r));if(0===o)return Ti.every(Math.max(kt(e,n,r),1));const[s,l]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return s.every(l)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:s(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},s]}(lo,ao,Wi,Yi,zi,Hi);function fo(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 po(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 go(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var _o,mo,yo={"-":"",_:" ",0:"0"},vo=/^\s*\d+/,wo=/^%/,xo=/[\\^$*+?|[\]().{}]/g;function bo(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function $o(t){return t.replace(xo,"\\$&")}function Ao(t){return new RegExp("^(?:"+t.map($o).join("|")+")","i")}function Mo(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function So(t,e,n){var r=vo.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Co(t,e,n){var r=vo.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function To(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Eo(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function No(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ko(t,e,n){var r=vo.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Do(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Uo(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 Po(t,e,n){var r=vo.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Oo(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Fo(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ho(t,e,n){var r=vo.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Lo(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zo(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function jo(t,e,n){var r=vo.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Yo(t,e,n){var r=vo.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ro(t,e,n){var r=vo.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qo(t,e,n){var r=wo.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Io(t,e,n){var r=vo.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Wo(t,e,n){var r=vo.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xo(t,e){return bo(t.getDate(),e,2)}function Vo(t,e){return bo(t.getHours(),e,2)}function Bo(t,e){return bo(t.getHours()%12||12,e,2)}function Zo(t,e){return bo(1+Yi.count(lo(t),t),e,3)}function Go(t,e){return bo(t.getMilliseconds(),e,3)}function Jo(t,e){return Go(t,e)+"000"}function Qo(t,e){return bo(t.getMonth()+1,e,2)}function Ko(t,e){return bo(t.getMinutes(),e,2)}function ta(t,e){return bo(t.getSeconds(),e,2)}function ea(t){var e=t.getDay();return 0===e?7:e}function na(t,e){return bo(Wi.count(lo(t)-1,t),e,2)}function ra(t){var e=t.getDay();return e>=4||0===e?Zi(t):Zi.ceil(t)}function ia(t,e){return t=ra(t),bo(Zi.count(lo(t),t)+(4===lo(t).getDay()),e,2)}function oa(t){return t.getDay()}function aa(t,e){return bo(Xi.count(lo(t)-1,t),e,2)}function sa(t,e){return bo(t.getFullYear()%100,e,2)}function la(t,e){return bo((t=ra(t)).getFullYear()%100,e,2)}function ua(t,e){return bo(t.getFullYear()%1e4,e,4)}function ca(t,e){var n=t.getDay();return bo((t=n>=4||0===n?Zi(t):Zi.ceil(t)).getFullYear()%1e4,e,4)}function ha(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+bo(e/60|0,"0",2)+bo(e%60,"0",2)}function fa(t,e){return bo(t.getUTCDate(),e,2)}function da(t,e){return bo(t.getUTCHours(),e,2)}function pa(t,e){return bo(t.getUTCHours()%12||12,e,2)}function ga(t,e){return bo(1+Ri.count(uo(t),t),e,3)}function _a(t,e){return bo(t.getUTCMilliseconds(),e,3)}function ma(t,e){return _a(t,e)+"000"}function ya(t,e){return bo(t.getUTCMonth()+1,e,2)}function va(t,e){return bo(t.getUTCMinutes(),e,2)}function wa(t,e){return bo(t.getUTCSeconds(),e,2)}function xa(t){var e=t.getUTCDay();return 0===e?7:e}function ba(t,e){return bo(Ki.count(uo(t)-1,t),e,2)}function $a(t){var e=t.getUTCDay();return e>=4||0===e?ro(t):ro.ceil(t)}function Aa(t,e){return t=$a(t),bo(ro.count(uo(t),t)+(4===uo(t).getUTCDay()),e,2)}function Ma(t){return t.getUTCDay()}function Sa(t,e){return bo(to.count(uo(t)-1,t),e,2)}function Ca(t,e){return bo(t.getUTCFullYear()%100,e,2)}function Ta(t,e){return bo((t=$a(t)).getUTCFullYear()%100,e,2)}function Ea(t,e){return bo(t.getUTCFullYear()%1e4,e,4)}function Na(t,e){var n=t.getUTCDay();return bo((t=n>=4||0===n?ro(t):ro.ceil(t)).getUTCFullYear()%1e4,e,4)}function ka(){return"+0000"}function Da(){return"%"}function Ua(t){return+t}function Pa(t){return Math.floor(+t/1e3)}function Oa(t){return new Date(t)}function Fa(t){return t instanceof Date?+t:+new Date(+t)}function Ha(t,e,n,r,i,o,a,s,l,u){var c=xi(),h=c.invert,f=c.domain,d=u(".%L"),p=u(":%S"),g=u("%I:%M"),_=u("%I %p"),m=u("%a %d"),y=u("%b %d"),v=u("%B"),w=u("%Y");function x(t){return(l(t)<t?d:s(t)<t?p:a(t)<t?g:o(t)<t?_:r(t)<t?i(t)<t?m:y:n(t)<t?v:w)(t)}return c.invert=function(t){return new Date(h(t))},c.domain=function(t){return arguments.length?f(Array.from(t,Fa)):f().map(Oa)},c.ticks=function(e){var n=f();return t(n[0],n[n.length-1],null==e?10:e)},c.tickFormat=function(t,e){return null==e?x:u(e)},c.nice=function(t){var n=f();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?f(function(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}(n,t)):c},c.copy=function(){return vi(c,Ha(t,e,n,r,i,o,a,s,l,u))},c}function La(){return fi.apply(Ha(co,ho,lo,ao,Wi,Yi,zi,Hi,Fi,mo).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function za(t){return function(){return t}}function ja(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 Gr(e)}function Ya(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ra(t){this._context=t}function qa(t){return new Ra(t)}function Ia(t){return t[0]}function Wa(t){return t[1]}function Xa(t,e){var n=za(!0),r=null,i=qa,o=null,a=ja(s);function s(s){var l,u,c,h=(s=Ya(s)).length,f=!1;for(null==r&&(o=i(c=a())),l=0;l<=h;++l)!(l<h&&n(u=s[l],l,s))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(u,l,s),+e(u,l,s));if(c)return o=null,c+""||null}return t="function"==typeof t?t:void 0===t?Ia:za(t),e="function"==typeof e?e:void 0===e?Wa:za(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:za(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:za(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:za(!!t),s):n},s.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),s):i},s.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),s):r},s}function Va(t,e,n){var r=null,i=za(!0),o=null,a=qa,s=null,l=ja(u);function u(u){var c,h,f,d,p,g=(u=Ya(u)).length,_=!1,m=new Array(g),y=new Array(g);for(null==o&&(s=a(p=l())),c=0;c<=g;++c){if(!(c<g&&i(d=u[c],c,u))===_)if(_=!_)h=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=c-1;f>=h;--f)s.point(m[f],y[f]);s.lineEnd(),s.areaEnd()}_&&(m[c]=+t(d,c,u),y[c]=+e(d,c,u),s.point(r?+r(d,c,u):m[c],n?+n(d,c,u):y[c]))}if(p)return s=null,p+""||null}function c(){return Xa().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Ia:za(+t),e="function"==typeof e?e:za(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Wa:za(+n),u.x=function(e){return arguments.length?(t="function"==typeof e?e:za(+e),r=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:za(+e),u):t},u.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:za(+t),u):r},u.y=function(t){return arguments.length?(e="function"==typeof t?t:za(+t),n=null,u):e},u.y0=function(t){return arguments.length?(e="function"==typeof t?t:za(+t),u):e},u.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:za(+t),u):n},u.lineX0=u.lineY0=function(){return c().x(t).y(e)},u.lineY1=function(){return c().x(t).y(n)},u.lineX1=function(){return c().x(r).y(e)},u.defined=function(t){return arguments.length?(i="function"==typeof t?t:za(!!t),u):i},u.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),u):a},u.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),u):o},u}function Ba(t){return t<0?-1:1}function Za(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(Ba(o)+Ba(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Ga(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Ja(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function Qa(t){this._context=t}function Ka(t){return new Qa(t)}function ts(t,e){this._context=t,this._t=e}function es(t){return new ts(t,1)}function ns(t,e,n){this.k=t,this.x=e,this.y=n}!function(t){_o=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,u=Ao(i),c=Mo(i),h=Ao(o),f=Mo(o),d=Ao(a),p=Mo(a),g=Ao(s),_=Mo(s),m=Ao(l),y=Mo(l),v={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Xo,e:Xo,f:Jo,g:la,G:ca,H:Vo,I:Bo,j:Zo,L:Go,m:Qo,M:Ko,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ua,s:Pa,S:ta,u:ea,U:na,V:ia,w:oa,W:aa,x:null,X:null,y:sa,Y:ua,Z:ha,"%":Da},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:fa,e:fa,f:ma,g:Ta,G:Na,H:da,I:pa,j:ga,L:_a,m:ya,M:va,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ua,s:Pa,S:wa,u:xa,U:ba,V:Aa,w:Ma,W:Sa,x:null,X:null,y:Ca,Y:Ea,Z:ka,"%":Da},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.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=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=m.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=_.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Fo,e:Fo,f:Ro,g:Do,G:ko,H:Lo,I:Lo,j:Ho,L:Yo,m:Oo,M:zo,p:function(t,e,n){var r=u.exec(e.slice(n));return r?(t.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:Po,Q:Io,s:Wo,S:jo,u:Co,U:To,V:Eo,w:So,W:No,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Do,Y:ko,Z:Uo,"%":qo};function b(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s<u;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=yo[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function $(t,e){return function(n){var r,i,o=go(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=po(go(o.y,0,1))).getUTCDay(),r=i>4||0===i?to.ceil(r):to(r),r=Ri.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=fo(go(o.y,0,1))).getDay(),r=i>4||0===i?Xi.ceil(r):Xi(r),r=Yi.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?po(go(o.y,0,1)).getUTCDay():fo(go(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,po(o)):fo(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=x[i in yo?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return v.x=b(n,v),v.X=b(r,v),v.c=b(e,v),w.x=b(n,w),w.X=b(r,w),w.c=b(e,w),{format:function(t){var e=b(t+="",v);return e.toString=function(){return t},e},parse:function(t){var e=$(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=b(t+="",w);return e.toString=function(){return t},e},utcParse:function(t){var e=$(t+="",!0);return e.toString=function(){return t},e}}}(t),mo=_o.format,_o.parse,_o.utcFormat,_o.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"]}),Ra.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)}}},Qa.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:Ja(this,this._t0,Ga(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,Ja(this,Ga(this,n=Za(this,t,e)),n);break;default:Ja(this,this._t0,n=Za(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},Object.create(Qa.prototype).point=function(t,e){Qa.prototype.point.call(this,e,t)},ts.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}},ns.prototype={constructor:ns,scale:function(t){return 1===t?this:new ns(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new ns(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},ns.prototype;const rs=s`: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}.place-header:hover{opacity:.7}.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-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}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}`,is="sea-temperatures-card",os=`${is}-editor`;class as extends ct{constructor(){super(...arguments),this._chartData={},this._chartWidth=400,this._dataFetched=!1}setConfig(t){if(!t||!t.places||!Array.isArray(t.places)||0===t.places.length)throw new Error(yt(this.hass,"common.errors.no_places"));this._config={show_last_updated:!0,show_trend:!0,show_stats:!0,show_chart:!0,show_country:!1,compact:!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 hs}),document.createElement(os)}static getStubConfig(){return{title:"Sea Temperatures",places:[]}}getCardSize(){return this._config?.places?.length||1}_getPlacesData(t,e){const n=[],r=Object.values(t.states);return e.places.forEach(i=>{const o="string"==typeof i?i:i.device,a="object"==typeof i?i.name:void 0;let s,l=t.states[o];if(l)s=t.entities[o]?.device_id;else{s=o;const e=r.filter(e=>t.entities[e.entity_id]?.device_id===s&&e.entity_id.startsWith("sensor."));if(0===e.length)return;l=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(l){const r=l.attributes,i=s?t.devices[s]:void 0,o=i?.name_by_user||i?.name||r.friendly_name||"Unknown",u="°F"===r.unit_of_measurement||"F"===r.unit_of_measurement,c=t=>{if(null==t||isNaN(parseFloat(String(t))))return;const e=parseFloat(String(t));return String(u?Math.round(100*(1.8*e+32))/100:e)};n.push({name:a||o,country:e.show_country&&r.country?String(r.country):void 0,temperature:l.state,yesterday:c(r.yesterday),last_week:c(r.last_week),date:r.date?String(r.date):void 0,average_min:c(r.average_min),average_max:c(r.average_max),average_avg:c(r.average_avg),unit:r.unit_of_measurement||"°C",entity_id:l.entity_id})}}),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),o=isNaN(r)?-1/0:r,a=isNaN(i)?-1/0:i;return"temp_asc"===e.sort_by?o-a:a-o}return 0}),n}updated(t){super.updated(t),this.hass&&this._config&&!this._dataFetched&&(this._dataFetched=!0,this._fetchChartData())}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")}return!0}_fetchChartData(){if(!this.hass||!this._config.places)return;const t=this._getPlacesData(this.hass,this._config).map(t=>t.entity_id);if(0===t.length)return;const e={};t.forEach(t=>{const n=this.hass?.states[t],r=n?.attributes?.charts;if(r?.last_thirty?.labels&&r?.last_thirty?.series){const i=r.last_thirty.labels,o=r.last_thirty.series;if(Array.isArray(i)&&Array.isArray(o)&&i.length===o.length){const r=(new Date).getFullYear(),a=(new Date).getMonth()+1,s="°F"===n?.attributes?.unit_of_measurement||"F"===n?.attributes?.unit_of_measurement;e[t]=i.map((t,e)=>{const n=String(t).split("-");if(2!==n.length)return{date:new Date,value:NaN};const i=parseInt(n[0],10),l=parseInt(n[1],10);let u=r;i>a+1&&(u-=1),a>10&&i<3&&(u+=1);let c=parseFloat(String(o[e]));return s&&!isNaN(c)&&(c=Math.round(100*(1.8*c+32))/100),{date:new Date(u,i-1,l),value:c}}).filter(t=>!isNaN(t.value)).sort((t,e)=>t.date.getTime()-e.date.getTime())}}}),this._chartData={...e},this.requestUpdate()}_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),o=Math.round(10*i)/10;if(Math.abs(o)>0){const t=o>0,e=new Intl.NumberFormat(this.hass?.language,{minimumFractionDigits:1,maximumFractionDigits:1}).format(Math.abs(o));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" @click=${()=>this._handleMoreInfo(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">
                    <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,"-")}"
        >
          ${this._drawChart(t.entity_id,e,t)}
        </svg>
      </div>
    `}_handleMouseMove(t,e,n,r,i,o){const a=t.currentTarget.ownerSVGElement;if(!a)return;const s=a.createSVGPoint();s.x=t.clientX,s.y=t.clientY;const l=a.getScreenCTM();if(!l)return;const u=s.matrixTransform(l.inverse()),c=r.invert(u.x),h=bt(t=>t.date).left,f=h(n,c,1),d=n[f-1],p=n[f];let g=d;if(d&&p?g=c.getTime()-d.date.getTime()>p.date.getTime()-c.getTime()?p:d:p&&(g=p),!g)return;const _=a.querySelector(".hover-group");if(!_)return;_.style.opacity="1";const m=r(g.date),y=i(g.value),v=_.querySelector(".hover-line");v.setAttribute("x1",String(m)),v.setAttribute("x2",String(m));const w=_.querySelector(".hover-point");w.setAttribute("cx",String(m)),w.setAttribute("cy",String(y));const x=_.querySelector(".hover-tooltip-bg"),b=_.querySelector(".hover-tooltip-text"),$=_.querySelector(".hover-tooltip-date"),A=this._chartWidth,M=Math.max(0,Math.min(m-35,A-70)),S=M+35,C="middle",T=Math.max(0,y-34),E=T+11,N=T+23;x.setAttribute("x",String(M)),x.setAttribute("y",String(T)),b.setAttribute("x",String(S)),b.setAttribute("y",String(E)),b.setAttribute("text-anchor",C);const k=new Intl.NumberFormat(this.hass?.language).format(g.value);b.textContent=`${k}${o}`,$.setAttribute("x",String(S)),$.setAttribute("y",String(N)),$.setAttribute("text-anchor",C),$.textContent=g.date.toLocaleDateString(this.hass?.language||void 0,{month:"short",day:"numeric"})}_handleMouseLeave(t){const e=t.currentTarget.ownerSVGElement;if(!e)return;const n=e.querySelector(".hover-group");n&&(n.style.opacity="0")}_drawChart(t,e,n){const r=this._chartWidth,i=120,o=r<360,a=15,s=o?48:65,l=25,u=10,c=La().domain(Mt(e,t=>t.date)).range([u,r-s]),h=[...e.map(t=>t.value)];n.average_min&&h.push(parseFloat(n.average_min)),n.average_max&&h.push(parseFloat(n.average_max));const f=Mt(h),d=.1*(f[1]-f[0])||1,p=Ai().domain([f[0]-d,f[1]+d]).range([i-l,a]);let g=Ka;"linear"===this._config.chart_smoothing&&(g=qa),"step"===this._config.chart_smoothing&&(g=es);const _=Xa().x(t=>c(t.date)).y(t=>p(t.value)).curve(g),m=Va().x(t=>c(t.date)).y0(i-l).y1(t=>p(t.value)).curve(g),y=(t,e,i)=>{if(!t)return null;const a=parseFloat(t);if(isNaN(a))return null;const l=p(a),c=n.unit||"°C",h=i?o?`${a.toFixed(1)}${c}`:`${i} ${a.toFixed(1)}${c}`:"";return X`
        <line
          class="ref-line ${e}"
          x1="${u}"
          x2="${r-s}"
          y1="${l}"
          y2="${l}"
        ></line>
        ${h?X`<text class="ref-label ${e}" x="${r-s+4}" y="${l}" text-anchor="start">${h}</text>`:""}
      `},v=t=>t.toLocaleDateString(this.hass?.language||void 0,{month:"short",day:"numeric"}),w=c.domain()[0],x=c.domain()[1],b=e[e.length-1],$=b?X`
      <circle
        class="now-dot"
        cx="${c(b.date)}"
        cy="${p(b.value)}"
        r="3"
        fill="var(--primary-color, #0077be)"
      ></circle>
    `:"",A=e.reduce((t,e)=>e.value<t.value?e:t,e[0]),M=e.reduce((t,e)=>e.value>t.value?e:t,e[0]),S=n.unit||"°C",C=X`
      <g class="hover-group" style="opacity: 0;">
        <line class="hover-line" x1="0" x2="0" y1="${a}" y2="${i-l}"></line>
        <circle class="hover-point" cx="0" cy="0" r="4"></circle>
        <rect class="hover-tooltip-bg" x="0" y="0" width="70" height="28" rx="4"></rect>
        <text class="hover-tooltip-text" x="0" y="0" text-anchor="middle"></text>
        <text class="hover-tooltip-date" x="0" y="0" text-anchor="middle"></text>
      </g>
    `;return X`
      <defs>
        <linearGradient id="gradient-${t.replace(/\./g,"-")}" x1="0%" y1="100%" x2="0%" y2="0%">
          <stop offset="0%" style="stop-color: var(--primary-color, #0077be); stop-opacity: 0.1"></stop>
          <stop offset="100%" style="stop-color: var(--error-color, #db4437); stop-opacity: 0.4"></stop>
        </linearGradient>
      </defs>
      <text class="axis-label start" x="${u}" y="${115}">${v(w)}</text>
      <text class="axis-label end" x="${r-s}" y="${115}" text-anchor="end">${v(x)}</text>
      
      <path class="chart-area" d="${m(e)||""}" fill="url(#gradient-${t.replace(/\./g,"-")})"></path>
      <path
        class="chart-line"
        d="${_(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"))}
      
      ${A?X`<circle class="extrema-dot min" cx="${c(A.date)}" cy="${p(A.value)}" r="3"></circle>`:""}
      ${M?X`<circle class="extrema-dot max" cx="${c(M.date)}" cy="${p(M.value)}" r="3"></circle>`:""}

      ${$}
      ${C}
      
      <rect
        class="hover-overlay"
        x="${u}"
        y="${a}"
        width="${r-u-s}"
        height="${i-a-l}"
        fill="transparent"
        @mousemove="${n=>this._handleMouseMove(n,t,e,c,p,S)}"
        @mouseleave="${t=>this._handleMouseLeave(t)}"
      ></rect>
    `}static get styles(){return[a(rs)]}}t([pt({attribute:!1})],as.prototype,"hass",void 0),t([
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
function(t){return(e,n,r)=>((t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,n),n))(e,n,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}("ha-card")],as.prototype,"_card",void 0),t([gt()],as.prototype,"_config",void 0),t([gt()],as.prototype,"_chartData",void 0),t([gt()],as.prototype,"_chartWidth",void 0),customElements.get(is)||customElements.define(is,as),window.customCards=window.customCards||[],window.customCards.push({type:is,name:"Sea Temperatures Card",description:"Display current and historical sea temperatures.",preview:!0,documentationURL:"https://github.com/timmaurice/sea-temperatures",getEntitySuggestion:(t,e)=>e.startsWith("sensor.seatemperatures_")&&t.states[e]?{config:{type:`custom:${is}`,places:[e]}}:null});const ss=s`.card-config{display:flex;flex-direction:column;gap:12px}.group{border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius, 12px);margin-top:0;padding:16px}.group-header{color:var(--primary-text-color);font-size:16px;font-weight:500;margin-bottom:12px}ha-form{display:block}.places-list{border:1px solid var(--divider-color);border-radius:var(--ha-card-border-radius, 12px);padding:16px;margin-bottom:12px}.places-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.places-header h3{margin:0;font-size:16px;font-weight:500;color:var(--primary-text-color)}.places{display:flex;flex-direction:column;gap:8px}.place-item{display:flex;align-items:center;gap:8px}.place-item ha-selector{flex:1}.handle{cursor:grab;color:var(--secondary-text-color);display:flex;align-items:center;justify-content:center}.handle:active{cursor:grabbing}.add-place-container{display:flex;justify-content:flex-end;margin-top:8px}`,ls=[{name:"title",selector:{text:{}}}],us=[{name:"sort_by",selector:{select:{options:[{value:"default",label:"Default"},{value:"name",label:"Name"},{value:"temp_asc",label:"Temperature Asc"},{value:"temp_desc",label:"Temperature Desc"}]}}},{type:"expandable",title:"groups.display",schema:[{name:"show_last_updated",selector:{boolean:{}}},{name:"show_trend",selector:{boolean:{}}},{name:"show_stats",selector:{boolean:{}}},{name:"show_chart",selector:{boolean:{}}},{name:"show_country",selector:{boolean:{}}},{name:"chart_smoothing",selector:{select:{options:["smooth","linear","step"]}}}]}];let cs=class extends ct{setConfig(t){this._config={sort_by:"default",show_trend:!0,show_last_updated:!0,show_stats:!0,show_chart:!0,show_country:!1,chart_smoothing:"smooth",...t}}_valueChanged(t){this.hass&&this._config&&vt(this,"config-changed",{config:{...this._config,...t.detail.value}})}_placeMoved(t){t.stopPropagation();const{oldIndex:e,newIndex:n}=t.detail;if(e===n)return;const r=[...this._config.places||[]],i=r.splice(e,1)[0];r.splice(n,0,i),this._config={...this._config,places:r},vt(this,"config-changed",{config:this._config})}_placeChanged(t,e){if(!e)return void this._removePlace(t);const n=[...this._config.places||[]],r="string"==typeof e?e:e.device,i=n.some((e,n)=>{if(n===t||!e)return!1;return("string"==typeof e?e:e.device)===r});if(i)return vt(this,"hass-notification",{message:yt(this.hass,"common.errors.duplicate_place")}),void this.requestUpdate();n[t]=e,this._config={...this._config,places:n},vt(this,"config-changed",{config:this._config})}_removePlace(t){const e=[...this._config.places||[]];e.splice(t,1),this._config={...this._config,places:e},vt(this,"config-changed",{config:this._config})}_addPlace(){const t=[...this._config.places||[],""];this._config={...this._config,places:t},vt(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return W``;const t=t=>t.map(t=>{const e={...t};return"sort_by"===e.name&&(e.selector={select:{options:[{value:"default",label:yt(this.hass,"editor.sort_by_options.default")},{value:"name",label:yt(this.hass,"editor.sort_by_options.name")},{value:"temp_asc",label:yt(this.hass,"editor.sort_by_options.temp_asc")},{value:"temp_desc",label:yt(this.hass,"editor.sort_by_options.temp_desc")}]}}),"chart_smoothing"===e.name&&(e.selector={select:{options:[{value:"smooth",label:yt(this.hass,"editor.chart_smoothing_options.smooth")},{value:"linear",label:yt(this.hass,"editor.chart_smoothing_options.linear")},{value:"step",label:yt(this.hass,"editor.chart_smoothing_options.step")}]}}),"expandable"===e.type&&Array.isArray(e.schema)&&(e.title=yt(this.hass,`editor.${e.title}`),e.schema=e.schema.map(t=>({...t}))),e}),e=t(ls),n=t(us);return W`
      <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)=>W`
                    <div class="place-item">
                      <div class="handle">
                        <ha-icon icon="mdi:drag"></ha-icon>
                      </div>
                      <ha-selector
                        .hass=${this.hass}
                        .selector=${{device:{integration:"seatemperatures"}}}
                        .value=${"string"==typeof t?t:t.device}
                        @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=s`
    ${a(ss)}
  `}};t([pt({attribute:!1})],cs.prototype,"hass",void 0),t([gt()],cs.prototype,"_config",void 0),cs=t([(t=>(e,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("sea-temperatures-card-editor")],cs);var hs=Object.freeze({__proto__:null,get SeaTemperaturesCardEditor(){return cs}});export{as as SeaTemperaturesCard};
