import v from "../../../../@babel/runtime/helpers/esm/defineProperty.mjs";
import p from "../../../../@babel/runtime/helpers/esm/objectSpread2.mjs";
import T from "../../../../@babel/runtime/helpers/esm/typeof.mjs";
import h from "../../../../@emotion/hash/dist/hash.browser.esm.mjs";
import l from "../../../../rc-util/es/Dom/canUseDom.mjs";
import { updateCSS as b, removeCSS as j } from "../../../../rc-util/es/Dom/dynamicCSS.mjs";
import { ATTR_TOKEN as A, ATTR_MARK as C } from "../StyleContext.mjs";
import "../theme/createTheme.mjs";
import M from "../theme/Theme.mjs";
import "../theme/ThemeCache.mjs";
var k = /* @__PURE__ */ new WeakMap(), f = {};
function z(t, n) {
  for (var e = k, r = 0; r < n.length; r += 1) {
    var a = n[r];
    e.has(a) || e.set(a, /* @__PURE__ */ new WeakMap()), e = e.get(a);
  }
  return e.has(f) || e.set(f, t()), e.get(f);
}
var d = /* @__PURE__ */ new WeakMap();
function y(t) {
  var n = d.get(t) || "";
  return n || (Object.keys(t).forEach(function(e) {
    var r = t[e];
    n += e, r instanceof M ? n += r.id : r && T(r) === "object" ? n += y(r) : n += r;
  }), d.set(t, n)), n;
}
function V(t, n) {
  return h("".concat(n, "_").concat(y(t)));
}
var c = "random-".concat(Date.now(), "-").concat(Math.random()).replace(/\./g, ""), g = "_bAmBoO_";
function E(t, n, e) {
  if (l()) {
    var r, a;
    b(t, c);
    var o = document.createElement("div");
    o.style.position = "fixed", o.style.left = "0", o.style.top = "0", n == null || n(o), document.body.appendChild(o), process.env.NODE_ENV !== "production" && (o.innerHTML = "Test", o.style.zIndex = "9999999");
    var i = e ? e(o) : (r = getComputedStyle(o).content) === null || r === void 0 ? void 0 : r.includes(g);
    return (a = o.parentNode) === null || a === void 0 || a.removeChild(o), j(c), i;
  }
  return !1;
}
var m = void 0;
function B() {
  return m === void 0 && (m = E("@layer ".concat(c, " { .").concat(c, ' { content: "').concat(g, '"!important; } }'), function(t) {
    t.className = c;
  })), m;
}
var H = l();
function I(t) {
  return typeof t == "number" ? "".concat(t, "px") : t;
}
function P(t, n, e) {
  var r, a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1;
  if (o)
    return t;
  var i = p(p({}, a), {}, (r = {}, v(r, A, n), v(r, C, e), r)), S = Object.keys(i).map(function(u) {
    var s = i[u];
    return s ? "".concat(u, '="').concat(s, '"') : null;
  }).filter(function(u) {
    return u;
  }).join(" ");
  return "<style ".concat(S, ">").concat(t, "</style>");
}
export {
  y as flattenToken,
  H as isClientSide,
  z as memoResult,
  B as supportLayer,
  P as toStyleStr,
  V as token2key,
  I as unit
};
