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