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

const eclMessageEcCss = ".ecl-message.sc-ecl-message-ec{border-bottom-width:2px;border-end-start-radius:0;border-inline-end-width:2px;border-inline-start-width:2px;border-start-start-radius:0;border-style:solid;border-top-width:2px;box-sizing:border-box;display:flex;margin:0;padding-bottom:1.5rem;-webkit-padding-end:0.5rem;padding-inline-end:0.5rem;-webkit-padding-start:1.5rem;padding-inline-start:1.5rem;padding-top:1.5rem;position:relative}.ecl-message__icon.sc-ecl-message-ec{flex-shrink:0;-webkit-margin-end:1rem;margin-inline-end:1rem}.ecl-message__content.sc-ecl-message-ec{width:100%}.ecl-message__title.sc-ecl-message-ec{color:#000;font:normal normal 400 1rem/1.25rem arial, sans-serif;font-weight:bold;margin-bottom:0.75rem;max-width:80ch}.ecl-message__description.sc-ecl-message-ec{color:#404040;font:normal normal 400 1rem/1.5rem arial, sans-serif;margin:0 0 0.5rem;max-width:80ch;padding-bottom:2rem}.ecl-message__close.sc-ecl-message-ec{bottom:0.25rem;color:#004494;font:normal normal 400 1rem/1.25rem arial, sans-serif;font-weight:700;position:absolute;right:0}.no-js.sc-ecl-message-ec .ecl-message__close.sc-ecl-message-ec{display:none}@supports (display: grid){.ecl-message__content.sc-ecl-message-ec{display:grid}.ecl-message__title.sc-ecl-message-ec{grid-column-start:1}.ecl-message__description.sc-ecl-message-ec{grid-column-start:1;padding-bottom:0}.ecl-message__close.sc-ecl-message-ec{align-self:self-end;bottom:auto;grid-column-start:1;grid-row-end:4;grid-row-start:3;justify-self:end;margin-bottom:-0.75rem;position:relative;right:auto}}@media (min-width: 768px){.ecl-message__title.sc-ecl-message-ec{margin-bottom:0.5rem}.ecl-message__description.sc-ecl-message-ec{margin-bottom:0;padding-bottom:0}.ecl-message__close.sc-ecl-message-ec{bottom:auto;top:0.75rem}@supports (display: grid){.ecl-message__content.sc-ecl-message-ec{grid-template-columns:auto max-content}.ecl-message__close.sc-ecl-message-ec{align-self:self-start;grid-column-start:2;grid-row-end:span 2;grid-row-start:1;margin-bottom:0;margin-top:-0.75rem;position:relative;right:auto;top:auto}}}.ecl-message--info.sc-ecl-message-ec{background:#fff;border-color:#006fb4}.ecl-message--info.sc-ecl-message-ec .ecl-message__icon.sc-ecl-message-ec{fill:#006fb4}.ecl-message--success.sc-ecl-message-ec{background:#fff;border-color:#467a39}.ecl-message--success.sc-ecl-message-ec .ecl-message__icon.sc-ecl-message-ec{fill:#467a39}.ecl-message--warning.sc-ecl-message-ec{background:#fff;border-color:#f29527}.ecl-message--warning.sc-ecl-message-ec .ecl-message__icon.sc-ecl-message-ec{fill:#f29527}.ecl-message--error.sc-ecl-message-ec{background:#fff;border-color:#da2131}.ecl-message--error.sc-ecl-message-ec .ecl-message__icon.sc-ecl-message-ec{fill:#da2131}ecl-button.sc-ecl-message-ec{grid-column-start:2;grid-row-start:1}.ecl-message__icon.sc-ecl-icon-ec.sc-ecl-message-ec{-webkit-margin-end:1rem;margin-inline-end:1rem}.ecl-message__close.sc-ecl-message-ec *.sc-ecl-message-ec{display:inline-flex;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}";

const eclMessageEuCss = ".ecl-message.sc-ecl-message-eu{border-bottom-width:0;border-end-start-radius:4px;border-inline-end-width:0;border-inline-start-width:4px;border-start-start-radius:4px;border-style:solid;border-top-width:0;box-sizing:border-box;display:flex;margin:0;padding-bottom:1.5rem;-webkit-padding-end:0.5rem;padding-inline-end:0.5rem;-webkit-padding-start:1.5rem;padding-inline-start:1.5rem;padding-top:1.5rem;position:relative}.ecl-message__icon.sc-ecl-message-eu{flex-shrink:0;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}.ecl-message__content.sc-ecl-message-eu{width:100%}.ecl-message__title.sc-ecl-message-eu{color:#171a22;font:normal normal 400 1rem/1.5rem arial, sans-serif;font-weight:bold;margin-bottom:0.5rem;max-width:80ch}.ecl-message__description.sc-ecl-message-eu{color:#515560;font:normal normal 400 1rem/1.5rem arial, sans-serif;margin:0 0 0.5rem;max-width:80ch;padding-bottom:2rem}.ecl-message__close.sc-ecl-message-eu{bottom:0.25rem;color:#0e47cb;font:normal normal 400 1rem/1.25rem arial, sans-serif;font-weight:none;position:absolute;right:0}.no-js.sc-ecl-message-eu .ecl-message__close.sc-ecl-message-eu{display:none}@supports (display: grid){.ecl-message__content.sc-ecl-message-eu{display:grid}.ecl-message__title.sc-ecl-message-eu{grid-column-start:1}.ecl-message__description.sc-ecl-message-eu{grid-column-start:1;padding-bottom:0}.ecl-message__close.sc-ecl-message-eu{align-self:self-end;bottom:auto;grid-column-start:1;grid-row-end:4;grid-row-start:3;justify-self:end;margin-bottom:-0.75rem;position:relative;right:auto}}@media (min-width: 768px){.ecl-message__title.sc-ecl-message-eu{margin-bottom:0.5rem}.ecl-message__description.sc-ecl-message-eu{margin-bottom:0;padding-bottom:0}.ecl-message__close.sc-ecl-message-eu{bottom:auto;top:0.75rem}@supports (display: grid){.ecl-message__content.sc-ecl-message-eu{grid-template-columns:auto max-content}.ecl-message__close.sc-ecl-message-eu{align-self:self-start;grid-column-start:2;grid-row-end:span 2;grid-row-start:1;margin-bottom:0;margin-top:-0.75rem;position:relative;right:auto;top:auto}}}.ecl-message--info.sc-ecl-message-eu{background:#f3f6fc;border-color:#0e47cb}.ecl-message--info.sc-ecl-message-eu .ecl-message__icon.sc-ecl-message-eu{fill:#0e47cb}.ecl-message--success.sc-ecl-message-eu{background:#f2fcf9;border-color:#00c991}.ecl-message--success.sc-ecl-message-eu .ecl-message__icon.sc-ecl-message-eu{fill:#008d66}.ecl-message--warning.sc-ecl-message-eu{background:#fff7f2;border-color:#ff6200}.ecl-message--warning.sc-ecl-message-eu .ecl-message__icon.sc-ecl-message-eu{fill:#cc4e00}.ecl-message--error.sc-ecl-message-eu{background:#fef2f5;border-color:#bf0036}.ecl-message--error.sc-ecl-message-eu .ecl-message__icon.sc-ecl-message-eu{fill:#bf0036}ecl-button.sc-ecl-message-eu{grid-column-start:2;grid-row-start:1}.ecl-message__icon.sc-ecl-icon-eu.sc-ecl-message-eu{-webkit-margin-end:1rem;margin-inline-end:1rem}.ecl-message__close.sc-ecl-message-eu *.sc-ecl-message-eu{display:inline-flex;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}";

const EclMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.theme = 'ec';
    this.variant = 'info';
    this.styleClass = undefined;
    this.messageTitle = undefined;
    this.closeLabel = undefined;
    this.eclScript = false;
  }
  getClass() {
    return [
      `ecl-message`,
      `ecl-message--${this.getVariant()}`,
      this.styleClass
    ].join(' ');
  }
  getVariant() {
    return this.variant === 'information' ? 'info' : this.variant;
  }
  componentDidRender() {
    if (this.eclScript) {
      const src = getAssetPath('./build/scripts/ecl-message-vanilla.js');
      if (document.querySelector(`script[src="${src}"]`)) {
        document.querySelector(`script[src="${src}"]`).remove();
      }
      const script = document.createElement('script');
      script.src = src;
      script.onload = () => {
        const message = new ECL.Message(this.el.firstElementChild);
        message.init();
      };
      document.body.appendChild(script);
    }
  }
  render() {
    return (h("div", { class: this.getClass(), "data-ecl-message": true, role: "alert" }, h("ecl-icon", { icon: this.variant, size: this.theme === 'ec' ? 'l' : 'm', "style-class": `ecl-message__icon sc-ecl-message-${this.theme}` }), h("div", { class: "ecl-message__content" }, h("ecl-button", { variant: "ghost", type: "button", "style-class": `ecl-message__close sc-ecl-message-${this.theme}`, "data-ecl-message-close": true }, this.closeLabel, h("ecl-icon", { slot: "icon-after", icon: "close-filled", theme: this.theme, "style-class": "ecl-button__icon ecl-button__icon--after" })), this.messageTitle ?
      h("div", { class: "ecl-message__title" }, this.messageTitle)
      : '', h("div", { class: "ecl-message__description" }, h("slot", null)))));
  }
  static get assetsDirs() { return ["build"]; }
  get el() { return this; }
  static get style() { return {
    ec: eclMessageEcCss,
    eu: eclMessageEuCss
  }; }
}, [38, "ecl-message", {
    "theme": [1],
    "variant": [1],
    "styleClass": [1, "style-class"],
    "messageTitle": [1, "message-title"],
    "closeLabel": [1, "close-label"],
    "eclScript": [4, "ecl-script"]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["ecl-message", "ecl-button", "ecl-icon"];
  components.forEach(tagName => { switch (tagName) {
    case "ecl-message":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, EclMessage$1);
      }
      break;
    case "ecl-button":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "ecl-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}

const EclMessage = EclMessage$1;
const defineCustomElement = defineCustomElement$1;

export { EclMessage, defineCustomElement };

//# sourceMappingURL=ecl-message.js.map