'use strict';

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

const index = require('./index-df541290.js');
const index$1 = require('./index-0b6f1dd9.js');
const index$2 = require('./index-c12b8888.js');
require('./_commonjsHelpers-10109b76.js');
require('./index-fe328b96.js');
require('./index-b7493032.js');

const styleCss = ".sc-ig-orders-h{display:block}[hidden].sc-ig-orders-h{display:none}.sc-ig-orders-h>div.sc-ig-orders>ig-orders-table.sc-ig-orders{border:1px solid rgb(var(--smoothly-medium-color))}.sc-ig-orders-h>div.sc-ig-orders>ig-orders-footer.sc-ig-orders{width:100%;max-width:90em;z-index:1;position:-webkit-sticky;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-ig-orders{display:inline}.sc-ig-orders-h>div.sc-ig-orders>div.sc-ig-orders>smoothly-trigger.sc-ig-orders:hover{border-color:transparent}.toolbar.sc-ig-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;-webkit-box-shadow:var(--smoothly-shadow);box-shadow:var(--smoothly-shadow);-webkit-animation-name:slide;animation-name:slide;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}@-webkit-keyframes slide{0%{width:0}}@keyframes slide{0%{width:0}}#charge.sc-ig-orders{display:inline-block;border-radius:5px 0 0 0;background-color:rgb(var(--smoothly-success-color))}#cancel.sc-ig-orders,#refund.sc-ig-orders{display:inline-block;border-radius:0;background-color:rgb(var(--smoothly-danger-color))}#synchronize.sc-ig-orders{display:inline-block;border-radius:0;background-color:rgb(var(--smoothly-dark-color));border-bottom-left-radius:5px}p.sc-ig-orders{margin:1em}";

const IntergiroOrders = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.selected = {};
    this.display = false;
  }
  componentWillLoad() {
    if (!this.ordersFiltered)
      this.updateOrders();
  }
  handleFilterChanged(event) {
    this.filter = event.detail;
    event.stopPropagation();
  }
  updateOrders() {
    const result = this.orders && (this.filter ? index$1.dist.filter(this.filter, this.orders) : [...this.orders]);
    this.ordersFiltered = result && index$2.sort(result, "created");
  }
  handleSelectedChanged(event) {
    this.selected = event.detail;
    event.stopPropagation();
  }
  render() {
    return (index.h("div", null, index.h("ig-filter", { template: index$2.Order.template, filter: this.filter }), index.h("ig-orders-actions", { selected: this.selected }), index.h("ig-orders-table", { display: this.display, orders: this.ordersFiltered, selected: this.selected, receipt: this.receipt, embedded: this.embedded }), index.h("ig-orders-footer", { orders: this.ordersFiltered, selected: this.selected })));
  }
  static get watchers() { return {
    "orders": ["updateOrders"],
    "filter": ["updateOrders"]
  }; }
};
IntergiroOrders.style = styleCss;

exports.ig_orders = IntergiroOrders;
