import { useState as m, useEffect as M, useContext as s } from "react";
import { b9 as T, bf as D, bv as H, cv as k, bB as F, dl as O, eF as q, bL as R, cU as I, U as B, V as n, eT as W, eQ as j, P as r, bh as y, bi as o, bj as l, a0 as i, bg as u, bk as z, bl as N, dn as A, bV as U, dt as _, du as G, bY as K, cG as Q, bn as Y, bo as c, dp as Z, dq as J, b_ as X, b$ as p, bZ as ee, eL as te, dH as ae, bA as ne } from "./684d2f28.js";
import { FormDataPropertyView as ie } from "./00dac55d.js";
import { textInputChildren as oe, checkMentionListData as le, textInputValidate as re, fixOldInputCompData as de } from "./0c4ef413.js";
import { focusWithOptions as se, blurMethod as ue } from "./d6402597.js";
import "react-dom";
const ce = 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};
    }
  }
`, me = [X, p, ee, te, ae];
let d = function() {
  const a = {
    ...oe,
    viewRef: D,
    allowClear: H,
    autoHeight: k,
    style: F(O),
    mentionList: q(le, {
      "@": ["Li Lei", "Han Meimei"],
      "#": ["123", "456", "789"]
    }),
    onEvent: R(me),
    invalid: I("invalid")
  };
  return new B(a, (e) => {
    const {
      mentionList: b
    } = e, [g, h] = m({}), [v, x] = m(!1), [f, w] = m("@"), C = (t, $) => {
      w($);
    }, V = (t) => {
      e.value.onChange(t), e.onEvent("change");
    }, S = (t) => {
      t.shiftKey && (t.preventDefault(), e.onEvent("submit"));
    }, E = (t) => {
      e.onEvent("mention");
    }, L = (t) => t.hasOwnProperty("validateStatus") && t.validateStatus === "error" ? "error" : "", P = () => ({
      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 M(() => {
      if (v) {
        const t = re(P());
        h(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(ce, {
        $style: e.style,
        children: /* @__PURE__ */ n(W, {
          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(b),
            onFocus: () => {
              x(!0), e.onEvent("focus");
            },
            onBlur: () => e.onEvent("blur"),
            onPressEnter: S,
            onSearch: C,
            onChange: V,
            onSelect: E,
            placeholder: e.placeholder,
            value: e.value.value,
            disabled: e.disabled,
            status: L(g),
            options: (b[f] || []).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,
      ...g
    });
  }).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(ie, {
      ...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(), z(e)]
      }), /* @__PURE__ */ n(o, {
        name: l.layout,
        children: N(e)
      }), /* @__PURE__ */ n(o, {
        name: l.advanced,
        children: A(e)
      }), /* @__PURE__ */ r(o, {
        name: l.validation,
        children: [U(e), e.validationType.propertyView({
          label: i("prop.textType")
        }), _(e), G(e), e.customRule.propertyView({})]
      })]
    }), ["layout", "both"].includes(s(u).editorModeStatus) && /* @__PURE__ */ n(y, {
      children: /* @__PURE__ */ n(o, {
        name: l.style,
        children: e.style.getPropertyView()
      })
    })]
  })).build();
}();
d = class extends d {
  autoHeight() {
    return this.children.autoHeight.getView();
  }
};
d = ne(d, de);
const ye = K(d, Q([se, ue])), we = Y(ye, [new c("value", i("export.inputValueDesc")), Z, J, new c("invalid", i("export.invalidDesc")), new c("hidden", i("export.hiddenDesc")), new c("disabled", i("export.disabledDesc"))]);
export {
  we as MentionComp
};
