import { C as c } from "./base-PQGakkrl.js";
class P {
  promise(r) {
    return new Promise((e) => {
      e(r);
    });
  }
  promiseFun(r) {
    return new Promise((e) => {
      r && r(e);
    });
  }
  resolve(r) {
    return Promise.resolve(r);
  }
  all(r) {
    return Promise.all(r);
  }
  allByJson(r) {
    return new Promise((e) => {
      if (c.isEmpty(r))
        return e({ result: {}, errors: {} });
      let n = 0;
      const i = Object.keys(r), u = i.length, s = {}, t = {}, l = (o) => {
        Promise.resolve(r[o]).then(
          (m) => {
            n += 1, s[o] = m, n === u && e({ result: s, errors: t });
          },
          (m) => {
            n += 1, t[o] = m, n === u && e({ result: s, errors: t });
          }
        );
      };
      i.forEach((o) => {
        l(o);
      });
    });
  }
}
const C = new P();
export {
  C
};
//# sourceMappingURL=promise-CPiVqqqL.js.map
