'use strict';

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

const index$1 = require('./index-df541290.js');
const index$2 = require('./index-c12b8888.js');
const index = require('./index-b7493032.js');
require('./index-0b6f1dd9.js');
require('./_commonjsHelpers-10109b76.js');
require('./index-fe328b96.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-ig-subscription-table-row-h{display:table-row}[hidden].sc-ig-subscription-table-row-h{display:none}.sc-ig-subscription-table-row-h:hover{border-top:1px solid rgb(var(--smoothly-medium-color));border-bottom:1px solid rgb(var(--smoothly-medium-color));-webkit-box-shadow:var(--smoothly-shadow);box-shadow:var(--smoothly-shadow)}.sc-ig-subscription-table-row-h>td.sc-ig-subscription-table-row>.openable.sc-ig-subscription-table-row{padding:.5em .3em;width:-webkit-max-content;width:-moz-max-content;width:max-content;min-width:3em;display:inline-block}.opened.sc-ig-subscription-table-row,.openable.sc-ig-subscription-table-row{cursor:pointer}.opened.sc-ig-subscription-table-row{border:solid 1px rgb(var(--smoothly-medium-shade));background-color:rgb(var(--smoothly-dark-shade));border-bottom:3px solid rgb(var(--smoothly-dark-shade));border-radius:0 0 2px 2px;margin-bottom:-2px}.sc-ig-subscription-table-row-h>td.sc-ig-subscription-table-row:first-of-type>.opened.sc-ig-subscription-table-row{border-left:none}";

const IntergiroSubscriptionTableRow = 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); }
};
IntergiroSubscriptionTableRow.style = styleCss;

exports.ig_subscription_table_row = IntergiroSubscriptionTableRow;
