import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { d as defineCustomElement$2 } from './ecl-icon2.js';
import { d as defineCustomElement$1 } from './ecl-link2.js';

const EclDescriptionListDefinition = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.getMarkup = (itemsArray) => {
      if (this.type === 'link' && itemsArray) {
        return itemsArray.map((link) => (h("ecl-link", { "style-class": `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}`, path: link.path }, link.icon ?
          h("ecl-icon", { slot: "icon-before", icon: link.icon })
          : '', link.label)));
      }
      else if (this.type === 'link' && !itemsArray) {
        return h("slot", null);
      }
      if (this.type === 'inline' && itemsArray) {
        return itemsArray.map((inline) => (h("ecl-link", { "style-class": `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}`, path: inline.path }, inline.label)));
      }
      else if (this.type === 'inline' && !itemsArray) {
        return h("slot", null);
      }
      if (this.type === 'taxonomy' && itemsArray) {
        return itemsArray.map((taxonomy) => (h("span", { class: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}` }, taxonomy.path ?
          h("ecl-link", { path: taxonomy.path }, taxonomy.label) : taxonomy)));
      }
      else if (this.type === 'taxonomy' && !itemsArray) {
        return h("slot", null);
      }
      if (this.type === 'text') {
        return h("slot", null);
      }
    };
    this.type = 'text';
    this.styleClass = '';
    this.theme = 'ec';
    this.items = undefined;
  }
  getClass() {
    return [
      `ecl-description-list__definition`,
      `sc-ecl-description-list-${this.theme}`,
      `ecl-description-list__definition--${this.type}`,
      this.styleClass
    ].join(' ');
  }
  render() {
    const itemsArray = this.items ? JSON.parse(this.items) : false;
    return (h("dd", { class: this.getClass() }, this.getMarkup(itemsArray)));
  }
}, [4, "ecl-description-list-definition", {
    "type": [1],
    "styleClass": [1, "style-class"],
    "theme": [1],
    "items": [1]
  }]);
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["ecl-description-list-definition", "ecl-icon", "ecl-link"];
  components.forEach(tagName => { switch (tagName) {
    case "ecl-description-list-definition":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, EclDescriptionListDefinition);
      }
      break;
    case "ecl-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
    case "ecl-link":
      if (!customElements.get(tagName)) {
        defineCustomElement$1();
      }
      break;
  } });
}

export { EclDescriptionListDefinition as E, defineCustomElement as d };

//# sourceMappingURL=ecl-description-list-definition2.js.map