AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(svg-to-pptx): restore flat authoring through round-trip sidecars
hugohe3cd8e3a6ad6eb
diff --git a/skills/ppt-master/scripts/authoring_roundtrip.py b/skills/ppt-master/scripts/authoring_roundtrip.pynew file mode 100644index 00000000..93a7efd2--- /dev/null+++ b/skills/ppt-master/scripts/authoring_roundtrip.py@@ -0,0 +1,1080 @@+#!/usr/bin/env python3+"""+PPT Master - Flat Authoring Round-trip Materializer++Materialize editable ``authoring-svg-flat/`` pages back into layered slide SVG+inputs for the existing source-preserving SVG-to-PPTX exporter. Unchanged+source objects recover their original round-trip metadata; edited objects stay+as authored SVG and are converted normally.++Usage:+ Imported by svg_to_pptx.py for ``-s <flat-authoring-dir> --roundtrip``.++Dependencies:+ None (standard library and sibling PPT Master modules only).+"""++from __future__ import annotations++import copy+import hashlib+import json+import re+import tempfile+from collections import Counter+from dataclasses import dataclass+from pathlib import Path+from typing import Any+from xml.etree import ElementTree as ET++from extract_svg_assets import extract_file+from slide_roster import discover_slide_svgs+from svg_authoring_view import (+ AUTHORING_MANIFEST_NAME,+ AUTHORING_SCHEMA,+ SOURCE_REF_ATTRIBUTE,+ project_svg_batch,+ semantic_subtree_sha256,+)+from svg_compatibility import normalize_single_child_group_filters+++SVG_NS = "http://www.w3.org/2000/svg"+XLINK_NS = "http://www.w3.org/1999/xlink"+VECTOR_INVENTORY_SCHEMA = "vector_asset_inventory.v1"+IMPORTED_ICON_NAMESPACE = "imported"+_URL_ID_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"\s]+)\1\s*\)")++ET.register_namespace("", SVG_NS)+ET.register_namespace("xlink", XLINK_NS)+++class AuthoringRoundtripError(RuntimeError):+ """Reject stale, ambiguous, or incomplete authoring round-trip input."""+++@dataclass(frozen=True)+class SourceRefRecord:+ source_path: tuple[int, ...]+ initial_authoring_subtree_sha256: str+++@dataclass(frozen=True)+class AuthoringDocument:+ name: str+ authoring_path: Path+ flat_source_path: Path+ layered_source_path: Path+ source_refs: dict[str, SourceRefRecord]+++@dataclass(frozen=True)+class VectorAssetRecord:+ icon: str+ asset_path: Path+ origin_document: str+ source_sha256: str+ expected_asset_sha256: str+ actual_asset_sha256: str++ @property+ def element_prefix(self) -> str:+ return self.icon.rsplit("/", 1)[-1]++ @property+ def baseline_key(self) -> str:+ stem = self.element_prefix+ match = re.search(r"(slide_\d+_ill\d+)$", stem)+ slot = match.group(1) if match else self.source_sha256+ return f"{self.origin_document}:{slot}"++ @property+ def unchanged(self) -> bool:+ return self.actual_asset_sha256 == self.expected_asset_sha256+++@dataclass(frozen=True)+class RefOccurrence:+ element: ET.Element+ asset: VectorAssetRecord | None+++@dataclass(frozen=True)+class AuthoringRoundtripResult:+ svg_files: tuple[Path, ...]+ report: dict[str, Any]+++def _local_name(name: object) -> str:+ return name.rsplit("}", 1)[-1] if isinstance(name, str) else ""+++def _parse_svg(path: Path) -> ET.Element:+ parser = ET.XMLParser(+ target=ET.TreeBuilder(insert_comments=True, insert_pis=True),+ )+ try:+ return ET.fromstring(path.read_bytes(), parser=parser)+ except (OSError, ET.ParseError) as exc:+ raise AuthoringRoundtripError(f"Cannot parse SVG {path}: {exc}") from exc+++def _load_json(path: Path, *, context: str) -> dict[str, Any]:+ try:+ payload = json.loads(path.read_text(encoding="utf-8"))+ except FileNotFoundError as exc:+ raise AuthoringRoundtripError(f"Missing {context}: {path}") from exc+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:+ raise AuthoringRoundtripError(f"Cannot read {context} {path}: {exc}") from exc+ if not isinstance(payload, dict):+ raise AuthoringRoundtripError(f"{context} must be a JSON object: {path}")+ return payload+++def _resolve_inside(root: Path, value: str, *, context: str) -> Path:+ path = (root / value).resolve()+ try:+ path.relative_to(root.resolve())+ except ValueError as exc:+ raise AuthoringRoundtripError(+ f"{context} resolves outside {root}: {value!r}"+ ) from exc+ return path+++def _sha256_file(path: Path) -> str:+ return hashlib.sha256(path.read_bytes()).hexdigest()+++def _source_element(root: ET.Element, path: tuple[int, ...]) -> ET.Element:+ element = root+ try:+ for index in path:+ element = list(element)[index]+ except (IndexError, TypeError) as exc:+ raise AuthoringRoundtripError(+ f"Source-ref path no longer resolves: {list(path)}"+ ) from exc+ return element+++def _source_identity(element: ET.Element) -> str | None:+ scope = element.get("data-pptx-shape-scope")+ shape_id = element.get("data-pptx-shape-id")+ if not scope or not shape_id:+ return None+ return f"{scope}:{shape_id}"+++def is_flat_authoring_bundle(authoring_dir: Path) -> bool:+ """Return whether a directory declares the supported flat authoring IR."""+ manifest_path = authoring_dir / AUTHORING_MANIFEST_NAME+ try:+ manifest = json.loads(manifest_path.read_text(encoding="utf-8"))+ except (OSError, UnicodeError, json.JSONDecodeError):+ return False+ return (+ isinstance(manifest, dict)+ and manifest.get("schema") == AUTHORING_SCHEMA+ and manifest.get("projection_kind") == "flat"+ and manifest.get("authoring_root") == "."+ and manifest.get("source_ref_attribute") == SOURCE_REF_ATTRIBUTE+ )+++def _load_documents(+ project_path: Path,+ authoring_dir: Path,+) -> tuple[Path, dict[str, AuthoringDocument], dict[str, Any]]:+ manifest_path = authoring_dir / AUTHORING_MANIFEST_NAME+ manifest = _load_json(manifest_path, context="flat authoring manifest")+ if manifest.get("schema") != AUTHORING_SCHEMA:+ raise AuthoringRoundtripError(+ f"Unsupported authoring manifest schema: {manifest.get('schema')!r}"+ )+ if manifest.get("projection_kind") != "flat":+ raise AuthoringRoundtripError(+ "Authoring round-trip requires projection_kind='flat'"+ )+ if manifest.get("authoring_root") != ".":+ raise AuthoringRoundtripError(+ "authoring_manifest.json authoring_root must be '.'"+ )+ if manifest.get("source_ref_attribute") != SOURCE_REF_ATTRIBUTE:+ raise AuthoringRoundtripError(+ "authoring_manifest.json uses an unsupported source-ref attribute"+ )+ source_root_raw = manifest.get("source_root")+ if not isinstance(source_root_raw, str) or not source_root_raw.strip():+ raise AuthoringRoundtripError(+ "authoring_manifest.json source_root must be a non-empty string"+ )+ source_root = (authoring_dir / source_root_raw).resolve()+ try:+ source_root.relative_to(project_path)+ except ValueError as exc:+ raise AuthoringRoundtripError(+ "Flat authoring source_root must stay inside the import workspace"+ ) from exc+ if not source_root.is_dir():+ raise AuthoringRoundtripError(+ f"Flat authoring backing SVG directory is missing: {source_root}"+ )++ documents_raw = manifest.get("documents")+ if not isinstance(documents_raw, list):+ raise AuthoringRoundtripError(+ "authoring_manifest.json documents must be an array"+ )+ documents: dict[str, AuthoringDocument] = {}+ layered_root = project_path / "svg"+ for index, raw in enumerate(documents_raw):+ if not isinstance(raw, dict):+ raise AuthoringRoundtripError(f"documents[{index}] must be an object")+ authoring_name = raw.get("authoring")+ source_name = raw.get("source")+ if not isinstance(authoring_name, str) or not authoring_name:+ raise AuthoringRoundtripError(+ f"documents[{index}].authoring must be a non-empty string"+ )+ if not isinstance(source_name, str) or not source_name:+ raise AuthoringRoundtripError(+ f"documents[{index}].source must be a non-empty string"+ )+ if authoring_name in documents:+ raise AuthoringRoundtripError(+ f"Duplicate authoring manifest document: {authoring_name}"+ )+ authoring_path = _resolve_inside(+ authoring_dir,+ authoring_name,+ context=f"documents[{index}].authoring",+ )+ flat_source_path = _resolve_inside(+ source_root,+ source_name,+ context=f"documents[{index}].source",+ )+ layered_source_path = _resolve_inside(+ layered_root,+ source_name,+ context=f"documents[{index}] layered source",+ )+ for label, path in (+ ("authoring SVG", authoring_path),+ ("flat backing SVG", flat_source_path),+ ("layered backing SVG", layered_source_path),+ ):+ if not path.is_file() or path.suffix.lower() != ".svg":+ raise AuthoringRoundtripError(f"Missing {label}: {path}")+ expected_source_sha = raw.get("source_sha256")+ if not isinstance(expected_source_sha, str) or not expected_source_sha:+ raise AuthoringRoundtripError(+ f"documents[{index}].source_sha256 must be a non-empty string"+ )+ actual_source_sha = _sha256_file(flat_source_path)+ if actual_source_sha != expected_source_sha:+ raise AuthoringRoundtripError(+ f"Flat backing SVG changed: {flat_source_path.name}; expected "+ f"{expected_source_sha}, found {actual_source_sha}"+ )++ refs_raw = raw.get("source_refs")+ if not isinstance(refs_raw, dict):+ raise AuthoringRoundtripError(+ f"documents[{index}].source_refs must be an object"+ )+ flat_root = _parse_svg(flat_source_path)+ refs: dict[str, SourceRefRecord] = {}+ for source_ref, ref_raw in refs_raw.items():+ if not isinstance(source_ref, str) or not isinstance(ref_raw, dict):+ raise AuthoringRoundtripError(+ f"Invalid source-ref record in {authoring_name}"+ )+ source_path_raw = ref_raw.get("source_path")+ if not (+ isinstance(source_path_raw, list)+ and all(+ isinstance(item, int) and not isinstance(item, bool) and item >= 0+ for item in source_path_raw+ )+ ):+ raise AuthoringRoundtripError(+ f"{authoring_name} source ref {source_ref!r} has invalid source_path"+ )+ initial_hash = ref_raw.get("initial_authoring_subtree_sha256")+ if not isinstance(initial_hash, str) or not initial_hash:+ raise AuthoringRoundtripError(+ f"{authoring_name} source ref {source_ref!r} has no initial hash"+ )+ source_path_tuple = tuple(source_path_raw)+ source_element = _source_element(flat_root, source_path_tuple)+ if _source_identity(source_element) != source_ref:+ raise AuthoringRoundtripError(+ f"{authoring_name} source ref {source_ref!r} resolves to "+ f"{_source_identity(source_element)!r}"+ )+ refs[source_ref] = SourceRefRecord(+ source_path=source_path_tuple,+ initial_authoring_subtree_sha256=initial_hash,+ )+ documents[authoring_name] = AuthoringDocument(+ name=authoring_name,+ authoring_path=authoring_path,+ flat_source_path=flat_source_path,+ layered_source_path=layered_source_path,+ source_refs=refs,+ )++ actual_files = {+ path.relative_to(authoring_dir).as_posix()+ for path in authoring_dir.rglob("*.svg")+ if path.is_file()+ }+ if actual_files != set(documents):+ raise AuthoringRoundtripError(+ "Authoring manifest/file roster differs; missing="+ f"{sorted(set(documents) - actual_files)}, "+ f"extra={sorted(actual_files - set(documents))}"+ )+ if manifest.get("file_count") != len(documents):+ raise AuthoringRoundtripError(+ "authoring_manifest.json file_count does not match documents"+ )+ expected_ref_count = sum(len(item.source_refs) for item in documents.values())+ if manifest.get("source_ref_count") != expected_ref_count:+ raise AuthoringRoundtripError(+ "authoring_manifest.json source_ref_count does not match documents"+ )+ return source_root, documents, manifest+++def _load_current_assets(+ project_path: Path,+ authoring_dir: Path,+ documents: dict[str, AuthoringDocument],+) -> tuple[dict[str, VectorAssetRecord], dict[str, Any] | None]:+ inventory_path = project_path / f"{authoring_dir.name}_vector_asset_inventory.json"+ if not inventory_path.is_file():+ return {}, None+ inventory = _load_json(inventory_path, context="flat vector asset inventory")+ if inventory.get("schema") != VECTOR_INVENTORY_SCHEMA:+ raise AuthoringRoundtripError(+ f"Unsupported vector inventory schema: {inventory.get('schema')!r}"+ )+ if inventory.get("icon_namespace") != IMPORTED_ICON_NAMESPACE:+ raise AuthoringRoundtripError(+ "Flat authoring vector inventory must use icon_namespace='imported'"+ )+ assets_raw = inventory.get("assets")+ if not isinstance(assets_raw, list):+ raise AuthoringRoundtripError("Vector inventory assets must be an array")+ icons_root = project_path / "icons"+ records: dict[str, VectorAssetRecord] = {}+ for index, raw in enumerate(assets_raw):+ if not isinstance(raw, dict):+ raise AuthoringRoundtripError(f"vector assets[{index}] must be an object")+ values = {+ name: raw.get(name)+ for name in (+ "icon",+ "asset",+ "svg",+ "source_sha256",+ "asset_sha256",+ )+ }+ if not all(isinstance(value, str) and value for value in values.values()):+ raise AuthoringRoundtripError(+ f"vector assets[{index}] is missing a required string field"+ )+ icon = str(values["icon"])+ origin = str(values["svg"])+ if icon in records:+ raise AuthoringRoundtripError(f"Duplicate vector asset id: {icon}")+ if origin not in documents:+ raise AuthoringRoundtripError(+ f"Vector asset {icon!r} names unknown document {origin!r}"+ )+ asset_path = _resolve_inside(+ icons_root,+ str(values["asset"]),+ context=f"vector asset {icon!r}",+ )+ if not asset_path.is_file() or asset_path.suffix.lower() != ".svg":+ raise AuthoringRoundtripError(f"Vector asset is missing: {asset_path}")+ records[icon] = VectorAssetRecord(+ icon=icon,+ asset_path=asset_path,+ origin_document=origin,+ source_sha256=str(values["source_sha256"]),+ expected_asset_sha256=str(values["asset_sha256"]),+ actual_asset_sha256=_sha256_file(asset_path),+ )+ if inventory.get("asset_count") != len(records):+ raise AuthoringRoundtripError("Vector inventory asset_count is stale")+ return records, inventory+++def _baseline_assets(+ entries: list[dict[str, Any]],+ icons_root: Path,+) -> dict[str, VectorAssetRecord]:+ records: dict[str, VectorAssetRecord] = {}+ for index, raw in enumerate(entries):+ values = {+ name: raw.get(name)+ for name in (+ "icon",+ "asset",+ "svg",+ "source_sha256",+ "asset_sha256",+ )+ }+ if not all(isinstance(value, str) and value for value in values.values()):+ raise AuthoringRoundtripError(+ f"Generated baseline vector asset {index} is incomplete"+ )+ icon = str(values["icon"])+ asset_path = icons_root / str(values["asset"])+ actual_sha = _sha256_file(asset_path)+ records[icon] = VectorAssetRecord(+ icon=icon,+ asset_path=asset_path,+ origin_document=str(values["svg"]),+ source_sha256=str(values["source_sha256"]),+ expected_asset_sha256=actual_sha,+ actual_asset_sha256=actual_sha,+ )+ return records+++def _generate_baseline_bundle(+ project_path: Path,+ source_root: Path,+ documents: dict[str, AuthoringDocument],+ inventory: dict[str, Any] | None,+) -> tuple[tempfile.TemporaryDirectory[str], Path, dict[str, VectorAssetRecord]]:+ temporary = tempfile.TemporaryDirectory(+ prefix=".authoring-baseline-",+ dir=project_path,+ )+ baseline_root = Path(temporary.name)+ mapping = [+ (document.flat_source_path, baseline_root / document.name)+ for document in sorted(documents.values(), key=lambda item: item.name)+ ]+ try:+ project_svg_batch(+ mapping,+ source_root,+ baseline_root,+ force=False,+ projection_kind="flat",+ )+ if inventory is None:+ return temporary, baseline_root, {}+ min_drawables = inventory.get("min_drawables")+ min_bytes = inventory.get("min_bytes")+ min_decoration_bytes = inventory.get("min_decoration_bytes")+ if not all(+ isinstance(value, int) and not isinstance(value, bool) and value >= 0+ for value in (min_drawables, min_bytes, min_decoration_bytes)+ ):+ raise AuthoringRoundtripError(+ "Flat vector inventory extraction thresholds are invalid"+ )+ icon_namespace = inventory.get("icon_namespace")+ if icon_namespace != IMPORTED_ICON_NAMESPACE:+ raise AuthoringRoundtripError(+ "Flat vector inventory must use icon_namespace='imported'"+ )+ baseline_icons = baseline_root / "_baseline_icons"+ entries: list[dict[str, Any]] = []+ for document in sorted(documents.values(), key=lambda item: item.name):+ entries.extend(+ extract_file(+ baseline_root / document.name,+ baseline_icons,+ IMPORTED_ICON_NAMESPACE,+ int(min_drawables),+ int(min_bytes),+ int(min_decoration_bytes),+ True,+ "baseline",+ None,+ None,+ )+ )+ return temporary, baseline_root, _baseline_assets(entries, baseline_icons)+ except Exception:+ temporary.cleanup()+ raise+++def _collapse_hash_only_groups(root: ET.Element) -> None:+ """Canonicalize attribute-free one-child wrappers for edit comparison."""+ for parent in list(root.iter()):+ changed = True+ while changed:+ changed = False+ for index, child in enumerate(list(parent)):+ if (+ _local_name(child.tag) != "g"+ or child.attrib+ or len(child) != 1+ or (child.text and child.text.strip())+ ):+ continue+ replacement = child[0]+ replacement.tail = child.tail+ parent.remove(child)+ parent.insert(index, replacement)+ changed = True+ break+++def _normalized_hash(+ element: ET.Element,+ assets: dict[str, VectorAssetRecord],+ *,+ asset: VectorAssetRecord | None = None,+) -> str:+ normalized = copy.deepcopy(element)+ prefix = f"{asset.element_prefix}_" if asset is not None else None++ def rewrite_url(match: re.Match[str]) -> str:+ quote, ref_id = match.group(1), match.group(2)+ if prefix and ref_id.startswith(prefix):+ ref_id = ref_id[len(prefix):]+ return f"url({quote}#{ref_id}{quote})"++ for item in normalized.iter():+ if prefix:+ item_id = item.get("id")+ if item_id and item_id.startswith(prefix):+ item.set("id", item_id[len(prefix):])+ for name, value in list(item.attrib.items()):+ rewritten = _URL_ID_RE.sub(rewrite_url, value)+ if _local_name(name) == "href" and rewritten.startswith(f"#{prefix}"):+ rewritten = "#" + rewritten[len(prefix) + 1:]+ if rewritten != value:+ item.set(name, rewritten)+ icon = item.get("data-icon")+ record = assets.get(icon or "")+ if record is not None:+ token = f"asset-slot:{record.baseline_key}"+ if not record.unchanged:+ token += f":edited:{record.actual_asset_sha256}"+ item.set("data-icon", token)+ normalize_single_child_group_filters(normalized)+ _collapse_hash_only_groups(normalized)+ return semantic_subtree_sha256(+ normalized,+ ignored_attributes=frozenset({SOURCE_REF_ATTRIBUTE}),+ )+++def _referenced_assets(+ root: ET.Element,+ assets: dict[str, VectorAssetRecord],+ *,+ document_name: str,+) -> dict[str, tuple[VectorAssetRecord, ET.Element]]:+ referenced: dict[str, tuple[VectorAssetRecord, ET.Element]] = {}+ for element in root.iter():+ icon = (element.get("data-icon") or "").strip()+ if not icon or icon in referenced:+ continue+ record = assets.get(icon)+ if record is None:+ if icon.startswith(f"{IMPORTED_ICON_NAMESPACE}/"):+ raise AuthoringRoundtripError(+ f"{document_name} references imported vector {icon!r} "+ "without an inventory record"+ )+ continue+ if record.origin_document != document_name:+ raise AuthoringRoundtripError(+ f"{document_name} references {icon!r} owned by "+ f"{record.origin_document}"+ )+ referenced[icon] = (record, _parse_svg(record.asset_path))+ return referenced+++def _ref_occurrences(+ root: ET.Element,+ referenced_assets: dict[str, tuple[VectorAssetRecord, ET.Element]],+) -> dict[str, list[RefOccurrence]]:+ occurrences: dict[str, list[RefOccurrence]] = {}+ for element in root.iter():+ source_ref = element.get(SOURCE_REF_ATTRIBUTE)+ if source_ref:+ occurrences.setdefault(source_ref, []).append(+ RefOccurrence(element=element, asset=None)+ )+ for record, asset_root in referenced_assets.values():+ for element in asset_root.iter():+ source_ref = element.get(SOURCE_REF_ATTRIBUTE)+ if source_ref:+ occurrences.setdefault(source_ref, []).append(+ RefOccurrence(element=element, asset=record)+ )+ return occurrences+++def _outer_source_ref_elements(root: ET.Element) -> list[ET.Element]:+ elements: list[ET.Element] = []++ def visit(element: ET.Element, inside_ref: bool) -> None:+ source_ref = element.get(SOURCE_REF_ATTRIBUTE)+ if source_ref and not inside_ref:+ elements.append(element)+ return+ for child in element:+ visit(child, inside_ref or bool(source_ref))++ visit(root, False)+ return elements+++def _layered_ref_index(root: ET.Element) -> dict[str, ET.Element]:+ index: dict[str, ET.Element] = {}+ for element in root.iter():+ if not element.get("id") or not element.get("data-pptx-object"):+ continue+ source_ref = _source_identity(element)+ if source_ref is None:+ continue+ if source_ref in index:+ raise AuthoringRoundtripError(+ f"Layered SVG contains duplicate source identity {source_ref!r}"+ )+ index[source_ref] = element+ return index+++def _direct_defs(root: ET.Element) -> ET.Element | None:+ return next(+ (child for child in root if _local_name(child.tag) == "defs"),+ None,+ )+++def _definition_changes(+ current_root: ET.Element,+ baseline_root: ET.Element,+ current_assets: dict[str, VectorAssetRecord],+ baseline_assets: dict[str, VectorAssetRecord],+) -> tuple[bool, set[str]]:+ current_defs = _direct_defs(current_root)+ baseline_defs = _direct_defs(baseline_root)+ current_hash = (+ _normalized_hash(current_defs, current_assets)+ if current_defs is not None+ else None+ )+ baseline_hash = (+ _normalized_hash(baseline_defs, baseline_assets)+ if baseline_defs is not None+ else None+ )+ if current_hash == baseline_hash:+ return False, set()+ current_children = list(current_defs) if current_defs is not None else []+ baseline_children = list(baseline_defs) if baseline_defs is not None else []+ current_by_id = {+ child.get("id"): child+ for child in current_children+ if child.get("id")+ }+ baseline_by_id = {+ child.get("id"): child+ for child in baseline_children+ if child.get("id")+ }+ changed_ids = {+ definition_id+ for definition_id in set(current_by_id) | set(baseline_by_id)+ if definition_id not in current_by_id+ or definition_id not in baseline_by_id+ or _normalized_hash(current_by_id[definition_id], current_assets)+ != _normalized_hash(baseline_by_id[definition_id], baseline_assets)+ }+ return True, changed_ids+++def _referenced_definition_ids(element: ET.Element) -> set[str]:+ references: set[str] = set()+ for item in element.iter():+ for name, value in item.attrib.items():+ references.update(match.group(2) for match in _URL_ID_RE.finditer(value))+ if _local_name(name) == "href" and value.startswith("#"):+ references.add(value[1:])+ return references+++def _merge_defs(+ layered_root: ET.Element,+ authoring_root: ET.Element,+ *,+ include_authoring_changes: bool,+) -> ET.Element | None:+ layered_defs = _direct_defs(layered_root)+ authoring_defs = _direct_defs(authoring_root)+ if layered_defs is None and (+ authoring_defs is None or not include_authoring_changes+ ):+ return None+ merged = (+ copy.deepcopy(layered_defs)+ if layered_defs is not None+ else ET.Element(f"{{{SVG_NS}}}defs")+ )+ if not include_authoring_changes or authoring_defs is None:+ return merged+ by_id = {+ child.get("id"): (index, child)+ for index, child in enumerate(merged)+ if child.get("id")+ }+ existing_hashes = {+ semantic_subtree_sha256(child)+ for child in merged+ }+ for child in authoring_defs:+ clone = copy.deepcopy(child)+ definition_id = clone.get("id")+ if definition_id and definition_id in by_id:+ index, previous = by_id[definition_id]+ merged.remove(previous)+ merged.insert(index, clone)+ by_id[definition_id] = (index, clone)+ continue+ child_hash = semantic_subtree_sha256(clone)+ if child_hash not in existing_hashes:+ merged.append(clone)+ existing_hashes.add(child_hash)+ return merged+++def _serialize_svg(root: ET.Element) -> bytes:+ payload = ET.tostring(root, encoding="utf-8", xml_declaration=True)+ return payload if payload.endswith(b"\n") else payload + b"\n"+++def _materialize_document(+ document: AuthoringDocument,+ baseline_path: Path,+ output_path: Path,+ current_assets: dict[str, VectorAssetRecord],+ baseline_assets: dict[str, VectorAssetRecord],+) -> dict[str, Any]:+ current_root = _parse_svg(document.authoring_path)+ baseline_root = _parse_svg(baseline_path)+ layered_root = _parse_svg(document.layered_source_path)+ layered_index = _layered_ref_index(layered_root)+ current_referenced_assets = _referenced_assets(+ current_root,+ current_assets,+ document_name=document.name,+ )+ baseline_referenced_assets = _referenced_assets(+ baseline_root,+ baseline_assets,+ document_name=document.name,+ )+ current_occurrences = _ref_occurrences(+ current_root,+ current_referenced_assets,+ )+ baseline_occurrences = _ref_occurrences(+ baseline_root,+ baseline_referenced_assets,+ )+ expected_refs = set(document.source_refs)+ baseline_refs = set(baseline_occurrences)+ if baseline_refs != expected_refs:+ raise AuthoringRoundtripError(+ f"{document.name} regenerated baseline source-ref closure differs; "+ f"missing={sorted(expected_refs - baseline_refs)}, "+ f"extra={sorted(baseline_refs - expected_refs)}"+ )+ baseline_duplicates = sorted(+ ref for ref, items in baseline_occurrences.items() if len(items) != 1+ )+ if baseline_duplicates:+ raise AuthoringRoundtripError(+ f"{document.name} regenerated baseline has duplicate source refs: "+ + ", ".join(baseline_duplicates)+ )+ current_unknown = sorted(set(current_occurrences) - expected_refs)+ if current_unknown:+ raise AuthoringRoundtripError(+ f"{document.name} contains unknown source refs: "+ + ", ".join(current_unknown)+ )+ current_duplicates = sorted(+ ref for ref, items in current_occurrences.items() if len(items) != 1+ )+ if current_duplicates:+ raise AuthoringRoundtripError(+ f"{document.name} contains duplicate source refs: "+ + ", ".join(current_duplicates)+ )++ defs_changed, changed_definition_ids = _definition_changes(+ current_root,+ baseline_root,+ current_assets,+ baseline_assets,+ )+ unchanged_refs: set[str] = set()+ edited_refs: set[str] = set()+ for source_ref, occurrences in current_occurrences.items():+ current = occurrences[0]+ baseline = baseline_occurrences[source_ref][0]+ current_hash = _normalized_hash(+ current.element,+ current_assets,+ asset=current.asset,+ )+ baseline_hash = _normalized_hash(+ baseline.element,+ baseline_assets,+ asset=baseline.asset,+ )+ references_changed_def = bool(+ changed_definition_ids+ & _referenced_definition_ids(current.element)+ )+ if current_hash == baseline_hash and not references_changed_def:+ unchanged_refs.add(source_ref)+ else:+ edited_refs.add(source_ref)+ deleted_refs = expected_refs - set(current_occurrences)++ baseline_use_counts: Counter[tuple[str, str]] = Counter()+ for use in baseline_root.iter():+ icon = (use.get("data-icon") or "").strip()+ record = baseline_assets.get(icon)+ if record is None:+ continue+ baseline_use_counts[+ (record.baseline_key, _normalized_hash(use, baseline_assets))+ ] += 1+ unchanged_use_ids: set[int] = set()+ for use in current_root.iter():+ icon = (use.get("data-icon") or "").strip()+ record = current_assets.get(icon)+ if record is None or not record.unchanged:+ continue+ key = (record.baseline_key, _normalized_hash(use, current_assets))+ if baseline_use_counts[key] <= 0:+ continue+ baseline_use_counts[key] -= 1+ unchanged_use_ids.add(id(use))++ def restore_nodes(element: ET.Element) -> list[ET.Element]:+ source_ref = element.get(SOURCE_REF_ATTRIBUTE)+ if source_ref in unchanged_refs:+ scope = source_ref.split(":", 1)[0]+ if scope != "slide":+ return []+ source = layered_index.get(source_ref)+ if source is None:+ raise AuthoringRoundtripError(+ f"{document.name} cannot find {source_ref!r} in layered source"+ )+ return [copy.deepcopy(source)]++ if _local_name(element.tag) == "use":+ icon = (element.get("data-icon") or "").strip()+ referenced = current_referenced_assets.get(icon)+ if referenced is not None:+ record, asset_root = referenced+ if record.unchanged and id(element) in unchanged_use_ids:+ outer_refs = _outer_source_ref_elements(asset_root)+ if outer_refs:+ restored: list[ET.Element] = []+ for outer in outer_refs:+ restored.extend(restore_nodes(outer))+ return restored++ clone = copy.deepcopy(element)+ for child in list(clone):+ clone.remove(child)+ for original_child in element:+ replacements = restore_nodes(original_child)+ if replacements:+ replacements[-1].tail = original_child.tail+ for replacement in replacements:+ clone.append(replacement)+ clone.attrib.pop(SOURCE_REF_ATTRIBUTE, None)+ if source_ref and source_ref.startswith("slide:"):+ source = layered_index.get(source_ref)+ if source is not None:+ for name in (+ "data-pptx-shape-id",+ "data-pptx-shape-scope",+ "data-pptx-shape-name",+ "data-name",+ ):+ if clone.get(name) is None and source.get(name) is not None:+ clone.set(name, str(source.get(name)))+ return [clone]++ baseline_unreferenced = Counter(+ _normalized_hash(child, baseline_assets)+ for child in baseline_root+ if _local_name(child.tag) != "defs"+ and child.get(SOURCE_REF_ATTRIBUTE) is None+ and _local_name(child.tag) != "use"+ )+ output_root = copy.deepcopy(layered_root)+ for child in list(output_root):+ output_root.remove(child)+ for name in ("width", "height", "viewBox"):+ value = current_root.get(name)+ if value is not None:+ output_root.set(name, value)+ merged_defs = _merge_defs(+ layered_root,+ current_root,+ include_authoring_changes=defs_changed or bool(edited_refs),+ )+ if merged_defs is not None and list(merged_defs):+ output_root.append(merged_defs)++ authored_unreferenced = 0+ expanded_vector_uses = 0+ for child in current_root:+ if _local_name(child.tag) == "defs":+ continue+ if (+ child.get(SOURCE_REF_ATTRIBUTE) is None+ and _local_name(child.tag) != "use"+ ):+ child_hash = _normalized_hash(child, current_assets)+ if baseline_unreferenced[child_hash] > 0:+ baseline_unreferenced[child_hash] -= 1+ continue+ authored_unreferenced += 1+ replacements = restore_nodes(child)+ if _local_name(child.tag) == "use" and len(replacements) > 1:+ expanded_vector_uses += 1+ for replacement in replacements:+ output_root.append(replacement)++ residual_refs = sorted({+ source_ref+ for element in output_root.iter()+ if (source_ref := element.get(SOURCE_REF_ATTRIBUTE))+ })+ if residual_refs:+ raise AuthoringRoundtripError(+ f"{document.name} materialization left source refs: {residual_refs[:5]}"+ )+ output_path.write_bytes(_serialize_svg(output_root))+ return {+ "file": document.name,+ "source_ref_count": len(expected_refs),+ "unchanged_refs": len(unchanged_refs),+ "edited_refs": len(edited_refs),+ "edited_ref_ids": sorted(edited_refs),+ "deleted_refs": len(deleted_refs),+ "deleted_ref_ids": sorted(deleted_refs),+ "authored_unreferenced": authored_unreferenced,+ "expanded_vector_uses": expanded_vector_uses,+ "defs_changed": defs_changed,+ }+++def materialize_flat_authoring_roundtrip(+ project_path: Path,+ authoring_dir: Path,+ output_dir: Path,+) -> AuthoringRoundtripResult:+ """Materialize a flat authoring bundle into preserve-mode slide SVGs."""+ project_path = project_path.resolve()+ authoring_dir = authoring_dir.resolve()+ output_dir = output_dir.resolve()+ try:+ authoring_dir.relative_to(project_path)+ output_dir.relative_to(project_path)+ except ValueError as exc:+ raise AuthoringRoundtripError(+ "Authoring and materialized directories must stay inside the project"+ ) from exc+ if not authoring_dir.is_dir():+ raise AuthoringRoundtripError(+ f"Authoring directory does not exist: {authoring_dir}"+ )+ if output_dir.exists() and any(output_dir.iterdir()):+ raise AuthoringRoundtripError(+ f"Materialized output directory must be empty: {output_dir}"+ )+ output_dir.mkdir(parents=True, exist_ok=True)++ source_root, documents, manifest = _load_documents(project_path, authoring_dir)+ current_assets, inventory = _load_current_assets(+ project_path,+ authoring_dir,+ documents,+ )+ baseline_temporary, baseline_root, baseline_assets = _generate_baseline_bundle(+ project_path,+ source_root,+ documents,+ inventory,+ )+ try:+ current_keys = sorted(record.baseline_key for record in current_assets.values())+ baseline_keys = sorted(record.baseline_key for record in baseline_assets.values())+ if current_keys != baseline_keys:+ raise AuthoringRoundtripError(+ "Regenerated flat vector extraction differs from its inventory; "+ f"missing={sorted(set(current_keys) - set(baseline_keys))}, "+ f"extra={sorted(set(baseline_keys) - set(current_keys))}"+ )+ document_reports = [+ _materialize_document(+ document,+ baseline_root / document.name,+ output_dir / document.name,+ current_assets,+ baseline_assets,+ )+ for document in sorted(documents.values(), key=lambda item: item.name)+ ]+ finally:+ baseline_temporary.cleanup()++ svg_files = tuple(discover_slide_svgs(output_dir))+ if len(svg_files) != len(documents):+ raise AuthoringRoundtripError(+ "Materialized slide roster does not match the authoring manifest"+ )+ totals = {+ key: sum(int(item[key]) for item in document_reports)+ for key in (+ "source_ref_count",+ "unchanged_refs",+ "edited_refs",+ "deleted_refs",+ "authored_unreferenced",+ "expanded_vector_uses",+ )+ }+ report: dict[str, Any] = {+ "schema": "ppt-master.authoring-roundtrip-materialization.v1",+ "authoring_root": str(authoring_dir),+ "manifest_schema": manifest.get("schema"),+ "projection_kind": manifest.get("projection_kind"),+ "materialized_slide_count": len(svg_files),+ "totals": totals,+ "documents": document_reports,+ }+ return AuthoringRoundtripResult(svg_files=svg_files, report=report)diff --git a/skills/ppt-master/scripts/resource_paths.py b/skills/ppt-master/scripts/resource_paths.pyindex 664b9f50..fc85b772 100644--- a/skills/ppt-master/scripts/resource_paths.py+++ b/skills/ppt-master/scripts/resource_paths.py@@ -27,6 +27,8 @@ from xml.etree import ElementTree as ETSVG_WORK_DIR_NAMES = frozenset({+ 'authoring-svg',+ 'authoring-svg-flat','svg','svg_output','svg_final',@@ -242,8 +244,13 @@ def svg_data_uri_payload_error(raw: str) -> str | None:return f'inline SVG data URI is not closed: {nested_error}'-def external_image_reference_candidates(svg_dir: Path, href: str) -> list[Path]:- """Return candidate paths for a non-data-URI SVG image href."""+def external_image_reference_candidates(+ svg_dir: Path,+ href: str,+ *,+ project_root: Path | None = None,+) -> list[Path]:+ """Return deterministic project-local candidates for an SVG image href."""parsed = urlsplit(href)if parsed.scheme and parsed.scheme not in {'file'}:return []@@ -253,18 +260,22 @@ def external_image_reference_candidates(svg_dir: Path, href: str) -> list[Path]:else href.split('?', 1)[0].split('#', 1)[0])svg_dir = Path(svg_dir)- project_root = project_root_for_svg_path(svg_dir).resolve()+ resolved_project_root = (+ Path(project_root).resolve()+ if project_root is not None+ else project_root_for_svg_path(svg_dir).resolve()+ )candidates = [svg_dir / decoded,- project_root / decoded,- project_root / 'images' / decoded,- project_root / 'templates' / decoded,+ resolved_project_root / decoded,+ resolved_project_root / 'images' / decoded,+ resolved_project_root / 'templates' / decoded,]safe_candidates: list[Path] = []for candidate in candidates:resolved = candidate.resolve()try:- resolved.relative_to(project_root)+ resolved.relative_to(resolved_project_root)except ValueError:continueif resolved not in safe_candidates:@@ -272,17 +283,35 @@ def external_image_reference_candidates(svg_dir: Path, href: str) -> list[Path]:return safe_candidates-def resolve_external_image_reference(svg_dir: Path, href: str) -> Path | None:+def resolve_external_image_reference(+ svg_dir: Path,+ href: str,+ *,+ project_root: Path | None = None,+) -> Path | None:"""Resolve an SVG image href to an existing file, or return None."""- for candidate in external_image_reference_candidates(svg_dir, href):+ for candidate in external_image_reference_candidates(+ svg_dir,+ href,+ project_root=project_root,+ ):if candidate.is_file():return candidatereturn None-def unresolved_external_image_reference_path(svg_dir: Path, href: str) -> Path:+def unresolved_external_image_reference_path(+ svg_dir: Path,+ href: str,+ *,+ project_root: Path | None = None,+) -> Path:"""Return the first candidate path for diagnostics when resolution fails."""- candidates = external_image_reference_candidates(svg_dir, href)+ candidates = external_image_reference_candidates(+ svg_dir,+ href,+ project_root=project_root,+ )if candidates:return candidates[0].resolve()return (Path(svg_dir) / href).resolve()diff --git a/skills/ppt-master/scripts/svg_authoring_view.py b/skills/ppt-master/scripts/svg_authoring_view.pyindex 6cb23164..f2a6d2f8 100644--- a/skills/ppt-master/scripts/svg_authoring_view.py+++ b/skills/ppt-master/scripts/svg_authoring_view.py@@ -22,10 +22,12 @@ Dependencies:The output directory is an authoring bundle: editable SVGs plus onemodel-readable `authoring_summary.json` and one tool-only-`authoring_manifest.json` provenance sidecar. It is the template-creation-input, not a release SVG directory; final templates are materialized from this-IR. Directory runs prepare and stage the complete batch before publishing it,-so a failed page leaves the existing destination set unchanged.+`authoring_manifest.json` provenance sidecar. Layered IR remains the+template-creation input; final templates are materialized from it. A flat+authoring bundle may also be selected explicitly by the SVG exporter through+its dangerous compatibility mode. Directory runs prepare and stage the+complete batch before publishing it, so a failed page leaves the existing+destination set unchanged."""from __future__ import annotations@@ -46,6 +48,7 @@ from xml.etree import ElementTree as ETfrom compact_svg_coordinates import compact_svg_treefrom console_encoding import configure_utf8_stdio+from svg_compatibility import normalize_single_child_group_filtersconfigure_utf8_stdio()@@ -244,6 +247,7 @@ class ProjectionStats:hidden_geometry_carriers: int = 0geometry_preview_wrappers: int = 0geometry_detail_markers: int = 0+ compatibility_normalizations: int = 0asset_references_rewritten: int = 0coordinate_attributes_compacted: int = 0source_attributes: Counter[str] = field(default_factory=Counter)@@ -254,6 +258,7 @@ class ProjectionStats:"hidden_geometry_carriers": self.hidden_geometry_carriers,"geometry_preview_wrappers": self.geometry_preview_wrappers,"geometry_detail_markers": self.geometry_detail_markers,+ "compatibility_normalizations": self.compatibility_normalizations,"source_attributes": dict(sorted(self.source_attributes.items())),"asset_references_rewritten": self.asset_references_rewritten,"coordinate_attributes_compacted": self.coordinate_attributes_compacted,@@ -264,6 +269,7 @@ class ProjectionStats:self.hidden_geometry_carriers += other.hidden_geometry_carriersself.geometry_preview_wrappers += other.geometry_preview_wrappersself.geometry_detail_markers += other.geometry_detail_markers+ self.compatibility_normalizations += other.compatibility_normalizationsself.asset_references_rewritten += other.asset_references_rewrittenself.coordinate_attributes_compacted += (other.coordinate_attributes_compacted@@ -382,6 +388,9 @@ def _project_subtree(parent: ET.Element, stats: ProjectionStats) -> None:if part == "geometry-preview":child.attrib.pop("data-pptx-part", None)+ stats.compatibility_normalizations += len(+ normalize_single_child_group_filters(child)+ )if _unwrap_preview(parent, child):stats.geometry_preview_wrappers += 1elif part == "geometry-detail":@@ -434,6 +443,9 @@ def _render_projection(source: Path, output: Path) -> tuple[ProjectionReport, bysource_references = _stamp_source_references(root)stats = ProjectionStats()_project_subtree(root, stats)+ stats.compatibility_normalizations += len(+ normalize_single_child_group_filters(root)+ )_strip_import_attributes(root, stats)_rewrite_asset_references(root, source.parent, output.parent, stats)stats.coordinate_attributes_compacted = compact_svg_tree(diff --git a/skills/ppt-master/scripts/svg_compatibility.py b/skills/ppt-master/scripts/svg_compatibility.pynew file mode 100644index 00000000..8cba0497--- /dev/null+++ b/skills/ppt-master/scripts/svg_compatibility.py@@ -0,0 +1,59 @@+"""Shared, semantics-preserving SVG compatibility normalizations.++See scripts/docs/svg-pipeline.md for the dangerous compatibility export+boundary.+"""++from __future__ import annotations++from xml.etree import ElementTree as ET+++_FILTER_TARGETS = frozenset({'circle', 'image', 'path', 'rect', 'text'})+_NON_VISUAL_TAGS = frozenset({'defs', 'desc', 'metadata', 'title'})+++def _local_name(tag: object) -> str:+ return tag.rsplit('}', 1)[-1] if isinstance(tag, str) else ''+++def normalize_single_child_group_filters(+ root: ET.Element,+) -> list[dict[str, str]]:+ """Move a group filter to its sole supported visual child.++ A filter on a one-child, attribute-free group is visually equivalent to+ the same filter on that child. Multi-child or otherwise styled groups are+ left unchanged because lowering would alter effect compositing.+ """+ normalizations: list[dict[str, str]] = []+ for group in root.iter():+ if _local_name(group.tag) != 'g':+ continue+ filter_value = group.get('filter')+ if filter_value is None:+ continue+ if set(group.attrib) != {'filter'}:+ continue+ if group.text and group.text.strip():+ continue+ visual_children = [+ child+ for child in group+ if isinstance(child.tag, str)+ and _local_name(child.tag) not in _NON_VISUAL_TAGS+ ]+ if len(visual_children) != 1:+ continue+ child = visual_children[0]+ child_tag = _local_name(child.tag)+ if child_tag not in _FILTER_TARGETS or child.get('filter') is not None:+ continue+ child.set('filter', filter_value)+ del group.attrib['filter']+ normalizations.append({+ 'action': 'lower-single-child-group-filter',+ 'target_tag': child_tag,+ 'filter': filter_value,+ })+ return normalizationsdiff --git a/skills/ppt-master/scripts/svg_to_pptx.py b/skills/ppt-master/scripts/svg_to_pptx.pyindex 4240b639..725c3682 100644--- a/skills/ppt-master/scripts/svg_to_pptx.py+++ b/skills/ppt-master/scripts/svg_to_pptx.py@@ -4,6 +4,15 @@Delegates to the svg_to_pptx package. ``-s final`` remains a native-exportdiagnostic override; the standard pipeline reads ``svg_output/``:python3 scripts/svg_to_pptx.py <project_path> -s final++An imported flat authoring bundle rehydrates unchanged source objects before+the source-preserving export:+ python3 scripts/svg_to_pptx.py <project_path> -s authoring-svg-flat \+ --roundtrip++An explicit compatibility export may normalize the default ``svg_output/`` or+another project-relative source selected with ``-s`` before strict flat+conversion. It does not provide source-object restoration."""import sysdiff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/context.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/context.pyindex 62fc9b82..3327763d 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/context.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/context.py@@ -86,6 +86,9 @@ class ConvertContext:content_type_overrides: dict[str, str] = field(default_factory=dict)rel_id_counter: int = 2 # rId1 reserved for slideLayoutsvg_dir: Path | None = None+ # Explicit project boundary for deterministic resource resolution. Direct+ # library callers may omit it and retain directory-name inference.+ resource_root: Path | None = Noneinherited_styles: dict[str, str] = field(default_factory=dict)# Effective SVG font sizes keyed by element identity. Shared resolution# keeps relative sizes and em tracking identical across checker/exporter.@@ -263,6 +266,7 @@ class ConvertContext:content_type_overrides=self.content_type_overrides,rel_id_counter=self.rel_id_counter,svg_dir=self.svg_dir,+ resource_root=self.resource_root,inherited_styles=merged,text_font_sizes=self.text_font_sizes,text_letter_spacings=self.text_letter_spacings,diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex 41af2ce4..32ff713f 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -29,7 +29,8 @@ from pptx_to_svg.preset_authoring import (materialize_compact_authored_preset_tree,validate_authored_preset_tree,)-from resource_paths import icon_search_dirs_for_svg+from resource_paths import icon_search_dirs_for_project, icon_search_dirs_for_svg+from svg_compatibility import normalize_single_child_group_filtersfrom .context import (TEXT_FLOW_PRESERVE,@@ -267,10 +268,15 @@ def _require_project_clip_paths(def _require_project_images(root: ET.Element,svg_path: Path | str,+ resource_root: Path | None = None,) -> None:"""Reject invalid picture frames and unresolved or corrupt sources."""path = Path(svg_path)- errors = project_image_errors(root, path.parent)+ errors = project_image_errors(+ root,+ path.parent,+ resource_root=resource_root,+ )if not errors:returnpreview = '; '.join(errors[:8])@@ -1653,6 +1659,8 @@ def convert_svg_to_slide_shapes(trace_out: list[dict[str, Any]] | None = None,promote_background: bool = True,text_flow: str | None = None,+ dangerous_nonconforming_export: bool = False,+ resource_root: Path | None = None,) -> tuple[str,dict[str, bytes],@@ -1696,6 +1704,11 @@ def convert_svg_to_slide_shapes(promote_background: Promote the first eligible full-canvas rectangleinto native ``p:bg``. Structured export disables this generic passand applies its narrower explicit background contract later.+ dangerous_nonconforming_export: Apply narrowly defined compatibility+ normalizations before the ordinary strict project preflight.+ Parsing, resource, conversion, and package failures remain blocking.+ resource_root: Explicit project boundary for local images and icons.+ Omit only for direct library calls that require legacy inference.Returns:(slide_xml, media_files, rel_entries, anim_targets,@@ -1713,6 +1726,15 @@ def convert_svg_to_slide_shapes("""text_flow = resolve_text_flow(text_flow, merge_paragraphs)svg_path = Path(svg_path)+ if resource_root is not None:+ resource_root = Path(resource_root).resolve()+ try:+ svg_path.resolve().relative_to(resource_root)+ except ValueError as exc:+ raise SvgNativeConversionError(+ f'{svg_path.name}: SVG source is outside resource root '+ f'{resource_root}'+ ) from exctree = ET.parse(str(svg_path))root = tree.getroot()_hydrate_native_payloads(root, svg_path)@@ -1723,6 +1745,16 @@ def convert_svg_to_slide_shapes()except CanvasContractError as exc:raise SvgNativeConversionError(str(exc)) from exc+ dangerous_normalizations = (+ normalize_single_child_group_filters(root)+ if dangerous_nonconforming_export+ else []+ )+ if dangerous_normalizations and verbose:+ print(+ ' [DANGEROUS][NORMALIZED] '+ f'{len(dangerous_normalizations)} single-child group filter(s)'+ )_require_native_marker_attributes(root, svg_path)_require_inline_formula_markers(root, svg_path)_require_project_hyperlinks(@@ -1821,7 +1853,11 @@ def convert_svg_to_slide_shapes(expand_use_data_icons,)- icons_dir, icons_fallback_dir = icon_search_dirs_for_svg(svg_path)+ icons_dir, icons_fallback_dir = (+ icon_search_dirs_for_project(resource_root)+ if resource_root is not None+ else icon_search_dirs_for_svg(svg_path)+ )if icons_dir.exists():expanded = expand_use_data_icons(root, icons_dir, icons_fallback_dir)if expanded:@@ -1875,6 +1911,17 @@ def convert_svg_to_slide_shapes(if verbose:print(f' Expanded {expanded_local} local <use href="#..."/> instance(s)')+ if dangerous_nonconforming_export:+ expanded_normalizations = normalize_single_child_group_filters(root)+ if expanded_normalizations:+ dangerous_normalizations.extend(expanded_normalizations)+ if verbose:+ print(+ ' [DANGEROUS][NORMALIZED] '+ f'{len(expanded_normalizations)} expanded-resource '+ 'group filter(s)'+ )+_require_inline_formula_markers(root, svg_path)_require_project_hyperlinks(root,@@ -1884,7 +1931,7 @@ def convert_svg_to_slide_shapes(# Recheck compiler-injected icon/use wrappers and cloned definition trees._require_project_nested_svg_crops(root, svg_path)- _require_project_images(root, svg_path)+ _require_project_images(root, svg_path, resource_root)_require_project_clip_paths(root, svg_path)_require_project_text_properties(root, svg_path)_require_project_stroke_styles(root, svg_path)@@ -1975,7 +2022,6 @@ def convert_svg_to_slide_shapes(svg_path,slide_count=slide_count,)-_require_project_text_properties(root, svg_path)try:text_font_sizes = resolve_project_font_sizes(root)@@ -2007,6 +2053,7 @@ def convert_svg_to_slide_shapes(viewport_width=viewport_width,viewport_height=viewport_height,svg_dir=Path(svg_path).parent,+ resource_root=resource_root,text_flow=text_flow,image_optimize=image_optimize,image_max_dimension=image_max_dimension,@@ -2118,7 +2165,7 @@ def convert_svg_to_slide_shapes(print(f' Converted {converted} elements, skipped {skipped}{promoted}')if trace_out is not None:- trace_out.append({+ trace_entry = {'slide_num': slide_num,'svg': str(svg_path),'page_role': root.get('data-pptx-page-role'),@@ -2133,7 +2180,10 @@ def convert_svg_to_slide_shapes(},'preprocess': trace_steps,'events': trace_events or [],- })+ }+ if dangerous_nonconforming_export:+ trace_entry['dangerous_normalizations'] = dangerous_normalizations+ trace_out.append(trace_entry)shapes_xml = '\n'.join(shapes)diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.pyindex d2454752..86873b4d 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/elements.py@@ -97,7 +97,11 @@ from .paths import ()-def _resolve_external_image(svg_dir: Path, href: str) -> Path:+def _resolve_external_image(+ svg_dir: Path,+ href: str,+ resource_root: Path | None = None,+) -> Path:"""Resolve a non-data-URI image href to a file on disk.Search order: next to the SVG (``svg_output/``), the project root, the@@ -106,7 +110,11 @@ def _resolve_external_image(svg_dir: Path, href: str) -> Path:(legacy flat-copied template assets). Raises ``FileNotFoundError`` if noneof these exist."""- candidate = resolve_external_image_reference(svg_dir, href)+ candidate = resolve_external_image_reference(+ svg_dir,+ href,+ project_root=resource_root,+ )if candidate is not None:return candidateraise FileNotFoundError(f'External image not found: {href}')@@ -362,6 +370,7 @@ def _project_image_href(elem: ET.Element) -> str:def load_project_image_source(elem: ET.Element,svg_dir: Path | None,+ resource_root: Path | None = None,) -> ProjectImageSource:"""Load one exact SVG image source or raise a contract error."""if elem.tag != f'{{{SVG_NS}}}image':@@ -380,7 +389,7 @@ def load_project_image_source(if svg_dir is None:raise ValueError('external image requires an SVG directory context')try:- img_path = _resolve_external_image(svg_dir, href)+ img_path = _resolve_external_image(svg_dir, href, resource_root)except FileNotFoundError as exc:raise ValueError(str(exc)) from excimg_format = _normalize_project_image_format(img_path.suffix)@@ -405,6 +414,7 @@ def project_image_errors(svg_dir: Path | None,*,allow_template_placeholders: bool = False,+ resource_root: Path | None = None,) -> list[str]:"""Return source and frame errors for exact SVG image elements."""errors: list[str] = []@@ -449,7 +459,7 @@ def project_image_errors():continuetry:- load_project_image_source(elem, svg_dir)+ load_project_image_source(elem, svg_dir, resource_root)except ValueError as exc:errors.append(f'{label} invalid image source: {exc}')return sorted(errors)@@ -2628,7 +2638,11 @@ def _build_text_fill_xml()if paint_tag == 'pattern':mode, image = resolve_project_text_image_fill(paint)- source = load_project_image_source(image, ctx.svg_dir)+ source = load_project_image_source(+ image,+ ctx.svg_dir,+ ctx.resource_root,+ )r_id = _register_image_media(ctx,source.img_format,@@ -4593,7 +4607,7 @@ def convert_image(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:to DrawingML picture geometry (prstGeom or custGeom) so the image isnatively clipped in PowerPoint."""- source = load_project_image_source(elem, ctx.svg_dir)+ source = load_project_image_source(elem, ctx.svg_dir, ctx.resource_root)# Raw coordinates (pre-context-transform) for clip path calculationsraw_x = svg_length_x(elem.get('x'), ctx)@@ -5220,7 +5234,11 @@ def convert_nested_svg(elem: ET.Element, ctx: ConvertContext) -> ShapeResult:"""crop = parse_project_nested_svg_crop(elem)image_elem = crop.image- source = load_project_image_source(image_elem, ctx.svg_dir)+ source = load_project_image_source(+ image_elem,+ ctx.svg_dir,+ ctx.resource_root,+ )svg_x = crop.xsvg_y = crop.ydiff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.pyindex 2b180081..de1c43fe 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py@@ -4967,6 +4967,8 @@ def create_pptx_with_native_svg(image_quality: int = 85,native_objects: bool = False,conversion_trace_path: Path | None = None,+ dangerous_nonconforming_export: bool = False,+ resource_root: Path | None = None,doc_metadata: dict[str, Any] | None = None,structure_name: str | None = None,pptx_structure: str = "structured",@@ -5045,6 +5047,11 @@ def create_pptx_with_native_svg(native_objects: Replace explicit ``data-pptx-replace-with`` chart/tablefallback groups with native PowerPoint Chart/Table objects. Default off.conversion_trace_path: Optional JSON path for native conversion diagnostics.+ dangerous_nonconforming_export: Apply narrowly defined compatibility+ normalizations before strict SVG conversion. Actual contract,+ conversion, and package failures remain blocking.+ resource_root: Explicit project boundary for SVG-local resource paths.+ Direct library callers may omit it to retain legacy inference.structure_name: Current deck identity used to name a flat Master, Layout,and theme.pptx_structure: PPTX structure strategy. ``baseline`` promotes safe@@ -5613,6 +5620,10 @@ def create_pptx_with_native_svg(theme_color_spec=active_theme_color_spec,primary_language=primary_language,promote_background=pptx_structure != "structured",+ dangerous_nonconforming_export=(+ dangerous_nonconforming_export+ ),+ resource_root=resource_root,trace_out=conversion_traceif conversion_trace is not Noneelse structure_trace,@@ -6411,6 +6422,13 @@ def create_pptx_with_native_svg(payload = {'output': str(output_path),'slide_count': public_slide_count,+ 'project_contract': {+ 'mode': (+ 'strict-after-dangerous-normalization'+ if dangerous_nonconforming_export+ else 'strict'+ ),+ },'slides': [entryfor entry in conversion_tracediff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.pyindex 0f8f987b..2e5fa1e1 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py@@ -11,6 +11,7 @@ import mathimport reimport shutilimport sys+import tempfileimport zipfilefrom dataclasses import dataclassfrom datetime import datetime@@ -22,6 +23,11 @@ if str(_SCRIPTS_DIR) not in sys.path:sys.path.insert(0, str(_SCRIPTS_DIR))from attribution_guard import require_skill_integrity # noqa: E402+from authoring_roundtrip import ( # noqa: E402+ AuthoringRoundtripError,+ is_flat_authoring_bundle,+ materialize_flat_authoring_roundtrip,+)from console_encoding import configure_utf8_stdio # noqa: E402from language_tags import ( # noqa: E402LanguageTagError,@@ -516,6 +522,8 @@ def _postflight_warning_summaries(external_image_count: int,generic_font_stack_count: int,unsafe_font_face_count: int,+ dangerous_nonconforming_export: bool,+ dangerous_normalization_count: int,) -> tuple[str, ...]:"""Return stable warning summaries for the terminal receipt."""warnings: list[str] = []@@ -531,9 +539,43 @@ def _postflight_warning_summaries(warnings.append(f'generic_only_font_stacks={generic_font_stack_count}')if unsafe_font_face_count:warnings.append(f'unsafe_exported_font_faces={unsafe_font_face_count}')+ if dangerous_nonconforming_export:+ warnings.append('dangerous_nonconforming_svg_export=enabled')+ if dangerous_normalization_count:+ warnings.append(+ f'dangerous_compatibility_normalizations={dangerous_normalization_count}'+ )return tuple(warnings)+def _conversion_trace_dangerous_normalization_count(+ conversion_trace_path: Path | None,+) -> int:+ """Count compatibility normalizations retained in a conversion trace."""+ if conversion_trace_path is None or not conversion_trace_path.is_file():+ return 0+ try:+ payload = json.loads(conversion_trace_path.read_text(encoding='utf-8'))+ except (OSError, UnicodeError, json.JSONDecodeError):+ return 0+ if not isinstance(payload, dict):+ return 0+ count = 0+ slides = payload.get('slides')+ if isinstance(slides, list):+ for slide in slides:+ if not isinstance(slide, dict):+ continue+ normalizations = slide.get('dangerous_normalizations')+ if not isinstance(normalizations, list):+ continue+ count += sum(+ 1 for normalization in normalizations+ if isinstance(normalization, dict)+ )+ return count++def _write_postflight_report(*,output_path: Path,@@ -544,6 +586,8 @@ def _write_postflight_report(backup_path: Path | None,conversion_trace_path: Path | None,deck_motion: dict[str, object],+ dangerous_nonconforming_export: bool,+ authoring_roundtrip: dict[str, object] | None,) -> _PostflightReceipt:"""Write the unified package/resource audit for a successful PPTX."""try:@@ -569,6 +613,11 @@ def _write_postflight_report(external_image_count = source_audit['images']['external']generic_only_font_stacks = source_audit['fonts']['generic_only_stacks']unsafe_font_faces = source_audit['fonts']['unsafe_exported_faces']+ dangerous_normalization_count = (+ _conversion_trace_dangerous_normalization_count(+ conversion_trace_path+ )+ )if quality_gate == 'failed':report_status = 'failed'elif (@@ -578,6 +627,7 @@ def _write_postflight_report(and not unsafe_font_facesand not introduced_warning_countand quality_gate == 'passed'+ and not dangerous_nonconforming_export):report_status = 'passed'else:@@ -596,6 +646,7 @@ def _write_postflight_report('svg_slide_count': len(svg_files),'layout_definition_count': len(layout_definition_files),'fingerprint': source_fingerprint,+ 'authoring_roundtrip': authoring_roundtrip,},'package': package,'checks': {@@ -609,6 +660,17 @@ def _write_postflight_report(),'transitions': 'enforced-at-build','animations': 'enforced-at-build',+ 'project_svg_contract': 'enforced-at-build',+ 'compatibility_normalization': (+ 'warning'+ if dangerous_nonconforming_export+ else 'not-applicable'+ ),+ 'authoring_roundtrip': (+ 'materialized-from-flat-authoring'+ if authoring_roundtrip is not None+ else 'not-applicable'+ ),'quality_gate': quality_gate,'quality_warnings': ('passed' if not introduced_warning_count else 'warning'@@ -627,6 +689,14 @@ def _write_postflight_report(},'quality': quality,'resources': source_audit,+ 'export_policy': {+ 'project_svg_contract': (+ 'strict-after-dangerous-normalization'+ if dangerous_nonconforming_export+ else 'strict'+ ),+ 'dangerous_normalization_count': dangerous_normalization_count,+ },'deck_motion': deck_motion,'backup_path': str(backup_path.resolve()) if backup_path else None,'conversion_trace_path': (@@ -647,6 +717,8 @@ def _write_postflight_report(external_image_count=external_image_count,generic_font_stack_count=len(generic_only_font_stacks),unsafe_font_face_count=len(unsafe_font_faces),+ dangerous_nonconforming_export=dangerous_nonconforming_export,+ dangerous_normalization_count=dangerous_normalization_count,)return _PostflightReceipt(output_path=output_path,@@ -978,6 +1050,8 @@ Examples:%(prog)s projects/ppt169_demo # Default: native pptx -> exports/, svg_output -> backup/<ts>/%(prog)s projects/ppt169_demo -o out.pptx # Explicit path (no backup/)%(prog)s projects/quick_generate_demo --quick-generate # Lockless flat export with normal postflight+ %(prog)s <import_workspace> -s authoring-svg-flat \\+ --roundtrip # Editable IR with source restoration# Disable transition / change transition effect%(prog)s projects/ppt169_demo -t none@@ -1051,8 +1125,8 @@ Recorded narration:parser.add_argument('project_path', type=str, help='Project directory path')parser.add_argument('-o', '--output', type=str, default=None, help='Output file path')parser.add_argument('-s', '--source', type=str, default=None,- help='Native SVG source directory. Default: svg_output/. '- 'Pass output/final/<name> only for diagnostics.')+ help='Project-relative SVG source directory. Default: '+ 'svg_output/. Pass another directory explicitly.')parser.add_argument('-f', '--format', type=str,choices=list(CANVAS_FORMATS.keys()), default=None,help='Require SVG canvases to match this registered format')@@ -1071,11 +1145,23 @@ Recorded narration:'--roundtrip',action='store_true',help=(- 'Diagnostic only: rebuild layered slide_*.svg against the validated '- 'source_template.pptx/native_structure.json emitted by '- 'pptx_to_svg.py --roundtrip, including unchanged validated source '- 'chart packages. Requires -s svg and does not alter normal '- 'flat/structured release export.'+ 'Source-preserving import export: rebuild layered slide_*.svg, or '+ 'materialize a flat authoring IR selected with -s, against the '+ 'validated source_template.pptx/native_structure.json emitted by '+ 'pptx_to_svg.py --roundtrip. Unchanged authoring objects recover '+ 'their source semantics; edited objects remain authored SVG. Does '+ 'not alter normal flat/structured release export.'+ ),+ )+ parser.add_argument(+ '--enable-dangerous-nonconforming-svg-export',+ action='store_true',+ help=(+ 'Apply supported compatibility normalizations to svg_output/ or an '+ 'explicit -s/--source, then run the ordinary strict converter. '+ 'Cannot be combined with --roundtrip or --quick-generate. '+ 'Unnormalized contract, resource, conversion, relationship, and '+ 'package failures remain blocking.'),)@@ -1298,6 +1384,7 @@ Recorded narration:legacy_native_objects = '--native-objects' in raw_argvargs = parser.parse_args(raw_argv)diagnostic_source = args.source not in {None, 'output'}+ compatibility_export = args.enable_dangerous_nonconforming_svg_exportif legacy_native_objects:print('Warning: --native-objects is deprecated; use '@@ -1323,12 +1410,34 @@ Recorded narration:)return 1+ if compatibility_export:+ conflicts: list[str] = []+ if args.roundtrip:+ conflicts.append('--roundtrip')+ if args.quick_generate:+ conflicts.append('--quick-generate')+ if args.pptx_structure not in {None, 'flat'}:+ conflicts.append('--pptx-structure must be omitted or flat')+ if conflicts:+ print(+ 'Error: --enable-dangerous-nonconforming-svg-export cannot '+ 'be used because ' + ', '.join(conflicts),+ file=sys.stderr,+ )+ return 1+ print(+ 'Warning: dangerous nonconforming SVG export is enabled. Supported '+ 'compatibility rewrites will run before strict conversion; visual '+ 'fidelity must be reviewed.',+ file=sys.stderr,+ )+if args.roundtrip:conflicts: list[str] = []if args.quick_generate:conflicts.append('--quick-generate')- if args.source != 'svg':- conflicts.append('-s/--source must be svg')+ if args.source is None:+ conflicts.append('-s/--source is required')if args.pptx_structure is not None:conflicts.append('--pptx-structure must be omitted')if conflicts:@@ -1356,11 +1465,11 @@ Recorded narration:if not args.with_notes:args.no_notes = Trueargs.pptx_structure = 'flat'- elif diagnostic_source and not args.roundtrip:+ elif (diagnostic_source or compatibility_export) and not args.roundtrip:if args.pptx_structure not in {None, 'flat'}:print(- "Error: a non-output diagnostic --source supports only "- "--pptx-structure flat",+ "Error: a diagnostic or dangerous compatibility source "+ "supports only --pptx-structure flat",file=sys.stderr,)return 1@@ -1375,7 +1484,12 @@ Recorded narration:native_structure_contract = Nonepptx_structure = args.pptx_structurelock_path = project_path / 'spec_lock.md'- if not args.quick_generate and not diagnostic_source and not lock_path.is_file():+ lockless_export = (+ args.quick_generate+ or diagnostic_source+ or compatibility_export+ )+ if not lockless_export and not lock_path.is_file():print("Error: spec_lock.md is required for release SVG export",file=sys.stderr,@@ -1383,11 +1497,11 @@ Recorded narration:return 1declared_structure_mode = (None- if args.quick_generate or diagnostic_source+ if lockless_exportelse _declared_pptx_structure_mode(project_path))primary_language = None- if not args.quick_generate and not diagnostic_source:+ if not lockless_export:try:primary_language = _declared_primary_language(project_path)except LanguageTagError as exc:@@ -1467,8 +1581,7 @@ Recorded narration:source_embedded_fonts = Noneif (pptx_structure in {'flat', 'structured'}- and not args.quick_generate- and not diagnostic_source+ and not lockless_export):try:theme_font_spec = load_theme_font_spec(project_path)@@ -1492,7 +1605,10 @@ Recorded narration:file=sys.stderr,)return 1- elif pptx_structure in {'flat', 'preserve'} and diagnostic_source:+ elif (+ pptx_structure in {'flat', 'preserve'}+ and (diagnostic_source or compatibility_export)+ ):try:(theme_color_spec,@@ -1522,23 +1638,23 @@ Recorded narration:canvas_format = args.formatexpected_viewbox = (None- if args.quick_generate or diagnostic_source+ if lockless_exportelse _declared_canvas_viewbox(project_path))- if expected_viewbox is None and not args.quick_generate and not diagnostic_source:+ if expected_viewbox is None and not lockless_export:print("Error: spec_lock.md must contain canvas.viewBox for release export",file=sys.stderr,)return 1- # Native DrawingML is the only PPTX product. A non-output ``-s`` remains a- # diagnostic source override; default and explicit output use release rules.+ # Native DrawingML is the only PPTX product. ``svg_output/`` is the default;+ # ``-s`` selects another project-relative SVG directory.native_source = args.source or 'output'native_files, native_source_dir = find_svg_files(project_path,native_source,- allow_fallback=args.source is None and not args.quick_generate,+ allow_fallback=False,)if args.roundtrip:native_files = [@@ -1546,7 +1662,6 @@ Recorded narration:for path in native_filesif re.fullmatch(r'slide_\d+\.svg', path.name)]- ref_files = native_filesif not native_files:if args.quick_generate:print(@@ -1554,6 +1669,12 @@ Recorded narration:f"{project_path / 'svg_output'}",file=sys.stderr,)+ elif compatibility_export and args.source is None:+ print(+ "Error: No SVG files found for dangerous compatibility export in: "+ f"{project_path / 'svg_output'}",+ file=sys.stderr,+ )elif args.source is not None:requested_dir = project_path / native_source_dirprint(@@ -1565,7 +1686,49 @@ Recorded narration:print("Error: No SVG files found", file=sys.stderr)return 1- release_quality_gate = args.quick_generate or args.source in {None, 'output'}+ ref_files = native_files+ authoring_roundtrip_temporary: tempfile.TemporaryDirectory[str] | None = None+ authoring_roundtrip_report: dict[str, object] | None = None+ if args.roundtrip and args.source != 'svg':+ authoring_source_dir = project_path / native_source_dir+ if not is_flat_authoring_bundle(authoring_source_dir):+ print(+ "Error: --roundtrip with a source other than svg requires a "+ "flat authoring bundle with authoring_manifest.json: "+ f"{authoring_source_dir}",+ file=sys.stderr,+ )+ return 1+ authoring_roundtrip_temporary = tempfile.TemporaryDirectory(+ prefix='.authoring-roundtrip-',+ dir=project_path.resolve(),+ )+ try:+ materialized = materialize_flat_authoring_roundtrip(+ project_path.resolve(),+ authoring_source_dir.resolve(),+ Path(authoring_roundtrip_temporary.name),+ )+ except (AuthoringRoundtripError, OSError) as exc:+ authoring_roundtrip_temporary.cleanup()+ print(f"Error: {exc}", file=sys.stderr)+ return 1+ native_files = list(materialized.svg_files)+ authoring_roundtrip_report = materialized.report+ totals = materialized.report.get('totals')+ if isinstance(totals, dict):+ print(+ " Authoring round-trip materialized: "+ f"{len(native_files)} slide(s), "+ f"{totals.get('unchanged_refs', 0)} unchanged ref(s), "+ f"{totals.get('edited_refs', 0)} edited ref(s), "+ f"{totals.get('deleted_refs', 0)} deleted ref(s)"+ )++ release_quality_gate = (+ args.quick_generate+ or args.source in {None, 'output'}+ ) and not compatibility_exportif release_quality_gate:source_fingerprint = _svg_source_fingerprint(native_files)quality = _quality_report_context(project_path, source_fingerprint)@@ -1704,8 +1867,11 @@ Recorded narration:native_tag = "_native_charts_tables" if args.native_objects else ""narrated_tag = "_narrated" if (args.recorded_narration or args.narration_audio_dir) else ""native_path = exports_dir / f"{project_name}_{timestamp}{native_tag}{narrated_tag}.pptx"- # Preserve the authored svg_output/ beside every default-path export.- backup_dir = project_path / "backup" / timestamp+ # Preserve svg_output/ only when it is the actual source. A custom -s+ # directory remains the caller-owned source and is not copied under a+ # misleading svg_output backup name.+ if not diagnostic_source:+ backup_dir = project_path / "backup" / timestampnative_path.parent.mkdir(parents=True, exist_ok=True)@@ -2191,6 +2357,10 @@ Recorded narration:source_theme_xml=source_theme_xml,source_embedded_fonts=source_embedded_fonts,primary_language=primary_language,+ dangerous_nonconforming_export=(+ compatibility_export+ ),+ resource_root=project_path.resolve(),)if verbose:@@ -2214,6 +2384,10 @@ Recorded narration:conversion_trace_path = (project_path / 'validation' / f'{native_path.stem}.trace.json')+ elif compatibility_export:+ conversion_trace_path = (+ project_path / 'validation' / f'{native_path.stem}.trace.json'+ )try:success = create_pptx_with_native_svg(output_path=native_path,@@ -2269,6 +2443,10 @@ Recorded narration:backup_path=backup_path,conversion_trace_path=conversion_trace_path,deck_motion=deck_motion,+ dangerous_nonconforming_export=(+ compatibility_export+ ),+ authoring_roundtrip=authoring_roundtrip_report,)except PptxPostflightValidationError as exc:print(