import { r as registerInstance, h } from './index-aeac5cad.js';
import './_commonjsHelpers-91fffb88.js';
import { s as sort } from './index-df45deab.js';

const styleCss = ".sc-payfunc-orders-h{display:block}[hidden].sc-payfunc-orders-h{display:none}.sc-payfunc-orders-h>div.sc-payfunc-orders>payfunc-orders-table.sc-payfunc-orders{border:1px solid rgb(var(--smoothly-medium-color))}.sc-payfunc-orders-h>div.sc-payfunc-orders>payfunc-orders-footer.sc-payfunc-orders{width:100%;max-width:90em;z-index:1;position:sticky;bottom:0;color:rgb(var(--smoothly-light-contrast));background-color:rgb(var(--smoothly-light-color));padding:.5em 0 .5em 0}smoothly-trigger.sc-payfunc-orders{display:inline}.sc-payfunc-orders-h>div.sc-payfunc-orders>div.sc-payfunc-orders>smoothly-trigger.sc-payfunc-orders:hover{border-color:transparent}.toolbar.sc-payfunc-orders{z-index:1;padding:0.5em 0 0.9em 0.5em;overflow:hidden;position:fixed;height:10.1em;background-color:rgb(var(--smoothly-light-color));top:33%;right:0;border-radius:.3em 0 0 .3em;box-shadow:var(--smoothly-shadow);animation-name:slide;animation-duration:.3s;animation-timing-function:ease-out}@keyframes slide{0%{width:0}}#charge.sc-payfunc-orders{display:inline-block;border-radius:5px 0 0 0;background-color:rgb(var(--smoothly-success-color))}#cancel.sc-payfunc-orders,#refund.sc-payfunc-orders{display:inline-block;border-radius:0;background-color:rgb(var(--smoothly-danger-color))}#synchronize.sc-payfunc-orders{display:inline-block;border-radius:0;background-color:rgb(var(--smoothly-dark-color));border-bottom-left-radius:5px}p.sc-payfunc-orders{margin:1em}";

const PayfuncOrders = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.selected = {};
    this.display = false;
  }
  componentWillLoad() {
    if (!this.ordersFiltered)
      this.updateOrders();
  }
  updateOrders(orders) {
    var _a;
    this.ordersFiltered = sort((_a = orders !== null && orders !== void 0 ? orders : this.orders) !== null && _a !== void 0 ? _a : [], "created");
  }
  handleFilterChanged(event) {
    this.updateOrders(event.detail);
    event.stopPropagation();
  }
  handleSelectedChanged(event) {
    this.selected = event.detail;
    event.stopPropagation();
  }
  render() {
    return (h("div", null, h("payfunc-filter", { filter: this.filter, value: this.orders }), h("payfunc-orders-actions", { selected: this.selected }), h("payfunc-orders-table", { display: this.display, orders: this.ordersFiltered, selected: this.selected, receipt: this.receipt }), h("payfunc-orders-footer", { orders: this.ordersFiltered, selected: this.selected })));
  }
  static get watchers() { return {
    "orders": ["updateOrders"]
  }; }
};
PayfuncOrders.style = styleCss;

export { PayfuncOrders as payfunc_orders };
