/**
 * 平台配置映射
 */
export const PLATFORM_CONFIGS = {
    playcraft: {
        sizeLimit: Infinity, // 无大小限制
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        outputFileName: 'index.html',
        includeSourcemap: true, // 通用构建包含 sourcemap
        imageQuality: {
            jpg: 85,
            png: [0.8, 0.9],
            webp: 85,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.9,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true, // 使用 IIFE 确保 pc 全局可用，避免 ESM 模块作用域问题
        },
        playable: {
            patchXhrOut: false,
            inlineGameScripts: false,
            compressEngine: false,
            compressConfigJson: false,
            configJsonInline: false,
            externFiles: true, // 允许外部文件
            mraidSupport: false,
            snapchatCta: false,
        },
    },
    facebook: {
        sizeLimit: 5 * 1024 * 1024, // 5MB（HTML/ZIP 总包体）
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['fbPlayableAd'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true, // Facebook 支持现代浏览器特性
            preferIIFE: true, // 但推荐使用 IIFE（更好的兼容性）
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            compressEngine: false, // 关闭引擎压缩，便于调试
            configJsonInline: true,
        },
    },
    snapchat: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid', 'snapchatCta'],
        outputFileName: 'ad.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 80,
            png: [0.75, 0.85],
            webp: 80,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.85,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true, // Snapchat 推荐 IIFE
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true,
            mraidSupport: true,
            snapchatCta: true,
        },
    },
    ironsource: {
        sizeLimit: 5 * 1024 * 1024, // 5MB（修正）
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid', 'dapi'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            configJsonInline: true,
            mraidSupport: true,
        },
    },
    applovin: {
        sizeLimit: 5 * 1024 * 1024, // 5MB（修正）
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            configJsonInline: true,
            mraidSupport: true,
        },
    },
    google: {
        sizeLimit: 5 * 1024 * 1024, // 5MB（修正）
        outputFormat: 'html', // 与 GoogleAdapter / CLI 默认一致；需要 ZIP 时显式传 format
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['exitApi'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true, // 使用 IIFE 格式确保正确打包（原生 ESM 有兼容性问题）
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true,
        },
    },
    tiktok: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['pangleSdk'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 80,
            png: [0.75, 0.85],
            webp: 80,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.85,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true,
        },
    },
    unity: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid3'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            configJsonInline: true,
            mraidSupport: true,
        },
    },
    liftoff: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true,
            mraidSupport: true,
        },
    },
    moloco: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['fbPlayableAd'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            configJsonInline: true,
        },
    },
    bigo: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['bigoSdk'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 80,
            png: [0.75, 0.85],
            webp: 80,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.85,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true,
        },
    },
    inmobi: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true,
            mraidSupport: true,
        },
    },
    adikteev: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mraid3'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            configJsonInline: true,
            mraidSupport: true,
        },
    },
    remerge: {
        sizeLimit: 5 * 1024 * 1024, // 5MB
        outputFormat: 'html',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['fbPlayableAd'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 75,
            png: [0.7, 0.8],
            webp: 75,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.8,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true,
        },
        playable: {
            patchXhrOut: true,
            inlineGameScripts: true,
            configJsonInline: true,
        },
    },
    mintegral: {
        sizeLimit: 5 * 1024 * 1024, // 5MB (ZIP)
        outputFormat: 'zip',
        minifyCSS: true,
        minifyJS: true,
        compressImages: false, // 禁用图片压缩，原图输出效果更好
        compressModels: true,
        injectScripts: ['mintegralSdk'],
        outputFileName: 'index.html',
        includeSourcemap: false,
        imageQuality: {
            jpg: 80,
            png: [0.75, 0.85],
            webp: 80,
        },
        modelCompression: {
            method: 'draco',
            quality: 0.85,
        },
        esmSupport: {
            enabled: true,
            preferIIFE: true, // Mintegral 推荐 IIFE 确保兼容性
        },
        playable: {
            inlineGameScripts: true,
            externFiles: true, // Mintegral ZIP 支持外部文件（但非 JS/HTML 资源需 base64）
        },
    },
};
