'use strict';

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

const shared_tailwindElement_index = require('../../index-179a633e.cjs');
const queryAssignedElements = require('../../query-assigned-elements-d5e45650.cjs');
const index = require('../../index-1d3f4a5a.cjs');
require('../../bundle-mjs-d58a83c6.cjs');

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result)
    __defProp(target, key, result);
  return result;
};
exports.LuksoModal = class LuksoModal extends shared_tailwindElement_index.TailwindElement {
  constructor() {
    super(...arguments);
    this.isOpen = false;
    this.disableAnimations = false;
    this.size = "small";
    this.styles = index.ce({
      slots: {
        wrapper: "opacity-0 fixed z-[1000] transition-opacity top-0 left-0 p-6",
        overlay: "bg-[rgba(196,202,206,0.6)] backdrop-blur-sm fixed top-0 left-0 w-[100vw] h-[100vh] z-[999]",
        dialog: "bg-neutral-98 rounded-12 shadow-neutral-shadow-round-3xl z-[1001]"
      },
      variants: {
        isOpen: {
          true: {
            wrapper: "flex opacity-100 visible items-center justify-center w-[100vw] h-[100vh]"
          },
          false: {
            wrapper: "hidden"
          }
        },
        size: {
          small: {
            dialog: "w-[352px]"
          },
          medium: {
            dialog: "w-[849px]"
          },
          full: {
            dialog: "w-full"
          },
          auto: {}
        },
        disableAnimations: {
          false: {
            wrapper: "animation-duration-300 delay-300 ",
            overlay: "animation-duration-300"
          }
        }
      },
      compoundVariants: [
        {
          disableAnimations: false,
          isOpen: true,
          class: {
            wrapper: "animate-fade-in",
            overlay: "animate-fade-in"
          }
        }
      ]
    });
  }
  close() {
    this.isOpen = false;
  }
  async handleBackdropClick() {
    await this.updateComplete;
    const clickEvent = new CustomEvent("on-backdrop-click", {
      bubbles: true,
      composed: true
    });
    this.dispatchEvent(clickEvent);
  }
  render() {
    const { wrapper, overlay, dialog } = this.styles({
      isOpen: this.isOpen,
      size: this.size,
      disableAnimations: this.disableAnimations
    });
    return shared_tailwindElement_index.x`
      <div data-testid="modal" class=${wrapper()}>
        <div class=${overlay()} @click=${this.handleBackdropClick}></div>
        <div class=${dialog()}>
          <slot></slot>
        </div>
      </div>
    `;
  }
};
__decorateClass([
  queryAssignedElements.n({ type: Boolean, attribute: "is-open" })
], exports.LuksoModal.prototype, "isOpen", 2);
__decorateClass([
  queryAssignedElements.n({ type: Boolean, attribute: "disable-animations" })
], exports.LuksoModal.prototype, "disableAnimations", 2);
__decorateClass([
  queryAssignedElements.n({ type: String })
], exports.LuksoModal.prototype, "size", 2);
exports.LuksoModal = __decorateClass([
  queryAssignedElements.e("lukso-modal")
], exports.LuksoModal);
