"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExportImageFormats = getExportImageFormats;
const get_prop_1 = require("../../../objects/get-prop");
const serviceDownloadFormat_1 = require("../../enums/serviceDownloadFormat");
const _types_1 = require("../_types");
/**
 * @private
 * Returns all the download formats that are exposed by an Image Service via the /exportImage operation.
 */
function getExportImageFormats(entity) {
    const serverVersion = (0, get_prop_1.getProp)(entity, "extendedProps.server.currentVersion") || 0;
    // NOTE: We have to imperatively exclude formats based on the server version
    // because there is no other way to determine which formats are supported.
    // See the EXPORT_IMAGE_FORMATS constant for notes on individual formats.
    const supportedFormats = (serverVersion < 10.2
        ? _types_1.EXPORT_IMAGE_FORMATS.filter((f) => f !== serviceDownloadFormat_1.ServiceDownloadFormat.PNG32)
        : _types_1.EXPORT_IMAGE_FORMATS);
    return supportedFormats.map((format) => ({
        type: "dynamic",
        format,
    }));
}
//# sourceMappingURL=getExportImageFormats.js.map