'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const enableStatistic = process.env.NODE_ENV !== "production" || typeof CSSINJS_STATISTIC !== "undefined";
let recording = true;
function merge(...objs) {
  if (!enableStatistic)
    return Object.assign({}, ...objs);
  recording = false;
  const ret = {};
  objs.forEach((obj) => {
    const keys = Object.keys(obj);
    keys.forEach((key) => {
      Object.defineProperty(ret, key, {
        configurable: true,
        enumerable: true,
        get: () => obj[key]
      });
    });
  });
  recording = true;
  return ret;
}
const statistic = {};
const _statistic_build_ = {};
function noop() {
}
function statisticToken(token) {
  let tokenKeys;
  let proxy = token;
  let flush = noop;
  if (enableStatistic) {
    tokenKeys = /* @__PURE__ */ new Set();
    proxy = new Proxy(token, {
      get(obj, prop) {
        if (recording)
          tokenKeys.add(prop);
        return obj[prop];
      }
    });
    flush = (componentName, componentToken) => {
      statistic[componentName] = { global: Array.from(tokenKeys), component: componentToken };
    };
  }
  return { token: proxy, keys: tokenKeys, flush };
}

exports._statistic_build_ = _statistic_build_;
exports.default = statisticToken;
exports.merge = merge;
exports.statistic = statistic;
//# sourceMappingURL=statistic.cjs.map
