import {
  copyRichTextData
} from "@makeswift/controls";
import { Types as PropControllerTypes } from "@makeswift/prop-controllers";
import { isLegacyDescriptor } from "../prop-controllers/descriptors";
import { copy as propControllerCopy } from "../prop-controllers/copy";
import { DELETED_PROP_CONTROLLER_TYPES } from "../prop-controllers/deleted";
function copy(definition, value, context) {
  if (!isLegacyDescriptor(definition)) {
    return definition.copyData(value, context);
  }
  switch (definition.type) {
    case PropControllerTypes.Backgrounds:
    case PropControllerTypes.Grid:
    case PropControllerTypes.NavigationLinks:
    case PropControllerTypes.Link:
    case PropControllerTypes.Shadows:
    case PropControllerTypes.Image:
    case PropControllerTypes.Images:
    case PropControllerTypes.ResponsiveColor:
    case PropControllerTypes.TableFormFields:
    case PropControllerTypes.Table:
    case PropControllerTypes.Border:
    case PropControllerTypes.ElementID:
      return propControllerCopy(definition, value, context);
    case DELETED_PROP_CONTROLLER_TYPES.RichText:
      return copyRichTextData(value, context);
    default:
      return value;
  }
}
function merge(definition, a, b = a, context) {
  if (!isLegacyDescriptor(definition)) {
    return definition.mergeData(a, b, context);
  }
  switch (definition.type) {
    default:
      return b;
  }
}
function getTranslatableData(definition, data) {
  if (!isLegacyDescriptor(definition)) {
    return definition.getTranslatableData(data);
  }
  switch (definition.type) {
    case PropControllerTypes.TextInput:
    case PropControllerTypes.TextArea:
      return data;
    default:
      return null;
  }
}
export {
  copy,
  getTranslatableData,
  merge
};
//# sourceMappingURL=control.js.map