import catalog from "./five-axis-machine-catalog.json" with { type: "json" }; const allowedStatus = new Set(["supported", "adapter-required", "identity-only"]); const allowedCoordinates = /^[XYZABCUVW]+$/; for (const item of catalog.cases) { if (!item.id || !item.label || !item.family || !item.kinematics || !allowedCoordinates.test(item.coordinates)) throw new Error("five_axis_catalog_invalid"); if (!Number.isInteger(item.joints) || item.joints < 5 || !allowedStatus.has(item.webWasm)) throw new Error("five_axis_catalog_case_invalid"); if (!Array.isArray(item.localCases) || item.localCases.length === 0 || !item.kinematicsSource) throw new Error("five_axis_catalog_sources_missing"); } if (new Set(catalog.cases.map((item) => item.id)).size !== catalog.cases.length) throw new Error("five_axis_catalog_duplicate"); export const FIVE_AXIS_CATALOG = Object.freeze(catalog); export const FIVE_AXIS_CASES = Object.freeze(catalog.cases.map((item) => Object.freeze(item))); export const FIVE_AXIS_STATUS_LABELS = Object.freeze({ supported: "Web/WASM 已支持", "adapter-required": "源码案例 · 待 WASM 运动学适配", "identity-only": "仅直角坐标基线 · 无非线性 RTCP" }); export const fiveAxisCase = (value) => FIVE_AXIS_CASES.find((item) => [item.id, item.coordinates, item.kinematics].includes(value)) ?? null;