var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
  if (kind === "m")
    throw new TypeError("Private method is not writable");
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a setter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _KlevuModal_dialogRef;
import { Host, h } from "@stencil/core";
/**
 * Stylized modal dialog.
 */
export class KlevuModal {
  constructor() {
    _KlevuModal_dialogRef.set(this, void 0);
    this.startOpen = false;
  }
  componentDidLoad() {
    if (this.startOpen) {
      this.openModal();
    }
  }
  async openModal() {
    var _a;
    (_a = __classPrivateFieldGet(this, _KlevuModal_dialogRef, "f")) === null || _a === void 0 ? void 0 : _a.showModal();
  }
  async closeModal() {
    var _a;
    (_a = __classPrivateFieldGet(this, _KlevuModal_dialogRef, "f")) === null || _a === void 0 ? void 0 : _a.close();
  }
  render() {
    return (h(Host, null, h("dialog", { ref: (el) => (__classPrivateFieldSet(this, _KlevuModal_dialogRef, el, "f")) }, h("header", null, h("form", { method: "dialog" }, h("button", null, h("span", { part: "material-icon" }, "close")))), h("main", null, h("slot", null)))));
  }
  static get is() { return "klevu-modal"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["klevu-modal.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["klevu-modal.css"]
    };
  }
  static get properties() {
    return {
      "startOpen": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "start-open",
        "reflect": false,
        "defaultValue": "false"
      }
    };
  }
  static get methods() {
    return {
      "openModal": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "",
          "tags": []
        }
      },
      "closeModal": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "",
          "tags": []
        }
      }
    };
  }
}
_KlevuModal_dialogRef = new WeakMap();
//# sourceMappingURL=klevu-modal.js.map
