import { __exports as y } from "../../../../../../../_virtual/resolveConfig.js";
import E from "../../../../../lodash@4.17.21/node_modules/lodash/some.js";
import P from "../../../../../lodash@4.17.21/node_modules/lodash/mergeWith.js";
import C from "../../../../../lodash@4.17.21/node_modules/lodash/isFunction.js";
import F from "../../../../../lodash@4.17.21/node_modules/lodash/isUndefined.js";
import M from "../../../../../lodash@4.17.21/node_modules/lodash/defaults.js";
import b from "../../../../../lodash@4.17.21/node_modules/lodash/map.js";
import q from "../../../../../lodash@4.17.21/node_modules/lodash/get.js";
import L from "../../../../../lodash@4.17.21/node_modules/lodash/uniq.js";
import U from "../../../../../lodash@4.17.21/node_modules/lodash/toPath.js";
import $ from "../../../../../lodash@4.17.21/node_modules/lodash/head.js";
import w from "../../../../../lodash@4.17.21/node_modules/lodash/isPlainObject.js";
import "./negateValue.js";
import "../corePluginList.js";
import "./configurePlugins.js";
import W from "../../stubs/defaultConfig.stub.js";
import z from "../../colors.js";
import { __exports as D } from "../../../../../../../_virtual/negateValue.js";
import { __exports as K } from "../../../../../../../_virtual/corePluginList.js";
import { __exports as R } from "../../../../../../../_virtual/configurePlugins.js";
Object.defineProperty(y, "__esModule", {
  value: !0
});
y.default = fr;
var j = i(E), m = i(P), c = i(C), k = i(F), A = i(M), B = i(b), l = i(q), G = i(L), H = i(U), h = i($), _ = i(w), J = i(D), p = i(K), N = i(R), Q = i(W), S = i(z);
function i(r) {
  return r && r.__esModule ? r : { default: r };
}
const O = {
  colors: S.default,
  negative(r) {
    return Object.keys(r).filter((t) => r[t] !== "0").reduce((t, e) => ({
      ...t,
      [`-${e}`]: (0, J.default)(r[e])
    }), {});
  },
  breakpoints(r) {
    return Object.keys(r).filter((t) => typeof r[t] == "string").reduce((t, e) => ({
      ...t,
      [`screen-${e}`]: r[e]
    }), {});
  }
};
function X(r, ...t) {
  return (0, c.default)(r) ? r(...t) : r;
}
function x(r) {
  return r.reduce((t, {
    extend: e
  }) => (0, m.default)(t, e, (f, n) => (0, k.default)(f) ? [n] : Array.isArray(f) ? [n, ...f] : [n, f]), {});
}
function Y(r) {
  return {
    ...r.reduce((t, e) => (0, A.default)(t, e), {}),
    extend: x(r)
  };
}
function v(r, t) {
  if (Array.isArray(r) && (0, _.default)((0, h.default)(r)))
    return r.concat(t);
  if (Array.isArray(t) && (0, _.default)((0, h.default)(t)) && (0, _.default)(r))
    return [r, ...t];
  if (Array.isArray(t))
    return t;
}
function Z({
  extend: r,
  ...t
}) {
  return (0, m.default)(t, r, (e, f) => !(0, c.default)(e) && !(0, j.default)(f, c.default) ? (0, m.default)({}, e, ...f, v) : (n, o) => (0, m.default)({}, ...[e, ...f].map((u) => X(u, n, o)), v));
}
function T(r) {
  const t = (e, f) => {
    const n = (0, H.default)(e);
    let o = 0, u = r;
    for (; u != null && o < n.length; )
      u = u[n[o++]], u = (0, c.default)(u) ? u(t, O) : u;
    return u === void 0 ? f : u;
  };
  return Object.keys(r).reduce((e, f) => ({
    ...e,
    [f]: (0, c.default)(r[f]) ? r[f](t, O) : r[f]
  }), {});
}
function g(r) {
  let t = [];
  return r.forEach((e) => {
    t = [...t, e];
    const f = (0, l.default)(e, "plugins", []);
    f.length !== 0 && f.forEach((n) => {
      n.__isOptionsFunction && (n = n()), t = [...t, ...g([(0, l.default)(n, "config", {})])];
    });
  }), t;
}
function I(r) {
  return {
    ...r.reduce((e, f) => (Object.entries(f || {}).forEach(([n, o]) => {
      (0, c.default)(o) ? e[n] = o({
        variants(u) {
          return (0, l.default)(e, u, []);
        },
        before(u, d, a = (0, l.default)(e, n, [])) {
          if (d === void 0)
            return [...u, ...a];
          const s = a.indexOf(d);
          return s === -1 ? [...a, ...u] : [...a.slice(0, s), ...u, ...a.slice(s)];
        },
        after(u, d, a = (0, l.default)(e, n, [])) {
          if (d === void 0)
            return [...a, ...u];
          const s = a.indexOf(d);
          return s === -1 ? [...u, ...a] : [...a.slice(0, s + 1), ...u, ...a.slice(s + 1)];
        },
        without(u, d = (0, l.default)(e, n, [])) {
          return d.filter((a) => !u.includes(a));
        }
      }) : e[n] = o;
    }), e), {}),
    extend: x(r)
  };
}
function V({
  extend: r,
  ...t
}, e) {
  return (0, m.default)(t, r, (f, n) => {
    const o = (0, G.default)([...f || [], ...n].flat());
    return n.flat().length === 0 ? o : o.sort((u, d) => e.indexOf(u) - e.indexOf(d));
  });
}
function rr([r, ...t], e) {
  return Array.isArray(r) ? r : V(I([r, ...t].reverse()), e);
}
function tr(r) {
  return [...r].reduceRight((e, f) => (0, c.default)(f) ? f({
    corePlugins: e
  }) : (0, N.default)(f, e), p.default).slice().sort((e, f) => Math.sign(p.default.indexOf(e) - p.default.indexOf(f)));
}
function er(r) {
  return [...r].reduceRight((e, f) => [...e, ...f], []);
}
function fr(r) {
  const t = [...g(r), {
    darkMode: !1,
    prefix: "",
    important: !1,
    separator: ":",
    variantOrder: Q.default.variantOrder
  }], {
    variantOrder: e
  } = t.find((f) => f.variantOrder);
  return (0, A.default)({
    theme: T(Z(Y((0, B.default)(t, (f) => (0, l.default)(f, "theme", {}))))),
    variants: rr(t.map((f) => (0, l.default)(f, "variants", {})), e),
    corePlugins: tr(t.map((f) => f.corePlugins)),
    plugins: er(r.map((f) => (0, l.default)(f, "plugins", [])))
  }, ...t);
}
//# sourceMappingURL=resolveConfig.js.map
