import { __exports as C } from "../../../../../../../_virtual/processPlugins.js";
import "../../../../../lodash@4.17.21/node_modules/lodash/lodash.js";
import N from "../../../../../postcss@8.4.14/node_modules/postcss/lib/postcss.js";
import B from "../../../../../postcss@8.4.14/node_modules/postcss/lib/node.js";
import U from "../../../../../lodash@4.17.21/node_modules/lodash/isFunction.js";
import "./escapeClassName.js";
import "./generateVariantFunction.js";
import "./parseObjectStyles.js";
import "./prefixSelector.js";
import "./wrapWithVariants.js";
import "./cloneNodes.js";
import "./transformThemeValue.js";
import "./nameClass.js";
import "./isKeyframeRule.js";
import { __exports as W } from "../../../../../../../_virtual/escapeClassName.js";
import { __exports as k } from "../../../../../../../_virtual/generateVariantFunction.js";
import { __exports as G } from "../../../../../../../_virtual/parseObjectStyles.js";
import { __exports as I } from "../../../../../../../_virtual/prefixSelector.js";
import { __exports as K } from "../../../../../../../_virtual/wrapWithVariants.js";
import { __exports as T } from "../../../../../../../_virtual/cloneNodes.js";
import { __exports as $ } from "../../../../../../../_virtual/transformThemeValue.js";
import { __exports as q } from "../../../../../../../_virtual/nameClass.js";
import { __exports as D } from "../../../../../../../_virtual/isKeyframeRule.js";
import { l as E } from "../../../../../../../_virtual/lodash.js";
Object.defineProperty(C, "__esModule", {
  value: !0
});
C.default = te;
var f = o(E.exports), m = o(N), L = o(B), z = o(U), H = o(W), J = o(k), Q = o(G), X = o(I), O = o(K), Y = o(T), Z = o($), ee = o(q), V = o(D);
function o(s) {
  return s && s.__esModule ? s : { default: s };
}
function d(s) {
  return Array.isArray(s) ? f.default.flatMap(s, (r) => r instanceof L.default ? r : (0, Q.default)(r)) : d([s]);
}
function v(s, r) {
  return m.default.atRule({
    name: "layer",
    params: r
  }).append((0, Y.default)(Array.isArray(s) ? s : [s]));
}
function te(s, r) {
  const x = [], y = [], h = [], P = {}, c = (i) => (0, X.default)(r.prefix, i);
  function _(i, n) {
    const e = {
      variants: [],
      respectPrefix: !0,
      respectImportant: !0
    };
    n = Array.isArray(n) ? Object.assign({}, e, {
      variants: n
    }) : f.default.defaults(n, e);
    const t = m.default.root({
      nodes: d(i)
    });
    t.walkRules((a) => {
      n.respectPrefix && !(0, V.default)(a) && (a.selector = c(a.selector)), n.respectImportant && r.important && (a.__tailwind = {
        ...a.__tailwind,
        important: r.important
      });
    }), h.push(v((0, O.default)(t.nodes, n.variants), "utilities"));
  }
  const p = (i, n) => i ? f.default.get(r, i, n) : r;
  return s.forEach((i) => {
    i.__isOptionsFunction && (i = i()), ((0, z.default)(i) ? i : f.default.get(i, "handler", () => {
    }))({
      postcss: m.default,
      config: p,
      theme: (e, t) => {
        const [a, ...u] = f.default.toPath(e), l = p(["theme", a, ...u], t);
        return (0, Z.default)(a)(l);
      },
      corePlugins: (e) => Array.isArray(r.corePlugins) ? r.corePlugins.includes(e) : p(`corePlugins.${e}`, !0),
      variants: (e, t) => Array.isArray(r.variants) ? r.variants : p(`variants.${e}`, t),
      e: H.default,
      prefix: c,
      addUtilities: _,
      matchUtilities: (e, {
        values: t,
        variants: a,
        respectPrefix: u,
        respectImportant: l
      }) => {
        let R = Object.entries(t || {}), b = Object.entries(e).flatMap(([w, g]) => R.map(([S, F]) => {
          let A = g(F, {
            includeRules(j, M) {
              _(j, M);
            }
          });
          return A ? {
            [(0, ee.default)(w, S)]: A
          } : null;
        }).filter(Boolean));
        _(b, {
          variants: a,
          respectPrefix: u,
          respectImportant: l
        });
      },
      addComponents: (e, t) => {
        const a = {
          variants: [],
          respectPrefix: !0
        };
        t = Array.isArray(t) ? Object.assign({}, a, {
          variants: t
        }) : f.default.defaults(t, a);
        const u = m.default.root({
          nodes: d(e)
        });
        u.walkRules((l) => {
          t.respectPrefix && !(0, V.default)(l) && (l.selector = c(l.selector));
        }), y.push(v((0, O.default)(u.nodes, t.variants), "components"));
      },
      addBase: (e) => {
        x.push(v(d(e), "base"));
      },
      addVariant: (e, t, a = {}) => {
        P[e] = (0, J.default)(t, a);
      }
    });
  }), {
    base: x,
    components: y,
    utilities: h,
    variantGenerators: P
  };
}
//# sourceMappingURL=processPlugins.js.map
