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 { UMB_WEBHOOK_ROOT_WORKSPACE_PATH } from '../../constants.js';
import { UMB_WEBHOOK_WORKSPACE_CONTEXT } from './webhook-workspace.context-token.js';
import { html, customElement, state, css } from '../../../../external/lit/index.js';
import { umbFocus, UmbLitElement } from '../../../core/lit-element/index.js';
import { UmbTextStyles } from '../../../core/style/index.js';
let UmbWebhookWorkspaceEditorElement = class UmbWebhookWorkspaceEditorElement extends UmbLitElement {
    #workspaceContext;
    constructor() {
        super();
        this._url = '';
        this._name = '';
        this._description = '';
        this.consumeContext(UMB_WEBHOOK_WORKSPACE_CONTEXT, (context) => {
            this.#workspaceContext = context;
            this.observe(this.#workspaceContext?.url, (url) => (this._url = url ?? ''));
            this.observe(this.#workspaceContext?.name, (name) => (this._name = name ?? ''));
            this.observe(this.#workspaceContext?.description, (description) => (this._description = description ?? ''));
        });
    }
    #onNameChange(event) {
        const value = event.target.value.toString();
        this.#workspaceContext?.setName(value);
    }
    #onDescriptionChange(event) {
        const value = event.target.value.toString();
        this.#workspaceContext?.setDescription(value);
    }
    render() {
        return html `
			<umb-entity-detail-workspace-editor back-path=${UMB_WEBHOOK_ROOT_WORKSPACE_PATH}>
				<div id="header" slot="header">
					<div id="editors">
						<uui-input
							id="name"
							label=${this.localize.term('placeholders_entername')}
							placeholder=${this.localize.term('placeholders_entername')}
							.value=${this._name}
							@change=${this.#onNameChange}
							${umbFocus()}>
						</uui-input>

						<uui-input
							id="description"
							.label=${this.localize.term('placeholders_enterDescription')}
							.value=${this._description}
							.placeholder=${this.localize.term('placeholders_enterDescription')}
							@input=${this.#onDescriptionChange}></uui-input>
					</div>
				</div>
			</umb-entity-detail-workspace-editor>
		`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			#header {
				width: 100%;
			}

			#name {
				width: 100%;
				z-index: 1;
			}

			#description {
				width: 100%;
				margin-top: -1px;
				--uui-input-height: var(--uui-size-8);
				--uui-input-border-color: transparent;
			}

			#description:hover {
				--uui-input-border-color: var(--uui-color-border);
			}
		`,
    ]; }
};
__decorate([
    state()
], UmbWebhookWorkspaceEditorElement.prototype, "_url", void 0);
__decorate([
    state()
], UmbWebhookWorkspaceEditorElement.prototype, "_name", void 0);
__decorate([
    state()
], UmbWebhookWorkspaceEditorElement.prototype, "_description", void 0);
UmbWebhookWorkspaceEditorElement = __decorate([
    customElement('umb-webhook-workspace-editor')
], UmbWebhookWorkspaceEditorElement);
export { UmbWebhookWorkspaceEditorElement };
export default UmbWebhookWorkspaceEditorElement;
