import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { t as watchBlockNumber } from './chunk-LAFZBYO7.js';
import { s as state } from './wallet.js';

const NKEditionSupplyText = /*@__PURE__*/ proxyCustomElement(class NKEditionSupplyText extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    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)));
  }
}, [1, "nk-edition-supply-text", {
    "editionId": [2, "edition-id"],
    "quantity": [32],
    "maxQuantity": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["nk-edition-supply-text"];
  components.forEach(tagName => { switch (tagName) {
    case "nk-edition-supply-text":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, NKEditionSupplyText);
      }
      break;
  } });
}

const NkEditionSupplyText = NKEditionSupplyText;
const defineCustomElement = defineCustomElement$1;

export { NkEditionSupplyText, defineCustomElement };

//# sourceMappingURL=nk-edition-supply-text.js.map