var j = Object.defineProperty, v = Object.defineProperties;
var A = Object.getOwnPropertyDescriptors;
var w = Object.getOwnPropertySymbols;
var m = Object.prototype.hasOwnProperty, u = Object.prototype.propertyIsEnumerable;
var d = (e, t, r) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, c = (e, t) => {
  for (var r in t || (t = {}))
    m.call(t, r) && d(e, r, t[r]);
  if (w)
    for (var r of w(t))
      u.call(t, r) && d(e, r, t[r]);
  return e;
}, f = (e, t) => v(e, A(t));
var x = (e, t) => {
  var r = {};
  for (var n in e)
    m.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
  if (e != null && w)
    for (var n of w(e))
      t.indexOf(n) < 0 && u.call(e, n) && (r[n] = e[n]);
  return r;
};
import { jsx as s, jsxs as T, Fragment as F } from "react/jsx-runtime";
const N = (e) => {
  var h, o;
  const n = e, {
    node: t
  } = n, r = x(n, [
    "node"
  ]);
  if (t.tagName === "a" && ((h = t.children) == null ? void 0 : h.length) > 0) {
    const g = ((o = t.children[0]) == null ? void 0 : o.value) || "";
    let i = /(^https?:\/\/|^www\.)(?:www\.)?[\w\-]+(\.[\w\-]+)+(\/[\w\- .\/?%&=]*)?/g, a = g.match(i), p = g.replace(i, "").trim();
    if (!(a != null && a.length))
      return /* @__PURE__ */ s("a", c({}, r));
    const l = a[0];
    return /* @__PURE__ */ T(F, {
      children: [/* @__PURE__ */ s("a", f(c({}, r), {
        href: /^www\./.test(l) ? "//" + l : l,
        children: l
      })), p]
    });
  }
  return /* @__PURE__ */ s("a", c({}, r));
}, k = N;
export {
  k as default
};
