import { K as p, D as T, M as V, O as C, aB as j, H as P, j as o, Z as R, X as A, Y as B } from "./index-b203ecbb.js";
import { useMemo as m, useCallback as f } from "react";
import { g as D, r as v } from "./util-63c4ca8a.js";
import { P as F } from "./index-56e81c67.js";
import { f as H } from "./style-c902ea32.js";
import "react-dom";
const M = (n = !1) => n ? p`
        width: 100%;
      ` : H, $ = (n = !1, r) => {
  const c = p`
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  `, l = p`
    flex-direction: column;
    gap: 8px;
  `;
  return p`
    display: flex;
    padding: ${r ? "0" : "8px 0"};
    ${n ? l : c};
    width: 100%;
  `;
}, k = (n) => {
  const {
    isSetterSingleRow: r,
    placeholder: c,
    attrName: l,
    handleUpdateDsl: g,
    expectedType: N,
    value: t,
    widgetDisplayName: y,
    labelName: d,
    detailedDescription: w,
    defaultValue: a,
    labelDesc: h,
    // widgetType,
    wrappedCodeFunc: S,
    labelSize: b,
    onlyHasSetter: x = !1
  } = n, u = T(
    V
  ), s = m(() => {
    const e = Object.keys(u);
    for (let i = 0; i < e.length; i++)
      if (u[e[i]].includes(y))
        return e[i];
    return "";
  }, [u, y]), I = m(() => s && C(t ?? "") && (t != null && t.includes("currentItem")) ? (e) => D(e, s) : S, [s, t, S]), W = m(() => {
    if (s)
      return v(
        t ?? a,
        s
      );
    if (!(t === void 0 && a === void 0))
      return j(t ?? a) ? t ?? a : `{{ ${t ?? a} }}`;
  }, [s, a, t]), L = f(
    (e) => {
      let i = e;
      s && C(e ?? "") && e.includes("currentItem") && (i = D(e, s)), g(l, i);
    },
    [l, s, g]
  ), E = f(() => {
  }, []), O = f(
    (e) => {
      console.log(e);
    },
    []
  );
  return /* @__PURE__ */ P("div", { css: $(r, x), children: [
    !x && d && /* @__PURE__ */ o("span", { style: { marginRight: "10px" }, children: /* @__PURE__ */ o(
      F,
      {
        labelName: d,
        labelDesc: h,
        labelSize: b
      }
    ) }),
    /* @__PURE__ */ o("div", { css: M(r), children: /* @__PURE__ */ o(
      R,
      {
        scopeOfAutoComplete: "page",
        value: W,
        onChange: L,
        showLineNumbers: !1,
        placeholder: c,
        expectValueType: s ? void 0 : N,
        lang: A.JAVASCRIPT,
        maxHeight: "208px",
        maxWidth: "100%",
        codeType: B.EXPRESSION,
        modalTitle: d,
        modalDescription: w ?? h,
        onFocus: E,
        onBlur: O,
        wrappedCodeFunc: I
      }
    ) })
  ] });
};
k.displayName = "BaseInput";
export {
  k as default
};
//# sourceMappingURL=index-c673e3ee.js.map
