import { r as registerInstance, h, H as Host } from './index-55faf181.js';
import { N as NestedField } from './nested-395a4cd4.js';
import './BaseField-461b6d0c.js';

const dvnFieldDisplayCss = ".sc-dvn-field-display-h{font-size:0.9em;margin:0px 0px calc(4 * var(--spacing-unit)) 0px;display:block}.sc-dvn-field-display-h:last-child{margin-bottom:0}.title.sc-dvn-field-display{font-size:0.8em;margin-bottom:calc(2 * var(--spacing-unit));color:var(--color-text-secondary)}";

const fieldTagMap = {
  number: 'dvn-field-display-number',
  'multiple-choice': 'dvn-field-display-multiple-choice',
  'single-choice': 'dvn-field-display-single-choice',
  text: 'dvn-field-display-text',
  date: 'dvn-field-display-date',
  attachment: 'dvn-field-display-attachment',
  rawData: 'dvn-field-display-raw-data',
  range: 'dvn-field-display-range',
  reference: 'dvn-field-display-reference',
};
const DvnFieldDisplay = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.showTitle = true;
  }
  render() {
    const { field, infoTitle, meta, showTitle, value } = this;
    let fieldToPass = field;
    let Tag = fieldTagMap[field.type];
    if (field.type === NestedField.type) {
      Tag = fieldTagMap[field.nestedField.type];
      fieldToPass = field.nestedField;
    }
    return (h(Host, null, showTitle && h("div", { class: "title" }, (infoTitle || '').toUpperCase()), Tag
      ? h(Tag, { field: fieldToPass, value: value, meta: meta, fixHeight: false })
      : h("span", null, value)));
  }
};
DvnFieldDisplay.style = dvnFieldDisplayCss;

export { DvnFieldDisplay as dvn_field_display };
