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_COLLECTION_CONTEXT } from '../default/index.js';
import { css, customElement, html } from '../../../../external/lit/index.js';
import { debounce } from '../../utils/index.js';
import { UmbLitElement } from '../../lit-element/index.js';
let UmbCollectionFilterFieldElement = class UmbCollectionFilterFieldElement extends UmbLitElement {
    #collectionContext;
    constructor() {
        super();
        this.consumeContext(UMB_COLLECTION_CONTEXT, (context) => {
            this.#collectionContext = context;
        });
    }
    #debouncedFilter = debounce((filter) => this.#collectionContext?.setFilter({ filter }), 500);
    #onInput(event) {
        const filter = event.target.value ?? '';
        this.#debouncedFilter(filter);
    }
    render() {
        return html `
			<uui-input
				label=${this.localize.term('general_filter')}
				placeholder=${this.localize.term('placeholders_filter')}
				data-mark="input:filter"
				@input=${this.#onInput}></uui-input>
		`;
    }
    static { this.styles = [
        css `
			:host {
				display: flex;
			}

			uui-input {
				width: 100%;
			}
		`,
    ]; }
};
UmbCollectionFilterFieldElement = __decorate([
    customElement('umb-collection-filter-field')
], UmbCollectionFilterFieldElement);
export { UmbCollectionFilterFieldElement };
