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 { css } from 'lit';
import { customElement, property, query } from 'lit/decorators.js';
import { repeat } from 'lit/directives/repeat.js';
import { styleMap } from 'lit/directives/style-map.js';
import { html } from 'lit/static-html.js';
let MultiTagView = class MultiTagView extends WithDisposable(ShadowlessElement) {
    constructor() {
        super(...arguments);
        this.value = [];
        this.options = [];
    }
    render() {
        const values = this.value;
        const map = new Map(this.options?.map(v => [v.id, v]));
        return html `
      <div class="affine-select-cell-container">
        ${repeat(values, id => {
            const option = map.get(id);
            if (!option) {
                return;
            }
            const style = styleMap({
                backgroundColor: option.color,
            });
            return html `<span class="select-selected" style=${style}
            >${option.value}</span
          >`;
        })}
      </div>
    `;
    }
};
MultiTagView.styles = css `
    affine-multi-tag-view {
      display: flex;
      align-items: center;
      width: 100%;
      height: 100%;
      min-height: 22px;
    }

    .affine-select-cell-container * {
      box-sizing: border-box;
    }

    .affine-select-cell-container {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px;
      width: 100%;
      font-size: var(--affine-font-sm);
    }

    .affine-select-cell-container .select-selected {
      height: 22px;
      font-size: 14px;
      line-height: 22px;
      padding: 0 8px;
      border-radius: 4px;
      white-space: nowrap;
      background: var(--affine-tag-white);
      overflow: hidden;
      text-overflow: ellipsis;
    }
  `;
__decorate([
    query('.affine-select-cell-container')
], MultiTagView.prototype, "selectContainer", void 0);
__decorate([
    property({ attribute: false })
], MultiTagView.prototype, "value", void 0);
__decorate([
    property({ attribute: false })
], MultiTagView.prototype, "options", void 0);
MultiTagView = __decorate([
    customElement('affine-multi-tag-view')
], MultiTagView);
export { MultiTagView };
//# sourceMappingURL=multi-tag-view.js.map