import { defineComponent as s, computed as i, openBlock as a, createElementBlock as n, toDisplayString as l, unref as o, normalizeClass as p, createElementVNode as c } from "vue";
import { isNil as m } from "lodash-unified";
import "../../config-provider/index.mjs";
import f from "../style/index.mjs";
import { languageFormat as y } from "./utils.mjs";
import { useNamespace as g } from "../../config-provider/hooks/use-namespace.mjs";
const B = {
  key: 0,
  style: {
    whiteSpace: "pre-wrap",
    wordWrap: "break-word",
    wordBreak: "break-all"
  }
}, I = /* @__PURE__ */ s({
  name: "ApFieldTextAreaRead",
  __name: "read",
  props: {
    mode: { default: "edit" },
    class: {},
    style: {},
    emptyText: { default: "--" },
    customReadMode: {},
    rows: {},
    autoSize: { type: [Boolean, Object] },
    onResize: {},
    onCompositionstart: {},
    onCompositionend: {},
    valueModifiers: {},
    size: {},
    value: {},
    name: {},
    type: { default: "text" },
    onFocus: {},
    onBlur: {},
    onChange: {},
    onInput: {},
    onKeydown: {},
    onKeyup: {},
    onMousedown: {},
    focused: { type: Boolean },
    hidden: { type: Boolean },
    disabled: { type: Boolean, default: void 0 },
    prefixCls: {},
    id: {},
    readonly: { type: Boolean },
    autofocus: { type: Boolean },
    variant: {},
    autocomplete: {},
    placeholder: {},
    lazy: { type: Boolean, default: !0 },
    maxlength: {},
    loading: { type: Boolean },
    bordered: { type: Boolean, default: !0 },
    showCount: { type: [Boolean, Object] },
    htmlSize: {},
    onPressEnter: {},
    onMouseUp: {},
    onRawInput: {},
    "onUpdate:value": {},
    status: {},
    defaultValue: {},
    inputElement: {},
    triggerFocus: {},
    handleReset: {},
    clearIcon: {},
    allowClear: { type: Boolean, default: !0 },
    beforeInput: {},
    code: { type: [Boolean, Object], default: !1 }
  },
  setup(e) {
    const { m: r } = g("field-textarea"), u = f("field"), t = e, d = i(() => {
      if (t.code)
        return t.code === !0 ? {
          language: "text"
        } : {
          language: t.code?.language ?? "text"
        };
    });
    return (h, v) => e.code ? (a(), n("pre", {
      key: 1,
      class: p([o(r)("code"), o(u)])
    }, [
      c("code", null, l(o(y)(e.value, d.value.language)), 1)
    ], 2)) : (a(), n("span", B, l(o(m)(e.value) || e.value === "" ? e.emptyText : e.value), 1));
  }
});
export {
  I as default
};
