import { r as registerInstance, h, H as Host } from './index-b6f10a81.js';
import './BaseField-d94c5b14.js';
import { A as AttachmentSourceType } from './attachment-8831acff.js';

const dvnFieldDisplayAttachmentCss = ".sc-dvn-field-display-attachment-h{display:block;padding:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}";

const DvnFieldDisplayAttachment = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  render() {
    const { field } = this;
    if (field.sourceType === AttachmentSourceType.RawUrl) {
      const src = this.value;
      return (h(Host, null, h("dvn-image", { leaned: true, bordered: true, src: src })));
    }
    let attachments = [];
    if (field.sourceType === AttachmentSourceType.AttachmentObject) {
      attachments = [this.value];
    }
    else if (field.sourceType === AttachmentSourceType.AttachmentObjects) {
      attachments = this.value;
    }
    return (h(Host, null, attachments.map(attachment => (h("dvn-image", { leaned: true, bordered: true, src: attachment.url, scale: "small" })))));
  }
};
DvnFieldDisplayAttachment.style = dvnFieldDisplayAttachmentCss;

export { DvnFieldDisplayAttachment as dvn_field_display_attachment };
