"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 gradient_to_background_image_exports = {};
__export(gradient_to_background_image_exports, {
  gradientToBackgroundImage: () => gradientToBackgroundImage
});
module.exports = __toCommonJS(gradient_to_background_image_exports);
var import_types = require("@wix/ambassador-ricos-v1-ricos-conversation/types");
var import_color_utils = require("./color-utils.js");
const gradientToBackgroundImage = (gradient) => {
  if (gradient?.type === import_types.GradientType.LINEAR) {
    return `linear-gradient(${gradient.linearOptions}deg, ${[...gradient.stops ?? []].sort((a, b) => (a.position ?? 0) - (b.position ?? 0)).map(
      (stop) => `${(0, import_color_utils.hexToRgba)(stop.color ?? void 0, (stop.opacity ?? 1) * 100)} ${((stop.position ?? 0) * 100).toFixed(2)}%`
    ).join(", ")})`;
  }
  if (gradient?.type === import_types.GradientType.RADIAL) {
    return `radial-gradient(circle at ${gradient.radialOptions?.x}% ${gradient.radialOptions?.y}%, ${[...gradient.stops ?? []].sort((a, b) => (a.position ?? 0) - (b.position ?? 0)).map(
      (stop) => `${(0, import_color_utils.hexToRgba)(stop.color ?? void 0, (stop.opacity ?? 1) * 100)} ${((stop.position ?? 0) * 100).toFixed(2)}%`
    ).join(", ")})`;
  }
  return "";
};
//# sourceMappingURL=gradient-to-background-image.js.map
