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 { css, html, customElement, property, state, repeat } from '../../../../../../external/lit/index.js';
import { UmbTextStyles } from '../../../../../core/style/index.js';
import { UmbContentTypeContainerStructureHelper, UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT, } from '../../../../content-type/index.js';
import { UmbLitElement } from '../../../../../core/lit-element/index.js';
import './content-editor-properties.element.js';
let UmbContentWorkspaceViewEditTabElement = class UmbContentWorkspaceViewEditTabElement extends UmbLitElement {
    get containerId() {
        return this._containerId;
    }
    set containerId(value) {
        this._containerId = value;
        this.#groupStructureHelper.setContainerId(value);
    }
    #groupStructureHelper;
    constructor() {
        super();
        this.#groupStructureHelper = new UmbContentTypeContainerStructureHelper(this);
        this._groups = [];
        this._hasProperties = false;
        this.consumeContext(UMB_PROPERTY_STRUCTURE_WORKSPACE_CONTEXT, (workspaceContext) => {
            this.#groupStructureHelper.setStructureManager(
            // Assuming its the same content model type that we are working with here... [NL]
            workspaceContext?.structure);
        });
        this.observe(this.#groupStructureHelper.childContainers, (groups) => {
            this._groups = groups;
        });
        this.observe(this.#groupStructureHelper.hasProperties, (hasProperties) => {
            this._hasProperties = hasProperties;
        });
    }
    render() {
        return html `
			${this._hasProperties
            ? html `
						<uui-box>
							<umb-content-workspace-view-edit-properties
								data-mark="property-group:root"
								.containerId=${this._containerId}></umb-content-workspace-view-edit-properties>
						</uui-box>
					`
            : ''}
			${repeat(this._groups, (group) => group.key, (group) => html `<uui-box .headline=${this.localize.string(group.name) ?? ''}>
						<umb-content-workspace-view-edit-properties
							data-mark="property-group:${group.name}"
							.containerId=${group.ids[0]}></umb-content-workspace-view-edit-properties>
					</uui-box>`)}
		`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			uui-box {
				--uui-box-default-padding: 0 var(--uui-size-space-5);
			}
			uui-box:not(:first-child) {
				margin-top: var(--uui-size-layout-1);
			}
		`,
    ]; }
};
__decorate([
    property({ type: String })
], UmbContentWorkspaceViewEditTabElement.prototype, "containerId", null);
__decorate([
    state()
], UmbContentWorkspaceViewEditTabElement.prototype, "_containerId", void 0);
__decorate([
    state()
], UmbContentWorkspaceViewEditTabElement.prototype, "_groups", void 0);
__decorate([
    state()
], UmbContentWorkspaceViewEditTabElement.prototype, "_hasProperties", void 0);
UmbContentWorkspaceViewEditTabElement = __decorate([
    customElement('umb-content-workspace-view-edit-tab')
], UmbContentWorkspaceViewEditTabElement);
export { UmbContentWorkspaceViewEditTabElement };
export default UmbContentWorkspaceViewEditTabElement;
