export function createTemplateEditContext(template, baseline) { return { type: template.type || "template", id: template.id, name: template.name, revision: template.revision, readOnly: template.type === "animation" || Boolean(template.read_only ?? template.readOnly), baseline, }; } export function templateEditSnapshot(context, serializedScene) { if (!context) return null; return { type: context.type || "template", id: context.id, name: context.name, revision: context.revision, readOnly: Boolean(context.readOnly), dirty: serializedScene !== context.baseline, }; } export function sceneNeedsTemplateSave(context, serializedScene) { return !context || serializedScene !== context.baseline; }