import { defineComponent as p, ref as f, openBlock as o, createElementBlock as i, createElementVNode as t, toDisplayString as a, withDirectives as m, withKeys as x, vModelText as k } from "vue";
import { updateProfile as _, urlRegex as y } from "./composables-5f691338.js";
const h = { class: "p-2 flex items-center break-all flex-wrap" }, b = { class: "mr-2 font-bold" }, g = { class: "flex items-center flex-wrap" }, w = {
  key: 0,
  class: "text-md flex items-center"
}, C = {
  key: 0,
  class: "p-0"
}, $ = ["href"], S = /* @__PURE__ */ t("div", { class: "i-la-pen" }, null, -1), B = [
  S
], D = {
  key: 1,
  class: "p-1 flex items-center flex-1"
}, E = { class: "-ml-16" }, K = /* @__PURE__ */ t("div", { class: "i-la-check" }, null, -1), P = [
  K
], U = /* @__PURE__ */ t("div", { class: "i-la-times" }, null, -1), V = [
  U
], M = /* @__PURE__ */ p({
  __name: "UserProfileField",
  props: {
    field: { type: String, default: "" },
    content: { type: String, default: "" }
  },
  setup(n) {
    const c = n, d = f(!1), s = f(c.content);
    function r() {
      _(c.field, s.value), d.value = !1, s.value = "";
    }
    function v(u) {
      return y({ exact: !0 }).test(u);
    }
    return (u, e) => (o(), i("div", h, [
      t("div", b, a(n.field), 1),
      t("div", g, [
        d.value ? (o(), i("div", D, [
          m(t("input", {
            class: "p-2 rounded-xl pr-16 dark-bg-dark-400",
            "onUpdate:modelValue": e[1] || (e[1] = (l) => s.value = l),
            type: "text",
            onKeydown: e[2] || (e[2] = x((l) => r(), ["enter"]))
          }, null, 544), [
            [k, s.value]
          ]),
          t("div", E, [
            t("button", {
              class: "p-1",
              type: "submit",
              onClick: e[3] || (e[3] = (l) => r())
            }, P),
            t("button", {
              class: "p-1",
              onClick: e[4] || (e[4] = (l) => {
                s.value = "", d.value = !1;
              })
            }, V)
          ])
        ])) : (o(), i("div", w, [
          v(n.content) ? (o(), i("a", {
            key: 1,
            class: "font-bold underline",
            href: n.content,
            target: "_blank"
          }, a(n.content), 9, $)) : (o(), i("div", C, a(n.content), 1)),
          t("button", {
            class: "p-1",
            onClick: e[0] || (e[0] = (l) => d.value = !0)
          }, B)
        ]))
      ])
    ]));
  }
});
export {
  M as default
};
//# sourceMappingURL=UserProfileField-54e340e8.js.map
