import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';

/** Create Month and year when component was encountered, for analytics */
function getVocaAdded(Date) {
  return `${Date.getFullYear()}.${Date.getMonth() + 1}`;
}

class VocaStatsEntity {
  constructor(dataTrackingId) {
    /** Underscore aka snake case is used, for support of GTM statistics requirements */
    this.voca_component = dataTrackingId;
    /** This value saves month and year used in a _id, for uniqueness of collected data.  */
    this.voca_added = getVocaAdded(new Date());
  }
}

const teliaVstCss = "telia-vst{display:none}";

const TeliaVST = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.vocaInternalUStats = createEvent(this, "vocaInternalUStats", 7);
  }
  connectedCallback() {
    this.vocaInternalUStats.emit(new VocaStatsEntity(this.dataTrackingId));
  }
  render() {
    return h(Host, null);
  }
  static get style() { return teliaVstCss; }
}, [0, "telia-vst", {
    "dataTrackingId": [1, "data-tracking-id"]
  }]);
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["telia-vst"];
  components.forEach(tagName => { switch (tagName) {
    case "telia-vst":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, TeliaVST);
      }
      break;
  } });
}
defineCustomElement();

export { TeliaVST as T, defineCustomElement as d };
