'use strict';

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

const index$1 = require('./index-0b1e2673.js');
require('./_commonjsHelpers-937cd5b3.js');
const index$2 = require('./index-2eb96242.js');
const index = require('./index-36cf3884.js');

const sv = {
  "@": "à",
  "Remove item": "Ta bort artikel",
};

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

const styleCss = ".sc-payfunc-display-item-h{display:block}[hidden].sc-payfunc-display-item-h{display:none}.sc-payfunc-display-item-h>section.sc-payfunc-display-item{margin-left:.3em;display:flex;flex-wrap:nowrap}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.sc-payfunc-display-item{margin-bottom:0.8em;padding-left:1.5em;white-space:nowrap;overflow:hidden;text-overflow:visible}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.medium.sc-payfunc-display-item{flex-grow:2}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.small.sc-payfunc-display-item{flex-grow:1}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>span.big.sc-payfunc-display-item{flex-grow:3}.left.sc-payfunc-display-item{border-left:1px solid rgb(var(--smoothly-medium-color))}.sc-payfunc-display-item-h>section.sc-payfunc-display-item>smoothly-trigger.sc-payfunc-display-item{margin-right:0px;margin-left:8px;margin-top:-3px;float:right}";

const PayfuncDisplayItem = class {
  constructor(hostRef) {
    index$1.registerInstance(this, hostRef);
    this.itemDeleted = index$1.createEvent(this, "itemDeleted", 7);
    this.item = {};
    this.removable = true;
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  delete(event) {
    if (event.detail.name == "item") {
      event.stopPropagation();
      this.itemDeleted.emit({ index: this.index });
    }
  }
  render() {
    const t = this.t;
    return [
      this.item ? (index$1.h("section", null, index$1.h("span", { class: "small" }, this.item.quantity ? this.item.quantity : this.item.unit ? 1 : "", " ", this.item.unit), index$1.h("span", { class: "big" }, this.item.name), index$1.h("span", { class: "medium" }, t("@"), " ", index$2.Item.amount(this.item) / (this.item.quantity ? this.item.quantity : 1), " ", this.currency), index$1.h("span", { class: "medium" }, index$2.Item.amount(this.item), " ", this.currency), this.removable ? (index$1.h("smoothly-trigger", { fill: "clear", name: "item" }, index$1.h("smoothly-icon", { size: "small", toolTip: t("Remove item"), name: "trash" }))) : (""))) : (""),
    ];
  }
  get element() { return index$1.getElement(this); }
};
PayfuncDisplayItem.style = styleCss;

exports.payfunc_display_item = PayfuncDisplayItem;
