var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/preview/context/ConfigContext.ts
var ConfigContext_exports = {};
__export(ConfigContext_exports, {
  ConfigConsumer: () => ConfigConsumer,
  ConfigProvider: () => ConfigProvider,
  default: () => ConfigContext_default,
  getModifyName: () => getModifyName,
  getPrefixCls: () => getPrefixCls,
  getPrettyCls: () => getPrettyCls
});
module.exports = __toCommonJS(ConfigContext_exports);
var React = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
var import_compact = __toESM(require("lodash/compact"));
var import_entries = __toESM(require("lodash/entries"));
function _slicedToArray(arr, i) {
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
  throw new TypeError(
    "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
  );
}
function _unsupportedIterableToArray(o, minLen) {
  if (!o)
    return;
  if (typeof o === "string")
    return _arrayLikeToArray(o, minLen);
  var n = Object.prototype.toString.call(o).slice(8, -1);
  if (n === "Object" && o.constructor)
    n = o.constructor.name;
  if (n === "Map" || n === "Set")
    return Array.from(o);
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
    return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
  if (len == null || len > arr.length)
    len = arr.length;
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
    arr2[i] = arr[i];
  }
  return arr2;
}
function _iterableToArrayLimit(arr, i) {
  if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr)))
    return;
  var _arr = [];
  var _n = true;
  var _d = false;
  var _e = void 0;
  try {
    for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
      _arr.push(_s.value);
      if (i && _arr.length === i)
        break;
    }
  } catch (err) {
    _d = true;
    _e = err;
  } finally {
    try {
      if (!_n && _i["return"] != null)
        _i["return"]();
    } finally {
      if (_d)
        throw _e;
    }
  }
  return _arr;
}
function _arrayWithHoles(arr) {
  if (Array.isArray(arr))
    return arr;
}
var getModifyName = function getModifyName2(modifyName, modifyValue) {
  switch (modifyValue) {
    case "default":
      modifyName = "";
      break;
    case "large":
      modifyName = "lg";
      break;
    case "middle":
      modifyName = "md";
      break;
    case "small":
      modifyName = "sm";
      break;
    default:
      modifyName = modifyValue;
      break;
  }
  return modifyName;
};
var getPrefixCls = function getPrefixCls2() {
  var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "cyber";
  return function(suffix, prefixCls) {
    if (!prefixCls) {
      prefixCls = suffix ? "".concat(prefix, "-").concat(suffix) : prefix;
    }
    return prefixCls;
  };
};
var getPrettyCls = function getPrettyCls2() {
  var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "cyber";
  return function(suffix, prefixCls, outerClassName) {
    prefixCls = getPrefixCls(prefix)(suffix, prefixCls);
    return function(modifiers, element, innerClassName) {
      if (typeof modifiers === "string") {
        innerClassName = element;
        element = modifiers;
        modifiers = {};
      }
      var elementName = (0, import_compact.default)([prefixCls, element]).join("-");
      var modifierNames = (0, import_entries.default)(modifiers).reduce(function(acc, cur) {
        var _cur = _slicedToArray(cur, 2), key = _cur[0], value = _cur[1];
        var modifyName = key;
        if (typeof value === "string") {
          modifyName = getModifyName(modifyName, value);
          if (modifyName) {
            acc["".concat(elementName, "-").concat(modifyName)] = !!value;
          }
        } else {
          acc["".concat(elementName, "-").concat(modifyName)] = !!value;
        }
        return acc;
      }, {});
      return (0, import_classnames.default)(elementName, modifierNames, outerClassName, innerClassName);
    };
  };
};
var ConfigContext = React.createContext({
  iconPrefix: "icon-b",
  getPrefixCls: getPrefixCls(),
  getPrettyCls: getPrettyCls()
});
var ConfigConsumer = ConfigContext.Consumer;
var ConfigProvider = ConfigContext.Provider;
var ConfigContext_default = ConfigContext;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ConfigConsumer,
  ConfigProvider,
  getModifyName,
  getPrefixCls,
  getPrettyCls
});
