import { a as TailwindElement, x } from '../../index-DUvJL4Yz.js';
import { n, s as safeCustomElement } from '../../safe-custom-element-B49fAUL7.js';
import { c as ce } from '../../index-B9iart53.js';

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;
};
let LuksoModal = class extends TailwindElement {
  constructor() {
    super(...arguments);
    this.isOpen = false;
    this.disableAnimations = false;
    this.size = "small";
    this.hasBottomPadding = false;
    this.styles = ce({
      slots: {
        wrapper: "opacity-0 fixed z-[1011] transition-opacity inset-0 w-screen h-screen overflow-y-auto overscroll-none scrolling-touch touch-pan-y",
        inner: "min-h-screen flex items-center justify-center px-6 pt-6 w-full",
        overlay: "bg-[rgba(196,202,206,0.6)] backdrop-blur-sm fixed inset-0 w-[100vw] h-[100vh] z-[1010]",
        dialog: "bg-neutral-98 rounded-12 shadow-neutral-shadow-round-3xl z-[1012] mx-auto"
      },
      variants: {
        isOpen: {
          true: {
            wrapper: "opacity-100 visible 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"
          }
        },
        hasBottomPadding: {
          true: {
            inner: "pb-[120px]"
          },
          false: {
            inner: "pb-6"
          }
        }
      },
      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, inner } = this.styles({
      isOpen: this.isOpen,
      size: this.size,
      disableAnimations: this.disableAnimations,
      hasBottomPadding: this.hasBottomPadding
    });
    return x`
      <div data-testid="modal" class=${wrapper()}>
        <div class=${inner()}>
          <div class=${overlay()} @click=${this.handleBackdropClick}></div>
          <div class=${dialog()}>
            <slot></slot>
          </div>
        </div>
      </div>
    `;
  }
};
__decorateClass([
  n({ type: Boolean, attribute: "is-open" })
], LuksoModal.prototype, "isOpen", 2);
__decorateClass([
  n({ type: Boolean, attribute: "disable-animations" })
], LuksoModal.prototype, "disableAnimations", 2);
__decorateClass([
  n({ type: String })
], LuksoModal.prototype, "size", 2);
__decorateClass([
  n({ type: Boolean, attribute: "has-bottom-padding" })
], LuksoModal.prototype, "hasBottomPadding", 2);
LuksoModal = __decorateClass([
  safeCustomElement("lukso-modal")
], LuksoModal);

export { LuksoModal };
