import w from "../../../../../@emotion_hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js";
import x from "../../../../../@emotion_unitless@0.10.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js";
import A from "../../../../../@emotion_memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js";
var _ = /[A-Z]|^ms/g, C = /_EMO_([^_]+?)_([^]*?)_EMO_/g, b = function(a) {
  return a.charCodeAt(1) === 45;
}, h = function(a) {
  return a != null && typeof a != "boolean";
}, v = /* @__PURE__ */ A(function(r) {
  return b(r) ? r : r.replace(_, "-$&").toLowerCase();
}), y = function(a, n) {
  switch (a) {
    case "animation":
    case "animationName":
      if (typeof n == "string")
        return n.replace(C, function(f, t, e) {
          return i = {
            name: t,
            styles: e,
            next: i
          }, t;
        });
  }
  return x[a] !== 1 && !b(a) && typeof n == "number" && n !== 0 ? n + "px" : n;
};
function l(r, a, n) {
  if (n == null)
    return "";
  var f = n;
  if (f.__emotion_styles !== void 0)
    return f;
  switch (typeof n) {
    case "boolean":
      return "";
    case "object": {
      var t = n;
      if (t.anim === 1)
        return i = {
          name: t.name,
          styles: t.styles,
          next: i
        }, t.name;
      var e = n;
      if (e.styles !== void 0) {
        var s = e.next;
        if (s !== void 0)
          for (; s !== void 0; )
            i = {
              name: s.name,
              styles: s.styles,
              next: i
            }, s = s.next;
        var u = e.styles + ";";
        return u;
      }
      return S(r, a, n);
    }
    case "function": {
      if (r !== void 0) {
        var c = i, o = n(r);
        return i = c, l(r, a, o);
      }
      break;
    }
  }
  var m = n;
  return m;
}
function S(r, a, n) {
  var f = "";
  if (Array.isArray(n))
    for (var t = 0; t < n.length; t++)
      f += l(r, a, n[t]) + ";";
  else
    for (var e in n) {
      var s = n[e];
      if (typeof s != "object") {
        var u = s;
        h(u) && (f += v(e) + ":" + y(e, u) + ";");
      } else if (Array.isArray(s) && typeof s[0] == "string" && a == null)
        for (var c = 0; c < s.length; c++)
          h(s[c]) && (f += v(e) + ":" + y(e, s[c]) + ";");
      else {
        var o = l(r, a, s);
        switch (e) {
          case "animation":
          case "animationName": {
            f += v(e) + ":" + o + ";";
            break;
          }
          default:
            f += e + "{" + o + "}";
        }
      }
    }
  return f;
}
var d = /label:\s*([^\s;{]+)\s*(;|$)/g, i;
function E(r, a, n) {
  if (r.length === 1 && typeof r[0] == "object" && r[0] !== null && r[0].styles !== void 0)
    return r[0];
  var f = !0, t = "";
  i = void 0;
  var e = r[0];
  if (e == null || e.raw === void 0)
    f = !1, t += l(n, a, e);
  else {
    var s = e;
    t += s[0];
  }
  for (var u = 1; u < r.length; u++)
    if (t += l(n, a, r[u]), f) {
      var c = e;
      t += c[u];
    }
  d.lastIndex = 0;
  for (var o = "", m; (m = d.exec(t)) !== null; )
    o += "-" + m[1];
  var p = w(t) + o;
  return {
    name: p,
    styles: t,
    next: i
  };
}
export {
  E as serializeStyles
};
//# sourceMappingURL=emotion-serialize.esm.js.map
