import { RULESET as d, KEYFRAMES as E, DECLARATION as g, WEBKIT as s, MOZ as h, MS as x } from "./Enum.js";
import { sizeof as $, combine as y, replace as t, match as A } from "./Utility.js";
import { copy as u } from "./Tokenizer.js";
import { serialize as a } from "./Serializer.js";
import { prefix as M } from "./Prefixer.js";
function I(r) {
  var o = $(r);
  return function(c, i, p, w) {
    for (var n = "", f = 0; f < o; f++)
      n += r[f](c, i, p, w) || "";
    return n;
  };
}
function K(r) {
  return function(o) {
    o.root || (o = o.return) && r(o);
  };
}
function L(r, o, c, i) {
  if (r.length > -1 && !r.return)
    switch (r.type) {
      case g:
        r.return = M(r.value, r.length);
        break;
      case E:
        return a([u(r, { value: t(r.value, "@", "@" + s) })], i);
      case d:
        if (r.length)
          return y(r.props, function(p) {
            switch (A(p, /(::plac\w+|:read-\w+)/)) {
              case ":read-only":
              case ":read-write":
                return a([u(r, { props: [t(p, /:(read-\w+)/, ":" + h + "$1")] })], i);
              case "::placeholder":
                return a([
                  u(r, { props: [t(p, /:(plac\w+)/, ":" + s + "input-$1")] }),
                  u(r, { props: [t(p, /:(plac\w+)/, ":" + h + "$1")] }),
                  u(r, { props: [t(p, /:(plac\w+)/, x + "input-$1")] })
                ], i);
            }
            return "";
          });
    }
}
export {
  I as middleware,
  L as prefixer,
  K as rulesheet
};
//# sourceMappingURL=Middleware.js.map
