'use strict';

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

const index$2 = require('./index-140bcbcd.js');
const index$1 = require('./index-d3079b93.js');
const Item = require('./Item-00ce8c24.js');
const index$4 = require('./index-76391849.js');
require('./Credentials-8e4749ab.js');
require('./Token-8c5ba5d9.js');
require('./App-0b3e3f31.js');
const Notice = require('./Notice-e970b490.js');
const unknown = require('./unknown-38d3748c.js');
const index$3 = require('./index-bddf9814.js');
const index = require('./index-6200f021.js');
require('./_commonjsHelpers-537d719a.js');
require('./index-09251373.js');
require('./TextDecoder-753156f3.js');
require('./index-3b10efe6.js');
require('./index-5380418f.js');
require('./index-188cc15d.js');

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

function create$d(language) {
  return index$1.dist.create({
    sv: sv$d,
  }, language);
}

const styleCss$d = ".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:0.5em;padding-bottom:0.5em}label.sc-ig-email-address{display:block;-webkit-margin-before:0.6em;margin-block-start:0.6em;-webkit-margin-after:0.2em;margin-block-end:0.2em;text-transform:capitalize;margin-bottom:0.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$2.registerInstance(this, hostRef);
    this.edit = index$2.createEvent(this, "edit", 7);
    this.delete = index$2.createEvent(this, "delete", 7);
    this.editable = true;
    this.type = "primary";
    this.mode = "display";
  }
  componentWillLoad() {
    this.t = create$d(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$2.h("smoothly-popup", null, index$2.h("smoothly-icon", { name: "ellipsis-vertical-outline", size: "small" }), index$2.h("div", { color: "light", slot: "popup" }, index$2.h("smoothly-icon", { size: "small", name: "pencil-outline", toolTip: t("Edit"), onClick: () => (this.mode = "edit") }), index$2.h("smoothly-icon", { size: "small", name: "trash", toolTip: t("Delete"), onClick: () => this.onDelete() })))),
          index$2.h("label", null, t(this.type)),
          index$2.h("smoothly-display", { type: "email", value: this.value }),
        ]) : (index$2.h("ig-email-input", { value: this.value, type: this.type, mode: "edit", onEdit: (e) => this.onEdit(e) })),
      ]
      : [];
  }
  get element() { return index$2.getElement(this); }
};
IntergiroEmailAddress.style = styleCss$d;

const sv$c = {
  Add: "Lägg till",
  Email: "E-post",
};

function create$c(language) {
  return index$1.dist.create({
    sv: sv$c,
  }, language);
}

const styleCss$c = ".sc-ig-email-addresses-h{display:block}label.sc-ig-email-addresses{font-weight:bold}.sc-ig-email-addresses-h:not([label]) label.sc-ig-email-addresses{font-weight:bold}smoothly-icon.sc-ig-email-addresses{cursor:pointer;float:right;margin-top:-0.2em;visibility:hidden}ig-email-address.sc-ig-email-addresses{clear:both}.sc-ig-email-addresses-h:hover smoothly-icon.sc-ig-email-addresses{visibility:visible}";

const IntergiroEmailAddresses = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.changed = index$2.createEvent(this, "changed", 7);
    this.editable = true;
    this.adding = false;
  }
  get types() {
    return Item.EmailAddresses.types.filter(type => Item.EmailAddresses.is(this.value) ? !this.value[type] : this.value ? type != "primary" : type);
  }
  get emailAddresses() {
    return Item.EmailAddresses.is(this.value) ? Object.assign({}, this.value) : { primary: this.value };
  }
  componentWillLoad() {
    this.t = create$c(this.element);
  }
  onEdit(e) {
    const type = e.detail.type;
    delete e.detail.type;
    let result;
    if (!Item.EmailAddresses.is(this.value))
      result = e.detail.value;
    else {
      result = Object.assign({}, this.value);
      result[type] = e.detail.value;
    }
    this.changed.emit((this.value = result));
  }
  onDelete(e) {
    const type = e.detail;
    const result = Object.assign({}, this.emailAddresses);
    delete result[type];
    this.changed.emit((this.value = result));
  }
  onAdd(e) {
    const type = e.detail.type;
    const value = e.detail.value;
    const result = this.emailAddresses;
    result[type] = value;
    this.changed.emit((this.value = result));
    this.adding = false;
  }
  render() {
    return [
      index$2.h("label", null, this.t("Email")),
      this.adding ? (index$2.h("ig-email-input", { onEdit: () => (this.adding = false), types: this.types, mode: "add", onAdd: (e) => this.onAdd(e) })) : ([]),
      this.editable && this.types.length > 0 ? (index$2.h("smoothly-icon", { name: "add-circle", toolTip: this.t("Add"), fill: "clear", size: "medium", color: "success", style: this.adding ? { display: "none" } : {}, onClick: () => (this.adding = true) })) : ([]),
      Item.EmailAddresses.is(this.value) ? (Item.EmailAddresses.map(this.value, (type, value) => [
        index$2.h("ig-email-address", { value: value, type: type, editable: this.editable, onEdit: (e) => this.onEdit(e), onDelete: (e) => this.onDelete(e) }),
      ])) : this.value ? (index$2.h("ig-email-address", { value: this.value, editable: this.editable, onEdit: (e) => this.onEdit(e), onDelete: (e) => this.onDelete(e) })) : ([]),
    ];
  }
  get element() { return index$2.getElement(this); }
};
IntergiroEmailAddresses.style = styleCss$c;

const sv$b = {
  Save: "Spara",
  Cancel: "Avbryt",
  primary: "primär",
  billing: "fakturering",
  "Please enter a valid email address.": "Ange en giltig e-postadress.",
};

function create$b(language) {
  return index$1.dist.create({
    sv: sv$b,
  }, language);
}

const styleCss$b = ".sc-ig-email-input-h{display:block;margin-top:0.5em}smoothly-submit.sc-ig-email-input,smoothly-submit.sc-ig-email-input>button.sc-ig-email-input{background-color:transparent;border:none;cursor:pointer;color:transparent;width:auto;float:right;margin-bottom:0.2em}smoothly-input.sc-ig-email-input{border:1px solid rgb(var(--smoothly-medium-color))}form.sc-ig-email-input{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-wrap:wrap;flex-wrap:wrap}form.sc-ig-email-input>*.sc-ig-email-input{width:100%}smoothly-select.sc-ig-email-input{display:grid;margin-bottom:0.5em}";

const IntergiroEmailInput = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.edit = index$2.createEvent(this, "edit", 7);
    this.add = index$2.createEvent(this, "add", 7);
    this.notice = index$2.createEvent(this, "notice", 7);
    this.types = [];
    this.type = this.types[0];
    this.mode = "edit";
  }
  componentWillLoad() {
    this.t = create$b(this.element);
  }
  onSubmit(e) {
    const value = e.detail.email;
    if (value) {
      if (this.mode == "add")
        this.add.emit({ type: this.type, value });
      else
        this.edit.emit(e.detail.email);
    }
    else
      this.notice.emit(Notice.Notice.failed(this.t("Please enter a valid email address.")));
  }
  onCancel() {
    this.edit.emit(this.value);
  }
  onSelectionChanged(e) {
    this.type = e.detail.value;
  }
  toUpperCase(value) {
    return value.charAt(0).toUpperCase() + value.slice(1);
  }
  render() {
    const t = this.t;
    return (index$2.h("form", null, this.mode == "add" ? (index$2.h("smoothly-select", { background: "transparent" }, this.types.map(option => this.type == option ? (index$2.h("option", { value: option, selected: true }, this.toUpperCase(t(option)))) : (index$2.h("option", { value: option }, this.toUpperCase(t(option))))))) : ([]), index$2.h("smoothly-input", { type: "email", name: "email", value: this.value }, this.mode == "add" ? t("Email") : t(this.type)), index$2.h("div", null, index$2.h("smoothly-submit", { prevent: true, onSubmit: (e) => this.onSubmit(e) }, index$2.h("smoothly-icon", { name: "checkmark-circle", toolTip: t("Save"), color: "success", fill: "clear", size: "small" })), index$2.h("smoothly-submit", { prevent: true, onSubmit: () => this.onCancel() }, index$2.h("smoothly-icon", { name: "close-circle", toolTip: t("Cancel"), color: "light", fill: "clear", size: "small" })))));
  }
  get element() { return index$2.getElement(this); }
};
IntergiroEmailInput.style = styleCss$b;

const sv$a = {
  Name: "Namn",
  Email: "Mail",
  Phone: "Telefon",
  "There is no contact information available.": "Det finns ingen kontaktinformation tillgänglig.",
};

function create$a(language) {
  return index$1.dist.create({
    sv: sv$a,
  }, language);
}

const styleCss$a = ".sc-ig-order-contact-h{display:-ms-flexbox;display:flex;width:100%;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:start;justify-content:flex-start;padding:1em;padding-left:4.5em}[hidden].sc-ig-order-contact-h{display:none}dt.sc-ig-order-contact{font-weight:bold;text-align:left;margin-bottom:0.2em}dt.sc-ig-order-contact::first-letter{text-transform:capitalize}section.sc-ig-order-contact{width:30%}section.sc-ig-order-contact>dt.sc-ig-order-contact+*.sc-ig-order-contact{width:70%}";

const IntergiroOrderContact = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create$a(this.element);
  }
  render() {
    return !this.contact || Object.values(this.contact).length < 1 ? (index$2.h("p", null, this.t("There is no contact information available."))) : ([
      this.contact.name && (index$2.h("section", null, index$2.h("dt", null, this.t("Name")), index$2.h("smoothly-display", { type: "text", value: Item.Name.get(this.contact.name) }))),
      this.contact.email && (index$2.h("section", null, index$2.h("dt", null, this.t("Email")), index$2.h("ig-email-addresses", { editable: false, value: this.contact.email }))),
      this.contact.phone && (index$2.h("section", null, index$2.h("dt", null, this.t("Phone")), index$2.h("ig-phone-numbers", { editable: false, value: this.contact.phone }))),
    ]);
  }
  get element() { return index$2.getElement(this); }
};
IntergiroOrderContact.style = styleCss$a;

const sv$9 = {
  Amount: "Belopp",
  Reason: "Anledning",
  Error: "Fel",
  Status: "Status",
  Type: "Typ",
  Details: "Detaljer",
  " (failed)": " (misslyckades)",
  defer: "skicka",
  order: "beställa",
  cancel: "avbryta",
  charge: "godkänna",
  refund: "återbetala",
  settle: "utbetala",
  fail: "misslycka",
  synchronize: "synkronisera",
  "gross: ": "brutto: ",
  "net: ": "netto: ",
  "fee: ": "avgift: ",
};

function create$9(language) {
  return index$1.dist.create({
    sv: sv$9,
  }, language);
}

const styleCss$9 = "*.sc-ig-order-events-h{display:-ms-flexbox;display:flex}[hidden].sc-ig-order-events-h{display:none}.sc-ig-order-events-h>span.sc-ig-order-events{-ms-flex-positive:1;flex-grow:1;padding-left:0.6em;padding-right:0.6em}ul.sc-ig-order-events{width:100%;list-style-type:none;-webkit-padding-start:0;padding-inline-start:0;margin-top:0;margin-bottom:0}summary.sc-ig-order-events{outline:none;text-align:left}dl.sc-ig-order-events{margin:8px;width:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;max-height:3em;-ms-flex-pack:start;justify-content:flex-start}dt.sc-ig-order-events{font-weight:bold;text-align:left}dd.sc-ig-order-events{text-align:left;margin:0}";

const IntergiroOrderEvents = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create$9(this.element);
  }
  render() {
    return (index$2.h("ul", null, this.event.map(e => (index$2.h("li", null, e.type == "fail" && e.items != undefined
      ? [
        index$2.h("details", null, index$2.h("summary", null, index$3.dist.DateTime.localize(index$3.dist.DateTime.parse(e.date)), index$2.h("b", null, " ", this.t(e.original)), " ", this.t(" (failed)"), "\u2003", index$4.Item.amount(e.items), " ", this.currency), this.renderEvent(e)),
      ]
      : e.type == "fail" && e.items == undefined
        ? [
          index$2.h("details", null, index$2.h("summary", null, index$3.dist.DateTime.localize(index$3.dist.DateTime.parse(e.date)), index$2.h("b", null, " ", this.t(e.original)), " ", this.t(" (failed)")), this.renderEvent(e)),
        ]
        : e.type == "settle"
          ? [
            index$2.h("summary", null, "\u2003", index$3.dist.DateTime.localize(index$3.dist.DateTime.parse(e.date)), index$2.h("b", null, " ", this.t(e.type)), "\u2003 ", this.t("gross: "), " ", e.gross, " ", this.currency, "\u2003", this.t("fee: "), " ", e.fee, " ", this.currency, "\u2003", this.t("net: "), " ", e.net, " ", this.currency),
          ]
          : e.type != "fail" && e.items == undefined
            ? [
              index$2.h("summary", null, "\u2003", index$3.dist.DateTime.localize(index$3.dist.DateTime.parse(e.date)), index$2.h("b", null, " ", this.t(e.type))),
            ]
            : e.type != "fail" && e.items != undefined
              ? [
                index$2.h("summary", null, "\u2003", index$3.dist.DateTime.localize(index$3.dist.DateTime.parse(e.date)), index$2.h("b", null, " ", this.t(e.type)), "\u2003", index$4.Item.amount(e.items), " ", this.currency),
              ]
              : "Error")))));
  }
  renderEvent(event) {
    var _a, _b;
    let result;
    switch (event.type) {
      case "defer":
      case "deny":
      case "cancel":
      case "charge":
      case "order":
      case "pay":
      case "pend":
      case "refund":
      case "settle":
      case "synchronize":
        result = (index$2.h("dl", null, event.items
          ? [
            index$2.h("dt", null, this.t("Amount")),
            index$2.h("dd", null, index$4.Item.amount(event.items), " ", this.currency),
          ]
          : ""));
        break;
      case "fail":
        result = (index$2.h("dl", null, event.items
          ? [
            index$2.h("dt", null, this.t("Amount")),
            index$2.h("dd", null, index$4.Item.amount(event.items), " ", this.currency),
          ]
          : "", event.original ? [index$2.h("dt", null, this.t("Reason")), index$2.h("dd", null, this.t(event.original))] : "", event.error ? [index$2.h("dt", null, this.t("Error")), index$2.h("dd", null, event.error)] : "", ((_a = event.error) === null || _a === void 0 ? void 0 : _a.status) ? [index$2.h("dt", null, this.t("Status")), index$2.h("dd", null, event.error.status)] : "", ((_b = event.error) === null || _b === void 0 ? void 0 : _b.type) ? [index$2.h("dt", null, this.t("Type")), index$2.h("dd", null, event.error.type)] : "", index$4.Event.Fail.is(event) && unknown.backendFailure.is(event.error)
          ? [index$2.h("dt", null, this.t("Details")), index$2.h("dd", null, event.error.details.body.status.message)]
          : ""));
        break;
      default:
        result = index$2.h("dl", null);
    }
    return result;
  }
  get element() { return index$2.getElement(this); }
};
IntergiroOrderEvents.style = styleCss$9;

const sv$8 = {
  Qty: "Antal",
  Name: "Namn",
  Price: "Pris",
  VAT: "Moms",
  Total: "Totalt",
  Status: "Status",
};

function create$8(language) {
  return index$1.dist.create({
    sv: sv$8,
  }, language);
}

const styleCss$8 = ".sc-ig-order-items-h{display:inline-block}[hidden].sc-ig-order-items-h{display:none}.sc-ig-order-items-h>table.sc-ig-order-items{table-layout:fixed;width:100%}.sc-ig-order-items-h>table.sc-ig-order-items>tr.sc-ig-order-items>th.sc-ig-order-items{text-align:left;padding-top:0.4em;padding-bottom:0.5em}.sc-ig-order-items-h>table.sc-ig-order-items>tr.sc-ig-order-items>th.wide.sc-ig-order-items{width:20%}.sc-ig-order-items-h>table.sc-ig-order-items>tr.sc-ig-order-items>th.status.sc-ig-order-items{width:19%;max-width:20em}";

const IntergiroOrderItems = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.quantityStatus = false;
  }
  componentWillLoad() {
    this.t = create$8(this.element);
  }
  handleQuantityStatus(event) {
    this.quantityStatus = true;
  }
  render() {
    const t = this.t;
    return [
      index$2.h("table", null, index$2.h("tr", null, index$2.h("th", null, this.quantityStatus ? t("Qty") : ""), index$2.h("th", { class: "wide" }, this.quantityStatus ? t("Name") : ""), index$2.h("th", null, this.quantityStatus ? t("Price") : ""), index$2.h("th", null, this.quantityStatus ? t("VAT") : ""), index$2.h("th", null, t("Total")), index$2.h("th", { class: "status" }, t("Status"))), typeof this.order.items === "number"
        ? []
        : index$4.Item.asArray(this.order.items).map((item, index) => (index$2.h("ig-order-items-quantity", { order: this.order.id, currency: this.order.currency, item: item }))), index$2.h("ig-order-items-total", { currency: this.order.currency, items: this.order.items })),
    ];
  }
  get element() { return index$2.getElement(this); }
};
IntergiroOrderItems.style = styleCss$8;

const sv$7 = {
  VAT: "moms",
};

function create$7(language) {
  return index$1.dist.create({
    sv: sv$7,
  }, language);
}

const styleCss$7 = ".sc-ig-order-items-quantity-h{display:table-row;width:100%}[hidden].sc-ig-order-items-quantity-h{display:none}.sc-ig-order-items-quantity-h>td.sc-ig-order-items-quantity{vertical-align:middle;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;padding-right:auto}.sc-ig-order-items-quantity-h>td.sc-ig-order-items-quantity>div.sc-ig-order-items-quantity{padding-right:auto;padding-left:0.15em}.sc-ig-order-items-quantity-h>td.sc-ig-order-items-quantity>div.sc-ig-order-items-quantity>ig-status-change.sc-ig-order-items-quantity{margin-right:0.3em;padding-right:0.5em;-ms-flex-negative:5;flex-shrink:5;max-width:20em;width:100%;-ms-flex-line-pack:stretch;align-content:stretch}.sc-ig-order-items-quantity-h>td.sc-ig-order-items-quantity>div.status.sc-ig-order-items-quantity{display:-ms-flexbox;display:flex;-ms-flex-line-pack:stretch;align-content:stretch;-ms-flex-wrap:nowrap;flex-wrap:nowrap}";

const IntergirOrderItemsQuantity = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.notice = index$2.createEvent(this, "notice", 7);
    this.quantityStatus = index$2.createEvent(this, "quantityStatus", 7);
  }
  componentWillLoad() {
    this.t = create$7(this.element);
  }
  async emitChangeStatus(e) {
    const response = await index$4.Connection.post(`order/${this.order}/event`, {
      type: e.detail.type,
      items: typeof e.detail.items == "number" ? e.detail.items : Object.assign(Object.assign(Object.assign({}, this.item), e.detail.items), { status: undefined }),
    });
    this.notice.emit(unknown.Error.is(response)
      ? Notice.Notice.failed(this.t("Failed to change status."))
      : Notice.Notice.succeded(this.t("Status changed.")));
  }
  sendQuantityStatus(status) {
    this.quantityStatus.emit(status);
  }
  render() {
    const t = this.t;
    this.item.quantity ? this.sendQuantityStatus(true) : "";
    return [
      this.item
        ? [
          index$2.h("td", null, index$2.h("div", null, this.item.quantity ? this.item.quantity : this.item.unit ? 1 : "", this.item.unit)),
          index$2.h("td", null, index$2.h("div", null, this.item.name)),
          index$2.h("td", null, index$2.h("div", null, this.item.quantity
            ? t("@") + (index$4.Item.amount(this.item) / (this.item.quantity ? this.item.quantity : 1)).toFixed(2)
            : "")),
          index$2.h("td", null, index$2.h("div", null, this.item.vat ? this.item.vat.toFixed(2) : "")),
          index$2.h("td", null, index$2.h("div", null, index$4.Item.amount(this.item).toFixed(2), " ", this.currency)),
          index$2.h("td", null, index$2.h("div", { class: "status" }, ["ordered", "charged", "refunded", "cancelled"]
            .map((status) => { var _a, _b; return [status, (_b = (_a = this.item.status) === null || _a === void 0 ? void 0 : _a.filter(s => s == status).length) !== null && _b !== void 0 ? _b : 0]; })
            .filter(argument => argument[1])
            .map(argument => this.item.quantity ? (index$2.h("ig-status-change", { status: argument[0], quantity: argument[1], unit: this.item.unit, onChangeStatus: (e) => this.emitChangeStatus(e) })) : (index$2.h("ig-status-change", { status: argument[0], amount: index$4.Item.amount(this.item), currency: this.currency, onChangeStatus: (e) => this.emitChangeStatus(e) }))))),
        ]
        : "",
    ];
  }
  get element() { return index$2.getElement(this); }
};
IntergirOrderItemsQuantity.style = styleCss$7;

const sv$6 = {
  "Order total": "Orderbelopp",
};

function create$6(language) {
  return index$1.dist.create({
    sv: sv$6,
  }, language);
}

const styleCss$6 = ".sc-ig-order-items-total-h{display:table-row;width:100%}[hidden].sc-ig-order-items-total-h{display:none}.sc-ig-order-items-total-h>td.sc-ig-order-items-total>div.sc-ig-order-items-total{vertical-align:middle;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;padding-top:0.2em;padding-left:0.15em;padding-right:0.15em}.sc-ig-order-items-total-h>td.sc-ig-order-items-total>div.total.sc-ig-order-items-total{border-top:solid 1px rgb(var(--smoothly-light-color));width:6em}";

const IntergirOrderItemsTotal = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create$6(this.element);
  }
  render() {
    var _a;
    const t = this.t;
    return [
      index$2.h("td", null),
      index$2.h("td", null, index$2.h("div", null, t("Order total"))),
      index$2.h("td", null),
      index$4.Item.vat(this.items) ? (index$2.h("td", null, index$2.h("div", { class: "total" }, (_a = index$4.Item.vat(this.items)) === null || _a === void 0 ? void 0 : _a.toFixed(2)))) : (index$2.h("td", null, index$2.h("div", null))),
      index$2.h("td", null, index$2.h("div", { class: "total" }, index$4.Item.amount(this.items).toFixed(2), " ", this.currency)),
      index$2.h("td", null),
    ];
  }
  get element() { return index$2.getElement(this); }
};
IntergirOrderItemsTotal.style = styleCss$6;

const sv$5 = {
  Scheme: "System",
  Number: "Nummer",
  Expires: "Giltigt t.o.m.",
  Type: "Typ",
  card: "kort",
  Method: "Metod",
  Contact: "Kontakt",
  Message: "Meddelande",
  "Open link": "Öppna länk",
  defer: "skickad",
  link: "länk",
};

function create$5(language) {
  return index$1.dist.create({
    sv: sv$5,
  }, language);
}

const styleCss$5 = "*.sc-ig-order-payment-h{display:-ms-flexbox;display:flex}[hidden].sc-ig-order-payment-h{display:none}.sc-ig-order-payment-h>span.sc-ig-order-payment{-ms-flex-positive:1;flex-grow:1;padding-left:0.6em;padding-right:0.6em}ul.sc-ig-order-payment{width:100%;list-style-type:none;margin-top:0;margin-bottom:0;-webkit-padding-start:0;padding-inline-start:0}summary.sc-ig-order-payment{outline:none;text-align:left}dl.sc-ig-order-payment{margin:8px;width:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;max-height:3em;-ms-flex-pack:start;justify-content:flex-start}dt.sc-ig-order-payment{font-weight:bold;text-align:left}dd.sc-ig-order-payment{text-align:left;margin:0}dd.icon.sc-ig-order-payment{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding-top:0.5em}";

const IntergirOrderPayment = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create$5(this.element);
  }
  render() {
    const t = this.t;
    return (index$2.h("ul", null, index$2.h("li", null, this.order.payment.type == "card" ? (index$2.h("summary", null, index$2.h("dl", null, this.order.payment.type ? [index$2.h("dt", null, t("Type")), index$2.h("dd", null, t(this.order.payment.type))] : "", this.order.payment.scheme ? [index$2.h("dt", null, t("Scheme")), index$2.h("dd", null, this.order.payment.scheme)] : "", index$4.Payment.Card.is(this.order.payment)
      ? [
        index$2.h("dt", null, t("Number")),
        index$2.h("dd", null, this.order.payment.iin.substring(0, 4) +
          " " +
          this.order.payment.iin.substring(4) +
          "** **** " +
          this.order.payment.last4),
      ]
      : "", this.order.payment.expires
      ? [
        index$2.h("dt", null, t("Expires")),
        index$2.h("dd", null, this.order.payment.expires[0], "/", this.order.payment.expires[1]),
      ]
      : ""))) : this.order.payment.type == "defer" ? (index$2.h("summary", null, index$2.h("dl", null, this.order.payment.type ? [index$2.h("dt", null, t("Type")), index$2.h("dd", null, t(this.order.payment.type))] : "", this.order.payment.method ? [index$2.h("dt", null, t("Method")), index$2.h("dd", null, t(this.order.payment.method))] : "", this.order.payment.contact ? [index$2.h("dt", null, t("Contact")), index$2.h("dd", null, this.order.payment.contact)] : "", this.order.payment.message ? [index$2.h("dt", null, t("Message")), index$2.h("dd", null, this.order.payment.message)] : "", index$4.Payment.Defer.is(this.order.payment) && this.order.payment.link != undefined
      ? [
        index$2.h("dt", null),
        index$2.h("dd", { class: "icon" }, index$2.h("a", { target: "_blank", href: this.order.payment.link }, index$2.h("smoothly-icon", { toolTip: t("Open link"), name: "open" }))),
      ]
      : ""))) : ("No payment information available."))));
  }
  get element() { return index$2.getElement(this); }
};
IntergirOrderPayment.style = styleCss$5;

const sv$4 = {};

function create$4(language) {
  return index$1.dist.create({
    sv: sv$4,
  }, language);
}

const styleCss$4 = ".sc-ig-orders-table-details-h{display:table-row}.sc-ig-orders-table-details-h>.sc-ig-orders-table-details:nth-child(1){border-top:solid 1px rgb(var(--smoothly-medium-shade));border-bottom:solid 1px rgb(var(--smoothly-medium-shade));background-color:rgb(var(--smoothly-dark-shade));padding-top:0.5em;padding-bottom:0.5em;padding-left:5%}";

const IntergiroOrdersTableDetails = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.opened = "";
    this.selected = false;
  }
  componentWillLoad() {
    this.t = create$4(this.element);
  }
  render() {
    let result;
    switch (this.opened) {
      case "number":
        result = (index$2.h("ig-number-details", { identifier: this.order.id, number: this.order.number, name: "order" }));
        break;
      case "contact":
        result = (index$2.h("ig-order-contact", { contact: Item.Contact.is(this.order.customer) ? this.order.customer : undefined }));
        break;
      case "items":
        result = index$2.h("ig-order-items", { order: this.order });
        break;
      case "payment":
        result = index$2.h("ig-order-payment", { order: this.order });
        break;
      case "created":
        result = (index$2.h("ig-order-events", { event: this.order.event, currency: this.order.currency, payment: this.order.payment }));
        break;
      default:
        result = [];
        break;
    }
    return Array.isArray(result) && result.length == 0 ? result : [index$2.h("td", { colSpan: 8 }, result)];
  }
  get element() { return index$2.getElement(this); }
};
IntergiroOrdersTableDetails.style = styleCss$4;

const sv$3 = {
  Edit: "Redigera",
  Delete: "Radera",
  primary: "primär",
  cellphone: "mobiltelefon",
  landline: "fast telefon",
};

function create$3(language) {
  return index$1.dist.create({
    sv: sv$3,
  }, language);
}

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

const IntergiroPhoneNumber = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.edit = index$2.createEvent(this, "edit", 7);
    this.delete = index$2.createEvent(this, "delete", 7);
    this.editable = true;
    this.type = "primary";
    this.mode = "display";
  }
  componentWillLoad() {
    this.t = create$3(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$2.h("smoothly-popup", null, index$2.h("smoothly-icon", { name: "ellipsis-vertical-outline", size: "small" }), index$2.h("div", { color: "light", slot: "popup" }, index$2.h("smoothly-icon", { size: "small", name: "pencil-outline", toolTip: t("Edit"), onClick: () => (this.mode = "edit") }), index$2.h("smoothly-icon", { size: "small", name: "trash", toolTip: "Delete", onClick: () => this.onDelete() })))),
      index$2.h("label", null, t(this.type)),
      index$2.h("smoothly-display", { type: "phone", value: this.value }),
    ]) : (index$2.h("ig-phone-number-input", { value: this.value, onEdit: (e) => this.onEdit(e) }))) : ([]);
  }
  get element() { return index$2.getElement(this); }
};
IntergiroPhoneNumber.style = styleCss$3;

const sv$2 = {
  Save: "Spara",
  Cancel: "Avbryt",
  primary: "primär",
  cellphone: "mobiltelefon",
  landline: "fast telefon",
  "Please enter a valid phone number.": "Ange ett giltigt telefonnummer.",
  "Phone number": "Telefonnummer",
};

function create$2(language) {
  return index$1.dist.create({
    sv: sv$2,
  }, language);
}

const styleCss$2 = ".sc-ig-phone-number-input-h{margin-top:0.5em;display:block}smoothly-submit.sc-ig-phone-number-input,smoothly-submit.sc-ig-phone-number-input>button.sc-ig-phone-number-input{background-color:transparent;border:none;cursor:pointer;color:transparent;width:auto;float:right;margin-top:0.2em}smoothly-input.sc-ig-phone-number-input{border:1px solid rgb(var(--smoothly-medium-color))}form.sc-ig-phone-number-input{display:-ms-flexbox;display:flex;-ms-flex-flow:row;flex-flow:row;-ms-flex-wrap:wrap;flex-wrap:wrap}form.sc-ig-phone-number-input>*.sc-ig-phone-number-input:not(smoothly-icon){width:100%}form.sc-ig-phone-number-input>tr.sc-ig-phone-number-input>span.sc-ig-phone-number-input>smoothly-icon.sc-ig-phone-number-input{float:left;margin-right:0.2em}form.sc-ig-phone-number-input>tr.sc-ig-phone-number-input>span.sc-ig-phone-number-input{float:left;margin-right:1em;padding-bottom:0.5em;padding-top:0.5em;font-size:0.9em}";

const IntergiroPhoneNumberInput = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.add = index$2.createEvent(this, "add", 7);
    this.edit = index$2.createEvent(this, "edit", 7);
    this.notice = index$2.createEvent(this, "notice", 7);
    this.types = [];
    this.type = this.types[0];
    this.mode = "edit";
  }
  componentWillLoad() {
    this.t = create$2(this.element);
  }
  onSubmit(e) {
    const value = e.detail.phone;
    if (value) {
      if (this.mode == "add")
        this.add.emit({ type: this.type, value });
      else
        this.edit.emit(value);
    }
    else
      this.notice.emit(Notice.Notice.failed(this.t("Please enter a valid phone number.")));
  }
  onCancel() {
    this.edit.emit(this.value);
  }
  onSelectionChanged(e) {
    this.type = e.detail.value;
  }
  toUpperCase(value) {
    return value.charAt(0).toUpperCase() + value.slice(1);
  }
  render() {
    const t = this.t;
    return (index$2.h("form", null, this.mode == "add" ? (index$2.h("smoothly-select", { background: "transparent" }, this.types.map(option => this.type == option ? (index$2.h("option", { value: option, selected: true }, this.toUpperCase(t(option)))) : (index$2.h("option", { value: option }, this.toUpperCase(t(option))))))) : ([]), index$2.h("smoothly-input", { type: "phone", name: "phone", value: this.value }, this.mode == "add" ? t("Phone number") : t(this.type)), index$2.h("div", null, index$2.h("smoothly-submit", { prevent: true, onSubmit: (e) => this.onSubmit(e) }, index$2.h("smoothly-icon", { name: "checkmark-circle", toolTip: t("Save"), color: "success", fill: "clear", size: "small" })), index$2.h("smoothly-submit", { prevent: true, onSubmit: () => this.onCancel() }, index$2.h("smoothly-icon", { name: "close-circle", toolTip: t("Cancel"), color: "light", fill: "clear", size: "small" })))));
  }
  get element() { return index$2.getElement(this); }
};
IntergiroPhoneNumberInput.style = styleCss$2;

const sv$1 = {
  Add: "Lägg till",
};

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

const styleCss$1 = ".sc-ig-phone-numbers-h{display:block}label.sc-ig-phone-numbers{font-weight:bold}smoothly-icon.sc-ig-phone-numbers{cursor:pointer;float:right;margin-top:-0.2em;visibility:hidden}ig-phone-number.sc-ig-phone-numbers{clear:both}.sc-ig-phone-numbers-h:hover smoothly-icon.sc-ig-phone-numbers{visibility:visible}";

const IntergiroPhoneNumbers = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.changed = index$2.createEvent(this, "changed", 7);
    this.editable = true;
    this.adding = false;
  }
  componentWillLoad() {
    this.t = create$1(this.element);
  }
  get types() {
    return Item.PhoneNumbers.types.filter(type => Item.PhoneNumbers.is(this.value) ? !this.value[type] : this.value ? type != "primary" : type);
  }
  get phoneNumbers() {
    return Item.PhoneNumbers.is(this.value) ? Object.assign({}, this.value) : { primary: this.value };
  }
  onEdit(e) {
    const type = e.detail.type;
    delete e.detail.type;
    let result;
    if (!Item.PhoneNumbers.is(this.value))
      result = e.detail.value;
    else {
      result = Object.assign({}, this.value);
      result[type] = e.detail.value;
    }
    this.changed.emit((this.value = result));
  }
  onDelete(e) {
    const type = e.detail;
    const result = Object.assign({}, this.phoneNumbers);
    delete result[type];
    this.changed.emit((this.value = result));
  }
  onAdd(e) {
    const type = e.detail.type;
    const value = e.detail.value;
    const result = this.phoneNumbers;
    result[type] = value;
    this.changed.emit((this.value = result));
    this.adding = false;
  }
  render() {
    return [
      index$2.h("label", null, this.label),
      this.adding ? (index$2.h("ig-phone-number-input", { onEdit: (e) => (this.adding = false), types: this.types, mode: "add", onAdd: (e) => this.onAdd(e) })) : ([]),
      this.editable && this.types.length > 0 ? (index$2.h("smoothly-icon", { name: "add-circle", toolTip: this.t("Add"), fill: "clear", size: "medium", color: "success", style: this.adding ? { display: "none" } : {}, onClick: () => (this.adding = true) })) : ([]),
      this.phoneNumbers ? (Item.PhoneNumbers.is(this.value) ? (Item.PhoneNumbers.map(this.value, (type, value) => [
        index$2.h("ig-phone-number", { value: value, type: type, editable: this.editable, onEdit: (e) => this.onEdit(e), onDelete: (e) => this.onDelete(e) }),
      ])) : (index$2.h("ig-phone-number", { value: this.value, editable: this.editable, onEdit: (e) => this.onEdit(e), onDelete: (e) => this.onDelete(e) }))) : ([]),
    ];
  }
  get element() { return index$2.getElement(this); }
};
IntergiroPhoneNumbers.style = styleCss$1;

const sv = {
  create: "skapad",
  order: "beställa",
  cancel: "avbryt",
  charge: "debitera",
  pay: "betala",
  refund: "återbetala",
  deny: "neka",
  pending: "väntande",
  defer: "skicka",
  Quantity: "Antal",
  Amount: "Summa",
};

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

const styleCss = ".sc-ig-status-change-h{display:inline-block}[hidden].sc-ig-status-change-h{display:none}button.sc-ig-status-change{display:block;padding:0.2em 0.3em;border:none;font-size:inherit}button.sc-ig-status-change:focus{outline:unset}content.sc-ig-status-change>*.sc-ig-status-change{text-align:center;height:2.5em;min-width:2.5em}content.sc-ig-status-change>.sc-ig-status-change:first-child{border-top-left-radius:5px;border-bottom-left-radius:5px}content.sc-ig-status-change>.sc-ig-status-change:last-child{border-top-right-radius:5px;border-bottom-right-radius:5px}#charge.sc-ig-status-change{background-color:rgb(var(--smoothly-success-color))}#cancel.sc-ig-status-change{background-color:rgb(var(--smoothly-danger-color))}#refund.sc-ig-status-change{background-color:rgb(var(--smoothly-danger-color))}#synchronize.sc-ig-status-change{background-color:rgb(var(--smoothly-dark-color))}#amount.sc-ig-status-change{min-width:6em;padding:0;background-color:rgb(var(--smoothly-dark-color))}content.sc-ig-status-change{display:-ms-flexbox;display:flex}.sc-ig-status-change-h>smoothly-popup.sc-ig-status-change{display:inline}";

const IntergiroStatusChange = class {
  constructor(hostRef) {
    index$2.registerInstance(this, hostRef);
    this.changeStatus = index$2.createEvent(this, "changeStatus", 7);
  }
  get mode() {
    return this.amount && index$3.dist.Currency.is(this.currency) ? "amount" : "quantity";
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  emitChangeStatus(type) {
    var _a, _b, _c;
    const value = !((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value)
      ? 1
      : this.mode == "quantity"
        ? Number.parseInt((_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.value)
        : Number.parseFloat((_c = this.inputElement) === null || _c === void 0 ? void 0 : _c.value);
    this.changeStatus.emit({ type, items: this.mode == "quantity" ? { quantity: value } : value });
    if (this.popupElement)
      this.popupElement.visible = false;
  }
  render() {
    var _a;
    const t = this.t;
    let events;
    switch (this.status) {
      case "created":
      case "deferred":
      case "pending":
        events = [];
        break;
      case "ordered":
        events = [];
        break;
      case "charged":
      case "paid":
        events = ["refund"];
        break;
      default:
      case "denied":
      case "cancelled":
      case "refunded":
      case "synchronized":
        events = [];
        break;
    }
    return [
      events.length != 0 ? (index$2.h("smoothly-popup", { ref: (e) => (this.popupElement = e) }, index$2.h("main", null, index$2.h("ig-status", { quantity: this.quantity, unit: this.unit, status: this.status })), index$2.h("content", { slot: "popup" }, this.quantity == 1 ? ("") : this.mode == "quantity" ? (index$2.h("smoothly-select", { color: "dark", identifier: "quantity", ref: (e) => (this.inputElement = e) }, generateOptions((_a = this.quantity) !== null && _a !== void 0 ? _a : 1).map(c => (c = this.quantity ? (index$2.h("option", { value: c }, c)) : (index$2.h("option", { value: c, selected: true }, c)))))) : (index$2.h("smoothly-input", { type: "price", name: "amount", id: "amount", value: this.amount, ref: (e) => (this.inputElement = e) }, t("Amount"), " (", this.currency, ")")), events.map(event => (index$2.h("button", { onClick: () => this.emitChangeStatus(event), id: event, name: event }, index$2.h("smoothly-icon", { toolTip: t(event), name: event == "cancel"
          ? "close"
          : event == "charge"
            ? "checkmark"
            : event == "refund"
              ? "arrow-undo"
              : "", color: event == "cancel"
          ? "danger"
          : event == "charge"
            ? "success"
            : event == "refund"
              ? "danger"
              : "medium" }))))))) : (index$2.h("div", null, index$2.h("span", null, index$2.h("ig-status", { quantity: this.quantity, unit: this.unit, status: this.status })))),
    ];
  }
  get element() { return index$2.getElement(this); }
};
function generateOptions(count) {
  const result = [];
  for (let c = 1; c <= count; c++)
    result.push(c);
  return result;
}
IntergiroStatusChange.style = styleCss;

exports.ig_orders_table_row = index.IntergiroOrdersTableRow;
exports.ig_email_address = IntergiroEmailAddress;
exports.ig_email_addresses = IntergiroEmailAddresses;
exports.ig_email_input = IntergiroEmailInput;
exports.ig_order_contact = IntergiroOrderContact;
exports.ig_order_events = IntergiroOrderEvents;
exports.ig_order_items = IntergiroOrderItems;
exports.ig_order_items_quantity = IntergirOrderItemsQuantity;
exports.ig_order_items_total = IntergirOrderItemsTotal;
exports.ig_order_payment = IntergirOrderPayment;
exports.ig_orders_table_details = IntergiroOrdersTableDetails;
exports.ig_phone_number = IntergiroPhoneNumber;
exports.ig_phone_number_input = IntergiroPhoneNumberInput;
exports.ig_phone_numbers = IntergiroPhoneNumbers;
exports.ig_status_change = IntergiroStatusChange;
