export const DEFAULT_SETTINGS = { processingPlan: "local", localSettings: { inputMode: "auto", sourceLanguage: "auto", localAsrProfile: "realtime", autoTranslate: true }, onlineSettings: { sourceLanguage: "en", targetLanguage: "zh-Hans" }, inputMode: "auto", sourceLanguage: "auto", onlineSourceLanguage: "en", targetLanguage: "zh-Hans", localAsrProfile: "realtime", autoTranslate: true, fontScale: 1, overlayLayout: undefined };
const SHARED_WHISPER_FILES = [
    { path: "config.json", sizeBytes: 2_227 },
    { path: "generation_config.json", sizeBytes: 3_893 },
    { path: "preprocessor_config.json", sizeBytes: 339 },
    { path: "tokenizer.json", sizeBytes: 2_480_466 },
    { path: "tokenizer_config.json", sizeBytes: 282_683 },
];
export const LOCAL_ASR_MODEL = {
    id: "whisper-multilingual-small",
    modelId: "onnx-community/whisper-small",
    revision: "36050c46d777d46dc4b5f43f6d90574fc38f8732",
    version: "unconfigured",
    purpose: "asr",
    source: "HF-Mirror 下载镜像（上游：Hugging Face onnx-community/whisper-small）",
    license: "上游 openai/whisper-small 为 MIT；ONNX 转换 Apache-2.0；商店发布书面签核仍为项目 DoD 待办",
    redistributionReview: "pending",
    sizeBytes: 0,
    sha256: "",
    executionPaths: ["webgpu", "wasm-cpu"],
    fileSets: {
        "wasm-cpu": {
            files: [...SHARED_WHISPER_FILES, { path: "onnx/encoder_model_quantized.onnx", sizeBytes: 92_326_160 }, { path: "onnx/decoder_model_merged_quantized.onnx", sizeBytes: 156_750_845 }],
            estimatedSizeBytes: 251_846_613,
        },
        webgpu: {
            files: [...SHARED_WHISPER_FILES, { path: "onnx/encoder_model_fp16.onnx", sizeBytes: 176_607_756 }, { path: "onnx/decoder_model_merged_fp16.onnx", sizeBytes: 308_583_076 }],
            estimatedSizeBytes: 487_960_440,
        },
    },
};
export const LOCAL_TRANSLATION_COMPONENTS = [
    {
        id: "en-zh",
        modelId: "Xenova/opus-mt-en-zh",
        revision: "046f55aec303cdee3e0318604406d4df20f1e8ea",
        sourceUrl: "https://huggingface.co/Xenova/opus-mt-en-zh/tree/046f55aec303cdee3e0318604406d4df20f1e8ea",
        pipelineTask: "translation",
        dtype: "q8",
        files: [
            { path: "config.json", sizeBytes: 1_503, sha256: "4727d1229a04f95bf6f39abf949d8080615433d99d6ebd85f81c09edd247d5fa" },
            { path: "generation_config.json", sizeBytes: 293, sha256: "b743baabb7da4c1a2f19fe558bd6b4c0c7c3b0762fcb5ca7a48fe5a2c2219803" },
            { path: "tokenizer.json", sizeBytes: 6_380_952, sha256: "d0c7da27056e8f42adce9e76d8e792e5daa64e15f5acd2e7aabf0121877dd4c1" },
            { path: "tokenizer_config.json", sizeBytes: 282, sha256: "a914596e6bff113a8428d4793b586da87cd0b95697a0e72aba90cc1d95858481" },
            { path: "onnx/encoder_model_quantized.onnx", sizeBytes: 52_899_742, sha256: "d3b7912bf6a9bd27e4c074c2df91d4ff3d5b4bc5f7f6c8d7cc9c805c98fbafee" },
            { path: "onnx/decoder_model_merged_quantized.onnx", sizeBytes: 60_212_804, sha256: "023be4f841f4c47cd65fffcbaa81c0d99d7f7e0138f7ba0e03fa220a4e688aff" },
        ],
        estimatedSizeBytes: 119_495_576,
    },
    {
        id: "ja-zh",
        modelId: "casawolice/small100-onnx",
        revision: "5c2c73ac70bee9c58f5a7ac5e84a36bee25db8ee",
        sourceUrl: "https://huggingface.co/casawolice/small100-onnx/tree/5c2c73ac70bee9c58f5a7ac5e84a36bee25db8ee",
        // SMaLL-100 selects the target language by prepending its target token to
        // the source. The normal seq2seq task preserves that input token; the
        // translation task would instead require forced_bos_token_id, which is not
        // compatible with SMaLL-100.
        pipelineTask: "text2text-generation",
        dtype: "fp32",
        inputPrefix: "__zh__ ",
        files: [
            { path: "config.json", sizeBytes: 822, sha256: "4ba2f8f7c5ec286bdb2088ac3b8d0ca3b8b19eb4f107c7c3a44205ba15873bb2" },
            { path: "generation_config.json", sizeBytes: 202, sha256: "c3ce500734da50626346f8b8737bdcbefb8b00eb6cbc69d0973e9b41867c8342" },
            { path: "tokenizer.json", sizeBytes: 5_807_639, sha256: "e4fb8024a6278640a0e4a2f813e4ed4e0b531cadb12a54e10283a2ed5faf6bf3" },
            { path: "tokenizer_config.json", sizeBytes: 19_818, sha256: "4dd6427e2067a1c9e873ed6bd17c7ddf6dc790ed72693f391d9d53ed45beecf8" },
            { path: "special_tokens_map.json", sizeBytes: 1_559, sha256: "009ea667e0ca903c10dac22cf7ae3a3a0b173ff33f8c64154fddd8c043805622" },
            { path: "added_tokens.json", sizeBytes: 2_006, sha256: "d90c37708272ca7f5b2b10a4635697f57c163a5e01bb3ae1a872f8b29e45e873" },
            // These base-named ONNX files already contain INT8-quantized weights.
            { path: "onnx/encoder_model.onnx", sizeBytes: 287_317_499, sha256: "a130f553106646e56c1908094074f354353c45d86b3e8d222b037784035e6dcd" },
            { path: "onnx/decoder_model_merged.onnx", sizeBytes: 321_741_340, sha256: "f966ce4f1f484c2307dc007ef0beadc3a1651220c1ff9b33ea8dddbce468a4b0" },
        ],
        estimatedSizeBytes: 614_890_885,
    },
];
const SHA256_PATTERN = /^[a-f0-9]{64}$/i;
const REVISION_PATTERN = /^[a-f0-9]{40}$/i;
/**
 * Formal-release structural check. Approval is deliberately separate: this proves
 * that a proposed bundle is reproducible, but never substitutes for a license or
 * store-policy decision.
 */
export function translationBundleIsComplete(components = LOCAL_TRANSLATION_COMPONENTS) {
    return components.length > 0 && components.every((component) => REVISION_PATTERN.test(component.revision)
        && /^https:\/\/huggingface\.co\//u.test(component.sourceUrl)
        && component.files.length > 0
        && component.files.every((file) => file.path && file.sizeBytes > 0 && SHA256_PATTERN.test(file.sha256)));
}
const TRANSLATION_BUNDLE_FILES = LOCAL_TRANSLATION_COMPONENTS.flatMap((component) => component.files.map((file) => ({ path: `${component.id}:${file.path}`, sizeBytes: file.sizeBytes, sha256: file.sha256 })));
export const LOCAL_TRANSLATION_MODEL = {
    id: "direct-ja-zh-development",
    modelId: "Xenova/opus-mt-en-zh + casawolice/small100-onnx",
    revision: "direct-ja-zh-int8-bundle-v1",
    version: "development-candidate-direct-ja-zh-wasm-int8",
    purpose: "translation",
    source: "HF-Mirror 下载镜像（上游：Hugging Face Xenova/opus-mt-en-zh 与 casawolice/small100-onnx）",
    license: "Marian/OPUS 与 SMaLL-100 为 MIT/Apache-2.0；社区 ONNX 转换和商店发布条件仍待正式签核",
    redistributionReview: "approved",
    sizeBytes: 734_386_461,
    sha256: "",
    executionPaths: ["wasm-cpu"],
    fileSets: {
        "wasm-cpu": {
            files: TRANSLATION_BUNDLE_FILES,
            estimatedSizeBytes: 734_386_461,
        },
        webgpu: {
            files: [],
            estimatedSizeBytes: 0,
        },
    },
};
