import { r as registerInstance, h, g as getElement, c as createEvent } from './index-65e437df.js';
import './_commonjsHelpers-7b8ed50b.js';
import { e as Schedule } from './index-5a6f97d3.js';
import { d as dist } from './index-15e1c25d.js';
import { d as dist$1 } from './index-1c311e76.js';

const sv = {
  "Upcoming payments": "Kommande betalningar",
};

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

const styleCss = ".sc-payfunc-future-due-dates-h{display:block}[hidden].sc-payfunc-future-due-dates-h{display:none}.sc-payfunc-future-due-dates-h>table.sc-payfunc-future-due-dates{border:1px solid rgb(var(--smoothly-medium-color));width:100%;height:100%}tr.sc-payfunc-future-due-dates:first-of-type{border-bottom:1px solid rgb(var(--smoothly-medium-color));font-weight:bold}td.sc-payfunc-future-due-dates{padding:.3em}";

const PayfuncFutureDueDates = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  render() {
    return [
      h("table", null, h("tr", { color: "light" }, h("td", null, this.t("Upcoming payments"))), this.dates
        ? this.dates.map(date => (h("tr", null, h("td", null, dist$1.DateTime.localize(dist$1.DateTime.parse(date)).slice(0, 10)))))
        : []),
    ];
  }
  get element() { return getElement(this); }
};
PayfuncFutureDueDates.style = styleCss;

const en = {
  "-2": "third to last",
  "-1": "second to last",
  "0": "last",
};

const sv$1 = {
  frequency: "frekvens",
  offset: "offset",
  daily: "daglig",
  weekly: "veckovis",
  monthly: "månadsvis",
  quarterly: "kvartalsvis",
  yearly: "årlig",
  date: "datum",
  month: "månad",
  weekday: "veckodag",
  monday: "måndag",
  tuesday: "tisdag",
  wednesday: "onsdag",
  thursday: "torsdag",
  friday: "fredag",
  saturday: "lördag",
  sunday: "söndag",
  january: "januari",
  february: "februari",
  march: "mars",
  may: "maj",
  june: "juni",
  july: "juli",
  august: "augusti",
  october: "oktober",
  first: "första",
  second: "andra",
  third: "tredje",
  "-2": "tredje sista dagen",
  "-1": "andra sista dagen",
  "0": "sista dagen",
};

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

const styleCss$1 = ".sc-payfunc-schedule-h{width:100%;display:flex;flex-direction:row;justify-content:space-around}[hidden].sc-payfunc-schedule-h{display:none}.sc-payfunc-schedule-h>section.sc-payfunc-schedule{width:100%}.sc-payfunc-schedule-h>section.sc-payfunc-schedule>label.sc-payfunc-schedule{font-weight:bold;text-align:left;padding-bottom:.2em;text-transform:capitalize}.sc-payfunc-schedule-h>section.sc-payfunc-schedule>smoothly-display.sc-payfunc-schedule{width:10em;max-width:10em;text-transform:capitalize;align-self:flex-start}";

const PayfuncSchedule = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.notice = createEvent(this, "notice", 7);
    this.advanced = false;
  }
  componentWillLoad() {
    this.t = create$1(this.element);
    this.frequency = typeof this.schedule == "object" ? this.schedule.frequency : this.schedule;
    this.offset = Schedule.is(this.schedule) && this.schedule.frequency != "daily" ? this.schedule.offset : undefined;
    this.divisor = Schedule.is(this.schedule) ? this.schedule.divisor : undefined;
  }
  render() {
    return [
      h("section", null, h("label", null, this.t("frequency")), h("smoothly-display", { type: "text", value: this.t(this.frequency) })),
      (this.frequency == "quarterly" || this.frequency == "yearly") && this.offset != undefined ? (h("section", null, h("label", null, this.t("month")), h("smoothly-display", { type: "text", value: this.t(Array.isArray(this.offset) ? Schedule.months[this.offset[0]] : Schedule.months[this.offset]) }))) : ([]),
      (this.frequency == "monthly" ||
        ((this.frequency == "yearly" || this.frequency == "quarterly") && Array.isArray(this.offset))) &&
        this.offset != undefined ? (h("section", null, h("label", null, this.t("date")), h("smoothly-display", { type: "text", value: this.t(Array.isArray(this.offset) ? (this.offset[1] + 1).toString() : (this.offset + 1).toString()) }))) : ([]),
      this.frequency == "weekly" && !Array.isArray(this.offset) && this.offset != undefined ? (h("section", null, h("label", null, this.t("weekday")), h("smoothly-display", { type: "text", value: this.t(Schedule.weekdays[this.offset - 1]) }))) : ([]),
      this.divisor != undefined ? (h("section", null, h("label", null, this.t("divisor")), h("smoothly-display", { type: "text", value: Array.isArray(this.divisor)
          ? this.divisor[0].toString() + " / " + this.divisor[1].toString()
          : this.divisor.toString() }))) : ([]),
    ];
  }
  get element() { return getElement(this); }
};
PayfuncSchedule.style = styleCss$1;

export { PayfuncFutureDueDates as payfunc_future_due_dates, PayfuncSchedule as payfunc_schedule };
