'use strict';

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

const index = require('./index-0b1e2673.js');
require('./_commonjsHelpers-937cd5b3.js');
const index$1 = require('./index-ab186017.js');

const styleCss = ".sc-payfunc-account-balance-h{display:block;padding-top:.5em}[hidden].sc-payfunc-account-balance-h{display:none}.sc-payfunc-account-balance-h>section.sc-payfunc-account-balance>payfunc-items-list.sc-payfunc-account-balance{padding-top:1em}.sc-payfunc-account-balance-h>section.sc-payfunc-account-balance:first-of-type{display:flex;justify-content:space-between}.sc-payfunc-account-balance-h>section.sc-payfunc-account-balance:last-of-type{display:block}payfunc-future-due-dates.sc-payfunc-account-balance{min-width:13em}payfunc-orders-table.sc-payfunc-account-balance{border:1px solid rgb(var(--smoothly-medium-color));margin-top:1em}main.sc-payfunc-account-balance{display:flex;flex-wrap:wrap}main.sc-payfunc-account-balance>*.sc-payfunc-account-balance{width:min-content}";

const PayfuncAccountBalance = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.filterOrders();
  }
  filterOrders() {
    const orders = this.orders
      ? this.orders.filter(o => o.payment.type == "account" || o.payment.type == "card" ? o.payment.charge == "balance" : false)
      : undefined;
    this.ordersFiltered = orders;
  }
  render() {
    return [
      index.h("section", null, index.h("main", null, index.h("payfunc-schedule", { schedule: this.account.schedule }), this.account.limit ? index.h("payfunc-limit", { account: this.account }) : []), index.h("payfunc-future-due-dates", { dates: index$1.Schedule.calculateDueDates(this.account.schedule, 4) })),
      index.h("section", null, this.account.balance.length > 0 ? index.h("payfunc-items-list", { items: this.account.balance }) : [], this.ordersFiltered && this.ordersFiltered.length > 0 ? (index.h("payfunc-orders-table", { display: true, orders: this.ordersFiltered })) : ([])),
    ];
  }
  static get watchers() { return {
    "orders": ["filterOrders"]
  }; }
};
PayfuncAccountBalance.style = styleCss;

exports.payfunc_account_balance = PayfuncAccountBalance;
