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

const NKIsHolder = /*@__PURE__*/ proxyCustomElement(class NKIsHolder extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.isHolder = false;
    this.tokenId = undefined;
  }
  componentWillLoad() {
    this.disconnect = watchBlockNumber({ listen: true }, async () => {
      const account = getAccount();
      if (this.tokenId) {
        this.isHolder =
          (await state.diamond.base.ownerOf(this.tokenId)) === account.address;
      }
      else {
        this.isHolder =
          (await state.diamond.base.balanceOf(account.address)).toNumber() > 0;
      }
    });
  }
  disconnectedCallback() {
    this.disconnect();
  }
  render() {
    return h(Host, null, this.isHolder ? h("slot", null) : null);
  }
}, [1, "nk-is-holder", {
    "tokenId": [1, "token-id"],
    "isHolder": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["nk-is-holder"];
  components.forEach(tagName => { switch (tagName) {
    case "nk-is-holder":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, NKIsHolder);
      }
      break;
  } });
}

const NkIsHolder = NKIsHolder;
const defineCustomElement = defineCustomElement$1;

export { NkIsHolder, defineCustomElement };

//# sourceMappingURL=nk-is-holder.js.map