'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-3e5ae956.js');

const ModalComponentSelect = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  async selectPartial(partial, event) {
    if (event)
      event.preventDefault();
    document.dispatchEvent(new CustomEvent("fireenjinEditorClick", {
      detail: {
        event: event,
        template: {
          id: partial.id,
          name: partial.name ? partial.name : partial.subject,
          html: partial.html,
        },
        blockId: this.blockId,
      },
    }));
  }
  render() {
    return (index.h(index.Host, null, index.h("ion-header", null, index.h("ion-toolbar", null, index.h("ion-title", null, "Select a Template"), index.h("ion-buttons", { slot: "primary" }, index.h("ion-button", { onClick: (event) => document.dispatchEvent(new CustomEvent("fireenjinModalClose", {
        detail: { event },
      })) }, index.h("ion-icon", { slot: "icon-only", name: "close" }))))), index.h("ion-content", { class: "ion-padding" }, index.h("ion-grid", null, index.h("ion-row", null, (this.partials || []).map((partial) => (index.h("ion-col", { size: "12", sizeMd: "6" }, index.h("ion-item", { onClick: (event) => this.selectPartial(partial, event), detail: true, href: "#" }, index.h("ion-label", null, index.h("h2", null, (partial === null || partial === void 0 ? void 0 : partial.name) || (partial === null || partial === void 0 ? void 0 : partial.subject) || "No Name"), index.h("fireenjin-render-template", { template: {
        html: (partial === null || partial === void 0 ? void 0 : partial.html) || "",
        id: "partial",
      }, zoom: 0.5, partials: this.partials, style: {
        height: "250px",
        width: "250px",
      } })))))))))));
  }
};

exports.fireenjin_modal_component_select = ModalComponentSelect;
