'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-1141a245.js');
const utils = require('./utils-95d43da5.js');

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

const DvnFieldDisplayCellText = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  render() {
    const { field } = this;
    let value = this.value;
    if (!value) {
      return (index.h(index.Host, null));
    }
    if (field.inputType === 'url') {
      value = index.h("a", { href: value.startsWith('http') ? value : `http://${value}`, target: "_blank" }, value);
    }
    else if (field.inputType === 'email') {
      value = index.h("a", { href: `mailto:${value}` }, value);
    }
    else if (utils.hasLink(this.value)) {
      return (index.h(index.Host, { innerHTML: utils.linkify(value) }));
    }
    if (field.format === 'markdown') {
      return (index.h(index.Host, null, index.h("dvn-markdown", { content: value })));
    }
    return (index.h(index.Host, null, value));
  }
};
DvnFieldDisplayCellText.style = dvnFieldDisplayCellTextCss;

exports.dvn_field_display_cell_text = DvnFieldDisplayCellText;
