import { LitElement, css, html } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import { renderIpxBody } from "../atomic-ipx-body/ipx-body.js";
import { ipxBodyStyles } from "../atomic-ipx-body/ipx-body-styles.js";
import { bindingGuard } from "../../../decorators/binding-guard.js";
import { bindings } from "../../../decorators/bindings.js";
import { errorGuard } from "../../../decorators/error-guard.js";
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
import { updateBreakpoints } from "../../../utils/replace-breakpoint-utils.js";
import { once, randomID } from "../../../utils/utils.js";
function _ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function _ts_metadata(k, v) {
    if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
}
class AtomicIpxEmbedded extends LitElement {
    initialize() {}
    connectedCallback() {
        super.connectedCallback();
        this.checkFooterSlot();
        this.ensureHostId();
    }
    checkFooterSlot() {
        this.hasFooterSlotElements = !!this.querySelector('[slot="footer"]');
    }
    ensureHostId() {
        if (!this.id) this.id = randomID('atomic-ipx-embedded-');
    }
    render() {
        this.updateBreakpoints();
        return html`
      <div part="backdrop">
        ${renderIpxBody({
            props: {
                i18n: this.bindings.i18n,
                visibility: 'embedded',
                displayFooterSlot: this.hasFooterSlotElements,
                header: html`<slot name="header"></slot>`,
                body: html`<slot name="body"></slot>`,
                footer: html`<slot name="footer"></slot>`
            }
        })}
      </div>
    `;
    }
    constructor(...args){
        super(...args), this.hasFooterSlotElements = true, this.updateBreakpoints = once(()=>updateBreakpoints(this));
    }
}
AtomicIpxEmbedded.styles = [
    ipxBodyStyles,
    css`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */:host{box-shadow:0 0 .5rem #00000080;height:inherit}[part=backdrop]{height:inherit;inset:auto 3rem 4.25rem auto;pointer-events:auto}`
];
_ts_decorate([
    state(),
    _ts_metadata("design:type", "u" < typeof AnyBindings ? Object : AnyBindings)
], AtomicIpxEmbedded.prototype, "bindings", void 0);
_ts_decorate([
    state(),
    _ts_metadata("design:type", "u" < typeof Error ? Object : Error)
], AtomicIpxEmbedded.prototype, "error", void 0);
_ts_decorate([
    property({
        type: Object
    }),
    _ts_metadata("design:type", "u" < typeof HTMLElement ? Object : HTMLElement)
], AtomicIpxEmbedded.prototype, "container", void 0);
_ts_decorate([
    state()
], AtomicIpxEmbedded.prototype, "hasFooterSlotElements", void 0);
_ts_decorate([
    bindingGuard(),
    errorGuard(),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", []),
    _ts_metadata("design:returntype", void 0)
], AtomicIpxEmbedded.prototype, "render", null);
AtomicIpxEmbedded = _ts_decorate([
    customElement('atomic-ipx-embedded'),
    bindings(),
    withTailwindStyles
], AtomicIpxEmbedded);
export { AtomicIpxEmbedded };
