"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/block-editor/src/components/color-palette/with-color-context.js
var with_color_context_exports = {};
__export(with_color_context_exports, {
  default: () => with_color_context_default
});
module.exports = __toCommonJS(with_color_context_exports);
var import_compose = require("@wordpress/compose");
var import_use_settings = require("../use-settings");
var import_jsx_runtime = require("react/jsx-runtime");
var with_color_context_default = (0, import_compose.createHigherOrderComponent)((WrappedComponent) => {
  return (props) => {
    const [
      defaultColors,
      themeColors,
      customColors,
      enableCustomColors,
      enableDefaultColors
    ] = (0, import_use_settings.useSettings)(
      "color.palette.default",
      "color.palette.theme",
      "color.palette.custom",
      "color.custom",
      "color.defaultPalette"
    );
    const _colors = enableDefaultColors ? [
      ...themeColors || [],
      ...defaultColors || [],
      ...customColors || []
    ] : [...themeColors || [], ...customColors || []];
    const { colors = _colors, disableCustomColors = !enableCustomColors } = props;
    const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors;
    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      WrappedComponent,
      {
        ...{
          ...props,
          colors,
          disableCustomColors,
          hasColorsToChoose
        }
      }
    );
  };
}, "withColorContext");
//# sourceMappingURL=with-color-context.js.map
