import { useState as m, useEffect as $, useContext as s } from "react";
import { X as T, N as R, O, aA as k, Z as v, dA as F, az as H, eE as I, a2 as W, d5 as q, U as z, F as n, eR as B, eM as J, a6 as r, G as y, a7 as o, a8 as l, Y as i, af as u, bJ as N, a9 as A, dC as j, ca as U, dH as G, dI as K, cd as X, cP as Y, d8 as Z, cR as _, aa as Q, ac as c, dD as p, dE as ee, bS as te, co as ae, cp as ne, cn as ie, eP as oe, eN as le } from "./603b75d9.js";
import { FormDataPropertyView as re } from "./f9847c56.js";
import { textInputChildren as de, checkMentionListData as se, textInputValidate as ue, fixOldInputCompData as ce } from "./41aba172.js";
import "react-dom";
const me = T.div`
  box-sizing:border-box;
  .rc-textarea {
    background-color:${(a) => a.$style.background};
    padding:${(a) => a.$style.padding};
    text-transform:${(a) => a.$style.textTransform};
    text-decoration:${(a) => a.$style.textDecoration};
    margin: 0px 3px 0px 3px !important;
  }

  .ant-input-clear-icon {
    opacity: 0.45;
    color: ${(a) => a.$style.text};
    top: 10px;

    &:hover {
      opacity: 0.65;
      color: ${(a) => a.$style.text};
    }
  }
`, ye = [ae, ne, ie, oe, le];
let d = function() {
  const a = {
    ...de,
    viewRef: R,
    allowClear: O,
    autoHeight: k,
    style: v(F, "style"),
    animationStyle: v(H, "animationStyle"),
    mentionList: I(se, {
      "@": ["John Doe", "Jane Doe", "Michael Smith", "Emily Davis", "Robert Johnson", "Patricia Brown", "William Jones", "Jennifer Miller", "David Wilson", "Linda Moore"],
      "#": ["#lowcode", "#automation", "#appbuilder", "#nocode", "#workflow", "#draganddrop", "#rapiddevelopment", "#digitaltransformation", "#integration", "#api"]
    }),
    onEvent: W(ye),
    invalid: q("invalid")
  };
  return new z(a, (e) => {
    const {
      mentionList: g
    } = e, [h, x] = m({}), [f, b] = m(!1), [w, S] = m("@"), C = (t, L) => {
      S(L);
    }, V = (t) => {
      e.value.onChange(t), e.onEvent("change");
    }, E = (t) => {
      t.shiftKey && (t.preventDefault(), e.onEvent("submit"));
    }, P = (t) => {
      e.onEvent("mention");
    }, M = (t) => t.hasOwnProperty("validateStatus") && t.validateStatus === "error" ? "error" : "", D = () => ({
      value: {
        value: e.value.value
      },
      required: e.required,
      minLength: (e == null ? void 0 : e.minLength) ?? 0,
      maxLength: (e == null ? void 0 : e.maxLength) ?? 0,
      validationType: e.validationType,
      regex: e.regex,
      customRule: e.customRule
    });
    return $(() => {
      if (f) {
        const t = ue(D());
        x(t), e.invalid.onChange(t.validateStatus !== "");
      }
    }, [e.value.value, e.required, e == null ? void 0 : e.minLength, e == null ? void 0 : e.maxLength, e.validationType, e.regex, e.customRule]), e.label({
      required: e.required,
      children: /* @__PURE__ */ n(me, {
        $style: e.style,
        children: /* @__PURE__ */ n(B, {
          theme: {
            token: {
              colorBgContainer: e.style.background,
              colorBorder: e.style.border,
              borderRadius: parseInt(e.style.radius),
              colorText: e.style.text,
              colorPrimary: e.style.accent
            }
          },
          children: /* @__PURE__ */ n(J, {
            prefix: Object.keys(g),
            onFocus: () => {
              b(!0), e.onEvent("focus");
            },
            onBlur: () => e.onEvent("blur"),
            onPressEnter: E,
            onSearch: C,
            onChange: V,
            onSelect: P,
            placeholder: e.placeholder,
            value: e.value.value,
            disabled: e.disabled,
            status: M(h),
            options: (g[w] || []).map((t) => ({
              key: t,
              value: t,
              label: t
            })),
            autoSize: e.autoHeight,
            style: {
              height: "100%",
              maxHeight: "100%",
              resize: "none",
              // padding: props.style.padding,
              fontStyle: e.style.fontStyle,
              fontFamily: e.style.fontFamily,
              borderWidth: e.style.borderWidth,
              fontWeight: e.style.textWeight,
              fontSize: e.style.textSize
            },
            readOnly: e.readOnly
          })
        })
      }),
      style: e.style,
      animationStyle: e.animationStyle,
      ...h
    });
  }).setPropertyViewFn((e) => /* @__PURE__ */ r(y, {
    children: [/* @__PURE__ */ r(o, {
      name: l.basic,
      children: [e.value.propertyView({
        label: i("prop.defaultValue")
      }), e.placeholder.propertyView({
        label: i("prop.placeholder")
      }), ["logic", "both"].includes(s(u).editorModeStatus) && e.mentionList.propertyView({
        label: i("mention.mentionList")
      })]
    }), /* @__PURE__ */ n(re, {
      ...e
    }), ["layout", "both"].includes(s(u).editorModeStatus) && e.label.getPropertyView(), ["logic", "both"].includes(s(u).editorModeStatus) && /* @__PURE__ */ r(y, {
      children: [/* @__PURE__ */ r(o, {
        name: l.interaction,
        children: [e.onEvent.getPropertyView(), N(e)]
      }), /* @__PURE__ */ n(o, {
        name: l.layout,
        children: A(e)
      }), /* @__PURE__ */ n(o, {
        name: l.advanced,
        children: j(e)
      }), /* @__PURE__ */ r(o, {
        name: l.validation,
        children: [U(e), e.validationType.propertyView({
          label: i("prop.textType")
        }), G(e), K(e), e.customRule.propertyView({})]
      })]
    }), ["layout", "both"].includes(s(u).editorModeStatus) && /* @__PURE__ */ r(y, {
      children: [/* @__PURE__ */ n(o, {
        name: l.style,
        children: e.style.getPropertyView()
      }), /* @__PURE__ */ n(o, {
        name: l.animationStyle,
        hasTooltip: !0,
        children: e.animationStyle.getPropertyView()
      })]
    })]
  })).build();
}();
d = class extends d {
  autoHeight() {
    return this.children.autoHeight.getView();
  }
};
d = te(d, ce);
const ge = X(d, Y([Z, _])), we = Q(ge, [new c("value", i("export.inputValueDesc")), p, ee, new c("invalid", i("export.invalidDesc")), new c("hidden", i("export.hiddenDesc")), new c("disabled", i("export.disabledDesc"))]);
export {
  we as MentionComp
};
