'use strict';

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

const index = require('./index-df541290.js');
const index$1 = require('./index-07607ed6.js');
require('./index-e4cf4aa6.js');
require('./_commonjsHelpers-5bbc2693.js');

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

const IntergiroAccountBalance = 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("ig-schedule", { schedule: this.account.schedule }), this.account.limit ? index.h("ig-limit", { account: this.account }) : []), index.h("ig-future-due-dates", { dates: index$1.Schedule.calculateDueDates(this.account.schedule, 4) })),
      index.h("section", null, this.account.balance.length > 0 ? index.h("ig-items-list", { items: this.account.balance }) : [], this.ordersFiltered && this.ordersFiltered.length > 0 ? (index.h("ig-orders-table", { display: true, orders: this.ordersFiltered })) : ([])),
    ];
  }
  static get watchers() { return {
    "orders": ["filterOrders"]
  }; }
};
IntergiroAccountBalance.style = styleCss;

exports.ig_account_balance = IntergiroAccountBalance;
