"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 common_exports = {};
__export(common_exports, {
  FileSource: () => FileSource,
  Gradient: () => Gradient,
  Gradient_Stop: () => Gradient_Stop,
  Link: () => Link,
  Link_Rel: () => Link_Rel,
  Media: () => Media,
  Oembed: () => Oembed,
  PlaybackOptions: () => PlaybackOptions,
  PluginContainerData: () => PluginContainerData,
  PluginContainerData_Height: () => PluginContainerData_Height,
  PluginContainerData_Spoiler: () => PluginContainerData_Spoiler,
  PluginContainerData_Width: () => PluginContainerData_Width,
  TextStyle: () => TextStyle,
  gradient_TypeFromJSON: () => gradient_TypeFromJSON,
  gradient_TypeToJSON: () => gradient_TypeToJSON,
  link_TargetFromJSON: () => link_TargetFromJSON,
  link_TargetToJSON: () => link_TargetToJSON,
  pluginContainerData_AlignmentFromJSON: () => pluginContainerData_AlignmentFromJSON,
  pluginContainerData_AlignmentToJSON: () => pluginContainerData_AlignmentToJSON,
  pluginContainerData_Width_TypeFromJSON: () => pluginContainerData_Width_TypeFromJSON,
  pluginContainerData_Width_TypeToJSON: () => pluginContainerData_Width_TypeToJSON,
  textStyle_TextAlignmentFromJSON: () => textStyle_TextAlignmentFromJSON,
  textStyle_TextAlignmentToJSON: () => textStyle_TextAlignmentToJSON
});
module.exports = __toCommonJS(common_exports);
var import_common_enums = require("./common.enums.js");
function textStyle_TextAlignmentFromJSON(object) {
  switch (object) {
    case 0:
    case "AUTO":
      return import_common_enums.TextStyle_TextAlignment.AUTO;
    case 1:
    case "LEFT":
      return import_common_enums.TextStyle_TextAlignment.LEFT;
    case 2:
    case "RIGHT":
      return import_common_enums.TextStyle_TextAlignment.RIGHT;
    case 3:
    case "CENTER":
      return import_common_enums.TextStyle_TextAlignment.CENTER;
    case 4:
    case "JUSTIFY":
      return import_common_enums.TextStyle_TextAlignment.JUSTIFY;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_common_enums.TextStyle_TextAlignment.UNRECOGNIZED;
  }
}
function textStyle_TextAlignmentToJSON(object) {
  switch (object) {
    case import_common_enums.TextStyle_TextAlignment.AUTO:
      return "AUTO";
    case import_common_enums.TextStyle_TextAlignment.LEFT:
      return "LEFT";
    case import_common_enums.TextStyle_TextAlignment.RIGHT:
      return "RIGHT";
    case import_common_enums.TextStyle_TextAlignment.CENTER:
      return "CENTER";
    case import_common_enums.TextStyle_TextAlignment.JUSTIFY:
      return "JUSTIFY";
    default:
      return "UNKNOWN";
  }
}
function link_TargetFromJSON(object) {
  switch (object) {
    case 0:
    case "SELF":
      return import_common_enums.Link_Target.SELF;
    case 1:
    case "BLANK":
      return import_common_enums.Link_Target.BLANK;
    case 2:
    case "PARENT":
      return import_common_enums.Link_Target.PARENT;
    case 3:
    case "TOP":
      return import_common_enums.Link_Target.TOP;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_common_enums.Link_Target.UNRECOGNIZED;
  }
}
function link_TargetToJSON(object) {
  switch (object) {
    case import_common_enums.Link_Target.SELF:
      return "SELF";
    case import_common_enums.Link_Target.BLANK:
      return "BLANK";
    case import_common_enums.Link_Target.PARENT:
      return "PARENT";
    case import_common_enums.Link_Target.TOP:
      return "TOP";
    default:
      return "UNKNOWN";
  }
}
function pluginContainerData_AlignmentFromJSON(object) {
  switch (object) {
    case 0:
    case "CENTER":
      return import_common_enums.PluginContainerData_Alignment.CENTER;
    case 1:
    case "LEFT":
      return import_common_enums.PluginContainerData_Alignment.LEFT;
    case 2:
    case "RIGHT":
      return import_common_enums.PluginContainerData_Alignment.RIGHT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_common_enums.PluginContainerData_Alignment.UNRECOGNIZED;
  }
}
function pluginContainerData_AlignmentToJSON(object) {
  switch (object) {
    case import_common_enums.PluginContainerData_Alignment.CENTER:
      return "CENTER";
    case import_common_enums.PluginContainerData_Alignment.LEFT:
      return "LEFT";
    case import_common_enums.PluginContainerData_Alignment.RIGHT:
      return "RIGHT";
    default:
      return "UNKNOWN";
  }
}
function pluginContainerData_Width_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "CONTENT":
      return import_common_enums.PluginContainerData_Width_Type.CONTENT;
    case 1:
    case "SMALL":
      return import_common_enums.PluginContainerData_Width_Type.SMALL;
    case 2:
    case "ORIGINAL":
      return import_common_enums.PluginContainerData_Width_Type.ORIGINAL;
    case 3:
    case "FULL_WIDTH":
      return import_common_enums.PluginContainerData_Width_Type.FULL_WIDTH;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_common_enums.PluginContainerData_Width_Type.UNRECOGNIZED;
  }
}
function pluginContainerData_Width_TypeToJSON(object) {
  switch (object) {
    case import_common_enums.PluginContainerData_Width_Type.CONTENT:
      return "CONTENT";
    case import_common_enums.PluginContainerData_Width_Type.SMALL:
      return "SMALL";
    case import_common_enums.PluginContainerData_Width_Type.ORIGINAL:
      return "ORIGINAL";
    case import_common_enums.PluginContainerData_Width_Type.FULL_WIDTH:
      return "FULL_WIDTH";
    default:
      return "UNKNOWN";
  }
}
function gradient_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "LINEAR":
      return import_common_enums.Gradient_Type.LINEAR;
    case 1:
    case "RADIAL":
      return import_common_enums.Gradient_Type.RADIAL;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_common_enums.Gradient_Type.UNRECOGNIZED;
  }
}
function gradient_TypeToJSON(object) {
  switch (object) {
    case import_common_enums.Gradient_Type.LINEAR:
      return "LINEAR";
    case import_common_enums.Gradient_Type.RADIAL:
      return "RADIAL";
    default:
      return "UNKNOWN";
  }
}
const baseTextStyle = { textAlignment: import_common_enums.TextStyle_TextAlignment.AUTO };
const TextStyle = {
  fromJSON(object) {
    const message = { ...baseTextStyle };
    message.textAlignment = object.textAlignment !== void 0 && object.textAlignment !== null ? textStyle_TextAlignmentFromJSON(object.textAlignment) : import_common_enums.TextStyle_TextAlignment.AUTO;
    message.lineHeight = object.lineHeight !== void 0 && object.lineHeight !== null ? String(object.lineHeight) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.textAlignment !== void 0 && (obj.textAlignment = textStyle_TextAlignmentToJSON(
      message.textAlignment
    ));
    message.lineHeight !== void 0 && (obj.lineHeight = message.lineHeight);
    return obj;
  }
};
const baseLink = { target: import_common_enums.Link_Target.SELF };
const Link = {
  fromJSON(object) {
    const message = { ...baseLink };
    message.url = object.url !== void 0 && object.url !== null ? String(object.url) : void 0;
    message.anchor = object.anchor !== void 0 && object.anchor !== null ? String(object.anchor) : void 0;
    message.target = object.target !== void 0 && object.target !== null ? link_TargetFromJSON(object.target) : import_common_enums.Link_Target.SELF;
    message.rel = object.rel !== void 0 && object.rel !== null ? Link_Rel.fromJSON(object.rel) : void 0;
    message.customData = object.customData !== void 0 && object.customData !== null ? String(object.customData) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.url !== void 0 && (obj.url = message.url);
    message.anchor !== void 0 && (obj.anchor = message.anchor);
    message.target !== void 0 && (obj.target = link_TargetToJSON(message.target));
    message.rel !== void 0 && (obj.rel = message.rel ? Link_Rel.toJSON(message.rel) : void 0);
    message.customData !== void 0 && (obj.customData = message.customData);
    return obj;
  }
};
const baseLink_Rel = {};
const Link_Rel = {
  fromJSON(object) {
    const message = { ...baseLink_Rel };
    message.nofollow = object.nofollow !== void 0 && object.nofollow !== null ? Boolean(object.nofollow) : void 0;
    message.sponsored = object.sponsored !== void 0 && object.sponsored !== null ? Boolean(object.sponsored) : void 0;
    message.ugc = object.ugc !== void 0 && object.ugc !== null ? Boolean(object.ugc) : void 0;
    message.noreferrer = object.noreferrer !== void 0 && object.noreferrer !== null ? Boolean(object.noreferrer) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.nofollow !== void 0 && (obj.nofollow = message.nofollow);
    message.sponsored !== void 0 && (obj.sponsored = message.sponsored);
    message.ugc !== void 0 && (obj.ugc = message.ugc);
    message.noreferrer !== void 0 && (obj.noreferrer = message.noreferrer);
    return obj;
  }
};
const basePluginContainerData = {
  alignment: import_common_enums.PluginContainerData_Alignment.CENTER
};
const PluginContainerData = {
  fromJSON(object) {
    const message = { ...basePluginContainerData };
    message.width = object.width !== void 0 && object.width !== null ? PluginContainerData_Width.fromJSON(object.width) : void 0;
    message.alignment = object.alignment !== void 0 && object.alignment !== null ? pluginContainerData_AlignmentFromJSON(object.alignment) : import_common_enums.PluginContainerData_Alignment.CENTER;
    message.spoiler = object.spoiler !== void 0 && object.spoiler !== null ? PluginContainerData_Spoiler.fromJSON(object.spoiler) : void 0;
    message.height = object.height !== void 0 && object.height !== null ? PluginContainerData_Height.fromJSON(object.height) : void 0;
    message.textWrap = object.textWrap !== void 0 && object.textWrap !== null ? Boolean(object.textWrap) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.width !== void 0 && (obj.width = message.width ? PluginContainerData_Width.toJSON(message.width) : void 0);
    message.alignment !== void 0 && (obj.alignment = pluginContainerData_AlignmentToJSON(message.alignment));
    message.spoiler !== void 0 && (obj.spoiler = message.spoiler ? PluginContainerData_Spoiler.toJSON(message.spoiler) : void 0);
    message.height !== void 0 && (obj.height = message.height ? PluginContainerData_Height.toJSON(message.height) : void 0);
    message.textWrap !== void 0 && (obj.textWrap = message.textWrap);
    return obj;
  }
};
const basePluginContainerData_Spoiler = {};
const PluginContainerData_Spoiler = {
  fromJSON(object) {
    const message = {
      ...basePluginContainerData_Spoiler
    };
    message.enabled = object.enabled !== void 0 && object.enabled !== null ? Boolean(object.enabled) : void 0;
    message.description = object.description !== void 0 && object.description !== null ? String(object.description) : void 0;
    message.buttonText = object.buttonText !== void 0 && object.buttonText !== null ? String(object.buttonText) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.enabled !== void 0 && (obj.enabled = message.enabled);
    message.description !== void 0 && (obj.description = message.description);
    message.buttonText !== void 0 && (obj.buttonText = message.buttonText);
    return obj;
  }
};
const basePluginContainerData_Width = {};
const PluginContainerData_Width = {
  fromJSON(object) {
    const message = {
      ...basePluginContainerData_Width
    };
    message.size = object.size !== void 0 && object.size !== null ? pluginContainerData_Width_TypeFromJSON(object.size) : void 0;
    message.custom = object.custom !== void 0 && object.custom !== null ? String(object.custom) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.size !== void 0 && (obj.size = message.size !== void 0 ? pluginContainerData_Width_TypeToJSON(message.size) : void 0);
    message.custom !== void 0 && (obj.custom = message.custom);
    return obj;
  }
};
const basePluginContainerData_Height = {};
const PluginContainerData_Height = {
  fromJSON(object) {
    const message = {
      ...basePluginContainerData_Height
    };
    message.custom = object.custom !== void 0 && object.custom !== null ? String(object.custom) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.custom !== void 0 && (obj.custom = message.custom);
    return obj;
  }
};
const baseFileSource = {};
const FileSource = {
  fromJSON(object) {
    const message = { ...baseFileSource };
    message.url = object.url !== void 0 && object.url !== null ? String(object.url) : void 0;
    message.custom = object.custom !== void 0 && object.custom !== null ? String(object.custom) : void 0;
    message.id = object.id !== void 0 && object.id !== null ? String(object.id) : void 0;
    message.private = object.private !== void 0 && object.private !== null ? Boolean(object.private) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.url !== void 0 && (obj.url = message.url);
    message.custom !== void 0 && (obj.custom = message.custom);
    message.id !== void 0 && (obj.id = message.id);
    message.private !== void 0 && (obj.private = message.private);
    return obj;
  }
};
const baseMedia = {};
const Media = {
  fromJSON(object) {
    const message = { ...baseMedia };
    message.src = object.src !== void 0 && object.src !== null ? FileSource.fromJSON(object.src) : void 0;
    message.width = object.width !== void 0 && object.width !== null ? Number(object.width) : void 0;
    message.height = object.height !== void 0 && object.height !== null ? Number(object.height) : void 0;
    message.duration = object.duration !== void 0 && object.duration !== null ? Number(object.duration) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.src !== void 0 && (obj.src = message.src ? FileSource.toJSON(message.src) : void 0);
    message.width !== void 0 && (obj.width = message.width);
    message.height !== void 0 && (obj.height = message.height);
    message.duration !== void 0 && (obj.duration = message.duration);
    return obj;
  }
};
const basePlaybackOptions = {};
const PlaybackOptions = {
  fromJSON(object) {
    const message = { ...basePlaybackOptions };
    message.autoPlay = object.autoPlay !== void 0 && object.autoPlay !== null ? Boolean(object.autoPlay) : void 0;
    message.playInLoop = object.playInLoop !== void 0 && object.playInLoop !== null ? Boolean(object.playInLoop) : void 0;
    message.showControls = object.showControls !== void 0 && object.showControls !== null ? Boolean(object.showControls) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.autoPlay !== void 0 && (obj.autoPlay = message.autoPlay);
    message.playInLoop !== void 0 && (obj.playInLoop = message.playInLoop);
    message.showControls !== void 0 && (obj.showControls = message.showControls);
    return obj;
  }
};
const baseOembed = {};
const Oembed = {
  fromJSON(object) {
    const message = { ...baseOembed };
    message.type = object.type !== void 0 && object.type !== null ? String(object.type) : void 0;
    message.width = object.width !== void 0 && object.width !== null ? Number(object.width) : void 0;
    message.height = object.height !== void 0 && object.height !== null ? Number(object.height) : void 0;
    message.title = object.title !== void 0 && object.title !== null ? String(object.title) : void 0;
    message.url = object.url !== void 0 && object.url !== null ? String(object.url) : void 0;
    message.html = object.html !== void 0 && object.html !== null ? String(object.html) : void 0;
    message.authorName = object.authorName !== void 0 && object.authorName !== null ? String(object.authorName) : void 0;
    message.authorUrl = object.authorUrl !== void 0 && object.authorUrl !== null ? String(object.authorUrl) : void 0;
    message.providerName = object.providerName !== void 0 && object.providerName !== null ? String(object.providerName) : void 0;
    message.providerUrl = object.providerUrl !== void 0 && object.providerUrl !== null ? String(object.providerUrl) : void 0;
    message.thumbnailUrl = object.thumbnailUrl !== void 0 && object.thumbnailUrl !== null ? String(object.thumbnailUrl) : void 0;
    message.thumbnailWidth = object.thumbnailWidth !== void 0 && object.thumbnailWidth !== null ? String(object.thumbnailWidth) : void 0;
    message.thumbnailHeight = object.thumbnailHeight !== void 0 && object.thumbnailHeight !== null ? String(object.thumbnailHeight) : void 0;
    message.videoUrl = object.videoUrl !== void 0 && object.videoUrl !== null ? String(object.videoUrl) : void 0;
    message.version = object.version !== void 0 && object.version !== null ? String(object.version) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.type !== void 0 && (obj.type = message.type);
    message.width !== void 0 && (obj.width = message.width);
    message.height !== void 0 && (obj.height = message.height);
    message.title !== void 0 && (obj.title = message.title);
    message.url !== void 0 && (obj.url = message.url);
    message.html !== void 0 && (obj.html = message.html);
    message.authorName !== void 0 && (obj.authorName = message.authorName);
    message.authorUrl !== void 0 && (obj.authorUrl = message.authorUrl);
    message.providerName !== void 0 && (obj.providerName = message.providerName);
    message.providerUrl !== void 0 && (obj.providerUrl = message.providerUrl);
    message.thumbnailUrl !== void 0 && (obj.thumbnailUrl = message.thumbnailUrl);
    message.thumbnailWidth !== void 0 && (obj.thumbnailWidth = message.thumbnailWidth);
    message.thumbnailHeight !== void 0 && (obj.thumbnailHeight = message.thumbnailHeight);
    message.videoUrl !== void 0 && (obj.videoUrl = message.videoUrl);
    message.version !== void 0 && (obj.version = message.version);
    return obj;
  }
};
const baseGradient = { type: import_common_enums.Gradient_Type.LINEAR };
const Gradient = {
  fromJSON(object) {
    const message = { ...baseGradient };
    message.type = object.type !== void 0 && object.type !== null ? gradient_TypeFromJSON(object.type) : import_common_enums.Gradient_Type.LINEAR;
    message.stops = (object.stops ?? []).map(
      (e) => Gradient_Stop.fromJSON(e)
    );
    message.angle = object.angle !== void 0 && object.angle !== null ? Number(object.angle) : void 0;
    message.centerX = object.centerX !== void 0 && object.centerX !== null ? Number(object.centerX) : void 0;
    message.centerY = object.centerY !== void 0 && object.centerY !== null ? Number(object.centerY) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.type !== void 0 && (obj.type = gradient_TypeToJSON(message.type));
    if (message.stops) {
      obj.stops = message.stops.map(
        (e) => e ? Gradient_Stop.toJSON(e) : void 0
      );
    } else {
      obj.stops = [];
    }
    message.angle !== void 0 && (obj.angle = message.angle);
    message.centerX !== void 0 && (obj.centerX = message.centerX);
    message.centerY !== void 0 && (obj.centerY = message.centerY);
    return obj;
  }
};
const baseGradient_Stop = {};
const Gradient_Stop = {
  fromJSON(object) {
    const message = { ...baseGradient_Stop };
    message.color = object.color !== void 0 && object.color !== null ? String(object.color) : void 0;
    message.position = object.position !== void 0 && object.position !== null ? Number(object.position) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.color !== void 0 && (obj.color = message.color);
    message.position !== void 0 && (obj.position = message.position);
    return obj;
  }
};
//# sourceMappingURL=common.js.map
