"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 control_exports = {};
__export(control_exports, {
  copy: () => copy,
  getTranslatableData: () => getTranslatableData,
  merge: () => merge
});
module.exports = __toCommonJS(control_exports);
var import_controls = require("@makeswift/controls");
var import_prop_controllers = require("@makeswift/prop-controllers");
var import_descriptors = require("../prop-controllers/descriptors");
var import_copy = require("../prop-controllers/copy");
var import_deleted = require("../prop-controllers/deleted");
function copy(definition, value, context) {
  if (!(0, import_descriptors.isLegacyDescriptor)(definition)) {
    return definition.copyData(value, context);
  }
  switch (definition.type) {
    case import_prop_controllers.Types.Backgrounds:
    case import_prop_controllers.Types.Grid:
    case import_prop_controllers.Types.NavigationLinks:
    case import_prop_controllers.Types.Link:
    case import_prop_controllers.Types.Shadows:
    case import_prop_controllers.Types.Image:
    case import_prop_controllers.Types.Images:
    case import_prop_controllers.Types.ResponsiveColor:
    case import_prop_controllers.Types.TableFormFields:
    case import_prop_controllers.Types.Table:
    case import_prop_controllers.Types.Border:
    case import_prop_controllers.Types.ElementID:
      return (0, import_copy.copy)(definition, value, context);
    case import_deleted.DELETED_PROP_CONTROLLER_TYPES.RichText:
      return (0, import_controls.copyRichTextData)(value, context);
    default:
      return value;
  }
}
function merge(definition, a, b = a, context) {
  if (!(0, import_descriptors.isLegacyDescriptor)(definition)) {
    return definition.mergeData(a, b, context);
  }
  switch (definition.type) {
    default:
      return b;
  }
}
function getTranslatableData(definition, data) {
  if (!(0, import_descriptors.isLegacyDescriptor)(definition)) {
    return definition.getTranslatableData(data);
  }
  switch (definition.type) {
    case import_prop_controllers.Types.TextInput:
    case import_prop_controllers.Types.TextArea:
      return data;
    default:
      return null;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  copy,
  getTranslatableData,
  merge
});
//# sourceMappingURL=control.js.map