'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 = {
  daily: "daglig",
  weekly: "veckovis",
  monthly: "månadsvis",
  quarterly: "kvartalsvis",
  yearly: "årlig",
  ongoing: "pågående",
};

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

const styleCss = ".sc-payfunc-subscription-table-row-h{display:table-row}[hidden].sc-payfunc-subscription-table-row-h{display:none}.sc-payfunc-subscription-table-row-h:hover{border-top:1px solid rgb(var(--smoothly-medium-color));border-bottom:1px solid rgb(var(--smoothly-medium-color));box-shadow:var(--smoothly-shadow)}.sc-payfunc-subscription-table-row-h>td.sc-payfunc-subscription-table-row>.openable.sc-payfunc-subscription-table-row{padding:.5em .3em;width:max-content;min-width:3em}.opened.sc-payfunc-subscription-table-row,.openable.sc-payfunc-subscription-table-row{cursor:pointer}.opened.sc-payfunc-subscription-table-row{box-sizing:border-box;border:solid 1px;background-color:rgb(var(--smoothly-dark-shade));border-color:rgb(var(--smoothly-medium-shade));border-bottom-color:rgb(var(--smoothly-dark-shade))}.sc-payfunc-subscription-table-row-h>td.sc-payfunc-subscription-table-row:first-of-type>.opened.sc-payfunc-subscription-table-row{border-left:none}";

const PayfuncSubscriptionTableRow = class {
  constructor(hostRef) {
    index$1.registerInstance(this, hostRef);
    this.columnClicked = index$1.createEvent(this, "columnClicked", 7);
    this.opened = "";
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  handleColumnClick(column) {
    this.opened = column;
    this.columnClicked.emit({ id: this.subscription.id, column });
  }
  render() {
    var _a;
    return [
      index$1.h("td", null, index$1.h("section", { class: "openable" + (this.opened == "number" ? " opened" : ""), onClick: () => this.handleColumnClick("number") }, (_a = this.subscription.number) !== null && _a !== void 0 ? _a : this.subscription.id)),
      index$1.h("td", null, index$1.h("smoothly-display-amount", { class: "openable" + (this.opened == "amount" ? " opened" : ""), onClick: () => this.handleColumnClick("amount"), amount: index$2.Item.amount(this.subscription.items), currency: this.subscription.currency })),
      index$1.h("td", null, index$1.h("section", { class: "openable" + (this.opened == "schedule" ? " opened" : ""), onClick: () => this.handleColumnClick("schedule") }, this.t(typeof this.subscription.schedule == "object"
        ? this.subscription.schedule.frequency
        : this.subscription.schedule))),
      index$1.h("td", null, index$1.h("section", { class: "openable" + (this.opened == "start" ? " opened" : ""), onClick: () => this.handleColumnClick("start") }, this.subscription.start)),
      index$1.h("td", null, index$1.h("section", { class: "openable" + (this.opened == "end" ? " opened" : ""), onClick: () => this.handleColumnClick("end") }, this.subscription.end ? this.subscription.end : this.t("ongoing"))),
      index$1.h("td", null, index$1.h("section", { class: "openable" + (this.opened == "due" ? " opened" : ""), onClick: () => this.handleColumnClick("due") }, index$2.Schedule.next(this.subscription.schedule, this.subscription.start))),
    ];
  }
  get element() { return index$1.getElement(this); }
};
PayfuncSubscriptionTableRow.style = styleCss;

exports.payfunc_subscription_table_row = PayfuncSubscriptionTableRow;
