var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") 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;
};
import { ShadowlessElement, WithDisposable } from '@blockeditor/lit';
import { customElement, property } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
import { html } from 'lit/static-html.js';
import { Bound } from '../../surface-block/utils/bound.js';
let SurfaceRefImagePortal = class SurfaceRefImagePortal extends WithDisposable(ShadowlessElement) {
    firstUpdated() {
        this.disposables.add(this.model.propsUpdated.on(() => this.requestUpdate()));
    }
    render() {
        const { model, index } = this;
        const bound = Bound.deserialize(model.xywh);
        const style = {
            position: 'absolute',
            zIndex: `${index}`,
            width: `${bound.w}px`,
            height: `${bound.h}px`,
            transform: `translate(${bound.x}px, ${bound.y}px)`,
        };
        return html `
      <div
        style=${styleMap(style)}
        data-portal-reference-block-id="${model.id}"
      >
        ${this.renderModel(model)}
      </div>
    `;
    }
};
__decorate([
    property({ attribute: false })
], SurfaceRefImagePortal.prototype, "index", void 0);
__decorate([
    property({ attribute: false })
], SurfaceRefImagePortal.prototype, "model", void 0);
__decorate([
    property({ attribute: false })
], SurfaceRefImagePortal.prototype, "renderModel", void 0);
SurfaceRefImagePortal = __decorate([
    customElement('surface-ref-image-portal')
], SurfaceRefImagePortal);
export { SurfaceRefImagePortal };
//# sourceMappingURL=image.js.map