import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { e as error, a as alert, c as checkCircle } from './error.js';
import { d as defineCustomElement$2 } from './telia-icon2.js';
import { d as defineCustomElement$1 } from './telia-vst2.js';

const BadgeVariant = {
  ATTENTION: 'attention',
  SPECIAL: 'special',
  NEUTRAL: 'neutral',
  INFORMATION: 'information',
  SUCCESS: 'success',
  WARNING: 'warning',
  ERROR: 'error',
  // Deprectated variants below
  SPECIAL_OFFER: 'special-offer',
  NOT_AVAILABLE: 'not-available',
};
Object.values(BadgeVariant);

const teliaBadgeCss = ".telia-badge{font-family:\"TeliaSans\", Helvetica, Arial, \"Lucida Grande\", sans-serif;font-weight:500;font-size:calc(1.4rem * var(--voca-rem-multiplier));align-items:center;border-radius:calc(0.2rem * var(--voca-rem-multiplier));display:inline-flex;gap:calc(0.4rem * var(--voca-rem-multiplier));line-height:1;padding:calc(0.4rem * var(--voca-rem-multiplier)) calc(0.8rem * var(--voca-rem-multiplier))}.telia-badge--attention{background-color:#5e0092;color:#ffffff}.telia-badge--special{background-color:#edc8ff;color:#30004b}.telia-badge--neutral{background-color:rgba(0, 0, 0, 0.2);color:#303032}.telia-badge--information{background-color:#a6dbff;color:#003d66}.telia-badge--success{background-color:#a6e3c4;color:#00572a}.telia-badge--warning{background-color:#ffdca6;color:#663e00}.telia-badge--error{background-color:#f6aec6;color:#5b0925}.telia-badge--special-offer{background-color:#edc8ff;color:#29003e}.telia-badge--not-available{background-color:#dcdce1;color:#303032}";

const TeliaBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /** Test id set for web component host */
    this.dataTestid = null;
    /** Describe status of badge for better accessibility support */
    this.allyLabel = null;
    /** Tracking id is used to identify and count Component usage */
    this.dataTrackingId = 'telia-badge';
    /**
     * Maps the BadgeVariantType to the corresponding icon SVG.
     * @param variant - The variant to map to an icon SVG.
     * @returns The corresponding icon SVG for the variant.
     */
    this.mapIcon = (variant) => {
      switch (variant) {
        case BadgeVariant.SUCCESS:
          return checkCircle.svg;
        case BadgeVariant.WARNING:
          return alert.svg;
        case BadgeVariant.ERROR:
          return error.svg;
        default:
          return null;
      }
    };
  }
  /**
   * Validates that the variant prop is not a deprecated variant, and logs a warning message if it is.
   * TODO: Remove after deprecation.
   */
  validateDeprecatedVariants() {
    const deprecatedVariants = [
      BadgeVariant.SPECIAL_OFFER,
      BadgeVariant.NOT_AVAILABLE,
    ];
    const message = `Deprecation warning - [Telia-badge]: ${this.variant} variant. This variant will be deprecated soon.`;
    if (deprecatedVariants.includes(this.variant)) {
      console.warn(message);
    }
  }
  componentWillLoad() {
    this.validateDeprecatedVariants();
  }
  render() {
    const iconSvg = this.mapIcon(this.variant);
    return (h("span", { class: {
        'telia-badge': true,
        [`telia-badge--${this.variant}`]: !!this.variant,
      }, "data-testid": this.dataTestid }, (iconSvg || this.icon) && (h("telia-icon", { "ally-title": this.allyLabel, name: this.icon, size: "sm", svg: iconSvg })), h("slot", null), h("telia-vst", { dataTrackingId: this.dataTrackingId })));
  }
  static get style() { return teliaBadgeCss; }
}, [1, "telia-badge", {
    "variant": [1],
    "dataTestid": [1, "data-testid"],
    "icon": [1],
    "svg": [1],
    "allyLabel": [1, "ally-label"]
  }]);
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["telia-badge", "telia-icon", "telia-vst"];
  components.forEach(tagName => { switch (tagName) {
    case "telia-badge":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, TeliaBadge);
      }
      break;
    case "telia-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
    case "telia-vst":
      if (!customElements.get(tagName)) {
        defineCustomElement$1();
      }
      break;
  } });
}
defineCustomElement();

export { TeliaBadge as T, defineCustomElement as d };
