'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-df541290.js');
const index = require('./index-b7493032.js');
require('./_commonjsHelpers-10109b76.js');

const sv = {
  Edit: "Redigera",
  Delete: "Radera",
  primary: "primär",
  billing: "fakturering",
};

function create(language) {
  return index.dist.create({
    sv,
  }, language);
}

const styleCss = ".sc-ig-email-address-h{display:block;position:relative}[hidden].sc-ig-email-address-h{display:none}smoothly-display.sc-ig-email-address{border-top:1px solid rgb(var(--smoothly-medium-color));border-bottom:1px solid rgb(var(--smoothly-medium-color));padding-top:.5em;padding-bottom:.5em}label.sc-ig-email-address{display:block;-webkit-margin-before:.6em;margin-block-start:.6em;-webkit-margin-after:.2em;margin-block-end:.2em;text-transform:capitalize;margin-bottom:.2em}smoothly-popup.sc-ig-email-address{display:none;position:absolute;right:0}.sc-ig-email-address-h:hover smoothly-popup.sc-ig-email-address{display:inline}smoothly-icon.sc-ig-email-address{cursor:pointer}";

const IntergiroEmailAddress = class {
  constructor(hostRef) {
    index$1.registerInstance(this, hostRef);
    this.edit = index$1.createEvent(this, "edit", 7);
    this.delete = index$1.createEvent(this, "delete", 7);
    this.editable = true;
    this.type = "primary";
    this.mode = "display";
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  onEdit(event) {
    event.stopPropagation();
    this.value = event.detail;
    this.mode = "display";
    this.edit.emit({ type: this.type, value: this.value });
  }
  onDelete() {
    this.delete.emit(this.type);
  }
  render() {
    const t = this.t;
    return this.value.length > 0
      ? [
        this.mode == "display" ? ([
          this.editable && (index$1.h("smoothly-popup", null, index$1.h("smoothly-icon", { name: "ellipsis-vertical-outline", size: "small" }), index$1.h("div", { color: "light", slot: "popup" }, index$1.h("smoothly-icon", { size: "small", name: "pencil-outline", toolTip: t("Edit"), onClick: () => (this.mode = "edit") }), index$1.h("smoothly-icon", { size: "small", name: "trash", toolTip: t("Delete"), onClick: () => this.onDelete() })))),
          index$1.h("label", null, t(this.type)),
          index$1.h("smoothly-display", { type: "email", value: this.value }),
        ]) : (index$1.h("ig-email-input", { value: this.value, type: this.type, mode: "edit", onEdit: (e) => this.onEdit(e) })),
      ]
      : [];
  }
  get element() { return index$1.getElement(this); }
};
IntergiroEmailAddress.style = styleCss;

exports.ig_email_address = IntergiroEmailAddress;
