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 } from 'lit';
import { customElement } from 'lit/decorators.js';
import { tTag } from '../../../logical/data-type.js';
import { LiteralElement } from './literal-element.js';
let TagLiteral = class TagLiteral extends LiteralElement {
    tags() {
        const tags = this.type.data?.tags;
        if (!tags) {
            return [];
        }
        return tags;
    }
    render() {
        if (!this.value) {
            return html `<span class="dv-color-2">Empty</span>`;
        }
        return (this.tags().find(v => v.id === this.value)?.value ??
            html `<span class="dv-color-2">Empty</span>`);
    }
};
TagLiteral.styles = css `
    data-view-literal-tag-view {
      max-width: 100px;
      display: block;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
  `;
TagLiteral = __decorate([
    customElement('data-view-literal-tag-view')
], TagLiteral);
export { TagLiteral };
let MultiTagLiteral = class MultiTagLiteral extends LiteralElement {
    tags() {
        const type = this.type.ele;
        if (!tTag.is(type)) {
            return [];
        }
        const tags = type.data?.tags;
        if (!tags) {
            return [];
        }
        return tags;
    }
    render() {
        if (!this.value?.length) {
            return html `<span class="dv-color-2">Empty</span>`;
        }
        const tagMap = new Map(this.tags().map(v => [v.id, v.value]));
        return html `${this.value.map(id => tagMap.get(id)).join(',')}`;
    }
};
MultiTagLiteral.styles = css `
    data-view-literal-multi-tag-view {
      max-width: 100px;
      display: block;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
  `;
MultiTagLiteral = __decorate([
    customElement('data-view-literal-multi-tag-view')
], MultiTagLiteral);
export { MultiTagLiteral };
//# sourceMappingURL=tag-literal.js.map