import e from"./relative-time.js";import t from"./extended-time-element.js";import{localeFromElement as n}from"./utils.js";export default class RelativeTimeElement extends t{getFormattedDate(){const t=this.date;if(t)return new e(t,n(this)).toString()}connectedCallback(){l.push(this),i||(updateNowElements(),i=window.setInterval(updateNowElements,6e4)),super.connectedCallback()}disconnectedCallback(){const e=l.indexOf(this);-1!==e&&l.splice(e,1),l.length||i&&(clearInterval(i),i=null)}}const l=[];let i;function updateNowElements(){let e,t,n;for(t=0,n=l.length;t<n;t++)e=l[t],e.textContent=e.getFormattedDate()||""}window.customElements.get("relative-time")||(window.RelativeTimeElement=RelativeTimeElement,window.customElements.define("relative-time",RelativeTimeElement));