import { getCurrentInstance as C, inject as b, defineComponent as h, useSlots as g, openBlock as u, createBlock as d, unref as n, mergeProps as y, withCtx as F, resolveDynamicComponent as k, isRef as O } from "vue";
import { ElFormItem as w } from "element-plus";
const i = /* @__PURE__ */ new WeakMap(), E = (...l) => {
  var r;
  const o = l[0], t = (r = C()) == null ? void 0 : r.proxy;
  if (t == null)
    throw new Error("injectLocal must be called in setup");
  return i.has(t) && o in i.get(t) ? i.get(t)[o] : b(...l);
};
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const R = Symbol("FORM_PROVIDER_CONTEXT"), S = () => E(R), T = /* @__PURE__ */ h({
  name: "FsFormItem",
  inheritAttrs: !0,
  __name: "FsFormItem",
  props: {
    prop: {},
    label: {},
    labelWidth: {},
    required: { type: Boolean },
    rules: {},
    error: {},
    validateStatus: {},
    for: {},
    inlineMessage: {},
    showMessage: { type: Boolean },
    size: {}
  },
  setup(l) {
    const r = l, o = g(), t = S(), p = (e) => ({
      props: {
        validateEvent: !1,
        error: e.errors[0]
        // required: state.required
      }
    }), [a, c] = t.defineField(r.prop, p);
    function f() {
      return o.default ? o.default() : null;
    }
    const m = (() => {
      let e = f();
      return e ? (Array.isArray(e) || (e = [e]), e[0]) : void 0;
    })();
    return (e, s) => (u(), d(n(w), y({
      label: e.label,
      "label-width": e.labelWidth,
      size: e.size,
      "validate-status": e.validateStatus,
      required: e.required
    }, n(c)), {
      default: F(() => [
        (u(), d(k(n(m)), {
          modelValue: n(a),
          "onUpdate:modelValue": s[0] || (s[0] = (v) => O(a) ? a.value = v : null)
        }, null, 8, ["modelValue"]))
      ]),
      _: 1
    }, 16, ["label", "label-width", "size", "validate-status", "required"]));
  }
});
export {
  T as default
};
//# sourceMappingURL=FsFormItem.mjs.map
