import { g } from './SvgIcon-BKMVrGmr.mjs';
import { useSSRContext, ref, watch, resolveComponent, mergeProps, unref, withCtx, createVNode, openBlock, createBlock, toDisplayString, createCommentVNode, withDirectives, isRef, vModelDynamic, vModelText } from 'vue';
import { ssrRenderComponent, ssrRenderAttr, ssrInterpolate, ssrRenderAttrs, ssrGetDynamicModelProps } from 'vue/server-renderer';
import { j as Fv } from './server.mjs';

const q = { __name: "BaseTextInput", __ssrInlineRender: true, props: { name: { type: String, required: true }, type: { type: String, required: false, default: "text" }, label: { type: String, required: false }, placeholder: { type: String, required: false }, value: { type: String, required: false }, disabled: { type: Boolean, required: false }, absoluteError: { type: Boolean, required: false }, rounded: { type: Boolean, required: false }, icon: { type: String, required: false } }, emits: ["update:value"], setup(a2, { emit: q2 }) {
  const w2 = a2, I = Fv(w2.name), S = ref(w2.type), j = ref(null);
  return watch(() => w2.value, (e2) => {
    e2 && (j.value = e2, I.setValue(e2));
  }, { deep: true, immediate: true }), (t2, l2, k2, q3) => {
    const w3 = resolveComponent("VeeField"), I2 = g, V = resolveComponent("VeeErrorMessage");
    let _;
    l2(ssrRenderComponent(w3, mergeProps({ name: a2.name, type: unref(S) }, q3), { default: withCtx(({ field: e2, meta: l3 }, n2, o2, k3) => {
      if (!n2) return [createVNode("div", { class: "input-wrapper" }, [a2.label ? (openBlock(), createBlock("label", { key: 0, for: a2.name }, toDisplayString(a2.label), 9, ["for"])) : createCommentVNode("", true), "textarea" !== a2.type ? withDirectives((openBlock(), createBlock("input", mergeProps({ key: 1, disabled: a2.disabled, id: a2.name, type: unref(S), placeholder: a2.placeholder }, e2, { "onUpdate:modelValue": (e3) => isRef(j) ? j.value = e3 : null, onInput: (e3) => t2.$emit("update:value", e3.target.value), class: ["appearance-none", a2.rounded ? "!rounded-full !px-6" : ""], autocomplete: "off" }), null, 16, ["disabled", "id", "type", "placeholder", "onUpdate:modelValue", "onInput"])), [[vModelDynamic, unref(j)]]) : withDirectives((openBlock(), createBlock("textarea", mergeProps({ key: 2, disabled: a2.disabled, id: a2.name, type: a2.type, placeholder: a2.placeholder }, e2, { "onUpdate:modelValue": (e3) => isRef(j) ? j.value = e3 : null, onInput: (e3) => t2.$emit("update:value", e3.target.value), class: "appearance-none" }), null, 16, ["disabled", "id", "type", "placeholder", "onUpdate:modelValue", "onInput"])), [[vModelText, unref(j)]]), a2.icon ? (openBlock(), createBlock("div", { key: 3, type: "button", class: "absolute top-1/2 -translate-y-1/2 end-5 flex items-center justify-center" }, [createVNode(I2, { name: a2.icon }, null, 8, ["name"])])) : createCommentVNode("", true), "password" == a2.type ? (openBlock(), createBlock("button", { key: 4, type: "button", onClick: (e3) => "password" == unref(S) ? S.value = "text" : S.value = "password", class: "absolute top-1/2 -translate-y-1/2 end-5 flex items-center justify-center" }, ["password" == unref(S) ? (openBlock(), createBlock(I2, { key: 0, name: "eye", class: "scale-[1.5]" })) : (openBlock(), createBlock(I2, { key: 1, name: "eye-slash", class: "scale-[1.5]" }))], 8, ["onClick"])) : createCommentVNode("", true)]), createVNode(V, { class: ["text-sm text-red-500", a2.absoluteError && "absolute"], name: a2.name }, null, 8, ["name", "class"])];
      n2(`<div class="input-wrapper"${k3}>`), a2.label ? n2(`<label${ssrRenderAttr("for", a2.name)}${k3}>${ssrInterpolate(a2.label)}</label>`) : n2("<!---->"), "textarea" !== a2.type ? n2(`<input${ssrRenderAttrs((_ = mergeProps({ disabled: a2.disabled, id: a2.name, type: unref(S), placeholder: a2.placeholder }, e2, { class: ["appearance-none", a2.rounded ? "!rounded-full !px-6" : ""], autocomplete: "off" }), mergeProps(_, ssrGetDynamicModelProps(_, unref(j)))))}${k3}>`) : n2(`<textarea${ssrRenderAttrs(mergeProps({ disabled: a2.disabled, id: a2.name, type: a2.type, placeholder: a2.placeholder }, e2, { class: "appearance-none" }), "textarea")}${k3}>${ssrInterpolate(unref(j))}</textarea>`), a2.icon ? (n2(`<div type="button" class="absolute top-1/2 -translate-y-1/2 end-5 flex items-center justify-center"${k3}>`), n2(ssrRenderComponent(I2, { name: a2.icon }, null, o2, k3)), n2("</div>")) : n2("<!---->"), "password" == a2.type ? (n2(`<button type="button" class="absolute top-1/2 -translate-y-1/2 end-5 flex items-center justify-center"${k3}>`), "password" == unref(S) ? n2(ssrRenderComponent(I2, { name: "eye", class: "scale-[1.5]" }, null, o2, k3)) : n2(ssrRenderComponent(I2, { name: "eye-slash", class: "scale-[1.5]" }, null, o2, k3)), n2("</button>")) : n2("<!---->"), n2("</div>"), n2(ssrRenderComponent(V, { class: ["text-sm text-red-500", a2.absoluteError && "absolute"], name: a2.name }, null, o2, k3));
    }), _: 1 }, k2));
  };
} }, w = q.setup;
q.setup = (e2, t2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Inputs/BaseTextInput.vue"), w ? w(e2, t2) : undefined;
};

export { q };
//# sourceMappingURL=BaseTextInput-DBWJA1sk.mjs.map
