import p from "../../node_modules/jsonp/index.mjs";
const t = "https://webapi.dongweilawyer.com/api/Ueditor", g = (e) => {
  const a = new RegExp(`(?<= src=['"])[^'"]+`, "g");
  return new Promise((n) => {
    const r = e.match(a);
    if (r) {
      const i = r == null ? void 0 : r.map((c) => "source[]=" + encodeURIComponent(c)).join("&");
      p(t + "?" + i + "&action=catchimage", (c, s) => {
        if (c) {
          try {
            r.forEach((o) => {
              e = e.replace(o, "图片获取失败");
            }), console.log("err ==> ", c, e), n(e);
          } catch (o) {
            console.log("e ==> ", o);
          }
          return;
        }
        s.list && s.list.length ? s.list.forEach((o) => {
          e = e.replace(o.source, o.url);
        }) : r.forEach((o) => {
          e = e.replace(o, "图片获取失败");
        }), n(e);
      });
    } else
      n(e);
  });
};
export {
  g as default
};
