import { ref as a, watchEffect as p, resolveComponent as m, openBlock as f, createElementBlock as x, createElementVNode as e, normalizeClass as k, createVNode as h, withCtx as y, withDirectives as b, vModelText as C, pushScopeId as w, popScopeId as g } from "vue";
import { _export_sfc as I } from "./_plugin-vue_export-helper-6a641814.js";
const u = (n) => (w("data-v-ce1d591c"), n = n(), g(), n), L = { class: "flex flex-wrap" }, V = /* @__PURE__ */ u(() => /* @__PURE__ */ e("div", { class: "i-la-link" }, null, -1)), $ = [
  V
], E = { class: "p-4 max-w-600px" }, F = { class: "flex items-center gap-4" }, S = /* @__PURE__ */ u(() => /* @__PURE__ */ e("div", { class: "i-la-link text-2xl" }, null, -1)), B = /* @__PURE__ */ u(() => /* @__PURE__ */ e("div", { class: "text-lg" }, "Add a link", -1)), N = { class: "button text-xl" }, U = { class: "button text-xl" }, z = {
  __name: "FormLink",
  emits: ["update"],
  setup(n, { emit: _ }) {
    const l = a(), s = a(), i = a(), v = a(!1), c = a();
    return p(() => {
      var d;
      s.value ? (v.value = (d = i == null ? void 0 : i.value) == null ? void 0 : d.checkValidity(), v.value && (c.value = s.value, _("update", s.value))) : c.value = null;
    }), (d, t) => {
      const r = m("ui-layer");
      return f(), x("div", L, [
        e("button", {
          class: k(["button m-1", { active: c.value }]),
          onClick: t[0] || (t[0] = (o) => l.value = !l.value)
        }, $, 2),
        h(r, {
          class: "mt-20",
          open: l.value,
          onClose: t[4] || (t[4] = (o) => l.value = !1)
        }, {
          default: y(() => [
            e("div", E, [
              e("div", F, [
                S,
                B,
                e("button", N, [
                  e("div", {
                    class: "i-la-check",
                    onClick: t[1] || (t[1] = (o) => l.value = !1)
                  })
                ]),
                e("button", U, [
                  e("div", {
                    class: "i-la-trash-alt",
                    onClick: t[2] || (t[2] = (o) => {
                      s.value = null, l.value = !1;
                    })
                  })
                ])
              ]),
              b(e("input", {
                class: "text-sm p-4 my-4 dark-bg-dark-200",
                ref_key: "input",
                ref: i,
                "onUpdate:modelValue": t[3] || (t[3] = (o) => s.value = o),
                type: "url",
                placeholder: "Paste a URL"
              }, null, 512), [
                [C, s.value]
              ])
            ])
          ]),
          _: 1
        }, 8, ["open"])
      ]);
    };
  }
}, M = /* @__PURE__ */ I(z, [["__scopeId", "data-v-ce1d591c"]]);
export {
  M as default
};
//# sourceMappingURL=FormLink-0641daa9.js.map
