"use strict";
/* Socket Lib - Built with esbuild */
"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);
var resolve_exports = {};
__export(resolve_exports, {
  RAINBOW_GRADIENT: () => RAINBOW_GRADIENT,
  createTheme: () => createTheme,
  extendTheme: () => extendTheme,
  resolveColor: () => resolveColor,
  resolveShimmerColor: () => resolveShimmerColor
});
module.exports = __toCommonJS(resolve_exports);
var import_array = require("../primordials/array");
const RAINBOW_GRADIENT = [
  // Red/pink.
  [255, 100, 120],
  // Orange.
  [255, 140, 80],
  // Yellow/gold.
  [255, 180, 60],
  // Yellow/green.
  [220, 200, 80],
  // Green.
  [120, 200, 100],
  // Cyan/turquoise.
  [80, 200, 180],
  // Blue.
  [80, 160, 220],
  // Purple/violet.
  [140, 120, 220],
  // Pink/magenta.
  [200, 100, 200],
  // Red/pink.
  [255, 100, 140]
];
function createTheme(config) {
  return {
    __proto__: null,
    name: config.name,
    displayName: config.displayName,
    colors: { __proto__: null, ...config.colors },
    effects: config.effects ? { __proto__: null, ...config.effects } : void 0,
    meta: config.meta ? { __proto__: null, ...config.meta } : void 0
  };
}
function extendTheme(base, overrides) {
  return {
    __proto__: null,
    ...base,
    ...overrides,
    colors: {
      __proto__: null,
      ...base.colors,
      ...overrides.colors
    },
    effects: overrides.effects ? {
      __proto__: null,
      ...base.effects,
      ...overrides.effects,
      spinner: overrides.effects.spinner !== void 0 ? {
        __proto__: null,
        ...base.effects?.spinner,
        ...overrides.effects.spinner
      } : base.effects?.spinner,
      shimmer: overrides.effects.shimmer !== void 0 ? {
        __proto__: null,
        ...base.effects?.shimmer,
        ...overrides.effects.shimmer
      } : base.effects?.shimmer,
      pulse: overrides.effects.pulse !== void 0 ? {
        __proto__: null,
        ...base.effects?.pulse,
        ...overrides.effects.pulse
      } : base.effects?.pulse
    } : base.effects,
    meta: overrides.meta ? {
      __proto__: null,
      ...base.meta,
      ...overrides.meta
    } : base.meta
  };
}
function resolveColor(value, colors) {
  if (typeof value === "string") {
    if (value === "primary") {
      return colors.primary;
    }
    if (value === "secondary") {
      return colors.secondary ?? colors.primary;
    }
    if (value === "inherit") {
      return "inherit";
    }
    if (value === "rainbow") {
      return RAINBOW_GRADIENT;
    }
    return value;
  }
  return value;
}
function resolveShimmerColor(value, theme) {
  if (!value) {
    return "inherit";
  }
  if (value === "rainbow") {
    return RAINBOW_GRADIENT;
  }
  if (value === "inherit") {
    return "inherit";
  }
  if ((0, import_array.ArrayIsArray)(value)) {
    if (value.length > 0 && (0, import_array.ArrayIsArray)(value[0])) {
      return value;
    }
    return value;
  }
  return resolveColor(value, theme.colors);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  RAINBOW_GRADIENT,
  createTheme,
  extendTheme,
  resolveColor,
  resolveShimmerColor
});
