import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { ApplicationContext } from '@sankhyalabs/core';

const SnkActionsForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.APLICAR = 'OK';
    this.CANCELAR = 'CANCEL';
    this.FECHAR = 'CLOSE';
    this.titleMessage = undefined;
    this.message = undefined;
    this.accept = undefined;
    this.cancel = undefined;
  }
  /**
   * Responsável por abrir a popup.
   */
  async openPopup() {
    this._ezPopup.opened = true;
  }
  ;
  exitPopup() {
    this._ezPopup.opened = false;
  }
  handleModalAction(evt) {
    switch (evt) {
      case this.APLICAR:
        this.exitPopup();
        this.accept();
        break;
      case this.CANCELAR:
        this.exitPopup();
        this.cancel();
        break;
      case this.FECHAR:
        this.exitPopup();
        break;
    }
  }
  componentWillLoad() {
    this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
  }
  render() {
    return (h("ez-popup", { size: "small", heightMode: "auto", useHeader: false, ref: (ref) => this._ezPopup = ref }, h("ez-modal-container", { modalTitle: this.titleMessage, okButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.yes", undefined), cancelButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.no", undefined), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, h("div", { class: "ez-margin-bottom--large ez-flex ez-flex--column" }, h("label", { class: "ez-text ez-text--large ez-text--primary", innerHTML: this.message }), h("label", { class: "ez-text ez-text--large ez-text--primary" }, h("br", null), this._application.messagesBuilder.getMessage("snkActionsButton.clientEvent.cancelMessage", undefined))))));
  }
}, [2, "snk-client-confirm", {
    "titleMessage": [1, "title-message"],
    "message": [1],
    "accept": [16],
    "cancel": [16],
    "openPopup": [64]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["snk-client-confirm"];
  components.forEach(tagName => { switch (tagName) {
    case "snk-client-confirm":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, SnkActionsForm);
      }
      break;
  } });
}

const SnkClientConfirm = SnkActionsForm;
const defineCustomElement = defineCustomElement$1;

export { SnkClientConfirm, defineCustomElement };
