import { Host, h } from "@stencil/core";
import { watchBlockNumber } from "@wagmi/core";
import state from "../../stores/wallet";
export class NKEditionSupplyText {
  constructor() {
    this.quantity = undefined;
    this.maxQuantity = undefined;
    this.editionId = undefined;
  }
  componentWillLoad() {
    this.disconnect = watchBlockNumber({ listen: true }, async () => {
      const edition = await state.diamond.apps.edition.getEdition(this.editionId);
      this.quantity = edition.quantity.toNumber();
      this.maxQuantity = edition.maxQuantity.toNumber();
    });
  }
  disconnectedCallback() {
    this.disconnect();
  }
  render() {
    return (h(Host, null, this.maxQuantity === 0
      ? this.quantity
      : `${this.quantity} / ${this.maxQuantity}`, h("slot", null)));
  }
  static get is() { return "nk-edition-supply-text"; }
  static get encapsulation() { return "shadow"; }
  static get properties() {
    return {
      "editionId": {
        "type": "number",
        "mutable": false,
        "complexType": {
          "original": "number",
          "resolved": "number",
          "references": {}
        },
        "required": true,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Edition ID"
        },
        "attribute": "edition-id",
        "reflect": false
      }
    };
  }
  static get states() {
    return {
      "quantity": {},
      "maxQuantity": {}
    };
  }
}
//# sourceMappingURL=nk-edition-supply-text.js.map
