import { r as registerInstance, h, g as getElement } from './index-07845439.js';
import { a as Customer } from './index-e20749b7.js';
import { d as dist } from './index-63517df5.js';
import './index-b6cf748e.js';
import './_commonjsHelpers-8fe71198.js';
import './index-265fba1f.js';

const sv = {
  "total count: ": "totalt antal: ",
  "active: ": "aktiva: ",
  "created: ": "skapade: ",
  "inactive: ": "inaktiva: ",
  "pending: ": "väntande: ",
  "suspended: ": "avstängda: ",
};

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

const styleCss = "footer.sc-ig-customers-footer{display:block;margin:auto;border:1px solid rgb(var(--smoothly-medium-color));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 0em}.sc-ig-customers-footer-h>footer.sc-ig-customers-footer>td.sc-ig-customers-footer>span.sc-ig-customers-footer{display:inline-block;margin-left:0.4em;margin-right:0.6em}.sc-ig-customers-footer-h>footer.sc-ig-customers-footer>td.sc-ig-customers-footer{display:inline-block;padding-top:0.2em;margin-left:2em}";

const IntergiroCustomerFooter = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  render() {
    var _a;
    const [active, created, pending, suspended] = this.customers
      ? this.customers.reduce(([a, c, p, s], customer) => {
        var _a, _b;
        const status = (_a = customer.status) !== null && _a !== void 0 ? _a : Customer.Status.getStatus(customer, this.orders ? (_b = this.orders[customer.id]) === null || _b === void 0 ? void 0 : _b.slice(0, 1).shift() : undefined);
        return status == "active"
          ? [++a, c, p, s]
          : status == "created"
            ? [a, ++c, p, s]
            : status == "pending"
              ? [a, c, ++p, s]
              : [a, c, p, ++s];
      }, [0, 0, 0, 0])
      : [0, 0, 0, 0];
    return (h("footer", null, h("td", null, h("span", null, this.t("total count: ")), h("span", null, this.customers ? (_a = this.customers) === null || _a === void 0 ? void 0 : _a.length : 0)), h("td", null, h("span", null, this.t("active: ")), h("span", null, active)), h("td", null, h("span", null, this.t("created: ")), h("span", null, created)), h("td", null, h("span", null, this.t("pending: ")), h("span", null, pending)), h("td", null, h("span", null, this.t("suspended: ")), h("span", null, suspended))));
  }
  get element() { return getElement(this); }
};
IntergiroCustomerFooter.style = styleCss;

export { IntergiroCustomerFooter as ig_customers_footer };
