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
fix(pptx-roundtrip): close native validation and round-trip gaps
hugohe3e4d81f68b729
diff --git a/skills/ppt-master/scripts/pptx_to_svg/chart_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/chart_to_svg.pyindex c0304fb5..d90cf19e 100644--- a/skills/ppt-master/scripts/pptx_to_svg/chart_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/chart_to_svg.py@@ -8,10 +8,12 @@ when the chart XML cache can be mapped to the current native chart schema.from __future__ import annotationsimport math+import refrom dataclasses import dataclassfrom typing import Anyfrom xml.etree import ElementTree as ET+from svg_to_pptx.drawingml.utils import parse_font_familyfrom svg_to_pptx.native_objects.chart_data import _chart_data, _data_label_positionfrom .emu_units import NS, Xfrm, ooxml_bool@@ -132,6 +134,106 @@ def _payload_from_chart_xml(chart_root: ET.Element, xfrm: Xfrm) -> dict[str, Anyreturn payload+def _canonical_srgb_color(fill: ET.Element | None) -> str:+ """Return an exporter-canonical solid RGB fill, or reject the style."""+ if fill is None or fill.attrib:+ raise _UnsupportedChart("unsupported-chart-series-style")+ children = list(fill)+ if (+ len(children) != 1+ or _local_name(children[0].tag) != "srgbClr"+ or set(children[0].attrib) != {"val"}+ or list(children[0])+ ):+ raise _UnsupportedChart("unsupported-chart-series-style")+ color = children[0].attrib["val"].strip()+ if len(color) != 6 or any(char not in "0123456789abcdefABCDEF" for char in color):+ raise _UnsupportedChart("unsupported-chart-series-style")+ return color.upper()+++def _canonical_sp_pr_color(sp_pr: ET.Element, *, line_visible: bool) -> str:+ """Extract a color only from the exact series style emitted here."""+ if sp_pr.attrib:+ raise _UnsupportedChart("unsupported-chart-series-style")+ children = list(sp_pr)+ if [_local_name(child.tag) for child in children] != ["solidFill", "ln"]:+ raise _UnsupportedChart("unsupported-chart-series-style")+ color = _canonical_srgb_color(children[0])+ line = children[1]+ if line.attrib or len(line) != 1:+ raise _UnsupportedChart("unsupported-chart-series-style")+ line_child = line[0]+ if line_visible:+ if _local_name(line_child.tag) != "solidFill":+ raise _UnsupportedChart("unsupported-chart-series-style")+ if _canonical_srgb_color(line_child) != color:+ raise _UnsupportedChart("unsupported-chart-series-style")+ elif (+ _local_name(line_child.tag) != "noFill"+ or line_child.attrib+ or list(line_child)+ ):+ raise _UnsupportedChart("unsupported-chart-series-style")+ return color+++def _canonical_chart_colors(payload: dict[str, Any], plot: ET.Element) -> list[str] | None:+ """Recover colors from canonical series or pie data-point formatting."""+ chart_type = payload["type"]+ series_nodes = plot.findall("c:ser", C_NS)+ if chart_type in {"pie", "doughnut", "of_pie"}:+ if any(series.find("c:spPr", C_NS) is not None for series in series_nodes):+ raise _UnsupportedChart("unsupported-chart-series-style")+ point_nodes = [+ point+ for series in series_nodes+ for point in series.findall("c:dPt", C_NS)+ ]+ if not point_nodes:+ return None+ expected_count = len(payload["categories"]) + (1 if chart_type == "of_pie" else 0)+ colors: dict[int, str] = {}+ for point in point_nodes:+ if point.attrib or [_local_name(child.tag) for child in point] != ["idx", "spPr"]:+ raise _UnsupportedChart("unsupported-chart-series-style")+ idx = point.find("c:idx", C_NS)+ sp_pr = point.find("c:spPr", C_NS)+ try:+ point_index = int(idx.attrib.get("val", "")) if idx is not None else -1+ except ValueError:+ raise _UnsupportedChart("unsupported-chart-series-style") from None+ if (+ idx is None+ or set(idx.attrib) != {"val"}+ or list(idx)+ or sp_pr is None+ or point_index in colors+ ):+ raise _UnsupportedChart("unsupported-chart-series-style")+ colors[point_index] = _canonical_sp_pr_color(sp_pr, line_visible=True)+ if set(colors) != set(range(expected_count)):+ raise _UnsupportedChart("unsupported-chart-series-style")+ return [f"#{colors[index]}" for index in range(expected_count)]++ if any(series.find("c:dPt", C_NS) is not None for series in series_nodes):+ raise _UnsupportedChart("unsupported-chart-series-style")+ sp_pr_nodes = [series.find("c:spPr", C_NS) for series in series_nodes]+ if not any(sp_pr is not None for sp_pr in sp_pr_nodes):+ return None+ if any(sp_pr is None for sp_pr in sp_pr_nodes):+ raise _UnsupportedChart("unsupported-chart-series-style")+ line_visible = not (+ chart_type == "scatter"+ and payload.get("scatter_style", "marker") == "marker"+ )+ return [+ f"#{_canonical_sp_pr_color(sp_pr, line_visible=line_visible)}"+ for sp_pr in sp_pr_nodes+ if sp_pr is not None+ ]++def _validate_chart_semantics(payload: dict[str, Any],plot_area: ET.Element,@@ -139,6 +241,9 @@ def _validate_chart_semantics() -> None:"""Reject valid chart features the compact marker cannot reproduce."""chart_type = payload["type"]+ colors = _canonical_chart_colors(payload, plot)+ if colors:+ payload["style"] = {"colors": colors}for tag in ("trendline", "errBars", "dropLines", "hiLowLines", "upDownBars",):@@ -330,12 +435,25 @@ def _apply_chart_metadata(if chart is None:return- title = _chart_text(chart.find("c:title", C_NS))+ title_element = chart.find("c:title", C_NS)+ overlay = title_element.find("c:overlay", C_NS) if title_element is not None else None+ if overlay is not None and ooxml_bool(overlay.attrib.get("val"), True):+ raise _UnsupportedChart("unsupported-chart-title-overlay")+ title_entries = _canonical_title_entries(title_element)+ if (+ title_element is not None+ and title_element.find("c:tx/c:rich", C_NS) is not None+ and title_entries is None+ ):+ raise _UnsupportedChart("unsupported-chart-title-format")+ title = _chart_text(title_element)if title:- overlay = chart.find("c:title/c:overlay", C_NS)- if overlay is not None and ooxml_bool(overlay.attrib.get("val"), True):- raise _UnsupportedChart("unsupported-chart-title-overlay")- payload["title"] = title+ if title_entries is not None:+ payload["title"] = title_entries[0]+ if len(title_entries) == 2:+ payload["subtitle"] = title_entries[1]+ else:+ payload["title"] = titlelegend = chart.find("c:legend", C_NS)if legend is not None:@@ -421,6 +539,133 @@ def _chart_text(container: ET.Element | None) -> str:return "".join(values)+def _canonical_title_paragraph(paragraph: ET.Element) -> dict[str, Any] | None:+ """Return one exporter-canonical or basic Office title paragraph."""+ if paragraph.attrib or [_local_name(child.tag) for child in paragraph] != ["r"]:+ return None+ run = paragraph.find("a:r", C_NS)+ if run is None or run.attrib:+ return None+ run_child_names = [_local_name(child.tag) for child in run]+ if run_child_names == ["t"]:+ text = run.find("a:t", C_NS)+ if (+ text is None+ or text.attrib+ or list(text)+ or not (text.text or "")+ or text.text != text.text.strip()+ ):+ return None+ return {"text": text.text}+ if run_child_names != ["rPr", "t"]:+ return None+ run_props = run.find("a:rPr", C_NS)+ text = run.find("a:t", C_NS)+ if (+ run_props is None+ or set(run_props.attrib) != {"lang", "sz"}+ or text is None+ or text.attrib+ or list(text)+ or not (text.text or "")+ or text.text != text.text.strip()+ ):+ return None+ size_token = run_props.attrib["sz"]+ if re.fullmatch(r"[0-9]+", size_token) is None:+ return None+ size = int(size_token)+ if size % 10 != 0 or not 100 <= size <= 400000:+ return None+ child_names = [_local_name(child.tag) for child in run_props]+ if child_names not in ([], ["solidFill"], ["latin", "ea"], ["solidFill", "latin", "ea"]):+ return None+ solid_fill = run_props.find("a:solidFill", C_NS)+ color = None+ if solid_fill is not None:+ try:+ color = _canonical_srgb_color(solid_fill)+ except _UnsupportedChart:+ return None+ latin = run_props.find("a:latin", C_NS)+ east_asian = run_props.find("a:ea", C_NS)+ if (latin is None) != (east_asian is None):+ return None+ for font in (latin, east_asian):+ if font is not None and (+ set(font.attrib) != {"typeface"}+ or not font.attrib["typeface"].strip()+ or list(font)+ ):+ return None+ entry: dict[str, Any] = {+ "text": text.text,+ "font_size": _round_payload_number(size / 75.0),+ }+ if color is not None:+ entry["color"] = f"#{color}"+ if latin is not None and east_asian is not None:+ latin_name = latin.attrib["typeface"]+ east_asian_name = east_asian.attrib["typeface"]+ font_family = (+ latin_name+ if latin_name == east_asian_name+ else f"{latin_name}, {east_asian_name}"+ )+ resolved_fonts = parse_font_family(font_family)+ if (+ resolved_fonts["latin"] != latin_name+ or resolved_fonts["ea"] != east_asian_name+ ):+ return None+ entry["font_family"] = font_family+ return entry+++def _canonical_title_entries(title: ET.Element | None) -> list[dict[str, Any]] | None:+ """Recognize exporter-canonical or basic Office rich title structure."""+ if title is None:+ return None+ title_child_names = [_local_name(child.tag) for child in title]+ if title_child_names not in (["tx", "layout"], ["tx", "layout", "overlay"]):+ return None+ overlay = title.find("c:overlay", C_NS)+ if overlay is not None and (+ set(overlay.attrib) != {"val"}+ or list(overlay)+ or ooxml_bool(overlay.attrib.get("val"), True)+ ):+ return None+ tx = title.find("c:tx", C_NS)+ layout = title.find("c:layout", C_NS)+ rich = title.find("c:tx/c:rich", C_NS)+ if (+ tx is None+ or tx.attrib+ or [_local_name(child.tag) for child in tx] != ["rich"]+ or layout is None+ or layout.attrib+ or list(layout)+ or rich is None+ or rich.attrib+ ):+ return None+ children = list(rich)+ child_names = [_local_name(child.tag) for child in children]+ if child_names not in (+ ["bodyPr", "lstStyle", "p"],+ ["bodyPr", "lstStyle", "p", "p"],+ ):+ return None+ if children[0].attrib or list(children[0]) or children[1].attrib or list(children[1]):+ return None+ entries = [_canonical_title_paragraph(paragraph) for paragraph in children[2:]]+ if any(entry is None for entry in entries):+ return None+ return [entry for entry in entries if entry is not None]++def _data_label_text_style(tx_pr: ET.Element) -> dict[str, Any]:"""Extract the subset of label text properties emitted by this exporter."""body_pr = tx_pr.find("a:bodyPr", C_NS)diff --git a/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.py b/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.pyindex 69cb90e9..e3de69f3 100644--- a/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.py+++ b/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.py@@ -8,6 +8,7 @@ accessible for downstream shape conversion.from __future__ import annotationsimport posixpath+import reimport zipfilefrom dataclasses import dataclass, fieldfrom pathlib import Path, PurePosixPath@@ -57,8 +58,8 @@ def _parse_rels(zf: zipfile.ZipFile, rels_path: str) -> dict[str, dict[str, str]return {}try:root = ET.fromstring(zf.read(rels_path))- except ET.ParseError:- return {}+ except ET.ParseError as exc:+ raise RuntimeError(f"Invalid relationships XML in {rels_path}: {exc}") from excbase = rels_path.replace("/_rels/", "/") # source part pathbase = base[:-len(".rels")] # strip .rels suffix@@ -82,8 +83,8 @@ def _load_xml(zf: zipfile.ZipFile, part_path: str) -> ET.Element | None:return Nonetry:return ET.fromstring(zf.read(part_path))- except ET.ParseError:- return None+ except ET.ParseError as exc:+ raise RuntimeError(f"Invalid OOXML part {part_path}: {exc}") from exc# ---------------------------------------------------------------------------@@ -150,6 +151,7 @@ class OoxmlPackage:self.presentation: PartRef | None = Noneself.slide_size_px: tuple[float, float] = (1280.0, 720.0)self.slide_size_emu: tuple[int, int] = (12192000, 6858000)+ self.first_slide_number: int = 1self._slides: list[SlideRef] = []self._layouts: dict[str, PartRef] = {}self._masters: dict[str, PartRef] = {}@@ -219,6 +221,25 @@ class OoxmlPackage:if self.presentation is None:raise RuntimeError(f"presentation.xml missing in {self.path}")+ raw_first_slide_number = self.presentation.xml.attrib.get("firstSlideNum")+ if raw_first_slide_number is not None:+ first_slide_token = raw_first_slide_number.strip(" \t\r\n")+ if re.fullmatch(r"[+-]?[0-9]+", first_slide_token) is None:+ raise RuntimeError(+ f"Invalid presentation firstSlideNum: {raw_first_slide_number!r}"+ )+ digits = first_slide_token.lstrip("+-").lstrip("0") or "0"+ if len(digits) > 10:+ raise RuntimeError("Presentation firstSlideNum is outside xsd:int")+ first_slide_number = int(digits)+ if first_slide_token.startswith("-"):+ first_slide_number = -first_slide_number+ if not -(2**31) <= first_slide_number <= 2**31 - 1:+ raise RuntimeError(+ f"Presentation firstSlideNum is outside xsd:int: {first_slide_number}"+ )+ self.first_slide_number = first_slide_number+# slide sizesize = self.presentation.xml.find("p:sldSz", NS)if size is not None:diff --git a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.pyindex e16486b6..6168d022 100644--- a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py@@ -61,6 +61,7 @@ class AssemblyContext:palette: ColorPalette | Nonepkg: OoxmlPackageslide_part: PartRef+ slide_number: int | None = Nonetheme_fonts: dict[str, str] = field(default_factory=dict)media_subdir: str = "assets"embed_images: bool = False@@ -112,6 +113,7 @@ def assemble_slide(palette=palette,pkg=pkg,slide_part=slide.part,+ slide_number=pkg.first_slide_number + slide.index - 1,theme_fonts=theme_fonts or {},media_subdir=media_subdir,embed_images=embed_images,@@ -323,6 +325,7 @@ def _convert_shape(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) ->text_result = convert_vertical_txbody(tx_body, node.xfrm, ctx.palette,theme_fonts=ctx.theme_fonts,+ slide_number=ctx.slide_number,default_fill=text_default_fill,default_font_size_px=DEFAULT_FONT_SIZE_PX,fallback_lst_styles=node.inherited_lst_styles,@@ -333,6 +336,7 @@ def _convert_shape(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) ->text_result = convert_txbody(tx_body, node.xfrm, ctx.palette,theme_fonts=ctx.theme_fonts,+ slide_number=ctx.slide_number,default_fill=text_default_fill,default_font_size_px=DEFAULT_FONT_SIZE_PX,fallback_lst_styles=node.inherited_lst_styles,@@ -662,6 +666,7 @@ def _render_graphic_table(result = convert_tbl(tbl, node.xfrm, ctx.palette,theme_fonts=ctx.theme_fonts,+ slide_number=ctx.slide_number,id_prefix=f"tbl{ctx.shape_seq[0]}",grad_seq=ctx.grad_seq,marker_seq=ctx.marker_seq,diff --git a/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.pyindex 43f82833..1bfa5636 100644--- a/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py@@ -78,6 +78,7 @@ def convert_tbl(palette: ColorPalette | None,*,theme_fonts: dict[str, str] | None = None,+ slide_number: int | None = None,id_prefix: str = "tbl",grad_seq: list[int] | None = None,marker_seq: list[int] | None = None,@@ -116,6 +117,15 @@ def convert_tbl(native_status = "unsupported-native-transform"elif _table_has_merges(rows):native_status = "unsupported-merge"+ elif len(rows) > 1000 or len(col_widths) > 1000:+ native_status = "unsupported-table-size"+ elif (+ any(width < 0 for width in col_widths)+ or any(height < 0 for height in row_heights)+ or sum(col_widths) <= 0+ or sum(row_heights) <= 0+ ):+ native_status = "unsupported-table-geometry"elif _table_has_unsupported_style(tbl):native_status = "unsupported-table-style"elif _table_has_unsupported_direct_formatting(tbl, palette):@@ -176,6 +186,7 @@ def convert_tbl(cell_xfrm = Xfrm(x=cell_x, y=cell_y, w=cell_w, h=cell_h)text_result = _convert_cell_text(tx_body, tcPr, cell_xfrm, palette, theme_fonts,+ slide_number=slide_number,id_prefix=f"{id_prefix}txt",id_seq=grad_seq,)@@ -679,6 +690,7 @@ def _convert_cell_text(palette: ColorPalette | None,theme_fonts: dict[str, str] | None,*,+ slide_number: int | None,id_prefix: str,id_seq: list[int] | None,):@@ -697,6 +709,7 @@ def _convert_cell_text(try:return convert_txbody(tx_body, cell_xfrm, palette, theme_fonts=theme_fonts,+ slide_number=slide_number,id_prefix=id_prefix,id_seq=id_seq,)diff --git a/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.pyindex 511b2466..f342deef 100644--- a/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.py@@ -103,6 +103,7 @@ def convert_txbody(palette: ColorPalette | None,*,theme_fonts: dict[str, str] | None = None,+ slide_number: int | None = None,default_fill: str = DEFAULT_FILL_HEX,default_font_size_px: float = DEFAULT_FONT_SIZE_PX,fallback_lst_styles: tuple[ET.Element, ...] = (),@@ -118,7 +119,7 @@ def convert_txbody(tx_body, palette, theme_fonts or {}, default_fill=default_fill,default_font_size_px=default_font_size_px,fallback_lst_styles=fallback_lst_styles,- id_prefix=id_prefix, id_seq=id_seq,+ slide_number=slide_number, id_prefix=id_prefix, id_seq=id_seq,)if not paragraphs or not _has_visible_text(paragraphs):return TextResult()@@ -188,6 +189,7 @@ def convert_vertical_txbody(palette: ColorPalette | None,*,theme_fonts: dict[str, str] | None = None,+ slide_number: int | None = None,default_fill: str = DEFAULT_FILL_HEX,default_font_size_px: float = DEFAULT_FONT_SIZE_PX,fallback_lst_styles: tuple[ET.Element, ...] = (),@@ -208,7 +210,7 @@ def convert_vertical_txbody(tx_body, palette, theme_fonts or {}, default_fill=default_fill,default_font_size_px=default_font_size_px,fallback_lst_styles=fallback_lst_styles,- id_prefix=id_prefix, id_seq=id_seq,+ slide_number=slide_number, id_prefix=id_prefix, id_seq=id_seq,)runs = [run@@ -342,6 +344,7 @@ def _parse_paragraphs(default_fill: str = DEFAULT_FILL_HEX,default_font_size_px: float = DEFAULT_FONT_SIZE_PX,fallback_lst_styles: tuple[ET.Element, ...] = (),+ slide_number: int | None = None,id_prefix: str = "txt",id_seq: list[int] | None = None,) -> list[TextParagraph]:@@ -360,6 +363,7 @@ def _parse_paragraphs(lst_styles=lst_styles,default_fill=default_fill,default_font_size_px=default_font_size_px,+ slide_number=slide_number,id_prefix=id_prefix, id_seq=id_seq,)paragraphs.append(para)@@ -376,6 +380,7 @@ def _parse_paragraph(lst_styles: tuple[ET.Element, ...] = (),default_fill: str = DEFAULT_FILL_HEX,default_font_size_px: float = DEFAULT_FONT_SIZE_PX,+ slide_number: int | None = None,id_prefix: str = "txt",id_seq: list[int] | None = None,) -> TextParagraph:@@ -430,10 +435,15 @@ def _parse_paragraph(is_break=True,))elif local == "fld":- # Field (datetime / slidenum). Use the literal a:t fallback.+ # Slide SVGs have a concrete page context, so resolve slide-number+ # fields there. Standalone master/layout renders keep the literal+ # fallback because one shared part can serve many slide numbers.rpr = child.find("a:rPr", NS)text_elem = child.find("a:t", NS)text = text_elem.text or "" if text_elem is not None else ""+ field_type = child.attrib.get("type", "").strip().lower()+ if field_type == "slidenum" and slide_number is not None:+ text = str(slide_number)if text:run = _build_run(text, rpr, end_rpr, palette, theme_fonts,diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.pyindex 342be62b..6b793215 100644--- a/skills/ppt-master/scripts/svg_quality_checker.py+++ b/skills/ppt-master/scripts/svg_quality_checker.py@@ -948,11 +948,27 @@ class SVGQualityChecker:)return+ parent_map = {+ child: parent+ for parent in root.iter()+ for child in parent+ }+for marker in markers:marker_id = marker.get('id') or '<unnamed>'+ ancestors = []+ parent = parent_map.get(marker)+ while parent is not None and parent is not root:+ if parent.tag.rsplit('}', 1)[-1] == 'g':+ ancestors.append(parent)+ parent = parent_map.get(parent)+ ancestors_tuple = tuple(reversed(ancestors))if _validate_native_object_marker_with_warnings is not None:try:- warnings = _validate_native_object_marker_with_warnings(marker)+ warnings = _validate_native_object_marker_with_warnings(+ marker,+ ancestors=ancestors_tuple,+ )except RuntimeError as exc:result['errors'].append(f"Invalid data-pptx-native marker {marker_id}: {exc}"@@ -965,7 +981,7 @@ class SVGQualityChecker:continuetry:- _validate_native_object_marker(marker)+ _validate_native_object_marker(marker, ancestors=ancestors_tuple)except RuntimeError as exc:result['errors'].append(f"Invalid data-pptx-native marker {marker_id}: {exc}"@@ -973,7 +989,10 @@ class SVGQualityChecker:continueif _native_object_marker_warnings is None:continue- for warning in _native_object_marker_warnings(marker):+ for warning in _native_object_marker_warnings(+ marker,+ ancestors=ancestors_tuple,+ ):result['warnings'].append(f"data-pptx-native marker {marker_id}: {warning}")diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex c52d1f09..3310326b 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -26,7 +26,7 @@ from .elements import (convert_text, convert_image, convert_nested_svg,)from ..animation_config import is_chrome_id-from ..native_objects import convert_native_object+from ..native_objects import convert_native_object, native_marker_transformclass SvgNativeConversionError(RuntimeError):@@ -138,7 +138,16 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:keep their absolute slide coordinates unchanged."""transform = elem.get('transform', '')- dx, dy, sx, sy, angle_deg = parse_transform(transform)+ native_subtree_active = ctx.native_objects_enabled and any(+ descendant.get('data-pptx-native')+ and descendant.tag.replace(f'{{{SVG_NS}}}', '') != 'metadata'+ for descendant in elem.iter()+ )+ if native_subtree_active:+ dx, dy, sx, sy = native_marker_transform(transform)+ angle_deg = 0.0+ else:+ dx, dy, sx, sy, angle_deg = parse_transform(transform)filter_id = resolve_url_id(elem.get('filter', ''))style_overrides = _extract_inheritable_styles(elem)@@ -149,7 +158,7 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:child for child in elemif child.tag.replace(f'{{{SVG_NS}}}', '') not in _NON_VISUAL_TAGS]- matrix_supported = bool(transform) and visual_children and all(+ matrix_supported = not native_subtree_active and bool(transform) and visual_children and all(_supports_matrix_transform(child) for child in visual_children)# A pure ``rotate(angle [cx cy])`` falls through to the fallback path@@ -175,7 +184,14 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:style_overrides=style_overrides,)else:- child_ctx = ctx.child(dx, dy, sx, sy, filter_id=filter_id, style_overrides=style_overrides)+ child_ctx = ctx.child(+ ctx.scale_x * dx if native_subtree_active else dx,+ ctx.scale_y * dy if native_subtree_active else dy,+ sx,+ sy,+ filter_id=filter_id,+ style_overrides=style_overrides,+ )if child_ctx.native_objects_enabled:native_result = convert_native_object(elem, child_ctx)diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.pyindex fef6e86d..2d202a88 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/__init__.py@@ -18,6 +18,7 @@ from .chart_style import (_native_chart_chrome_errors,_native_chart_chrome_warnings,_native_chart_export_payload,+ _validate_chart_companion_boxes,)from .chart_xml import _chart_rels_xml, _chart_xmlfrom .chartex import (@@ -39,7 +40,9 @@ from .marker_common import (_bounds,_load_payload,_local_tag,+ _native_marker_validation_context,_validate_bounds_inputs,+ native_marker_transform,)from .table import (_build_native_table,@@ -55,6 +58,7 @@ from .workbook import (__all__ = ["convert_native_object","native_object_marker_warnings",+ "native_marker_transform","validate_native_object_marker","validate_native_object_marker_with_warnings",]@@ -164,6 +168,8 @@ def _validate_native_object_marker_payload(elem: ET.Element,*,validate_chrome: bool = True,+ ctx: ConvertContext | None = None,+ ancestors: tuple[ET.Element, ...] = (),) -> tuple[str, dict[str, Any], list[list[Any]] | None]:kind = (elem.get("data-pptx-native") or "").strip().lower()if not kind:@@ -172,17 +178,26 @@ def _validate_native_object_marker_payload(raise RuntimeError(f"Unsupported data-pptx-native value: {kind}")if _local_tag(elem) != "g":raise RuntimeError("Native PPTX table/chart markers must be <g> elements")- transform = elem.get("transform", "")- if transform and any(token in transform for token in ("rotate", "matrix", "skew")):- raise RuntimeError("Native PPTX table/chart markers support translate/scale transforms only")+ native_marker_transform(elem.get("transform"))payload = _load_payload(elem, kind)- _validate_bounds_inputs(elem, payload)+ bounds_ctx = ctx or _native_marker_validation_context(elem, ancestors)+ off_x, off_y, ext_cx, ext_cy, _ = _validate_bounds_inputs(elem, payload, bounds_ctx)table_rows = Noneif kind == "table":- table_rows, _ = _validate_table_payload(payload)+ table_rows, col_count = _validate_table_payload(payload)+ if ext_cx < col_count or ext_cy < len(table_rows):+ raise RuntimeError(+ "Native PPTX table bounds must provide at least one EMU per row and column"+ )else:- _chart_data(payload)+ chart_data = _chart_data(payload)+ _validate_chart_companion_boxes(+ payload,+ chart_bounds=(off_x, off_y, ext_cx, ext_cy),+ include_title=chart_data["kind"] == "chartex",+ include_subtitle_as_caption=chart_data["kind"] == "chartex",+ )if validate_chrome and elem.get("data-pptx-native-source") != "pptx":chrome_errors = _native_chart_chrome_errors(elem, payload)if chrome_errors:@@ -190,14 +205,25 @@ def _validate_native_object_marker_payload(return kind, payload, table_rows-def validate_native_object_marker(elem: ET.Element) -> None:+def validate_native_object_marker(+ elem: ET.Element,+ *,+ ancestors: tuple[ET.Element, ...] = (),+) -> None:"""Validate a data-pptx-native marker without mutating the PPTX package."""- _validate_native_object_marker_payload(elem)+ _validate_native_object_marker_payload(elem, ancestors=ancestors)-def validate_native_object_marker_with_warnings(elem: ET.Element) -> list[str]:+def validate_native_object_marker_with_warnings(+ elem: ET.Element,+ *,+ ancestors: tuple[ET.Element, ...] = (),+) -> list[str]:"""Validate a data-pptx-native marker and return non-fatal warnings."""- kind, payload, table_rows = _validate_native_object_marker_payload(elem)+ kind, payload, table_rows = _validate_native_object_marker_payload(+ elem,+ ancestors=ancestors,+ )if kind == "table" and table_rows is not None:return _native_table_warnings(elem, table_rows)if kind == "chart":@@ -205,9 +231,13 @@ def validate_native_object_marker_with_warnings(elem: ET.Element) -> list[str]:return []-def native_object_marker_warnings(elem: ET.Element) -> list[str]:+def native_object_marker_warnings(+ elem: ET.Element,+ *,+ ancestors: tuple[ET.Element, ...] = (),+) -> list[str]:"""Return non-fatal warnings for a data-pptx-native marker."""- return validate_native_object_marker_with_warnings(elem)+ return validate_native_object_marker_with_warnings(elem, ancestors=ancestors)def convert_native_object(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:@@ -216,7 +246,11 @@ def convert_native_object(elem: ET.Element, ctx: ConvertContext) -> ShapeResultif not kind:return None- kind, payload, _ = _validate_native_object_marker_payload(elem, validate_chrome=False)+ kind, payload, _ = _validate_native_object_marker_payload(+ elem,+ validate_chrome=False,+ ctx=ctx,+ )if kind == "table":return _build_native_table(elem, ctx, payload)payload, warnings = _native_chart_export_payload(elem, payload)diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.pyindex 27a43aa7..5451bc8e 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_data.py@@ -10,7 +10,9 @@ from .marker_common import (_clean_hex,_compact_key,_first_present,+ _hex_or_none,_number,+ _powerpoint_line_width_emu,)@@ -19,8 +21,8 @@ def _chart_number(value: Any) -> int | float:raise RuntimeError("Native PPTX chart values must be numeric")try:number = float(value)- except (TypeError, ValueError) as exc:- raise RuntimeError(f"Native PPTX chart value is not numeric: {value}") from exc+ except (TypeError, ValueError, OverflowError) as exc:+ raise RuntimeError("Native PPTX chart value is not numeric") from excif not math.isfinite(number):raise RuntimeError(f"Native PPTX chart value must be finite: {value}")return int(number) if number.is_integer() else number@@ -97,6 +99,7 @@ def _chart_data_labels(payload: dict[str, Any],chart_type: str,grouping: str | None,+ point_count: int,) -> dict[str, Any] | None:config = _data_labels_config(payload)if config is None:@@ -106,9 +109,74 @@ def _chart_data_labels(f"Native PPTX {chart_type} chart data labels are outside current support")_data_label_position(config.get("position"), chart_type, grouping)+ if config.get("color") is not None and _hex_or_none(config["color"]) is None:+ raise RuntimeError("Native PPTX chart data_labels.color must be a color")+ point_items = _data_label_point_items(+ config,+ chart_type,+ grouping,+ point_count,+ )+ for item in point_items:+ if item.get("color") is not None and _hex_or_none(item["color"]) is None:+ raise RuntimeError(+ "Native PPTX chart data_labels.points color must be a color"+ )+ colors = _chart_list(+ _first_present(+ config.get("colors"),+ config.get("label_colors"),+ config.get("labelColors"),+ ),+ "data_labels.colors",+ )+ if colors and len(colors) != point_count:+ raise RuntimeError("Native PPTX chart data_labels.colors must match point count")+ if any(_hex_or_none(color) is None for color in colors):+ raise RuntimeError("Native PPTX chart data_labels.colors entries must be colors")return config+def _data_label_point_items(+ config: dict[str, Any],+ chart_type: str,+ grouping: str | None,+ point_count: int,+) -> list[dict[str, Any]]:+ """Normalize selected point labels and validate their plot semantics."""+ raw_points = config.get("points")+ if raw_points is None:+ return []+ items: list[dict[str, Any]] = []+ seen: set[int] = set()+ for item in _chart_list(raw_points, "data_labels.points"):+ if isinstance(item, dict):+ raw_index = item.get("idx")+ data = dict(item)+ else:+ raw_index = item+ data = {}+ if isinstance(raw_index, bool):+ raise RuntimeError("Native PPTX chart data_labels.points idx must be an integer")+ index_value = _number(raw_index, "data_labels.points idx")+ if not index_value.is_integer():+ raise RuntimeError("Native PPTX chart data_labels.points idx must be an integer")+ index = int(index_value)+ if index < 0 or index >= point_count:+ raise RuntimeError("Native PPTX chart data_labels.points idx is outside point range")+ if index in seen:+ raise RuntimeError("Native PPTX chart data_labels.points idx values must be unique")+ _data_label_position(+ _first_present(data.get("position"), config.get("position")),+ chart_type,+ grouping,+ )+ seen.add(index)+ data["idx"] = index+ items.append(data)+ return items++_CATEGORY_CHART_TYPES = {"area","bar",@@ -412,12 +480,21 @@ def _category_series(payload: dict[str, Any], categories: list[str]) -> list[dicitem.get("fillOpacity"),)if fill_opacity is not None:+ fill_opacity = _number(fill_opacity, "series fill_opacity")+ if not 0 <= fill_opacity <= 1:+ raise RuntimeError(+ "Native PPTX chart series fill_opacity must be between 0 and 1"+ )series_item["fill_opacity"] = fill_opacityline_width = _first_present(item.get("line_width"),item.get("lineWidth"),)if line_width is not None:+ line_width = _number(line_width, "series line_width")+ if line_width <= 0:+ raise RuntimeError("Native PPTX chart series line_width must be positive")+ _powerpoint_line_width_emu(line_width, "series line_width")series_item["line_width"] = line_widthseries.append(series_item)return series@@ -488,7 +565,12 @@ def _category_chart_data(),True,),- "data_labels": _chart_data_labels(payload, chart_type, grouping),+ "data_labels": _chart_data_labels(+ payload,+ chart_type,+ grouping,+ len(categories),+ ),"series": series,}@@ -552,7 +634,12 @@ def _combo_plot_entry()entry: dict[str, Any] = {"axis": _combo_axis_name(plot_payload),- "data_labels": _chart_data_labels(plot_payload, chart_type, grouping),+ "data_labels": _chart_data_labels(+ plot_payload,+ chart_type,+ grouping,+ len(categories),+ ),"grouping": grouping,"series": plot_series,"type": chart_type,@@ -722,11 +809,27 @@ def _chartex_chart_data(payload: dict[str, Any], chart_type: str) -> dict[str, A"values": values,}if chart_type == "waterfall":- subtotals = payload.get("subtotals", payload.get("subtotal_indices", []))- data["subtotals"] = [- int(_chart_number(value))- for value in _chart_list(subtotals, "subtotals")- ]+ raw_subtotals = payload.get(+ "subtotals",+ payload.get("subtotal_indices", []),+ )+ subtotals: list[int] = []+ seen_subtotals: set[int] = set()+ for value in _chart_list(raw_subtotals, "subtotals"):+ index = _chart_number(value)+ if not isinstance(index, int):+ raise RuntimeError("Native PPTX waterfall subtotal indices must be integers")+ if index < 0 or index >= len(values):+ raise RuntimeError(+ "Native PPTX waterfall subtotal index is outside point range"+ )+ if index in seen_subtotals:+ raise RuntimeError(+ "Native PPTX waterfall subtotal indices must be unique"+ )+ seen_subtotals.add(index)+ subtotals.append(index)+ data["subtotals"] = subtotalsreturn dataif chart_type == "box_whisker":diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.pyindex 686ad16e..18e6e089 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_style.py@@ -2,6 +2,7 @@from __future__ import annotations+import mathfrom typing import Anyfrom xml.etree import ElementTree as ET@@ -26,6 +27,8 @@ from .marker_common import (_most_common_color,_number,_normalized_fallback_text,+ _powerpoint_emu,+ _powerpoint_emu_value,_relative_luminance,_style_attr,_visible_fallback_texts,@@ -354,8 +357,10 @@ def _alpha_xml(value: Any, field_name: str = "fill_opacity") -> str:raise RuntimeError(f"Native PPTX chart {field_name} must be numeric")try:alpha = float(value)- except (TypeError, ValueError):+ except (TypeError, ValueError, OverflowError):raise RuntimeError(f"Native PPTX chart {field_name} must be numeric") from None+ if not math.isfinite(alpha):+ raise RuntimeError(f"Native PPTX chart {field_name} must be finite")if alpha < 0 or alpha > 1:raise RuntimeError(f"Native PPTX chart {field_name} must be between 0 and 1")return f'<a:alpha val="{int(round(alpha * 100000))}"/>'@@ -707,6 +712,52 @@ def _chart_companion_entries(return entries+def _chart_companion_box(item: dict[str, Any]) -> tuple[int, int, int, int] | None:+ """Validate and resolve an optional explicit companion text box."""+ box_keys = ("x", "y", "width", "height")+ provided_box_keys = [key for key in box_keys if key in item]+ if provided_box_keys and len(provided_box_keys) != len(box_keys):+ raise RuntimeError(+ "Native PPTX chart companion text boxes require x/y/width/height together"+ )+ if not provided_box_keys:+ return None+ return (+ _powerpoint_emu(item["x"], "companion text x"),+ _powerpoint_emu(item["y"], "companion text y"),+ _powerpoint_emu(item["width"], "companion text width", positive=True),+ _powerpoint_emu(item["height"], "companion text height", positive=True),+ )+++def _validate_chart_companion_boxes(+ payload: dict[str, Any],+ *,+ chart_bounds: tuple[int, int, int, int],+ include_title: bool,+ include_subtitle_as_caption: bool,+) -> None:+ """Validate companion boxes without allocating shapes or relationships."""+ _, chart_off_y, _, chart_ext_cy = chart_bounds+ below_index = 0+ for item in _chart_companion_entries(+ payload,+ include_title=include_title,+ include_subtitle_as_caption=include_subtitle_as_caption,+ ):+ text = str(item.get("text") or "").strip()+ if not text:+ continue+ if _chart_companion_box(item) is not None:+ continue+ if str(item.get("role") or "note") != "title":+ _powerpoint_emu_value(+ chart_off_y + chart_ext_cy + px_to_emu(4 + below_index * 18),+ "companion text y",+ )+ below_index += 1++def _chart_companion_text_xml(ctx: ConvertContext,payload: dict[str, Any],@@ -744,12 +795,9 @@ def _chart_companion_text_xml(font_face = _chart_text_entry_font_face(item, chart_style.get("font_face"))align = str(item.get("align") or ("ctr" if role == "title" else "l"))bold = bool(item.get("bold", role == "title"))- has_box = all(_maybe_number(item.get(key)) is not None for key in ("x", "y", "width", "height"))- if has_box:- off_x = px_to_emu(_number(item["x"], "companion text x"))- off_y = px_to_emu(_number(item["y"], "companion text y"))- ext_cx = px_to_emu(_number(item["width"], "companion text width"))- ext_cy = px_to_emu(_number(item["height"], "companion text height"))+ explicit_box = _chart_companion_box(item)+ if explicit_box is not None:+ off_x, off_y, ext_cx, ext_cy = explicit_boxelif role == "title":off_x = chart_off_xoff_y = chart_off_y@@ -757,7 +805,10 @@ def _chart_companion_text_xml(ext_cy = px_to_emu(28)else:off_x = chart_off_x- off_y = chart_off_y + chart_ext_cy + px_to_emu(4 + below_index * 18)+ off_y = _powerpoint_emu_value(+ chart_off_y + chart_ext_cy + px_to_emu(4 + below_index * 18),+ "companion text y",+ )ext_cx = chart_ext_cxext_cy = px_to_emu(16)below_index += 1diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.pyindex a6c5f501..d6500514 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py@@ -5,11 +5,12 @@ from __future__ import annotationsfrom typing import Anyfrom xml.etree import ElementTree as ET-from ..drawingml.utils import detect_text_lang, px_to_emu, _xml_escape+from ..drawingml.utils import detect_text_lang, _xml_escapefrom .chart_data import (_DEFAULT_CHART_COLORS,_chart_list,_data_label_position,+ _data_label_point_items,_data_labels_config,)from .chart_style import (@@ -38,7 +39,7 @@ from .marker_common import (_first_present,_font_size_hpt,_hex_or_none,- _number,+ _powerpoint_line_width_emu,)@@ -74,7 +75,9 @@ def _series_color_xml(alpha_xml = _alpha_xml(fill_opacity, "series fill_opacity")line_width_xml = ""if line_width is not None:- line_width_xml = f' w="{max(px_to_emu(_number(line_width, "series line_width")), 1)}"'+ line_width_xml = (+ f' w="{_powerpoint_line_width_emu(line_width, "series line_width")}"'+ )line_xml = (f'<a:ln{line_width_xml}><a:solidFill><a:srgbClr val="{clean}"/></a:solidFill></a:ln>'if line else '<a:ln><a:noFill/></a:ln>'@@ -114,35 +117,6 @@ def _data_label_flags_xml(config: dict[str, Any]) -> str:)-def _data_label_point_items(config: dict[str, Any], point_count: int) -> list[dict[str, Any]]:- raw_points = config.get("points")- if raw_points is None:- return []- items: list[dict[str, Any]] = []- seen: set[int] = set()- for item in _chart_list(raw_points, "data_labels.points"):- if isinstance(item, dict):- raw_index = item.get("idx")- data = dict(item)- else:- raw_index = item- data = {}- if isinstance(raw_index, bool):- raise RuntimeError("Native PPTX chart data_labels.points idx must be an integer")- index_value = _number(raw_index, "data_labels.points idx")- if not index_value.is_integer():- raise RuntimeError("Native PPTX chart data_labels.points idx must be an integer")- index = int(index_value)- if index < 0 or index >= point_count:- raise RuntimeError("Native PPTX chart data_labels.points idx is outside point range")- if index in seen:- raise RuntimeError("Native PPTX chart data_labels.points idx values must be unique")- seen.add(index)- data["idx"] = index- items.append(data)- return items--def _data_labels_xml(config: dict[str, Any] | None,*,@@ -180,7 +154,12 @@ def _data_labels_xml(if num_fmt else "")flags_xml = _data_label_flags_xml(config)- point_items = _data_label_point_items(config, point_count)+ point_items = _data_label_point_items(+ config,+ chart_type,+ grouping,+ point_count,+ )if point_items:selected_items = {int(item["idx"]): item for item in point_items}point_label_xml = ""diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.pyindex fa943c91..a86b9d7b 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/marker_common.py@@ -3,12 +3,15 @@from __future__ import annotationsimport json+import mathimport re+from collections.abc import Iterablefrom typing import Anyfrom xml.etree import ElementTree as ETfrom ..drawingml.context import ConvertContext, IDENTITY_MATRIXfrom ..drawingml.utils import (+ EMU_PER_PX,FONT_PX_TO_HUNDREDTHS_PT,ctx_h,ctx_w,@@ -16,7 +19,6 @@ from ..drawingml.utils import (ctx_y,matrix_multiply,parse_transform_matrix,- px_to_emu,transform_point,)@@ -34,6 +36,20 @@ CHART_COLOR_STYLE_CONTENT_TYPE = "application/vnd.ms-office.chartcolorstyle+xml"CHART_STYLE_CONTENT_TYPE = "application/vnd.ms-office.chartstyle+xml"_NATIVE_KINDS = {"table", "chart"}+_POWERPOINT_COORD_MIN = -(2**31)+_POWERPOINT_COORD_MAX = 2**31 - 1+_POWERPOINT_LINE_WIDTH_MAX = 20116800+_TEXT_FONT_SIZE_MIN = 100+_TEXT_FONT_SIZE_MAX = 400000+_NATIVE_TRANSFORM_OPERATION_RE = re.compile(r"([A-Za-z]+)\s*\(([^()]*)\)")+_NATIVE_TRANSFORM_SEPARATOR_RE = re.compile(r"\s*,?\s*")+_NATIVE_TRANSFORM_ARGS_RE = re.compile(+ r"\s*"+ r"([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?)"+ r"(?:\s*(?:,\s*|\s+)"+ r"([-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?))?"+ r"\s*"+)_HEX_RE = re.compile(r"^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$")_RGB_RE = re.compile(r"^rgba?\(([^)]+)\)$", re.IGNORECASE)_POINT_RE = re.compile(r"[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?")@@ -101,6 +117,8 @@ def _hex_or_none(value: Any) -> str | None:value_float = float(part)except ValueError:return None+ if not math.isfinite(value_float):+ return Nonechannels.append(max(0, min(255, int(round(value_float)))))return "".join(f"{channel:02X}" for channel in channels)@@ -164,19 +182,125 @@ def _visible_fallback_texts(elem: ET.Element, *, include_metadata: bool = False)def _number(value: Any, field_name: str) -> float:+ if isinstance(value, bool):+ raise RuntimeError(f"Native PPTX object requires numeric {field_name}")try:- return float(value)- except (TypeError, ValueError) as exc:+ number = float(value)+ except (TypeError, ValueError, OverflowError) as exc:raise RuntimeError(f"Native PPTX object requires numeric {field_name}") from exc+ if not math.isfinite(number):+ raise RuntimeError(f"Native PPTX object requires finite numeric {field_name}")+ return numberdef _maybe_number(value: Any) -> float | None:- if value is None:+ if value is None or isinstance(value, bool):return Nonetry:- return float(value)- except (TypeError, ValueError):+ number = float(value)+ except (TypeError, ValueError, OverflowError):return None+ return number if math.isfinite(number) else None+++def _powerpoint_emu_value(+ emu: int,+ field_name: str,+ *,+ positive: bool = False,+) -> int:+ """Validate an already-resolved EMU value for a PowerPoint coordinate."""+ lower_bound = 1 if positive else _POWERPOINT_COORD_MIN+ if emu < lower_bound or emu > _POWERPOINT_COORD_MAX:+ qualifier = "positive " if positive else ""+ raise RuntimeError(+ f"Native PPTX object {field_name} must resolve to a {qualifier}"+ "32-bit PowerPoint coordinate"+ )+ return emu+++def _powerpoint_emu(value: Any, field_name: str, *, positive: bool = False) -> int:+ """Convert SVG px to an EMU value that PowerPoint can represent."""+ number = _number(value, field_name)+ scaled = number * EMU_PER_PX+ if not math.isfinite(scaled):+ raise RuntimeError(f"Native PPTX object {field_name} exceeds PowerPoint coordinates")+ return _powerpoint_emu_value(round(scaled), field_name, positive=positive)+++def _powerpoint_line_width_emu(value: Any, field_name: str) -> int:+ """Convert SVG px to a legal DrawingML ``ST_LineWidth`` value."""+ emu = _powerpoint_emu(value, field_name, positive=True)+ if emu > _POWERPOINT_LINE_WIDTH_MAX:+ raise RuntimeError(+ f"Native PPTX object {field_name} exceeds DrawingML line-width range"+ )+ return emu+++def native_marker_transform(transform: str | None) -> tuple[float, float, float, float]:+ """Return a strict native-marker transform as ``dx, dy, sx, sy``."""+ raw = (transform or "").strip()+ if not raw:+ return 0.0, 0.0, 1.0, 1.0++ cursor = 0+ operation_count = 0+ for match in _NATIVE_TRANSFORM_OPERATION_RE.finditer(raw):+ gap = raw[cursor:match.start()]+ valid_gap = (+ not gap+ if operation_count == 0+ else _NATIVE_TRANSFORM_SEPARATOR_RE.fullmatch(gap) is not None+ )+ if not valid_gap:+ raise RuntimeError(+ "Native PPTX table/chart markers support translate/scale transforms only"+ )+ name = match.group(1).lower()+ args_match = _NATIVE_TRANSFORM_ARGS_RE.fullmatch(match.group(2))+ if name not in {"translate", "scale"} or args_match is None:+ raise RuntimeError(+ "Native PPTX table/chart markers support translate/scale transforms only"+ )+ values = [float(value) for value in args_match.groups() if value is not None]+ if not all(math.isfinite(value) for value in values):+ raise RuntimeError("Native PPTX marker transform values must be finite")+ operation_count += 1+ cursor = match.end()++ if operation_count == 0 or raw[cursor:]:+ raise RuntimeError(+ "Native PPTX table/chart markers support translate/scale transforms only"+ )++ a, b, c, d, e, f = parse_transform_matrix(raw)+ components = (a, b, c, d, e, f)+ if not all(math.isfinite(value) for value in components):+ raise RuntimeError("Native PPTX marker transform exceeds finite coordinates")+ if b != 0.0 or c != 0.0:+ raise RuntimeError(+ "Native PPTX table/chart markers support translate/scale transforms only"+ )+ return e, f, a, d+++def _native_marker_validation_context(+ elem: ET.Element,+ ancestors: Iterable[ET.Element] = (),+) -> ConvertContext:+ """Build the scalar context used by native export for one marker path."""+ ctx = ConvertContext()+ for current in (*ancestors, elem):+ dx, dy, sx, sy = native_marker_transform(current.get("transform"))+ ctx = ctx.child(+ dx=ctx.scale_x * dx,+ dy=ctx.scale_y * dy,+ sx=sx,+ sy=sy,+ )+ return ctxdef _bbox_union(@@ -560,8 +684,12 @@ def _relative_luminance(color: str) -> float:return linear[0] * 0.2126 + linear[1] * 0.7152 + linear[2] * 0.0722-def _bounds(elem: ET.Element, payload: dict[str, Any], ctx: ConvertContext) -> tuple[int, int, int, int]:- """Return object bounds as DrawingML EMU tuple."""+def _resolved_bounds(+ elem: ET.Element,+ payload: dict[str, Any],+ ctx: ConvertContext,+) -> tuple[float, float, float, float, bool]:+ """Resolve object bounds in SVG px plus whether all bounds were explicit."""if ctx.use_transform_matrix:raise RuntimeError("Native PPTX table/chart markers support translate/scale only")@@ -601,40 +729,61 @@ def _bounds(elem: ET.Element, payload: dict[str, Any], ctx: ConvertContext) -> tresolved_y = ctx_y(y, ctx)resolved_w = ctx_w(width, ctx)resolved_h = ctx_h(height, ctx)- off_x = px_to_emu(resolved_x)- off_y = px_to_emu(resolved_y)- ext_cx = px_to_emu(resolved_w)- ext_cy = px_to_emu(resolved_h)- return off_x, off_y, ext_cx, ext_cy+ return resolved_x, resolved_y, resolved_w, resolved_h, explicit_bounds-def _validate_bounds_inputs(elem: ET.Element, payload: dict[str, Any]) -> None:- raw_x = payload.get("x", elem.get("data-pptx-x"))- raw_y = payload.get("y", elem.get("data-pptx-y"))- raw_width = payload.get("width", elem.get("data-pptx-width"))- raw_height = payload.get("height", elem.get("data-pptx-height"))- inferred = None- if any(value is None for value in (raw_x, raw_y, raw_width, raw_height)):- inferred = _inferred_bounds(elem)- if inferred is None:- raise RuntimeError(- "Native PPTX object requires x/y/width/height or visible fallback geometry"- )-- width = (- _number(raw_width, "width")- if raw_width is not None else inferred[2] - inferred[0] # type: ignore[index]+def _bounds(elem: ET.Element, payload: dict[str, Any], ctx: ConvertContext) -> tuple[int, int, int, int]:+ """Return object bounds as DrawingML EMU tuple."""+ x, y, width, height, _ = _resolved_bounds(elem, payload, ctx)+ return (+ _powerpoint_emu(x, "x"),+ _powerpoint_emu(y, "y"),+ _powerpoint_emu(width, "width", positive=True),+ _powerpoint_emu(height, "height", positive=True),)- height = (- _number(raw_height, "height")- if raw_height is not None else inferred[3] - inferred[1] # type: ignore[index]+++def _validate_bounds_inputs(+ elem: ET.Element,+ payload: dict[str, Any],+ ctx: ConvertContext,+) -> tuple[int, int, int, int, bool]:+ x, y, width, height, explicit_bounds = _resolved_bounds(elem, payload, ctx)+ return (+ _powerpoint_emu(x, "x"),+ _powerpoint_emu(y, "y"),+ _powerpoint_emu(width, "width", positive=True),+ _powerpoint_emu(height, "height", positive=True),+ explicit_bounds,)- if raw_x is not None:- _number(raw_x, "x")- if raw_y is not None:- _number(raw_y, "y")- if width <= 0 or height <= 0:- raise RuntimeError("Native PPTX object width/height must be positive")+++def _validate_payload_xml_strings(value: Any) -> None:+ """Reject JSON strings that cannot be serialized into PPTX XML 1.0 parts."""+ if isinstance(value, dict):+ for key, item in value.items():+ _validate_payload_xml_strings(key)+ _validate_payload_xml_strings(item)+ return+ if isinstance(value, list):+ for item in value:+ _validate_payload_xml_strings(item)+ return+ if not isinstance(value, str):+ return+ for char in value:+ codepoint = ord(char)+ if (+ codepoint in {0x09, 0x0A, 0x0D}+ or 0x20 <= codepoint <= 0xD7FF+ or 0xE000 <= codepoint <= 0xFFFD+ or 0x10000 <= codepoint <= 0x10FFFF+ ):+ continue+ raise RuntimeError(+ "Native PPTX metadata contains an XML 1.0-invalid character "+ f"U+{codepoint:04X}"+ )def _load_payload(elem: ET.Element, kind: str) -> dict[str, Any]:@@ -656,17 +805,29 @@ def _load_payload(elem: ET.Element, kind: str) -> dict[str, Any]:payload = json.loads(raw)except json.JSONDecodeError as exc:raise RuntimeError(f"Native PPTX {kind} metadata is not valid JSON: {exc.msg}") from exc+ except (ValueError, RecursionError) as exc:+ raise RuntimeError(f"Native PPTX {kind} metadata cannot be decoded") from excif not isinstance(payload, dict):raise RuntimeError(f"Native PPTX {kind} metadata must be a JSON object")+ _validate_payload_xml_strings(payload)return payloaddef _font_size_hpt(value: Any, default_px: int = 18) -> int:- try:- px = float(value)- except (TypeError, ValueError):- px = float(default_px)- return int(round(px * FONT_PX_TO_HUNDREDTHS_PT / 10.0)) * 10+ def convert(raw: Any) -> int | None:+ try:+ px = float(raw)+ except (TypeError, ValueError, OverflowError):+ return None+ scaled = px * FONT_PX_TO_HUNDREDTHS_PT+ if not math.isfinite(scaled):+ return None+ size = int(round(scaled / 10.0)) * 10+ if not _TEXT_FONT_SIZE_MIN <= size <= _TEXT_FONT_SIZE_MAX:+ return None+ return size++ return convert(value) or convert(default_px) or 1350def _first_present(*values: Any) -> Any:diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.pyindex 159ea6ba..eab4cc10 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/table.py@@ -6,19 +6,20 @@ from typing import Anyfrom xml.etree import ElementTree as ETfrom ..drawingml.context import ConvertContext, ShapeResult-from ..drawingml.utils import px_to_emu, _xml_escape+from ..drawingml.utils import _xml_escapefrom .chart_style import _font_face_xmlfrom .marker_common import (TABLE_URI,_bool_attr,_bounds,- _chart_bool,_clean_hex,_compact_key,_first_present,_font_size_hpt,_normalized_fallback_text,_number,+ _powerpoint_emu,+ _powerpoint_line_width_emu,_visible_fallback_texts,)@@ -71,6 +72,8 @@ _TABLE_TOP_LEVEL_SPAN_KEYS = {"merges","spans",}+_TABLE_MAX_ROWS = 1000+_TABLE_MAX_COLUMNS = 1000def _table_rows(payload: dict[str, Any]) -> list[list[Any]]:@@ -108,7 +111,36 @@ def _check_table_spans(payload: dict[str, Any], table_rows: list[list[Any]]) ->def _grid_is_strict(payload: dict[str, Any]) -> bool:- return bool(payload.get("strict_grid", payload.get("strictGrid", False)))+ value = payload.get("strict_grid", payload.get("strictGrid"))+ return _table_bool(value, "strict_grid", default=False)+++def _table_bool(value: Any, field_name: str, *, default: bool) -> bool:+ if value is None:+ return default+ if isinstance(value, bool):+ return value+ if value in (0, 1):+ return bool(value)+ key = _compact_key(value)+ if key in {"1", "on", "true", "yes"}:+ return True+ if key in {"0", "false", "no", "off"}:+ return False+ raise RuntimeError(f"Native PPTX table {field_name} must be a boolean")+++def _table_header_rows(payload: dict[str, Any], row_count: int) -> int:+ default = 1 if payload.get("columns") else 0+ value = _number(payload.get("header_rows", default), "table header_rows")+ if not value.is_integer():+ raise RuntimeError("Native PPTX table header_rows must be an integer")+ header_rows = int(value)+ if not 0 <= header_rows <= row_count:+ raise RuntimeError(+ "Native PPTX table header_rows must be between zero and the resolved row count"+ )+ return header_rowsdef _validate_table_lengths(payload: dict[str, Any], table_rows: list[list[Any]]) -> int:@@ -117,6 +149,8 @@ def _validate_table_lengths(payload: dict[str, Any], table_rows: list[list[Any]]col_count = max(len(row) for row in table_rows)if col_count <= 0:raise RuntimeError("Native PPTX table requires at least one column")+ if len(table_rows) > _TABLE_MAX_ROWS or col_count > _TABLE_MAX_COLUMNS:+ raise RuntimeError("Native PPTX table supports at most 1000 rows and columns")if _grid_is_strict(payload) and any(len(row) != col_count for row in table_rows):raise RuntimeError("Native PPTX table strict_grid requires every row to have the same length")@@ -124,27 +158,33 @@ def _validate_table_lengths(payload: dict[str, Any], table_rows: list[list[Any]]if column_widths is not None:if not isinstance(column_widths, list) or len(column_widths) != col_count:raise RuntimeError("Native PPTX table column_widths must match the resolved column count")- for idx, width in enumerate(column_widths, start=1):- _number(width, f"column_widths[{idx}]")+ _table_weights(column_widths, "column_widths")row_heights = payload.get("row_heights")if row_heights is not None:if not isinstance(row_heights, list) or len(row_heights) != len(table_rows):raise RuntimeError("Native PPTX table row_heights must match the resolved row count")- for idx, height in enumerate(row_heights, start=1):- _number(height, f"row_heights[{idx}]")+ _table_weights(row_heights, "row_heights")return col_countdef _validate_table_cell_formatting(payload: dict[str, Any], table_rows: list[list[Any]]) -> None:style = payload.get("style") if isinstance(payload.get("style"), dict) else {}+ _table_bool(style.get("band_row"), "style.band_row", default=True)for row in table_rows:for cell in row:cell_data = _cell_payload(cell)+ if "bold" in cell_data:+ _table_bool(cell_data["bold"], "cell bold", default=False)for side in ("left", "right", "top", "bottom"):_table_padding_value(cell_data, style, side)- _table_border_width(cell_data, style)+ border_width = _table_border_width(cell_data, style)+ if border_width > 0:+ _powerpoint_line_width_emu(+ border_width,+ "table border_width",+ )_table_anchor(cell_data, style)@@ -152,6 +192,7 @@ def _validate_table_payload(payload: dict[str, Any]) -> tuple[list[list[Any]], itable_rows = _table_rows(payload)_check_table_spans(payload, table_rows)col_count = _validate_table_lengths(payload, table_rows)+ _table_header_rows(payload, len(table_rows))_validate_table_cell_formatting(payload, table_rows)return table_rows, col_count@@ -196,19 +237,46 @@ def _weighted_lengths(*,field_name: str,) -> list[int]:+ if total < count:+ raise RuntimeError(+ f"Native PPTX table {field_name} cannot fit {count} positive grid lengths"+ )if weights is None:- base = max(total // count, 1)- values = [base] * count- values[-1] += total - sum(values)- return values+ base, remainder = divmod(total, count)+ return [base + (1 if idx < remainder else 0) for idx in range(count)]++ numeric = _table_weights(weights, field_name)+ largest = max(numeric)+ normalized = [weight / largest for weight in numeric]+ normalized_total = sum(normalized)+ distributable = total - count+ quotas = [distributable * weight / normalized_total for weight in normalized]+ extras = [int(quota) for quota in quotas]+ remainder = distributable - sum(extras)+ if remainder < 0 or remainder > count:+ raise RuntimeError(f"Native PPTX table {field_name} allocation overflowed")+ order = sorted(+ range(count),+ key=lambda idx: (quotas[idx] - extras[idx], normalized[idx], -idx),+ reverse=True,+ )+ for idx in order[:remainder]:+ extras[idx] += 1+ return [extra + 1 for extra in extras]+- numeric = [max(_number(weight, field_name), 0.0) for weight in weights]- numeric_total = sum(numeric)- if numeric_total <= 0:- raise RuntimeError(f"Native PPTX table {field_name} values must sum to a positive number")- values = [max(round(total * weight / numeric_total), 1) for weight in numeric]- values[-1] += total - sum(values)- return values+def _table_weights(weights: list[Any], field_name: str) -> list[float]:+ numeric = [+ _number(weight, f"{field_name}[{idx}]")+ for idx, weight in enumerate(weights, start=1)+ ]+ if any(weight < 0 for weight in numeric):+ raise RuntimeError(f"Native PPTX table {field_name} values must be non-negative")+ if max(numeric, default=0.0) <= 0:+ raise RuntimeError(+ f"Native PPTX table {field_name} values must sum to a positive number"+ )+ return numericdef _table_padding_value(@@ -241,7 +309,8 @@ def _table_padding_value(value = from_source(style)if value is None:return None- return max(px_to_emu(max(_number(value, f"table {side} padding"), 0.0)), 0)+ pixels = max(_number(value, f"table {side} padding"), 0.0)+ return _powerpoint_emu(pixels, f"table {side} padding")def _table_padding_attrs(cell_data: dict[str, Any], style: dict[str, Any]) -> str:@@ -299,7 +368,7 @@ def _table_border_xml(cell_data: dict[str, Any], style: dict[str, Any]) -> str:f'<a:solidFill><a:srgbClr val="{color}"/></a:solidFill>''<a:prstDash val="solid"/>')- line_width = max(px_to_emu(width), 1)+ line_width = _powerpoint_line_width_emu(width, "table border_width")return "".join(f'<a:{tag} w="{line_width}">{line}</a:{tag}>'for tag in ("lnL", "lnR", "lnT", "lnB")@@ -308,8 +377,7 @@ def _table_border_xml(cell_data: dict[str, Any], style: dict[str, Any]) -> str:def _build_native_table(elem: ET.Element, ctx: ConvertContext, payload: dict[str, Any]) -> ShapeResult:table_rows, col_count = _validate_table_payload(payload)- has_columns = bool(payload.get("columns") or [])- header_rows = int(payload.get("header_rows", 1 if has_columns else 0))+ header_rows = _table_header_rows(payload, len(table_rows))preserve_source_style = elem.get("data-pptx-native-source") == "pptx"for row in table_rows:@@ -378,13 +446,16 @@ def _build_native_table(elem: ET.Element, ctx: ConvertContext, payload: dict[stralign = "l"text = "" if cell_data.get("text") is None else str(cell_data.get("text"))if preserve_source_style:- bold = bool(cell_data["bold"]) if "bold" in cell_data else None+ bold = (+ _table_bool(cell_data["bold"], "cell bold", default=False)+ if "bold" in cell_data else None+ )cell_font_size = (_font_size_hpt(cell_data.get("font_size"), 18)if "font_size" in cell_data else None)else:- bold = bool(cell_data.get("bold", is_header))+ bold = _table_bool(cell_data.get("bold"), "cell bold", default=is_header)cell_font_size = (_font_size_hpt(cell_data.get("font_size"), 18)if "font_size" in cell_data@@ -416,7 +487,7 @@ def _build_native_table(elem: ET.Element, ctx: ConvertContext, payload: dict[strshape_id = ctx.next_id()first_row = _bool_attr(header_rows > 0)- band_row = _bool_attr(bool(style.get("band_row", True)))+ band_row = _bool_attr(_table_bool(style.get("band_row"), "style.band_row", default=True))table_style_id = style.get("table_style_id")if table_style_id is None and not preserve_source_style:table_style_id = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/workbook.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/workbook.pyindex ebf7d7c9..f2ce2c4d 100644--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/workbook.py+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/workbook.py@@ -38,7 +38,11 @@ def _xlsx_cell(value: Any, row: int, col: int) -> str:def _minimal_workbook(rows: list[list[Any]]) -> bytes:if XlsxWriterWorkbook is not None:buffer = io.BytesIO()- workbook = XlsxWriterWorkbook(buffer, {"in_memory": True})+ workbook = XlsxWriterWorkbook(buffer, {+ "in_memory": True,+ "strings_to_formulas": False,+ "strings_to_urls": False,+ })worksheet = workbook.add_worksheet("Sheet1")for row_index, row in enumerate(rows):for col_index, value in enumerate(row):@@ -50,8 +54,11 @@ def _minimal_workbook(rows: list[list[Any]]) -> bytes:workbook = OpenpyxlWorkbook()worksheet = workbook.activeworksheet.title = "Sheet1"- for row in rows:- worksheet.append(row)+ for row_index, row in enumerate(rows, start=1):+ for col_index, value in enumerate(row, start=1):+ cell = worksheet.cell(row=row_index, column=col_index, value=value)+ if isinstance(value, str):+ cell.data_type = "s"buffer = io.BytesIO()workbook.save(buffer)workbook.close()diff --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 74d8c806..b09575c1 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@@ -6,8 +6,8 @@ import hashlibimport jsonimport mimetypesimport os-import reimport posixpath+import reimport shutilimport statimport subprocess@@ -19,6 +19,7 @@ from dataclasses import dataclassfrom datetime import datetime, timezonefrom pathlib import Pathfrom typing import Any+from urllib.parse import urlsplitfrom xml.etree import ElementTree as ETfrom xml.sax.saxutils import escape@@ -1055,9 +1056,93 @@ def _prerender_legacy_pngs(return results-_REL_TARGET_RE = re.compile(r'<Relationship\b[^/]*?/>', re.DOTALL)-_TARGET_ATTR_RE = re.compile(r'Target="([^"]+)"')-_TARGET_MODE_EXT_RE = re.compile(r'TargetMode="External"')+_OPC_UNRESERVED = frozenset(+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"+)+_ASCII_LOWER_TRANSLATION = str.maketrans(+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ",+ "abcdefghijklmnopqrstuvwxyz",+)+++def _canonical_opc_part_path(path: str) -> str | None:+ """Return an OPC-equivalent package path key, or None when invalid."""+ if (+ not path+ or "\\" in path+ or path.endswith("/")+ or "//" in path+ or any(ord(char) <= 0x20 for char in path)+ ):+ return None+ output: list[str] = []+ index = 0+ while index < len(path):+ char = path[index]+ if char != "%":+ output.append(char)+ index += 1+ continue+ if index + 2 >= len(path) or not re.fullmatch(r"[0-9A-Fa-f]{2}", path[index + 1:index + 3]):+ return None+ value = int(path[index + 1:index + 3], 16)+ decoded = chr(value)+ if value in {0, ord("/"), ord("\\")}:+ return None+ output.append(decoded if decoded in _OPC_UNRESERVED else f"%{value:02X}")+ index += 3++ decoded_path = "".join(output)+ if decoded_path.rsplit("/", 1)[-1] in {".", ".."}:+ return None+ normalized = posixpath.normpath(decoded_path)+ if (+ not normalized+ or normalized in {".", ".."}+ or normalized.startswith("/")+ or normalized.startswith("../")+ ):+ return None+ return normalized.translate(_ASCII_LOWER_TRANSLATION)+++def _source_part_for_rels(rels_path: str) -> str | None:+ """Return the source part path represented by a relationship sidecar."""+ filename = posixpath.basename(rels_path)+ if filename == ".rels" or not filename.endswith(".rels"):+ return None+ source_dir = posixpath.dirname(posixpath.dirname(rels_path))+ source_name = filename[:-len(".rels")]+ return posixpath.join(source_dir, source_name) if source_dir else source_name+++def _resolve_internal_opc_target(rels_path: str, target: str) -> str | None:+ """Resolve one valid internal OPC Target to its canonical package key."""+ target_path_query = target.split("#", 1)[0]+ if (+ "\\" in target+ or "?" in target_path_query+ or any(ord(char) <= 0x20 for char in target)+ ):+ return None+ try:+ parsed = urlsplit(target)+ except ValueError:+ return None+ if parsed.scheme or parsed.netloc or parsed.query:+ return None++ source_part = _source_part_for_rels(rels_path)+ if parsed.path.startswith("/"):+ resolved = parsed.path[1:]+ elif parsed.path:+ base_dir = posixpath.dirname(source_part) if source_part else ""+ resolved = posixpath.join(base_dir, parsed.path) if base_dir else parsed.path+ elif source_part and "#" in target:+ resolved = source_part+ else:+ return None+ return _canonical_opc_part_path(resolved)def _verify_internal_rels_targets(extract_dir: Path) -> list[str]:@@ -1066,25 +1151,34 @@ def _verify_internal_rels_targets(extract_dir: Path) -> list[str]:Each entry is formatted as "<rels-path> -> <missing-target>". An empty listmeans every internal Target resolves to a real file in the package."""+ package_parts: set[str] = set()+ for path in extract_dir.rglob("*"):+ if not path.is_file():+ continue+ key = _canonical_opc_part_path(path.relative_to(extract_dir).as_posix())+ if key is not None:+ package_parts.add(key)problems: list[str] = []for rels_path in extract_dir.rglob('*.rels'):rels_rel = rels_path.relative_to(extract_dir).as_posix()- # `_rels/foo.xml.rels` lives one level below its referent's directory;- # Targets resolve relative to the parent of that `_rels` folder.- base_dir = posixpath.dirname(posixpath.dirname(rels_rel))- content = rels_path.read_text(encoding='utf-8')- for match in _REL_TARGET_RE.finditer(content):- element = match.group(0)- if _TARGET_MODE_EXT_RE.search(element):+ try:+ root = ET.parse(rels_path).getroot()+ except ET.ParseError as exc:+ problems.append(f'{rels_rel} -> <invalid relationships XML: {exc}>')+ continue+ for elem in root:+ attrs = _relationship_attrs(elem)+ if attrs.get('TargetMode', '').lower() == 'external':continue- target_match = _TARGET_ATTR_RE.search(element)- if not target_match:+ target = attrs.get('Target')+ if not target:+ problems.append(f'{rels_rel} -> <missing Target>')continue- target = target_match.group(1)- if target.startswith(('http://', 'https://', 'mailto:')):+ resolved = _resolve_internal_opc_target(rels_rel, target)+ if resolved is None:+ problems.append(f'{rels_rel} -> <invalid Target {target!r}>')continue- resolved = posixpath.normpath(posixpath.join(base_dir, target)) if base_dir else posixpath.normpath(target)- if not (extract_dir / resolved).exists():+ if resolved not in package_parts:problems.append(f'{rels_rel} -> {resolved}')return problemsdiff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/notes.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/notes.pyindex 4533e3ee..b5c9cf6f 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/notes.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/notes.py@@ -114,7 +114,7 @@ def create_notes_slide_xml(slide_num: int, notes_text: str) -> str:<a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr>- <p:ph type="sldImg"/>+ <p:ph type="sldImg" idx="2"/></p:nvPr></p:nvSpPr><p:spPr/>@@ -126,7 +126,7 @@ def create_notes_slide_xml(slide_num: int, notes_text: str) -> str:<a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr>- <p:ph type="body" idx="1"/>+ <p:ph type="body" sz="quarter" idx="3"/></p:nvPr></p:nvSpPr><p:spPr/>@@ -187,7 +187,13 @@ def create_notes_master_xml() -> str:<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="hdr" sz="quarter"/></p:nvPr></p:nvSpPr>- <p:spPr/>+ <p:spPr>+ <a:xfrm>+ <a:off x="0" y="0"/>+ <a:ext cx="2971800" cy="457200"/>+ </a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ </p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp>@@ -196,7 +202,13 @@ def create_notes_master_xml() -> str:<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="dt" sz="half" idx="1"/></p:nvPr></p:nvSpPr>- <p:spPr/>+ <p:spPr>+ <a:xfrm>+ <a:off x="3884613" y="0"/>+ <a:ext cx="2971800" cy="457200"/>+ </a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ </p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp>@@ -205,7 +217,13 @@ def create_notes_master_xml() -> str:<p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg" idx="2"/></p:nvPr></p:nvSpPr>- <p:spPr/>+ <p:spPr>+ <a:xfrm>+ <a:off x="1143000" y="685800"/>+ <a:ext cx="4572000" cy="3429000"/>+ </a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ </p:spPr></p:sp><p:sp><p:nvSpPr>@@ -213,7 +231,13 @@ def create_notes_master_xml() -> str:<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" sz="quarter" idx="3"/></p:nvPr></p:nvSpPr>- <p:spPr/>+ <p:spPr>+ <a:xfrm>+ <a:off x="685800" y="4343400"/>+ <a:ext cx="5486400" cy="4114800"/>+ </a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ </p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp>@@ -222,7 +246,13 @@ def create_notes_master_xml() -> str:<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="ftr" sz="quarter" idx="4"/></p:nvPr></p:nvSpPr>- <p:spPr/>+ <p:spPr>+ <a:xfrm>+ <a:off x="0" y="8685213"/>+ <a:ext cx="2971800" cy="457200"/>+ </a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ </p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp><p:sp>@@ -231,7 +261,13 @@ def create_notes_master_xml() -> str:<p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldNum" sz="quarter" idx="5"/></p:nvPr></p:nvSpPr>- <p:spPr/>+ <p:spPr>+ <a:xfrm>+ <a:off x="3884613" y="8685213"/>+ <a:ext cx="2971800" cy="457200"/>+ </a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ </p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree>