import { Modal as i } from "@aplus-frontend/antdv";
import { omit as a } from "lodash-unified";
function f(o) {
  return typeof o == "object" && typeof o.then == "function" ? o : !1;
}
const m = (o, n) => typeof o == "function" && f(o?.(n)), h = (o, n = "0.7") => {
  try {
    let t = o?.toLowerCase();
    if (t && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)) {
      if (t.length === 4) {
        let e = "#";
        for (let c = 1; c < 4; c += 1)
          e += t.slice(c, c + 1).concat(t.slice(c, c + 1));
        t = e;
      }
      const r = [];
      for (let e = 1; e < 7; e += 2)
        r.push(parseInt("0x" + t.slice(e, e + 2)));
      return "rgba(" + r.join(",") + "," + n + ")";
    }
    if (t && t.startsWith("rgb")) {
      let r = t.match(/(\d(\.\d+)?)+/g);
      return r = r?.slice(0, 3)?.concat(n), "rgba(" + r.join(",") + ")";
    }
    return t;
  } catch {
    return;
  }
}, p = (o) => {
  const { onOk: n = () => ({}) } = o;
  return new Promise((t, s) => {
    i.confirm({
      onOk: async () => {
        try {
          await n(), t(!0);
        } catch (r) {
          s(r);
        }
      },
      onCancel: () => {
        t(!1);
      },
      ...a(o, ["onOk"])
    });
  });
};
export {
  p as confirmHandle,
  m as isAsynchronous,
  f as isPromise,
  h as transferOpacityColor
};
