@office-open/core 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-B8LomQWM.d.mts → index-Cd0lFS5x.d.mts} +6 -1
- package/dist/index-Cd0lFS5x.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/dist/util/index.d.mts +1 -1
- package/package.json +2 -2
- package/dist/index-B8LomQWM.d.mts.map +0 -1
|
@@ -73,6 +73,11 @@ declare class Relationships {
|
|
|
73
73
|
add(type: RelationshipType, target: string, targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType]): number;
|
|
74
74
|
get relationshipCount(): number;
|
|
75
75
|
get nextRelationshipId(): number;
|
|
76
|
+
reserveId(id: number | string): void;
|
|
77
|
+
reserveSourceRids(source: string, passthrough: readonly {
|
|
78
|
+
source: string;
|
|
79
|
+
rId: string;
|
|
80
|
+
}[]): void;
|
|
76
81
|
renameEntryByType(type: string, newId: number): void;
|
|
77
82
|
idByKind(kind: string): number | undefined;
|
|
78
83
|
claimSourceRel(rel: {
|
|
@@ -577,4 +582,4 @@ declare function replaceOleLinkPlaceholders(xml: string, links: {
|
|
|
577
582
|
}[], offset: number): string;
|
|
578
583
|
//#endregion
|
|
579
584
|
export { xsdLightRigDirection as $, convertTwipToEmu as $t, xsdAnimValueType as A, ZipStreamWriter as An, UniqueNumericIdCreator as At, xsdCompoundLine as B, convertEmuToPixels as Bt, replacePlaceholders as C, Packer as Cn, xsdTextVerticalType as Ct, xsdAnimCalcMode as D, ZIP_STORED_LEVEL as Dn, xsdVerticalMergeRev as Dt, invertMap as E, ZIP_DEFLATE_LEVEL as En, xsdUnderlineStyle as Et, xsdAxisOrientation as F, strFromU8$1 as Fn, extUriMatches as Ft, xsdEffectContainer as G, convertMillimetersToTwip as Gt, xsdDataLabelPosition as H, convertEmuToTwip as Ht, xsdAxisPosition as I, unzipSync$1 as In, derivePasswordHash as It, xsdHierBranch as J, convertPointsToTwip as Jt, xsdErrorValueType as K, convertPixelsToEmu as Kt, xsdBlendMode as L, zipAndConvert as Ln, hashPasswordAgile as Lt, xsdAxisCrossBetween as M, createPacker as Mn, uniqueId as Mt, xsdAxisCrosses as N, createZipStream as Nn, uniqueNumericIdCreator as Nt, xsdAnimClass as O, ZipOptions as On, ImageFileType as Ot, xsdAxisLabelAlignment as P, levelForMediaName as Pn, uniqueUuid as Pt, xsdLegendPosition as Q, convertToTwip as Qt, xsdChartBuild as R, zipSync$1 as Rn, randomBytes as Rt, replaceOlePlaceholders as S, CompressionOptions as Sn, xsdTextTabAlignment as St, replaceVideoPlaceholders as T, XmlifyedFile as Tn, xsdTrendlineType as Tt, xsdDiagramBuild as U, convertInchesToEmu as Ut, xsdConsolidateFunction as V, convertEmuToPoints as Vt, xsdDiagramDirection as W, convertInchesToTwip as Wt, xsdIterateType as X, convertToInch as Xt, xsdHueDirection as Y, convertToEmu as Yt, xsdJcAlignment as Z, convertToPt as Zt, replaceImageLinkPlaceholders as _, buildRootRelationships as _n, xsdTableWidthType as _t, findAndReplaceImagePlaceholders as a, emitPercent as an, xsdPathFillMode as at, replaceNumberingPlaceholders as b, resolveRelationshipTarget as bn, xsdTextBuild as bt, getMediaRefs as c, parsePercent as cn, xsdPlaceholderType as ct, getVideoRefs as d, XmlifyedFileEntry as dn, xsdResizeHandles as dt, convertUniversalMeasureToEmu as en, xsdLineCap as et, hasPlaceholders as f, addBinaryFile as fn, xsdShadingPattern as ft, replaceHyperlinkPlaceholders as g, TargetModeType as gn, xsdStrikeStyle as gt, replaceChartPlaceholders as h, Relationships as hn, xsdSplitType as ht, collectPlaceholderKeys as i, emitAngle as in, xsdOrient as it, xsdAnimationDgmBuild as j, Zippable$1 as jn, hashedId as jt, xsdAnimLevel as k, ZipPartSink as kn, imageTypeFromPath as kt, getOleRefs as l, parsePercentAttr as ln, xsdPresetShadow as lt, replaceAudioPlaceholders as m, RelationshipType as mn, xsdSlideLayoutType as mt, SmartArtRelOptions as n, convertUniversalMeasureToPt as nn, xsdMaterialType as nt, formatId as o, mapOptional as on, xsdPattern as ot, replaceAllPlaceholders as p, compileMapping as pn, xsdSizeRepresents as pt, xsdFontAlignment as q, convertPointsToEmu as qt, addSmartArtRelationships as r, convertUniversalMeasureToTwip as rn, xsdMathStyle as rt, getAudioRefs as s, parseAngle as sn, xsdPenAlignment as st, IdFormat as t, convertUniversalMeasureToInch as tn, xsdLineEndSize as tt, getReferencedMedia as u, parseUniversalMeasure as un, xsdRectAlignment as ut, replaceImagePlaceholders as v, optionalRelsPart as vn, xsdTextAlign as vt, replaceSmartArtPlaceholders as w, PackerOptions as wn, xsdTotalsRowFunction as wt, replaceOleLinkPlaceholders as x, CompileFn as xn, xsdTextCaps as xt, replaceMediaPlaceholders as y, partPathToRelsPath as yn, xsdTextAnchor as yt, xsdComments as z, zipSyncAndConvert as zn, convertEmuToInches as zt };
|
|
580
|
-
//# sourceMappingURL=index-
|
|
585
|
+
//# sourceMappingURL=index-Cd0lFS5x.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Cd0lFS5x.d.mts","names":[],"sources":["../src/opc/packer.ts","../src/opc/relationships.ts","../src/util/compile.ts","../src/util/converters.ts","../src/util/crypto.ts","../src/util/ext-uri.ts","../src/util/generators.ts","../src/util/image-type.ts","../src/util/mappings.ts","../src/util/placeholder.ts"],"mappings":";;;;;UAiCiB;EACf;EACA,eAAe;;cAIJ;cAQA;cAiCA,oBAAqB,kBAAkB;UAOnC;EAEf;EAMA;;UAIe,cAAc,UAAU;EAEvC,OAAO;EAEP,YAAY;EAEZ,cAAc;;cAaH,gBAAuB,UAAU,YAC5C,OAAO,UACP,MAAM,GACN,kBACA,mBACC,QAAQ,aAAa;cAsBX,oBAAqB,UAAU,YAC1C,OAAO,UACP,MAAM,GACN,kBACA,mBACC,aAAa;cAcH,kBACX,OAAO,UACP,0BACC,eAAe;UAiED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AAA;;;;KChiBD;cAEC,WAAY,gBAAgB,eAAe,OAAO;iBAgC/C,oBAAoB,aAAa,KAAK;iBAoBtC,gBAAgB;iBAIhB,uBAAuB,aAAa;iBAkBpC,yBACd,aACA;EAAa;KACb,gBACA,WAAU;iBAUI,mBACd,aACA;EAAc;;EACX;;iBAcW,gCACd,aACA;EAAc;KACd,gBACA,WAAU,UACV,aAAa;EACV;EAAa;IAAc;;;iBA0DhB,uBACd,aACA,SAAS;EAAQ;EAAiB;EAAa;;iBAUjC,yBACd,aACA,qBACA,gBACA,WAAU;UAYK;EACf;EACA,cAAc;EAMd,cAAc;;iBAGA,4BACd,aACA,gBACA,oBACA,WAAU;iBAkBI,yBACd,gBACA,SAAS,YAAY,MAAM,kBAAkB,gBAAgB,8BAC7D,oBACA,0BACA,SAAS;iBAwCK,6BACd,aACA;EAA+B;EAAmB;EAAkB;;iBAatD,yBACd,aACA;EAAa;KACb;iBAMc,yBACd,aACA;EAAa;KACb;iBAMc,yBACd,aACA;EAAa;KACb;iBAMc,uBACd,aACA;EAAc;KACd;iBAoBc,aACd,aACA;EAAc;;EACX;;iBAKW,aACd,aACA;EAAc;;EACX;;iBAKW,aACd,aACA;EAAc;;EACX;;iBAKW,WACd,aACA;EAAc;;EACX;;iBAwCW,6BACd,aACA;EAAc;KACd;iBAMc,6BACd,aACA;EAAS;KACT;iBAMc,2BACd,aACA;EAAS;KACT"}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { A as positiveUniversalMeasureValue, C as hexColorValue, D as parseOnOff
|
|
|
5
5
|
import { $ as ColorStyleLabelOptions, $a as ScRgbColorOptions, $i as calculateEffectExtent, $n as ParagraphDescriptorOptions, $r as bodyPropertiesDesc, $t as pickNonVisualDrawingProperties, A as patternFillDesc, Aa as PatternFillOptions, Ai as LineEndType, An as parseTableStyleList, Ar as StrikeStyle, At as AnimateOneByOneOptions, B as solidFillDesc, Ba as TileAlignment, Bi as GeomRect, Bn as createGroupTransform2D, Br as TextRunOptions, Bt as createAdjustList, C as pictureLockingDesc, Ca as createGradientStop, Ci as OutlineFillProperties, Cn as TableStyleOptions, Cr as BulletStyleOptions, Ct as createLayoutDefinitionHeader, D as fillDesc, Da as GradientStopOptions, Di as createOutline, Dn as createTableStyle, Dr as DEFAULT_SHADOW_DIRECTION, Dt as AdjustListOptions, E as emitFillXml, Ea as FillOptions, Ei as PresetDash, En as ThemeableLineStyleOptions, Er as DEFAULT_SHADOW_BLUR_RADIUS, Et as createStyleDefinitionHeaderList, F as parseColorChoiceElement, Fa as BlipCompression, Fi as PresetGeometryOptions, Fn as shape3DDesc, Fr as TextCharacterPropertiesOptions, Ft as MaxChildrenOptions, G as DiagramTextPropertiesOptions, Ga as createColorElement, Gi as GeometryGuide, Gn as createBlipFill, Gr as NormalAutofitOptions, Gt as createOrgChart, H as systemColorDesc, Ha as TileOptions, Hi as PathFillMode, Hn as stringifyStretch, Hr as UnderlineStyle, Ht as createAnimationLevel, I as presetColorDesc, Ia as BlipOptions, Ii as ShapeType, In as StyleMatrixReferenceOptions, Ir as TextFieldOptions, It as OrgChartOptions, J as createDiagramTextProperties, Ja as SystemColorOptions, Ji as EffectDagOptions, Jn as stringifyLineProperties, Jr as TextHorzOverflow, Jt as NonVisualContentPartPropertiesOptions, K as createDiagramExtensionList, Ka as createSolidFill, Ki as stringifyAdjustmentValues, Kn as createSoftEdgeEffect, Kr as PresetTextShapeOptions, Kt as createPreferredChildren, L as rgbColorDesc, La as createBlip, Li as stringifyPresetGeometry, Ln as BlackWhiteMode, Lr as TextFont, Lt as PreferredChildrenOptions, M as hslColorDesc, Ma as createPatternFill, Mi as createLineEnd, Mn as bevelDesc, Mr as TextAlignment, Mt as AnimationLevelOptions, N as isPlainRgbColor, Na as SourceRectangleOptions, Ni as DashStop, Nn as cell3DDesc, Nr as TextBreakOptions, Nt as HierBranch, O as findFillChild, Oa as buildFill, Oi as LineEndLength, On as createTableStyleList, Or as DEFAULT_SHADOW_DISTANCE, Ot as AdjustOptions, P as parseColorChoice, Pa as createSourceRectangle, Pi as createCustomDash, Pn as scene3DDesc, Pr as TextCapitalization, Pt as HierBranchOptions, Q as ColorMethod, Qa as createSchemeColor, Qi as EffectListOptions, Qn as textBodyDesc, Qr as VerticalAnchor, Qt as parseNonVisualDrawingProperties, R as scRgbColorDesc, Ra as BlipEffectsOptions, Ri as ConnectionSite, Rn as GroupTransform2DOptions, Rr as TextHyperlinkOptions, Rt as PresentationLayoutVariablesOptions, S as groupLockingDesc, Sa as createGradientFill, Si as LineJoin, Sn as TableStyleListOptions, Sr as BulletPictureOptions, St as createColorsDefinitionHeaderList, T as effectListDesc, Ta as BlipFillMediaData, Ti as PenAlignment, Tn as TableTextStyleOptions, Tr as DEFAULT_SHADOW_ALPHA, Tt as createStyleDefinitionHeader, U as DiagramExtensionListOptions, Ua as createTileInfo, Ui as PathOptions, Un as createExtensionList, Ur as BodyPropertiesOptions, Ut as createHierBranch, V as stringifyColorChoice, Va as TileFlipMode, Vi as PathCommand, Vn as createTransform2D, Vr as TextTabAlignment, Vt as createAnimateOneByOne, W as DiagramExtensionOptions, Wa as SolidFillOptions, Wi as createCustomGeometry, Wn as BlipFillOptions, Wr as FlatTextOptions, Wt as createMaxChildren, X as createDiagramRelationshipIds, Xa as SchemeColor, Xi as BlurEffectOptions, Xn as createNoFill, Xr as TextVertOverflow, Xt as stringifyNonVisualContentPartProperties, Y as DiagramRelationshipIdsOptions, Ya as createSystemColor, Yi as createEffectDag, Yn as createGroupFill, Yr as TextShapePreset, Yt as parseNonVisualContentPartProperties, Z as ColorListOptions, Za as SchemeColorOptions, Zi as EffectExtent, Zn as TextBodyOptions, Zr as TextVertical, Zt as NonVisualDrawingPropertiesOptions, _ as transform2DDesc, _a as GradientShadeOptions, _i as SphereCoords, _n as TableBackgroundStyleOptions, _r as AutoNumberFormat, _t as LayoutDefinitionHeaderListOptions, a as BlipDescriptorOptions, aa as createPresetShadowEffect, ai as PresetMaterial, an as ContentPartLockingOptions, ao as createPresetColor, ar as readHyperlink, at as createEffectColorList, b as connectorLockingDesc, ba as PathShadeOptions, bi as CompoundLine, bn as TableFontReferenceOptions, br as BulletNoneOption, bt as StyleDefinitionHeaderOptions, c as sourceRectangleDesc, ca as createOuterShadowEffect, ci as BevelOptions, cn as PictureLockingOptions, co as ColorTransformOptions, cr as stringifyRunProperties, ct as createStyleLabel, d as tileDesc, da as GlowEffectOptions, di as createBottomBevel, dn as createContentPartLocking, dr as TextStylesOptions, dt as createTextLineColorList, ea as createEffectList, ei as createBodyProperties, en as stringifyNonVisualDrawingProperties, eo as createScRgbColor, er as paragraphDesc, et as DiagramStyleOptions, f as stringifyTextRun, fa as createGlowEffect, fi as BackdropOptions, fn as createGraphicFrameLocking, fr as parseTextStyles, ft as ColorsDefinitionHeaderListOptions, g as groupTransform2DDesc, ga as GradientFillOptions, gi as Scene3DOptions, gn as OnOffStyleType, gr as textStylesDesc, gt as DiagramNameOptions, h as groupShapePropertiesDesc, ha as createFillOverlayEffect, hi as Point3D, hn as createShapeLocking, hr as textListStyleDesc, ht as DiagramDescriptionOptions, i as presentationLayoutVariablesDesc, ia as PresetShadowEffectOptions, ii as shapePropertiesDesc, in as ConnectorLockingOptions, io as PresetColorOptions, ir as buildHyperlinkElement, it as createDiagramStyle, j as emitColorChoice, ja as PresetPattern, ji as LineEndWidth, jn as Cell3DOptions, jr as TabStopOptions, jt as AnimationLevel, k as gradientFillDesc, ka as extractBlipFillMedia, ki as LineEndOptions, kn as parseTableStyle, kr as RunFont, kt as AnimateOneByOne, l as stretchDesc, la as InnerShadowEffectOptions, li as BevelPreset, ln as ShapeLockingOptions, lo as createColorTransforms, lr as DEFAULT_TEXT_STYLES, lt as createTextEffectColorList, m as GroupShapePropertiesOptions, ma as FillOverlayEffectOptions, mi as LightRigOptions, mn as createPictureLocking, mr as stringifyTextStyles, mt as DiagramCategoryOptions, n as diagramRelationshipIdsDesc, na as createReflectionEffect, ni as ShapePropertiesExtensionOptions, nn as parseEndpointConnection, no as createRgbColor, nr as stringifyParagraphPropertiesElement, nt as HueDirection, o as blipDesc, oa as OuterShadowEffectOptions, oi as Shape3DOptions, on as GraphicFrameLockingOptions, oo as HslColorOptions, or as registerHyperlink, ot as createFillColorList, p as textRunDesc, pa as BlendMode, pi as CameraOptions, pn as createGroupLocking, pr as stringifyTextListStyleTag, pt as ColorsDefinitionHeaderOptions, q as createDiagramShape3D, qa as SystemColor, qi as EffectContainer, qn as outlineDesc, qr as TextBodyWrapping, qt as createPresentationLayoutVariables, r as diagramStyleDesc, ra as PresetShadow, ri as ShapePropertiesOptions, rn as stringifyEndpointConnection, ro as PresetColor, rr as Mutable, rt as StyleMatrixIndex, s as blipFillDesc, sa as RectAlignment, si as createShape3D, sn as GroupLockingOptions, so as createHslColor, sr as runPropertiesDesc, st as createLineColorList, t as diagramExtensionListDesc, ta as ReflectionEffectOptions, ti as parseBodyProperties, tn as EndpointConnectionOptions, to as RgbColorOptions, tr as readParagraphProperties, tt as FontCollectionIndex, u as stringifyBlipEffects, ua as createInnerShadowEffect, ui as createBevel, un as createConnectorLocking, ur as TextListStyleOptions, ut as createTextFillColorList, v as customGeometryDesc, va as LinearShadeOptions, vi as Vector3D, vn as TableCellBorderOptions, vr as BulletAutoNumOptions, vt as LayoutDefinitionHeaderOptions, w as shapeLockingDesc, wa as BlipFillConfigOptions, wi as OutlineOptions, wn as TableStyleRegion, wr as DEFAULT_OUTLINE_WIDTH, wt as createLayoutDefinitionHeaderList, x as graphicFrameLockingDesc, xa as RelativeRect, xi as LineCap, xn as TablePartStyleOptions, xr as BulletOptions, xt as createColorsDefinitionHeader, y as presetGeometryDesc, ya as PathShade, yi as createScene3D, yn as TableCellStyleOptions, yr as BulletCharOptions, yt as StyleDefinitionHeaderListOptions, z as schemeColorDesc, za as createBlipEffects, zi as CustomGeometryOptions, zn as Transform2DOptions, zr as TextParagraphPropertiesOptions, zt as createAdjust } from "./index-BDeoFmTS.mjs";
|
|
6
6
|
import { _ as ThemeOverrideOptions, a as DefaultShapeDefinitionOptions, c as ExtraColorSchemeOptions, d as FontSchemeOptions, f as FormatSchemeOptions, g as ThemeOptions, h as TextFontOptions, i as CustomColorOptions, l as FontCollectionOptions, m as SupplementalFontOptions, n as ColorSchemeIndex, o as DefaultShapeStyleOptions, p as ObjectDefaultsOptions, r as ColorSchemeOptions, s as EffectStyleOptions, t as ColorMappingOptions, u as FontReferenceOptions } from "./theme-options-wZX4i_xx.mjs";
|
|
7
7
|
import { i as convertOutput, n as OutputByType, r as OutputType, t as OoxmlMimeType } from "./output-yyxdkG0C.mjs";
|
|
8
|
-
import { $ as xsdLightRigDirection, $t as convertTwipToEmu, A as xsdAnimValueType, An as ZipStreamWriter, At as UniqueNumericIdCreator, B as xsdCompoundLine, Bt as convertEmuToPixels, C as replacePlaceholders, Cn as Packer, Ct as xsdTextVerticalType, D as xsdAnimCalcMode, Dn as ZIP_STORED_LEVEL, Dt as xsdVerticalMergeRev, E as invertMap, En as ZIP_DEFLATE_LEVEL, Et as xsdUnderlineStyle, F as xsdAxisOrientation, Fn as strFromU8, Ft as extUriMatches, G as xsdEffectContainer, Gt as convertMillimetersToTwip, H as xsdDataLabelPosition, Ht as convertEmuToTwip, I as xsdAxisPosition, In as unzipSync, It as derivePasswordHash, J as xsdHierBranch, Jt as convertPointsToTwip, K as xsdErrorValueType, Kt as convertPixelsToEmu, L as xsdBlendMode, Ln as zipAndConvert, Lt as hashPasswordAgile, M as xsdAxisCrossBetween, Mn as createPacker, Mt as uniqueId, N as xsdAxisCrosses, Nn as createZipStream, Nt as uniqueNumericIdCreator, O as xsdAnimClass, On as ZipOptions, Ot as ImageFileType, P as xsdAxisLabelAlignment, Pn as levelForMediaName, Pt as uniqueUuid, Q as xsdLegendPosition, Qt as convertToTwip, R as xsdChartBuild, Rn as zipSync, Rt as randomBytes, S as replaceOlePlaceholders, Sn as CompressionOptions, St as xsdTextTabAlignment, T as replaceVideoPlaceholders, Tn as XmlifyedFile, Tt as xsdTrendlineType, U as xsdDiagramBuild, Ut as convertInchesToEmu, V as xsdConsolidateFunction, Vt as convertEmuToPoints, W as xsdDiagramDirection, Wt as convertInchesToTwip, X as xsdIterateType, Xt as convertToInch, Y as xsdHueDirection, Yt as convertToEmu, Z as xsdJcAlignment, Zt as convertToPt, _ as replaceImageLinkPlaceholders, _n as buildRootRelationships, _t as xsdTableWidthType, a as findAndReplaceImagePlaceholders, an as emitPercent, at as xsdPathFillMode, b as replaceNumberingPlaceholders, bn as resolveRelationshipTarget, bt as xsdTextBuild, c as getMediaRefs, cn as parsePercent, ct as xsdPlaceholderType, d as getVideoRefs, dn as XmlifyedFileEntry, dt as xsdResizeHandles, en as convertUniversalMeasureToEmu, et as xsdLineCap, f as hasPlaceholders, fn as addBinaryFile, ft as xsdShadingPattern, g as replaceHyperlinkPlaceholders, gn as TargetModeType, gt as xsdStrikeStyle, h as replaceChartPlaceholders, hn as Relationships, ht as xsdSplitType, i as collectPlaceholderKeys, in as emitAngle, it as xsdOrient, j as xsdAnimationDgmBuild, jn as Zippable, jt as hashedId, k as xsdAnimLevel, kn as ZipPartSink, kt as imageTypeFromPath, l as getOleRefs, ln as parsePercentAttr, lt as xsdPresetShadow, m as replaceAudioPlaceholders, mn as RelationshipType, mt as xsdSlideLayoutType, n as SmartArtRelOptions, nn as convertUniversalMeasureToPt, nt as xsdMaterialType, o as formatId, on as mapOptional, ot as xsdPattern, p as replaceAllPlaceholders, pn as compileMapping, pt as xsdSizeRepresents, q as xsdFontAlignment, qt as convertPointsToEmu, r as addSmartArtRelationships, rn as convertUniversalMeasureToTwip, rt as xsdMathStyle, s as getAudioRefs, sn as parseAngle, st as xsdPenAlignment, t as IdFormat, tn as convertUniversalMeasureToInch, tt as xsdLineEndSize, u as getReferencedMedia, un as parseUniversalMeasure, ut as xsdRectAlignment, v as replaceImagePlaceholders, vn as optionalRelsPart, vt as xsdTextAlign, w as replaceSmartArtPlaceholders, wn as PackerOptions, wt as xsdTotalsRowFunction, x as replaceOleLinkPlaceholders, xn as CompileFn, xt as xsdTextCaps, y as replaceMediaPlaceholders, yn as partPathToRelsPath, yt as xsdTextAnchor, z as xsdComments, zn as zipSyncAndConvert, zt as convertEmuToInches } from "./index-
|
|
8
|
+
import { $ as xsdLightRigDirection, $t as convertTwipToEmu, A as xsdAnimValueType, An as ZipStreamWriter, At as UniqueNumericIdCreator, B as xsdCompoundLine, Bt as convertEmuToPixels, C as replacePlaceholders, Cn as Packer, Ct as xsdTextVerticalType, D as xsdAnimCalcMode, Dn as ZIP_STORED_LEVEL, Dt as xsdVerticalMergeRev, E as invertMap, En as ZIP_DEFLATE_LEVEL, Et as xsdUnderlineStyle, F as xsdAxisOrientation, Fn as strFromU8, Ft as extUriMatches, G as xsdEffectContainer, Gt as convertMillimetersToTwip, H as xsdDataLabelPosition, Ht as convertEmuToTwip, I as xsdAxisPosition, In as unzipSync, It as derivePasswordHash, J as xsdHierBranch, Jt as convertPointsToTwip, K as xsdErrorValueType, Kt as convertPixelsToEmu, L as xsdBlendMode, Ln as zipAndConvert, Lt as hashPasswordAgile, M as xsdAxisCrossBetween, Mn as createPacker, Mt as uniqueId, N as xsdAxisCrosses, Nn as createZipStream, Nt as uniqueNumericIdCreator, O as xsdAnimClass, On as ZipOptions, Ot as ImageFileType, P as xsdAxisLabelAlignment, Pn as levelForMediaName, Pt as uniqueUuid, Q as xsdLegendPosition, Qt as convertToTwip, R as xsdChartBuild, Rn as zipSync, Rt as randomBytes, S as replaceOlePlaceholders, Sn as CompressionOptions, St as xsdTextTabAlignment, T as replaceVideoPlaceholders, Tn as XmlifyedFile, Tt as xsdTrendlineType, U as xsdDiagramBuild, Ut as convertInchesToEmu, V as xsdConsolidateFunction, Vt as convertEmuToPoints, W as xsdDiagramDirection, Wt as convertInchesToTwip, X as xsdIterateType, Xt as convertToInch, Y as xsdHueDirection, Yt as convertToEmu, Z as xsdJcAlignment, Zt as convertToPt, _ as replaceImageLinkPlaceholders, _n as buildRootRelationships, _t as xsdTableWidthType, a as findAndReplaceImagePlaceholders, an as emitPercent, at as xsdPathFillMode, b as replaceNumberingPlaceholders, bn as resolveRelationshipTarget, bt as xsdTextBuild, c as getMediaRefs, cn as parsePercent, ct as xsdPlaceholderType, d as getVideoRefs, dn as XmlifyedFileEntry, dt as xsdResizeHandles, en as convertUniversalMeasureToEmu, et as xsdLineCap, f as hasPlaceholders, fn as addBinaryFile, ft as xsdShadingPattern, g as replaceHyperlinkPlaceholders, gn as TargetModeType, gt as xsdStrikeStyle, h as replaceChartPlaceholders, hn as Relationships, ht as xsdSplitType, i as collectPlaceholderKeys, in as emitAngle, it as xsdOrient, j as xsdAnimationDgmBuild, jn as Zippable, jt as hashedId, k as xsdAnimLevel, kn as ZipPartSink, kt as imageTypeFromPath, l as getOleRefs, ln as parsePercentAttr, lt as xsdPresetShadow, m as replaceAudioPlaceholders, mn as RelationshipType, mt as xsdSlideLayoutType, n as SmartArtRelOptions, nn as convertUniversalMeasureToPt, nt as xsdMaterialType, o as formatId, on as mapOptional, ot as xsdPattern, p as replaceAllPlaceholders, pn as compileMapping, pt as xsdSizeRepresents, q as xsdFontAlignment, qt as convertPointsToEmu, r as addSmartArtRelationships, rn as convertUniversalMeasureToTwip, rt as xsdMathStyle, s as getAudioRefs, sn as parseAngle, st as xsdPenAlignment, t as IdFormat, tn as convertUniversalMeasureToInch, tt as xsdLineEndSize, u as getReferencedMedia, un as parseUniversalMeasure, ut as xsdRectAlignment, v as replaceImagePlaceholders, vn as optionalRelsPart, vt as xsdTextAlign, w as replaceSmartArtPlaceholders, wn as PackerOptions, wt as xsdTotalsRowFunction, x as replaceOleLinkPlaceholders, xn as CompileFn, xt as xsdTextCaps, y as replaceMediaPlaceholders, yn as partPathToRelsPath, yt as xsdTextAnchor, z as xsdComments, zn as zipSyncAndConvert, zt as convertEmuToInches } from "./index-Cd0lFS5x.mjs";
|
|
9
9
|
import { C as PPTX_NS, D as parseCorePropsElement, E as buildCorePropertiesXmlString, S as DOCX_NS, T as CorePropertiesOptions, _ as createTraverser, a as getNextRelationshipIndex, b as ReplacerOptions, c as removeOverride, d as nextNumericId, f as patchSpaceAttribute, g as createTokenReplacer, h as createSplitInject, i as appendRelationship, l as createTextElementContents, m as TokenNotFoundError, n as PlaceholderDelimiters, o as appendContentType, p as toJson, r as applyCorePropertiesOverride, s as appendOverride, t as BasePatchOptions, u as getFirstLevelElements, v as RenderedParagraphNode, w as XmlNamespaceOptions, x as createReplacer, y as createRunRenderer } from "./index-CaNwM5_e.mjs";
|
|
10
10
|
import { $ as stringifyConnection, A as LayoutNodeChild, B as parseLayoutDefinition, C as ConstraintOptions, D as DiagramIterationOptions, E as DiagramDirection, F as ResizeHandles, G as ModelConnectionOptions, H as stringifyLayoutDefinitionPart, I as SampleDataOptions, J as stringifyDataModel, K as ModelPointOptions, L as VariableListOptions, M as LayoutRuleOptions, N as LayoutShapeOptions, O as ForEachOptions, P as OtherwiseOptions, Q as stringifyTransPoint, R as WhenOptions, S as ConstraintOperator, T as ConstraintType, U as withDiagramNamespaces, V as stringifyLayoutDefinition, W as DataModelOptions, X as PointPropertySetOptions, Y as stringifyDataModelOptions, Z as stringifyPoint, _ as AlgorithmType, a as SmartArtRawParts, at as DEFAULT_DRAWING_XML, b as ConditionFunction, c as StyleLabelOptions, ct as getStyleXml, d as stringifyStyleDefinition, dt as STYLE_CATEGORIES, et as ColorDefinitionOptions, f as stringifyStyleDefinitionPart, g as AlgorithmParameterType, h as AlgorithmParameterOptions, i as SmartArtData, it as stringifyColorDefinitionPart, j as LayoutNodeOptions, k as LayoutDefinitionOptions, l as TextProperties3DOptions, lt as COLOR_CATEGORIES, m as AlgorithmOptions, n as createDataModel, nt as parseColorDefinition, o as definitionId, ot as getColorXml, p as styleDefDesc, q as parseDataModelOptions, r as SmartArtCollection, rt as stringifyColorDefinition, s as StyleDefinitionOptions, st as getLayoutXml, t as TreeNode, tt as colorsDefDesc, u as parseStyleDefinition, ut as LAYOUT_CATEGORIES, v as ChildOrder, w as ConstraintRelationship, x as ConditionOperator, y as ChooseOptions, z as layoutDefDesc } from "./index-6_MYd0cg.mjs";
|
|
11
11
|
import { $ as stringifyVmlGroup, $n as stringifyVmlClipPath, $t as VmlImageDataOptions, A as VmlPolylineOptions, An as VmlInkOptions, Ar as VmlScreenSize, At as VmlStrokeArrowLength, B as parseVmlGroup, Bn as parseVmlCallout, Br as LengthUnit, Bt as VmlShadowOptions, C as VmlBaseShapeFields, Cn as VmlEquationXmlOptions, Cr as VmlConnectorType, Ct as VmlTextPathOptions, D as VmlImageOptions, Dn as VmlExtrusionPlane, Dr as VmlInsetMode, Dt as VmlTextboxOptions, E as VmlGroupOptions, En as VmlExtrusionOptions, Er as VmlHorizontalRuleAlign, Et as stringifyVmlTextPath, F as VmlShapetypeOptions, Fn as VmlOleObjectOptions, Fr as parseVmlTrueFalse, Ft as VmlStrokeJoinStyle, G as parseVmlRect, Gn as parseVmlExtrusion, Gt as VmlTextDataOptions, H as parseVmlLine, Hn as parseVmlComplex, Hr as parseVmlShapeStyle, Ht as parseVmlShadow, I as nextVmlShapeId, In as VmlOleObjectType, Ir as parseVmlTrueFalseBlank, It as VmlStrokeLineStyle, J as parseVmlShapeChild, Jn as parseVmlOfficeFill, Jt as stringifyVmlIsComment, K as parseVmlRoundRect, Kn as parseVmlInk, Kt as parseVmlIsComment, L as parseVmlArc, Ln as VmlOleUpdateMode, Lr as stringifyVmlAttributes, Lt as VmlStrokeOptions, M as VmlRoundRectOptions, Mn as VmlOfficeFillOptions, Mr as VmlTrueFalse, Mt as VmlStrokeArrowWidth, N as VmlShapeChild, Nn as VmlOfficeFillType, Nr as VmlTrueFalseBlank, Nt as VmlStrokeChildOptions, O as VmlLineOptions, On as VmlExtrusionRender, Or as VmlOfficeCoreAttributes, Ot as parseVmlTextbox, P as VmlShapeOptions, Pn as VmlOleDrawAspect, Pr as parseVmlAttributes, Pt as VmlStrokeEndCap, Q as stringifyVmlCurve, Qn as stringifyVmlCallout, Qt as stringifyVmlPath, R as parseVmlBackground, Rn as VmlSignatureLineOptions, Rr as stringifyVmlTrueFalse, Rt as parseVmlStroke, S as VmlBackgroundOptions, Sn as VmlDiagramRelationOptions, Sr as VmlConnectType, St as stringifyVmlWrap, T as VmlEditAs, Tn as VmlExtensionMode, Tr as VmlDiagramLayout, Tt as parseVmlTextPath, U as parseVmlOval, Un as parseVmlDiagram, Ur as parseVmlStyle, Ut as stringifyVmlShadow, V as parseVmlImage, Vn as parseVmlClipPath, Vr as VmlShapeStyle, Vt as VmlShadowType, W as parseVmlPolyline, Wn as parseVmlEquationXml, Wr as stringifyVmlStyle, Wt as VmlIsCommentOptions, X as stringifyVmlArc, Xn as parseVmlSignatureLine, Xt as VmlPathOptions, Y as parseVmlShapetype, Yn as parseVmlOleObject, Yt as stringifyVmlTextData, Z as stringifyVmlBackground, Zn as parseVmlSkew, Zt as parseVmlPath, _ as stringifyVmlColorMenu, _n as VmlCalloutOptions, _r as VML_SHAPE_ATTRS, _t as parseVmlAnchorLock, a as VmlRegroupTableOptions, an as stringifyVmlHandles, ar as stringifyVmlLock, at as stringifyVmlRoundRect, b as stringifyVmlShapeLayout, bn as VmlComplexOptions, br as VmlBlackWhiteMode, bt as stringifyVmlAnchorLock, c as VmlRuleProxyOptions, cn as stringifyVmlFormulas, cr as stringifyVmlSignatureLine, ct as stringifyVmlShapetype, d as VmlShapeDefaultsOptions, dn as VmlFillType, dr as VmlClientObjectType, dt as VmlBorderType, en as parseVmlImageData, er as stringifyVmlComplex, et as stringifyVmlImage, f as VmlShapeLayoutOptions, fn as VmlImageAspect, fr as parseVmlClientData, ft as VmlHorizontalAnchor, g as parseVmlShapeLayout, gn as VmlCalloutAngle, gr as VML_OFFICE_SHAPE_ATTRS, gt as VmlWrapType, h as parseVmlShapeDefaults, hn as EXT_ATTR, hr as VML_OFFICE_CORE_ATTRS, ht as VmlWrapSide, i as VmlRegroupEntryOptions, in as parseVmlHandles, ir as stringifyVmlInk, it as stringifyVmlRect, j as VmlRectOptions, jn as VmlLockOptions, jr as VmlShapeAttributes, jt as VmlStrokeArrowType, k as VmlOvalOptions, kn as VmlExtrusionType, kr as VmlOfficeShapeAttributes, kt as stringifyVmlTextbox, l as VmlRuleType, ln as VmlFillMethod, lr as stringifyVmlSkew, lt as VmlAnchorLockOptions, m as parseVmlColorMru, mn as stringifyVmlFill, mr as VML_CORE_ATTRS, mt as VmlWrapOptions, n as VmlColorMruOptions, nn as VmlHandleOptions, nr as stringifyVmlEquationXml, nt as stringifyVmlOval, o as VmlRuleHow, on as VmlFormulasOptions, or as stringifyVmlOfficeFill, ot as stringifyVmlShape, p as parseVmlColorMenu, pn as parseVmlFill, pr as stringifyVmlClientData, pt as VmlVerticalAnchor, q as parseVmlShape, qn as parseVmlLock, qt as parseVmlTextData, r as VmlIdMapOptions, rn as VmlHandlesOptions, rr as stringifyVmlExtrusion, rt as stringifyVmlPolyline, s as VmlRuleOptions, sn as parseVmlFormulas, sr as stringifyVmlOleObject, st as stringifyVmlShapeChild, t as VmlColorMenuOptions, tn as stringifyVmlImageData, tr as stringifyVmlDiagram, tt as stringifyVmlLine, u as VmlRulesOptions, un as VmlFillOptions, ur as VmlClientDataOptions, ut as VmlBorderOptions, v as stringifyVmlColorMru, vn as VmlClipPathOptions, vr as VmlAttrKind, vt as parseVmlBorder, w as VmlCurveOptions, wn as VmlExtAttribute, wr as VmlCoreAttributes, wt as VmlTextPathStyle, x as VmlArcOptions, xn as VmlDiagramOptions, xr as VmlColor, xt as stringifyVmlBorder, y as stringifyVmlShapeDefaults, yn as VmlColorMode, yr as VmlAttrSpec, yt as parseVmlWrap, z as parseVmlCurve, zn as VmlSkewOptions, zr as stringifyVmlTrueFalseBlank, zt as stringifyVmlStroke } from "./index-DkJrkIVp.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -27,7 +27,7 @@ var Relationships = class {
|
|
|
27
27
|
if (n) this.maxId = Math.max(this.maxId, Number(n[1]));
|
|
28
28
|
}
|
|
29
29
|
addRelationship(id, type, target, targetMode) {
|
|
30
|
-
const rid = `rId${id}
|
|
30
|
+
const rid = typeof id === "number" ? `rId${id}` : id;
|
|
31
31
|
this.trackId(rid);
|
|
32
32
|
this.entries.push({
|
|
33
33
|
id: rid,
|
|
@@ -67,6 +67,26 @@ var Relationships = class {
|
|
|
67
67
|
get nextRelationshipId() {
|
|
68
68
|
return this.maxId + 1;
|
|
69
69
|
}
|
|
70
|
+
/** Pre-claim a source id without registering an entry. Reserving every
|
|
71
|
+
* passthrough source id up front keeps auto-allocated ids (add(), next)
|
|
72
|
+
* strictly above the source id space, so a part the source didn't carry
|
|
73
|
+
* (a fresh comment, say) can never take an id a later source re-use will
|
|
74
|
+
* need — re-emitting the source rel at a taken id corrupts the package.
|
|
75
|
+
* Accepts the passthrough `rId` form ("rId7") or a bare number. */
|
|
76
|
+
reserveId(id) {
|
|
77
|
+
const n = typeof id === "number" ? id : /^rId(\d+)$/.exec(id)?.[1];
|
|
78
|
+
if (n !== void 0) this.trackId(`rId${n}`);
|
|
79
|
+
}
|
|
80
|
+
/** Reserve every passthrough id held by one source part — the uniform entry
|
|
81
|
+
* point compilers call before filling a part's rels from the model. Without
|
|
82
|
+
* it the model's batch allocations (offset snapshots, add()) can land on a
|
|
83
|
+
* source id, forcing the later source re-emission to collide or renumber
|
|
84
|
+
* (renumbering dangles the verbatim references that motivated keeping the
|
|
85
|
+
* source id). Reserving is invisible to hasId/hasRelationship, so source
|
|
86
|
+
* re-emission and rename-to-source-id still work. */
|
|
87
|
+
reserveSourceRids(source, passthrough) {
|
|
88
|
+
for (const rel of passthrough) if (rel.source === source) this.reserveId(rel.rId);
|
|
89
|
+
}
|
|
70
90
|
/** Rename the first entry matching `type` to `newId` — used to promote a
|
|
71
91
|
* structured rel (e.g. the slide layout) to its source id when the
|
|
72
92
|
* source rId is free. No-op when the slot is taken or no match. */
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["unzipSync","parse","strFromU8","stringify","zipSync","parse","extensionOf","withLeadingSlash","extensionOf"],"sources":["../src/opc/relationships.ts","../src/opc/media.ts","../src/opc/embeddings.ts","../src/opc/variant-types.ts","../src/opc/app-properties.ts","../src/opc/custom-properties.ts","../src/opc/encryption.ts","../src/opc/namespaces.ts","../src/opc/parser.ts","../src/opc/opc-consistency.ts","../src/opc/part-registry.ts","../src/opc/content-type-overrides.ts","../src/opc/content-types-input.ts","../src/opc/passthrough.ts","../src/connector/types.ts","../src/group/types.ts"],"sourcesContent":["import { escapeXml } from \"@office-open/xml\";\n\nimport type { XmlifyedFile } from \"./packer\";\n\nexport type RelationshipType =\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"\n | \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramLayout\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramStyle\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramColors\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing\"\n // WordprocessingML specific\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/attachedTemplate\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\"\n | \"http://schemas.microsoft.com/office/2011/relationships/people\"\n | \"http://schemas.microsoft.com/office/2011/relationships/commentsExtended\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/subDocument\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject\"\n // Native-format embedding (embedded xlsx/docx behind OLE objects)\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package\"\n | \"http://schemas.microsoft.com/office/2006/relationships/txbx\"\n // PresentationML specific\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideSyncProperties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeManager\"\n | \"http://schemas.microsoft.com/office/2007/relationships/media\"\n // SpreadsheetML specific\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/users\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/xmlMaps\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/volTypes\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells\";\n\nexport const TargetModeType = {\n EXTERNAL: \"External\",\n} as const;\n\ninterface RelationshipEntry {\n id: string;\n type: RelationshipType;\n target: string;\n targetMode?: string;\n}\n\n/**\n * Manages OOXML relationship entries and serializes to XML.\n *\n * Standalone class — no XmlComponent inheritance.\n * Pure string concatenation for zero-allocation XML output.\n */\nexport class Relationships {\n private entries: RelationshipEntry[] = [];\n // Max numeric id across entries, maintained on every mutation so the next\n // free id is O(1) instead of a full scan per read.\n private maxId = 0;\n\n private trackId(rid: string): void {\n const n = /^rId(\\d+)$/.exec(rid);\n if (n) this.maxId = Math.max(this.maxId, Number(n[1]));\n }\n\n public addRelationship(\n id: number | string,\n type: RelationshipType,\n target: string,\n targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType],\n ): void {\n const rid = `rId${id}`;\n this.trackId(rid);\n this.entries.push({ id: rid, type, target, targetMode });\n }\n\n /**\n * Register a relationship with an auto-allocated sequential id and return\n * the numeric id. Prefer this over the `relationshipCount + 1` +\n * `addRelationship` pair at every call site that wants the next id; reach\n * for `addRelationship` directly only when the id is externally determined\n * (a contiguous batch pre-computed from an offset, a fixed rId1, …).\n *\n * The id is max(existing) + 1, not count + 1 — externally-determined ids\n * (passthrough source ids) can leave gaps, and a gap-following count-based\n * id would collide with an existing entry (duplicate Relationship ids\n * corrupt the package for Office applications).\n */\n public add(\n type: RelationshipType,\n target: string,\n targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType],\n ): number {\n const id = this.maxId + 1;\n this.maxId = id;\n this.entries.push({ id: `rId${id}`, type, target, targetMode });\n return id;\n }\n\n public get relationshipCount(): number {\n return this.entries.length;\n }\n\n /** The next free numeric id (max existing + 1) — the safe offset base when\n * externally-determined ids (passthrough source ids) leave gaps below it. */\n public get nextRelationshipId(): number {\n return this.maxId + 1;\n }\n\n /** Rename the first entry matching `type` to `newId` — used to promote a\n * structured rel (e.g. the slide layout) to its source id when the\n * source rId is free. No-op when the slot is taken or no match. */\n public renameEntryByType(type: string, newId: number): void {\n if (this.hasId(`rId${newId}`)) return;\n const entry = this.entries.find((e) => e.type === type);\n if (entry) {\n entry.id = `rId${newId}`;\n this.maxId = Math.max(this.maxId, newId);\n }\n }\n\n /** Numeric id of the first entry matching `kind` (last segment of the type\n * URI), or undefined when none is registered. */\n public idByKind(kind: string): number | undefined {\n const entry = this.entries.find((e) => e.type.split(\"/\").pop() === kind);\n if (!entry) return undefined;\n const m = /^rId(\\d+)$/.exec(entry.id);\n if (!m) return undefined;\n return Number(m[1]);\n }\n\n /**\n * Claim a captured source relationship (round-trip pre-claim). Verbatim\n * part content references the source rIds, so re-emit the rel at its exact\n * source id whenever that slot is still free — renumbering would dangle\n * those references. Skips rels already registered under the same\n * kind+target (the model absorbed them); falls back to an auto id for\n * non-numeric source ids.\n */\n public claimSourceRel(rel: {\n relationshipType: string;\n target: string;\n rId: string;\n targetMode?: \"External\";\n }): void {\n if (this.hasRelationship(rel.relationshipType, rel.target)) return;\n const numeric = /^rId(\\d+)$/.exec(rel.rId);\n if (numeric && !this.hasId(rel.rId)) {\n this.addRelationship(\n Number(numeric[1]),\n rel.relationshipType as RelationshipType,\n rel.target,\n rel.targetMode,\n );\n } else {\n this.add(rel.relationshipType as RelationshipType, rel.target, rel.targetMode);\n }\n }\n\n /**\n * True when a relationship of the same kind and target is already\n * registered. The kind compares only the relationship type's last path\n * segment, so the transitional and strict URI forms of the same\n * relationship compare equal — passthrough re-emission uses this to skip\n * relationships the compiler already wired (a duplicate entry corrupts the\n * package for Office applications).\n */\n public hasRelationship(type: string, target: string): boolean {\n const kind = type.split(\"/\").pop();\n return this.entries.some((e) => e.type.split(\"/\").pop() === kind && e.target === target);\n }\n\n /**\n * True when any entry carries the relationship kind (last type segment).\n * Round-trip re-emission uses this as the ownership test: a rebuilt part\n * that already registered a rel of this kind absorbed the concept, so the\n * captured source rel (possibly a renamed target or the ISO-strict type\n * dual) must not be re-emitted alongside it.\n */\n public hasRelationshipKind(kind: string): boolean {\n return this.entries.some((e) => e.type.split(\"/\").pop() === kind);\n }\n\n /** True when an entry already occupies this exact relationship id. */\n public hasId(id: string): boolean {\n return this.entries.some((e) => e.id === id);\n }\n\n /**\n * The id of the entry matching kind+target (same last-path-segment equality\n * as {@link hasRelationship}), or undefined when absent. Round-trip legs use\n * this to point a reference element at an already-registered relationship.\n */\n public idOf(type: string, target: string): string | undefined {\n const kind = type.split(\"/\").pop();\n return this.entries.find((e) => e.type.split(\"/\").pop() === kind && e.target === target)?.id;\n }\n\n /** Directly builds XML string — zero intermediate tree allocation. */\n public serialize(): string {\n const p: string[] = [\n '<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">',\n ];\n for (const e of this.entries) {\n const tm = e.targetMode ? ` TargetMode=\"${escapeXml(e.targetMode)}\"` : \"\";\n p.push(\n `<Relationship Id=\"${escapeXml(e.id)}\" Type=\"${escapeXml(e.type)}\" Target=\"${escapeXml(e.target)}\"${tm}/>`,\n );\n }\n p.push(\"</Relationships>\");\n return p.join(\"\");\n }\n}\n\n/**\n * Serialize a Relationships part only when it carries at least one\n * relationship. Optional parts (fontTable, headers, footers, charts, drawings,\n * worksheets, …) emit no .rels part when empty — Office strips empty rels\n * shells when re-saving, so skipping them keeps generated packages free of\n * redundant empty parts and matches Office's normalized output.\n *\n * Always-on parts (the package `_rels/.rels` and the main\n * document/presentation/workbook parts) carry relationships by construction\n * and must NOT use this gate.\n */\nexport function optionalRelsPart(\n rel: Relationships,\n xmlDeclaration: string,\n path: string,\n): XmlifyedFile | undefined {\n return rel.relationshipCount > 0 ? { data: xmlDeclaration + rel.serialize(), path } : undefined;\n}\n\n/** Build the package root relationships shared by docx, pptx, and xlsx. */\nexport function buildRootRelationships(\n mainPartTarget: string,\n includeCustomProperties: boolean,\n passthroughRelationships?: readonly {\n source: string;\n relationshipType: string;\n target: string;\n targetMode?: \"External\";\n }[],\n): Relationships {\n const rels = new Relationships();\n rels.addRelationship(\n 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\",\n mainPartTarget,\n );\n rels.addRelationship(\n 2,\n \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\",\n \"docProps/core.xml\",\n );\n rels.addRelationship(\n 3,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\",\n \"docProps/app.xml\",\n );\n if (includeCustomProperties) {\n rels.addRelationship(\n 4,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\",\n \"docProps/custom.xml\",\n );\n }\n // Root-level passthrough relationships (round-trip): the source _rels/.rels\n // referenced parts the model carries verbatim — the package thumbnail above\n // all. Re-emitted as written; targets never move.\n for (const rel of passthroughRelationships ?? []) {\n if (rel.source !== \"\") continue;\n if (rels.hasRelationship(rel.relationshipType, rel.target)) continue;\n rels.add(rel.relationshipType as RelationshipType, rel.target, rel.targetMode);\n }\n return rels;\n}\n\n/**\n * Derive the .rels part path for a package part:\n * \"ppt/slides/slide1.xml\" → \"ppt/slides/_rels/slide1.xml.rels\".\n */\nexport function partPathToRelsPath(partPath: string): string {\n const idx = partPath.lastIndexOf(\"/\");\n const dir = partPath.substring(0, idx);\n const file = partPath.substring(idx + 1);\n return `${dir}/_rels/${file}.rels`;\n}\n\n/**\n * Resolve a relationship target against the referencing part's directory,\n * segment by segment: each \"..\" pops one directory level. A single\n * String.replace(\"../\", …) only strips the first occurrence and mis-resolves\n * deeper targets like \"../../media/image.png\".\n */\nexport function resolveRelationshipTarget(partPath: string, target: string): string {\n if (target.startsWith(\"/\")) return target.slice(1);\n const dir = partPath.substring(0, partPath.lastIndexOf(\"/\"));\n const dirParts = dir ? dir.split(\"/\") : [];\n for (const part of target.split(\"/\")) {\n if (part === \"..\") {\n dirParts.pop();\n } else if (part !== \".\" && part !== \"\") {\n dirParts.push(part);\n }\n }\n return dirParts.join(\"/\");\n}\n","/**\n * Content-deduplicated media collection for OOXML packages.\n *\n * Stores image entries keyed by file name. `addMedia` deduplicates by raw byte\n * content — byte-identical images referenced N times share one file, while\n * per-image metadata (transformation, extent, fallback) stays with each\n * reference in its own drawing XML and is passed via the `build` callback so it\n * never participates in the dedup key.\n *\n * Lookup is O(1) amortized: a `WeakMap` memoizes the resolved entry per input\n * `Uint8Array` (the hot path — a single document reuses the same buffer object\n * for repeated references), and a content-hash index (native CRC-32 where\n * available, FNV-1a fallback) resolves cross-object duplicates (e.g. a\n * freshly-decoded buffer carrying bytes already seen) with a one-time byte\n * verification to rule out hash collisions.\n *\n * @module\n */\n\nimport { nativeCrc32 } from \"./zip-native\";\n\n/**\n * Minimum fields every media entry carries. Package-specific entry types\n * extend this with their own transformation/extent/fallback fields.\n */\nexport interface BaseMediaEntry {\n fileName: string;\n data: Uint8Array;\n type: string;\n}\n\n/**\n * FNV-1a hash is a pure function of the bytes, so memoize it across\n * {@link Media} instances — repeated `generate()` calls that reuse the same\n * buffer objects (the common case) skip recomputation entirely.\n */\nconst hashKeyCache = new WeakMap<Uint8Array, string>();\n\n/**\n * Shared media collection for docx/pptx/xlsx. Generic over the package's entry\n * type so each package keeps its own metadata while sharing the registration +\n * dedup logic.\n */\nexport class Media<T extends BaseMediaEntry> {\n private readonly map = new Map<string, T>();\n /** FNV-1a content key (\"len:hash\") -> canonical file name, for cross-object dedup. */\n private readonly byContent = new Map<string, string>();\n /** Memoized result per input buffer — the repeated-reference hot path. */\n private readonly verified = new WeakMap<Uint8Array, string>();\n private counter = 0;\n /** Cached `array` snapshot — invalidated on add so compilers reading it per\n * part stop paying a fresh array copy per access. */\n private cachedArray: T[] | undefined;\n\n /**\n * Register media, reusing the existing entry when the bytes already exist.\n * Returns the canonical entry (shared across all identical references) —\n * callers read `entry.fileName` for placeholders/relationship targets or use\n * the whole entry (e.g. drawing XML). The `build` callback constructs the\n * package-specific entry from the allocated file name.\n *\n * Pass `fileName` to pin the name (round-trip scenarios preserving a source\n * file name); omit it to allocate the next sequential `imageN.ext`.\n */\n public addMedia(\n data: Uint8Array,\n type: string,\n build: (fileName: string) => T,\n fileName?: string,\n ): T {\n // Hot path: the same buffer object referenced repeatedly resolves instantly.\n // The cached entry must match the requested type — identical bytes registered\n // under a different type (e.g. EMF bytes also carried as WMF in an\n // mc:AlternateContent fallback) are distinct resources with different\n // content-types and must NOT collapse into one part.\n const verifiedName = this.verified.get(data);\n if (verifiedName !== undefined) {\n const existing = this.map.get(verifiedName)!;\n if (existing.type === type) return existing;\n }\n\n // Type-scoped content key: same bytes under different types stay separate.\n const key = `${type}:${this.contentKey(data)}`;\n const existingName = this.byContent.get(key);\n if (existingName !== undefined) {\n const existing = this.map.get(existingName)!;\n // Hash hit — confirm bytes + type match to exclude a collision, then memoize.\n if (existing.type === type && this.byteEqual(existing.data, data)) {\n this.verified.set(data, existingName);\n return existing;\n }\n }\n\n // A pinned name may already be taken by different bytes (e.g. a\n // counter-allocated name colliding with a source basename, or two round-trip\n // paths resolving to the same name). Re-allocate rather than overwrite —\n // overwriting would silently drop the prior media's bytes.\n const resolvedName = fileName ?? this.nextName(type);\n const finalName = this.map.has(resolvedName) ? this.nextName(type) : resolvedName;\n const entry = build(finalName);\n this.map.set(finalName, entry);\n this.cachedArray = undefined;\n this.byContent.set(key, finalName);\n this.verified.set(data, finalName);\n return entry;\n }\n\n /** Next sequential `imageN.${type}` that isn't already in use. */\n private nextName(type: string): string {\n let name = `image${++this.counter}.${type}`;\n while (this.map.has(name)) name = `image${++this.counter}.${type}`;\n return name;\n }\n\n /**\n * \"length:hash\" content key for `data`, memoized. Native CRC-32\n * (`zlib.crc32`) on Node/Bun — ~59× faster than JS hashing on 100 MB inputs;\n * FNV-1a fallback where no native zlib resolved. Both are 32-bit candidate\n * keys; the byte verification in `addMedia` rules out collisions, so the\n * weaker hash needs no collision handling of its own.\n */\n private contentKey(data: Uint8Array): string {\n const cached = hashKeyCache.get(data);\n if (cached !== undefined) return cached;\n const native = nativeCrc32(data);\n let key: string;\n if (native !== undefined) {\n key = `${data.length}:${(native >>> 0).toString(16)}`;\n } else {\n let hash = 0x811c9dc5;\n for (const byte of data) {\n hash ^= byte;\n hash = Math.imul(hash, 0x01000193);\n }\n key = `${data.length}:${(hash >>> 0).toString(16)}`;\n }\n hashKeyCache.set(data, key);\n return key;\n }\n\n /** Structural equality with early exit on the first mismatch. */\n private byteEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n\n /** All registered media entries (snapshot; stable between adds). */\n public get array(): T[] {\n if (this.cachedArray === undefined) this.cachedArray = [...this.map.values()];\n return this.cachedArray;\n }\n}\n","/**\n * OLE embedding collection shared by the format packages.\n *\n * Manages OLE object embeddings (word/embeddings/oleObjectN.bin,\n * ppt/embeddings/oleObjectN.bin) referenced by OLE object elements. Mirrors\n * the Media collection pattern but targets binary OLE container parts.\n *\n * @module\n */\n\n/** OLE embedding data stored under the package's embeddings/ directory. */\nexport interface EmbeddingData {\n /** File name within embeddings/ (e.g. \"oleObject1.bin\"). */\n fileName: string;\n /** Raw OLE container bytes. */\n data: Uint8Array;\n /** OLE program id (e.g. \"Excel.Sheet.12\") — informational only. */\n progId?: string;\n /**\n * Source relationship kind (round-trip): \"package\" for native-format\n * embeddings (xlsx/docx), \"oleObject\" for OLE compound binaries. Controls\n * the re-emitted relationship type; undefined (fresh authoring) means\n * oleObject.\n */\n relationshipType?: \"oleObject\" | \"package\";\n}\n\n/**\n * Collects OLE embeddings allocated during document generation. Each embedding\n * is stored under a sequential `oleObjectN.bin` name, mirroring MS Office's\n * numbering so output is deterministic and diffable.\n */\nexport class EmbeddingCollection {\n private map = new Map<string, EmbeddingData>();\n private counter = 0;\n /** Cached `array` snapshot — invalidated on add. */\n private cachedArray: EmbeddingData[] | undefined;\n\n /** Allocate the next sequential embedding file name (oleObject1.bin, …). */\n public nextEmbeddingName(): string {\n // Skip names already taken (e.g. round-tripped source basenames) — a\n // counter-allocated name colliding with a pinned one would overwrite it.\n let name = `oleObject${++this.counter}.bin`;\n while (this.map.has(name)) name = `oleObject${++this.counter}.bin`;\n return name;\n }\n\n /**\n * Register embedding bytes and return the stored entry. The requested name\n * is used when free or already claimed by identical bytes (two objects\n * sharing one embedded part); a name claimed by different bytes falls back\n * to a fresh sequential name — overwriting would silently drop the other\n * object's payload.\n */\n public addEmbedding(\n data: Uint8Array,\n requestedName?: string,\n progId?: string,\n relationshipType?: EmbeddingData[\"relationshipType\"],\n ): EmbeddingData {\n const requested = requestedName ?? this.nextEmbeddingName();\n const extras = {\n ...(progId !== undefined ? { progId } : {}),\n ...(relationshipType !== undefined ? { relationshipType } : {}),\n };\n const existing = this.map.get(requested);\n if (existing) {\n if (this.byteEqual(existing.data, data)) return existing;\n const fallbackName = this.nextEmbeddingName();\n const entry: EmbeddingData = { fileName: fallbackName, data, ...extras };\n this.map.set(fallbackName, entry);\n this.cachedArray = undefined;\n return entry;\n }\n const entry: EmbeddingData = { fileName: requested, data, ...extras };\n this.map.set(requested, entry);\n this.cachedArray = undefined;\n return entry;\n }\n\n /** All registered embeddings in insertion order (snapshot; stable between adds). */\n public get array(): EmbeddingData[] {\n if (this.cachedArray === undefined) this.cachedArray = [...this.map.values()];\n return this.cachedArray;\n }\n\n private byteEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n }\n}\n","/**\n * Variant value types (vt:*) — shared vocabulary for the docProps parts.\n *\n * custom.xml property values and app.xml vectors (HeadingPairs,\n * TitlesOfParts) are expressed with the vt:* element set defined in\n * shared-documentPropertiesVariantTypes.xsd. JS values map as:\n * string → vt:lpwstr, boolean → vt:bool, Date → vt:filetime, integers →\n * vt:i4, other numbers → vt:r8.\n *\n * The two domains spell strings differently and Excel enforces the split:\n * app.xml vectors (CT_VectorLpstr) must carry vt:lpstr — Excel refuses to\n * open a file whose HeadingPairs/TitlesOfParts use vt:lpwstr — while\n * custom.xml property values use vt:lpwstr, the spelling Office itself\n * writes there.\n *\n * @module\n */\n\nimport { escapeXml, textOf } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport { parseOnOff } from \"../util/values\";\n\n/** JS-level variant value carried by a vt:* element. */\nexport type VariantValue = string | number | boolean | Date;\n\n/** Numeric vt:* tags parsed back to a JS number. */\nconst NUMERIC_VT_TAGS = new Set([\n \"vt:i1\",\n \"vt:i2\",\n \"vt:i4\",\n \"vt:i8\",\n \"vt:ui1\",\n \"vt:ui2\",\n \"vt:ui4\",\n \"vt:ui8\",\n \"vt:int\",\n \"vt:uint\",\n \"vt:r4\",\n \"vt:r8\",\n \"vt:decimal\",\n]);\n\n/** Every scalar vt:* element stringifyVariantValue can emit. */\nconst VT_TAGS = new Set([\n ...NUMERIC_VT_TAGS,\n \"vt:lpwstr\",\n \"vt:lpstr\",\n \"vt:bstr\",\n \"vt:bool\",\n \"vt:date\",\n \"vt:filetime\",\n]);\n\n/** The vt:* element the default JS mapping picks for a value. */\nexport function defaultVariantTag(value: VariantValue): string {\n if (typeof value === \"string\") return \"vt:lpwstr\";\n if (typeof value === \"boolean\") return \"vt:bool\";\n if (value instanceof Date) return \"vt:filetime\";\n return Number.isInteger(value) ? \"vt:i4\" : \"vt:r8\";\n}\n\n/**\n * Serialize a JS value as its vt:* element (stringify side, custom.xml domain).\n *\n * Strings stay lpwstr (the spelling Office writes for custom property\n * values), integers become i4, other numbers r8, booleans bool, and Dates\n * filetime (xsd:dateTime form). A `sourceTag` captured at parse overrides the\n * default mapping so a source spelling the mapping would rewrite (an integer\n * carried as vt:r8, an lpstr string) round-trips unchanged.\n */\nexport function stringifyVariantValue(value: VariantValue, sourceTag?: string): string {\n const tag =\n sourceTag !== undefined && VT_TAGS.has(sourceTag) ? sourceTag : defaultVariantTag(value);\n let inner: string;\n if (tag === \"vt:bool\") inner = value ? \"true\" : \"false\";\n else if (tag === \"vt:date\" || tag === \"vt:filetime\")\n inner = value instanceof Date ? value.toISOString() : String(value);\n else if (typeof value === \"string\") inner = escapeXml(value);\n else inner = String(value);\n return `<${tag}>${inner}</${tag}>`;\n}\n\n/**\n * Parse a vt:* scalar element back to a JS value (parse side).\n *\n * Lenient about unknown tags: they round-trip as their text content, the\n * same fallback the previous string-only custom-properties parse used.\n */\nexport function parseVariantValue(el: Element): VariantValue | undefined {\n const text = textOf(el);\n switch (el.name) {\n case \"vt:lpwstr\":\n case \"vt:lpstr\":\n case \"vt:bstr\":\n return text;\n case \"vt:bool\":\n return parseOnOff(text) ?? false;\n case \"vt:date\":\n case \"vt:filetime\":\n return text ? new Date(text) : undefined;\n default:\n if (NUMERIC_VT_TAGS.has(el.name ?? \"\")) return text === \"\" ? undefined : Number(text);\n return text || undefined;\n }\n}\n\n/**\n * Serialize a vt:vector of lpstr entries (the TitlesOfParts shape).\n * lpstr is required: Excel refuses to open a file whose app.xml vectors\n * carry lpwstr (CT_VectorLpstr).\n */\nexport function stringifyStringVector(values: readonly string[]): string {\n const items = values.map((v) => `<vt:lpstr>${escapeXml(v)}</vt:lpstr>`).join(\"\");\n return `<vt:vector size=\"${values.length}\" baseType=\"lpstr\">${items}</vt:vector>`;\n}\n\n/**\n * Serialize a vt:vector of variant entries (the HLinks shape). Each value\n * keeps the element spelling stringifyVariantValue maps it to, wrapped in a\n * vt:variant carrier — round-trips whatever int/string mix the source carried.\n */\nexport function stringifyVariantVector(values: readonly VariantValue[]): string {\n const items = values.map((v) => `<vt:variant>${stringifyVariantValue(v)}</vt:variant>`).join(\"\");\n return `<vt:vector size=\"${values.length}\" baseType=\"variant\">${items}</vt:vector>`;\n}\n\n/** Parse a vt:vector with any scalar baseType into its JS values. */\nexport function parseVector(el: Element | undefined): VariantValue[] {\n if (!el || el.name !== \"vt:vector\") return [];\n const out: VariantValue[] = [];\n for (const child of el.elements ?? []) {\n // Whitespace text between entries (indentation) is not a value — the OPC\n // parser captures it, so filter to element children before dispatch.\n if (child.type !== \"element\") continue;\n // baseType=\"variant\" wraps each entry in a <vt:variant> carrier.\n const scalar =\n child.name === \"vt:variant\" ? child.elements?.find((e) => e.name?.startsWith(\"vt:\")) : child;\n if (!scalar) continue;\n const value = parseVariantValue(scalar);\n if (value !== undefined) out.push(value);\n }\n return out;\n}\n","/**\n * Extended (App) Properties module — shared OPC part (docProps/app.xml).\n *\n * Format-agnostic: CT_Properties (ISO-IEC29500-2_2016 shared-documentPropertiesExtended.xsd)\n * is identical across docx/pptx/xlsx. Each package surfaces only the fields it populates\n * (Pages/Words for docx, Slides for pptx, etc.) — all fields are optional.\n *\n * @module\n */\n\n// ── Descriptor ──\n\nimport { escapeXml } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport { parseOnOff } from \"../util/values\";\nimport { parseVector, stringifyStringVector, stringifyVariantVector } from \"./variant-types\";\nimport type { VariantValue } from \"./variant-types\";\n\n/** xsd:boolean lexical form — spec canonical form is \"true\"/\"false\" (Word's convention). */\nconst xsdBoolean = (value: boolean): string => (value ? \"true\" : \"false\");\n\n/**\n * Options for docProps/app.xml extended properties (CT_Properties).\n *\n * Property order follows the CT_Properties xsd:all sequence so the\n * emitted XML matches the reference schema ordering.\n */\nexport interface AppPropertiesOptions {\n /** Template name */\n template?: string;\n /** Manager name */\n manager?: string;\n /** Company name */\n company?: string;\n /** Page count */\n pages?: number;\n /** Word count */\n words?: number;\n /** Character count */\n characters?: number;\n /** Intended print/display format, e.g. \"Custom\" or \"A4 Paper\" */\n presentationFormat?: string;\n /** Line count */\n lines?: number;\n /** Paragraph count */\n paragraphs?: number;\n /** Notes count */\n notes?: number;\n /** Slides count */\n slides?: number;\n /** Total editing time (minutes) */\n totalTime?: number;\n /** Hidden slides count */\n hiddenSlides?: number;\n /** Multimedia clips count */\n mmClips?: number;\n /** Characters including spaces */\n charactersWithSpaces?: number;\n /** Document security level */\n docSecurity?: number;\n /** Hyperlink base URL */\n hyperlinkBase?: string;\n /**\n * Hyperlink metadata vector (HLinks) — Word's internal per-link records\n * (six entries per link). Round-trip only: fields are undocumented, so the\n * flat variant values are carried as-is.\n */\n hlinks?: VariantValue[];\n /** Application name */\n application?: string;\n /** Application version */\n appVersion?: string;\n /** Whether the document is scaled/cropped */\n scaleCrop?: boolean;\n /** Whether links are up to date */\n linksUpToDate?: boolean;\n /** Whether the document is shared */\n sharedDoc?: boolean;\n /** Whether hyperlinks changed */\n hyperlinksChanged?: boolean;\n /** Named part-group counters (Office always writes these) */\n headingPairs?: HeadingPairOptions[];\n /** Part titles (slide titles, sheet names, heading ranges) */\n titlesOfParts?: string[];\n /**\n * Emit the extended-properties vocabulary under the ap: prefix — the ISO\n * strict binding, where the source declares xmlns:ap explicitly instead of\n * using the namespace as the default. Round-trip only.\n */\n apPrefix?: true;\n}\n\n/** One HeadingPairs entry: a group name plus the number of parts it covers. */\nexport interface HeadingPairOptions {\n /** Group name (e.g. \"Fonts Used\", \"Theme\", \"Slide Titles\") */\n name: string;\n /** Number of parts in the group */\n count: number;\n}\n\n/** Subset of AppPropertiesOptions accepted by stringify. */\nexport type AppPropertiesInput = AppPropertiesOptions;\n\nexport const appPropertiesDesc: CustomDescriptor<AppPropertiesInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n // xsd:all is unordered, but emit in schema order for readability. The\n // ap-prefixed form (ISO strict round-trip) binds xmlns:ap explicitly;\n // vt: children keep their own prefix either way.\n const t = (name: string): string => (opts.apPrefix ? `ap:${name}` : name);\n const p: string[] = opts.apPrefix\n ? [\n '<ap:Properties xmlns:ap=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\"' +\n ' xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">',\n ]\n : [\n '<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\"' +\n ' xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">',\n ];\n\n // Schema order: Template, Manager, Company, Pages, Words, Characters,\n // PresentationFormat, Lines, Paragraphs, Slides, Notes, TotalTime,\n // HiddenSlides, MMClips, ScaleCrop, HeadingPairs, TitlesOfParts,\n // LinksUpToDate, CharactersWithSpaces, SharedDoc, HyperlinkBase, HLinks,\n // HyperlinksChanged, DigSig, Application, AppVersion, DocSecurity.\n if (opts.template !== undefined)\n p.push(`<${t(\"Template\")}>${escapeXml(opts.template)}</${t(\"Template\")}>`);\n if (opts.manager !== undefined)\n p.push(`<${t(\"Manager\")}>${escapeXml(opts.manager)}</${t(\"Manager\")}>`);\n if (opts.company !== undefined)\n p.push(`<${t(\"Company\")}>${escapeXml(opts.company)}</${t(\"Company\")}>`);\n if (opts.pages !== undefined) p.push(`<${t(\"Pages\")}>${opts.pages}</${t(\"Pages\")}>`);\n if (opts.words !== undefined) p.push(`<${t(\"Words\")}>${opts.words}</${t(\"Words\")}>`);\n if (opts.characters !== undefined)\n p.push(`<${t(\"Characters\")}>${opts.characters}</${t(\"Characters\")}>`);\n if (opts.presentationFormat !== undefined)\n p.push(\n `<${t(\"PresentationFormat\")}>${escapeXml(opts.presentationFormat)}</${t(\"PresentationFormat\")}>`,\n );\n if (opts.lines !== undefined) p.push(`<${t(\"Lines\")}>${opts.lines}</${t(\"Lines\")}>`);\n if (opts.paragraphs !== undefined)\n p.push(`<${t(\"Paragraphs\")}>${opts.paragraphs}</${t(\"Paragraphs\")}>`);\n if (opts.slides !== undefined) p.push(`<${t(\"Slides\")}>${opts.slides}</${t(\"Slides\")}>`);\n if (opts.notes !== undefined) p.push(`<${t(\"Notes\")}>${opts.notes}</${t(\"Notes\")}>`);\n if (opts.totalTime !== undefined)\n p.push(`<${t(\"TotalTime\")}>${opts.totalTime}</${t(\"TotalTime\")}>`);\n if (opts.hiddenSlides !== undefined)\n p.push(`<${t(\"HiddenSlides\")}>${opts.hiddenSlides}</${t(\"HiddenSlides\")}>`);\n if (opts.mmClips !== undefined) p.push(`<${t(\"MMClips\")}>${opts.mmClips}</${t(\"MMClips\")}>`);\n if (opts.scaleCrop !== undefined)\n p.push(`<${t(\"ScaleCrop\")}>${xsdBoolean(opts.scaleCrop)}</${t(\"ScaleCrop\")}>`);\n if (opts.headingPairs !== undefined && opts.headingPairs.length > 0) {\n // vt:lpstr is required here: Excel refuses to open a file whose\n // HeadingPairs variants carry lpwstr.\n const items = opts.headingPairs\n .map(\n (pair) =>\n `<vt:variant><vt:lpstr>${escapeXml(pair.name)}</vt:lpstr></vt:variant>` +\n `<vt:variant><vt:i4>${pair.count}</vt:i4></vt:variant>`,\n )\n .join(\"\");\n p.push(\n `<${t(\"HeadingPairs\")}><vt:vector size=\"${opts.headingPairs.length * 2}\" baseType=\"variant\">` +\n `${items}</vt:vector></${t(\"HeadingPairs\")}>`,\n );\n }\n if (opts.titlesOfParts !== undefined && opts.titlesOfParts.length > 0) {\n p.push(\n `<${t(\"TitlesOfParts\")}>${stringifyStringVector(opts.titlesOfParts)}</${t(\"TitlesOfParts\")}>`,\n );\n }\n if (opts.linksUpToDate !== undefined)\n p.push(`<${t(\"LinksUpToDate\")}>${xsdBoolean(opts.linksUpToDate)}</${t(\"LinksUpToDate\")}>`);\n if (opts.charactersWithSpaces !== undefined)\n p.push(\n `<${t(\"CharactersWithSpaces\")}>${opts.charactersWithSpaces}</${t(\"CharactersWithSpaces\")}>`,\n );\n if (opts.sharedDoc !== undefined)\n p.push(`<${t(\"SharedDoc\")}>${xsdBoolean(opts.sharedDoc)}</${t(\"SharedDoc\")}>`);\n if (opts.hyperlinkBase !== undefined)\n p.push(`<${t(\"HyperlinkBase\")}>${escapeXml(opts.hyperlinkBase)}</${t(\"HyperlinkBase\")}>`);\n if (opts.hlinks !== undefined && opts.hlinks.length > 0)\n p.push(`<${t(\"HLinks\")}>${stringifyVariantVector(opts.hlinks)}</${t(\"HLinks\")}>`);\n if (opts.hyperlinksChanged !== undefined)\n p.push(\n `<${t(\"HyperlinksChanged\")}>${xsdBoolean(opts.hyperlinksChanged)}</${t(\"HyperlinksChanged\")}>`,\n );\n if (opts.application !== undefined)\n p.push(`<${t(\"Application\")}>${escapeXml(opts.application)}</${t(\"Application\")}>`);\n if (opts.appVersion !== undefined)\n p.push(`<${t(\"AppVersion\")}>${escapeXml(opts.appVersion)}</${t(\"AppVersion\")}>`);\n if (opts.docSecurity !== undefined)\n p.push(`<${t(\"DocSecurity\")}>${opts.docSecurity}</${t(\"DocSecurity\")}>`);\n\n p.push(opts.apPrefix ? \"</ap:Properties>\" : \"</Properties>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const result: AppPropertiesOptions = {};\n // ISO strict binds the vocabulary under an explicit ap: prefix — strip\n // any prefix so ap:Template matches the local-name cases, and remember\n // the binding so stringify re-emits the same form.\n if (el.name === \"ap:Properties\") result.apPrefix = true;\n for (const child of el.elements ?? []) {\n if (typeof child.name !== \"string\") continue;\n const text = child.elements?.[0]?.text;\n // String fields are presence-based: Word writes empty elements\n // (\"<Company>\\n</Company>\", which the XML parser reduces to no text)\n // — capture \"\" so the element round-trips instead of being dropped.\n const str = String(text ?? \"\");\n const name = child.name.includes(\":\")\n ? child.name.slice(child.name.indexOf(\":\") + 1)\n : child.name;\n switch (name) {\n case \"Template\":\n result.template = str;\n break;\n case \"Manager\":\n result.manager = str;\n break;\n case \"Company\":\n result.company = str;\n break;\n case \"Pages\":\n if (typeof text === \"string\") result.pages = Number(text);\n break;\n case \"Words\":\n if (typeof text === \"string\") result.words = Number(text);\n break;\n case \"Characters\":\n if (typeof text === \"string\") result.characters = Number(text);\n break;\n case \"PresentationFormat\":\n result.presentationFormat = str;\n break;\n case \"Lines\":\n if (typeof text === \"string\") result.lines = Number(text);\n break;\n case \"Paragraphs\":\n if (typeof text === \"string\") result.paragraphs = Number(text);\n break;\n case \"Slides\":\n if (typeof text === \"string\") result.slides = Number(text);\n break;\n case \"Notes\":\n if (typeof text === \"string\") result.notes = Number(text);\n break;\n case \"TotalTime\":\n if (typeof text === \"string\") result.totalTime = Number(text);\n break;\n case \"HiddenSlides\":\n if (typeof text === \"string\") result.hiddenSlides = Number(text);\n break;\n case \"MMClips\":\n if (typeof text === \"string\") result.mmClips = Number(text);\n break;\n case \"HeadingPairs\": {\n const vector = child.elements?.find((e) => e.name === \"vt:vector\");\n const flat = parseVector(vector);\n const pairs: HeadingPairOptions[] = [];\n for (let i = 0; i + 1 < flat.length; i += 2) {\n const name = flat[i];\n const count = flat[i + 1];\n if (typeof name === \"string\" && typeof count === \"number\") {\n pairs.push({ name, count });\n }\n }\n if (pairs.length > 0) result.headingPairs = pairs;\n break;\n }\n case \"TitlesOfParts\": {\n const vector = child.elements?.find((e) => e.name === \"vt:vector\");\n const titles = parseVector(vector).filter((v): v is string => typeof v === \"string\");\n if (titles.length > 0) result.titlesOfParts = titles;\n break;\n }\n case \"ScaleCrop\":\n if (typeof text === \"string\") result.scaleCrop = parseOnOff(text) ?? false;\n break;\n case \"LinksUpToDate\":\n if (typeof text === \"string\") result.linksUpToDate = parseOnOff(text) ?? false;\n break;\n case \"CharactersWithSpaces\":\n if (typeof text === \"string\") result.charactersWithSpaces = Number(text);\n break;\n case \"SharedDoc\":\n if (typeof text === \"string\") result.sharedDoc = parseOnOff(text) ?? false;\n break;\n case \"HyperlinkBase\":\n result.hyperlinkBase = str;\n break;\n case \"HLinks\": {\n const vector = child.elements?.find((e) => e.name === \"vt:vector\");\n const values = parseVector(vector);\n if (values.length > 0) result.hlinks = values;\n break;\n }\n case \"HyperlinksChanged\":\n if (typeof text === \"string\") result.hyperlinksChanged = parseOnOff(text) ?? false;\n break;\n case \"Application\":\n result.application = str;\n break;\n case \"AppVersion\":\n result.appVersion = str;\n break;\n case \"DocSecurity\":\n if (typeof text === \"string\") result.docSecurity = Number(text);\n break;\n }\n }\n return result;\n },\n};\n","/**\n * Custom Properties module — shared OPC part (docProps/custom.xml).\n *\n * Format-agnostic: CT_CustomProperties (ISO-IEC29500-4_2016 shared-documentPropertiesCustom.xsd)\n * is identical across docx/pptx/xlsx.\n *\n * @module\n */\n\nimport { attr, escapeXml } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport {\n defaultVariantTag,\n parseVariantValue,\n stringifyVariantValue,\n type VariantValue,\n} from \"./variant-types\";\n\n/**\n * Options for a single custom property.\n *\n * @property name - The property name\n * @property value - The property value; the JS type picks the vt:* element\n * (string → lpwstr, number → i4/r8, boolean → bool, Date → filetime)\n */\nexport interface CustomPropertyOptions {\n /** The property name */\n name: string;\n /** The property value (as string) */\n value: VariantValue;\n /**\n * Source vt:* element spelling (round-trip), set only when the default JS\n * mapping would rewrite it — an integer carried as vt:r8 would otherwise\n * re-emit as vt:i4.\n */\n valueType?: string;\n}\n\n/** Input shape for the custom-properties descriptor. */\nexport interface CustomPropertiesInput {\n properties: CustomPropertyOptions[];\n}\n\nexport const customPropertiesDesc: CustomDescriptor<CustomPropertiesInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n const p: string[] = [\n '<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties\"' +\n ' xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">',\n ];\n let pid = 2;\n for (const prop of opts.properties) {\n p.push(\n `<property fmtid=\"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}\" pid=\"${pid}\" name=\"${escapeXml(prop.name)}\">` +\n stringifyVariantValue(prop.value, prop.valueType) +\n `</property>`,\n );\n pid++;\n }\n p.push(\"</Properties>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const properties: CustomPropertyOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"property\") continue;\n const name = attr(child, \"name\");\n if (!name) continue;\n\n // The value element is a single vt:* scalar (lpwstr, i4, bool, …)\n const valueEl = child.elements?.find((e) => e.name?.startsWith(\"vt:\"));\n if (valueEl) {\n const value = parseVariantValue(valueEl);\n if (value !== undefined) {\n const prop: CustomPropertyOptions = { name, value };\n if (valueEl.name && valueEl.name !== defaultVariantTag(value))\n prop.valueType = valueEl.name;\n properties.push(prop);\n }\n }\n }\n return { properties };\n },\n};\n","/**\n * Encrypted OOXML container detection and passthrough helpers.\n *\n * Password-protected OOXML files (ECMA-376 agile/standard encryption) wrap\n * the OPC package inside an OLE2/CFB compound file. The plaintext is not\n * recoverable without the password, so parse() carries the original bytes on\n * the options and generate() re-emits them verbatim instead of compiling.\n *\n * @module\n */\n\nimport type { DataType } from \"../util/data-type\";\nimport { toUint8Array } from \"../util/data-type\";\nimport type { OutputByType, OutputType } from \"./output\";\nimport { convertOutput } from \"./output\";\n\n/** OLE2/CFB compound-file signature shared by every encrypted OOXML file. */\nconst CFB_SIGNATURE = [0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1] as const;\n\n/**\n * Verbatim payload of a source file whose OOXML package is encrypted.\n * Round-trip only: the bytes are the only faithful representation until the\n * file is decrypted; every other options field stays empty.\n */\nexport interface EncryptedContainerOptions {\n /** Complete source file bytes (OLE2/CFB container). */\n data: DataType;\n}\n\n/** Whether `data` is an OLE2/CFB container — i.e. an encrypted OOXML file. */\nexport function isEncryptedContainer(data: Uint8Array): boolean {\n return data.length >= CFB_SIGNATURE.length && CFB_SIGNATURE.every((b, i) => data[i] === b);\n}\n\n/**\n * Converted output for an encrypted-container file, or `undefined` when the\n * options carry no encrypted payload (the normal compile path applies).\n */\nexport function encryptedContainerOutput<T extends OutputType>(\n file: { encrypted?: EncryptedContainerOptions },\n type: T,\n mimeType: string,\n): OutputByType[T] | undefined {\n const { encrypted } = file;\n if (!encrypted) return undefined;\n return convertOutput(toUint8Array(encrypted.data), type, mimeType);\n}\n\n/** Streaming variant of {@link encryptedContainerOutput}. */\nexport function encryptedContainerStream(file: {\n encrypted?: EncryptedContainerOptions;\n}): ReadableStream<Uint8Array> | undefined {\n const { encrypted } = file;\n if (!encrypted) return undefined;\n const bytes = toUint8Array(encrypted.data);\n return new ReadableStream<Uint8Array>({\n start(c) {\n c.enqueue(bytes);\n c.close();\n },\n });\n}\n\n/**\n * Reject encrypted passthrough mixed with real content: generate() re-emits\n * the encrypted bytes, so every other field would be silently dropped.\n *\n * `hasContent` is the package's primary content collection being non-empty\n * (e.g. `sections.length > 0`) — callers know their own shape.\n */\nexport function assertEncryptedExclusive(\n file: { encrypted?: EncryptedContainerOptions },\n hasContent: boolean,\n): void {\n if (file.encrypted && hasContent) {\n throw new Error(\n \"Encrypted passthrough carries no editable content — clear the content fields or drop `encrypted`.\",\n );\n }\n}\n","/**\n * Namespace URI → canonical prefix table for parse-time normalization.\n *\n * Producers are free to bind any prefix to a namespace (XML namespaces say\n * the prefix is arbitrary), and real-world generators do: pandoc writes\n * `ns0:`, ClosedXML binds the spreadsheet namespace to `x:`. Everything\n * downstream of the parser — descriptor `findChild(\"w:p\")` calls, registry\n * path matching — addresses elements by the canonical prefixes this library\n * itself emits, so non-canonical sources parsed blind.\n *\n * Feeding this table to the XML parser's `normalizeNamespaces` rewrites every\n * element and attribute name onto the canonical prefix (an empty value means\n * the canonical form is unprefixed — the sml and OPC namespaces), while\n * unknown URIs keep their source prefix and `xmlns` declarations follow the\n * rewrite so serialized output stays self-consistent.\n *\n * The table mirrors the prefixes this library's own stringify output uses —\n * when a new namespace appears in a part template, add it here in the same\n * change. Strict-OOXML variants (`purl.oclc.org`) are deliberately absent:\n * mapping them would silently convert strict packages to transitional.\n */\n\nconst SCHEMAS_OPENXML = \"http://schemas.openxmlformats.org\";\nconst SCHEMAS_MS = \"http://schemas.microsoft.com\";\n\n/**\n * Obsolete namespace URIs accepted by Office and the Open XML SDK, mapped to\n * their final standardized forms. A round-trip must normalize passthrough XML\n * too: rebuilding modeled parts with the final URI while carrying an obsolete\n * URI verbatim in a raw part creates a mixed-dialect package that Word rejects.\n *\n * Keep this aligned with Open XML SDK's OpenXmlNamespaceResolver\n * `_extendedNamespaces` table.\n */\nconst OOXML_OBSOLETE_NAMESPACE_ALIASES: Readonly<Record<string, string>> = {\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/3/main`]: `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`,\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/5/main`]: `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`,\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/6/main`]: `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`,\n [`${SCHEMAS_OPENXML}/spreadsheetml/2006/5/main`]: `${SCHEMAS_OPENXML}/spreadsheetml/2006/main`,\n [`${SCHEMAS_OPENXML}/spreadsheetml/2006/7/main`]: `${SCHEMAS_OPENXML}/spreadsheetml/2006/main`,\n [`${SCHEMAS_OPENXML}/presentationml/2006/3/main`]: `${SCHEMAS_OPENXML}/presentationml/2006/main`,\n [`${SCHEMAS_OPENXML}/drawingml/2006/3/main`]: `${SCHEMAS_OPENXML}/drawingml/2006/main`,\n [`${SCHEMAS_MS}/office/word/2010/11/wordml`]: `${SCHEMAS_MS}/office/word/2012/wordml`,\n};\n\n/**\n * Normalize obsolete OOXML namespace URI bytes without reparsing or\n * reserializing the XML. Byte-level replacement preserves every other source\n * detail (declaration, whitespace, prefix choices, attribute order, and line\n * endings), which is required for passthrough parts.\n */\nexport function normalizeObsoleteNamespaceAliases(data: Uint8Array): Uint8Array {\n let result = data;\n for (const pattern of OBSOLETE_PATTERNS) {\n result = replaceAsciiBytes(result, pattern);\n }\n return result;\n}\n\nfunction isNamespaceDeclarationValue(\n data: Uint8Array,\n valueOffset: number,\n valueLength: number,\n): boolean {\n const quote = data[valueOffset - 1];\n if ((quote !== 34 && quote !== 39) || data[valueOffset + valueLength] !== quote) return false;\n let i = valueOffset - 2;\n while (i >= 0 && (data[i] === 32 || data[i] === 9 || data[i] === 10 || data[i] === 13)) i--;\n if (data[i] !== 61) return false; // =\n i--;\n while (i >= 0 && (data[i] === 32 || data[i] === 9 || data[i] === 10 || data[i] === 13)) i--;\n const nameEnd = i + 1;\n while (\n i >= 0 &&\n ((data[i]! >= 65 && data[i]! <= 90) ||\n (data[i]! >= 97 && data[i]! <= 122) ||\n (data[i]! >= 48 && data[i]! <= 57) ||\n data[i] === 58 ||\n data[i] === 45 ||\n data[i] === 95)\n ) {\n i--;\n }\n // Byte compare against \"xmlns\"/\"xmlns:…\" — a decode would allocate a string\n // per hit just to test a fixed prefix. The name is the full attribute name,\n // so \"xmlns:foo\" (any prefix length) qualifies too.\n const nameStart = i + 1;\n const nameLen = nameEnd - nameStart;\n if (nameLen < 5) return false;\n for (let k = 0; k < 5; k++) {\n if (data[nameStart + k] !== XMLNS_BYTES[k]) return false;\n }\n return nameLen === 5 || data[nameStart + 5] === 58; // ':'\n}\n\n/** \"xmlns\" as bytes — module constant so the hit-path compare allocates nothing. */\nconst XMLNS_BYTES = Uint8Array.from([120, 109, 108, 110, 115]);\n\nfunction replaceAsciiBytes(\n data: Uint8Array,\n pattern: { needle: Uint8Array; value: Uint8Array },\n): Uint8Array {\n const { needle, value } = pattern;\n const positions: number[] = [];\n // Candidate scan driven by Uint8Array.indexOf (a native memchr in V8/JSC):\n // a per-byte loop walked every offset of multi-MB passthrough parts, while\n // indexOf skips between first-byte candidates at memory bandwidth.\n const first = needle[0]!;\n const lastStart = data.length - needle.length;\n let i = data.indexOf(first);\n while (i !== -1) {\n if (i <= lastStart) {\n let matches = true;\n for (let j = 1; j < needle.length; j++) {\n if (data[i + j] !== needle[j]!) {\n matches = false;\n break;\n }\n }\n if (matches && isNamespaceDeclarationValue(data, i, needle.length)) {\n positions.push(i);\n i += needle.length - 1; // skip past the match (the +1 below resumes after it)\n }\n }\n i = data.indexOf(first, i + 1);\n }\n if (positions.length === 0) return data;\n\n const out = new Uint8Array(data.length + positions.length * (value.length - needle.length));\n let sourceOffset = 0;\n let targetOffset = 0;\n for (const position of positions) {\n const prefix = data.subarray(sourceOffset, position);\n out.set(prefix, targetOffset);\n targetOffset += prefix.length;\n out.set(value, targetOffset);\n targetOffset += value.length;\n sourceOffset = position + needle.length;\n }\n out.set(data.subarray(sourceOffset), targetOffset);\n return out;\n}\n\n// Needle/value pairs encoded once at module load — the per-call\n// TextEncoder().encode() pair allocated on every passthrough part.\nconst OBSOLETE_PATTERNS: ReadonlyArray<{ needle: Uint8Array; value: Uint8Array }> = Object.entries(\n OOXML_OBSOLETE_NAMESPACE_ALIASES,\n).map(([obsolete, finalUri]) => ({\n needle: new TextEncoder().encode(obsolete),\n value: new TextEncoder().encode(finalUri),\n}));\n\nexport const OOXML_CANONICAL_PREFIXES: Readonly<Record<string, string>> = {\n // Obsolete aliases resolve through their final namespace's canonical prefix.\n ...Object.fromEntries(\n Object.entries(OOXML_OBSOLETE_NAMESPACE_ALIASES).map(([oldUri, finalUri]) => [\n oldUri,\n finalUri === `${SCHEMAS_OPENXML}/spreadsheetml/2006/main`\n ? \"\"\n : finalUri === `${SCHEMAS_OPENXML}/presentationml/2006/main`\n ? \"p\"\n : finalUri === `${SCHEMAS_OPENXML}/drawingml/2006/main`\n ? \"a\"\n : finalUri === `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`\n ? \"w\"\n : \"w15\",\n ]),\n ),\n\n // ── Main format namespaces ──\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/main`]: \"w\",\n [`${SCHEMAS_OPENXML}/presentationml/2006/main`]: \"p\",\n // spreadsheetml canonical form is the default (unprefixed) namespace\n [`${SCHEMAS_OPENXML}/spreadsheetml/2006/main`]: \"\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/main`]: \"a\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/relationships`]: \"r\",\n [`${SCHEMAS_OPENXML}/markup-compatibility/2006`]: \"mc\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/math`]: \"m\",\n\n // ── DrawingML variants ──\n [`${SCHEMAS_OPENXML}/drawingml/2006/wordprocessingDrawing`]: \"wp\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/spreadsheetDrawing`]: \"xdr\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/chart`]: \"c\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/chartDrawing`]: \"cdr\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/diagram`]: \"dgm\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/lockedCanvas`]: \"lc\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/picture`]: \"pic\",\n\n // ── OPC package namespaces (canonical form: unprefixed) ──\n [`${SCHEMAS_OPENXML}/package/2006/relationships`]: \"\",\n [`${SCHEMAS_OPENXML}/package/2006/content-types`]: \"\",\n [`${SCHEMAS_OPENXML}/package/2006/metadata/core-properties`]: \"\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/extended-properties`]: \"\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/custom-properties`]: \"\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/docPropsVTypes`]: \"vt\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/bibliography`]: \"b\",\n\n // ── VML family ──\n \"urn:schemas-microsoft-com:vml\": \"v\",\n \"urn:schemas-microsoft-com:office:office\": \"o\",\n \"urn:schemas-microsoft-com:office:word\": \"w10\",\n \"urn:schemas-microsoft-com:office:excel\": \"x\",\n \"urn:schemas-microsoft-com:office:powerpoint\": \"pvml\",\n\n // ── Word extensions ──\n [`${SCHEMAS_MS}/office/word/2006/wordml`]: \"wne\",\n [`${SCHEMAS_MS}/office/word/2010/wordml`]: \"w14\",\n [`${SCHEMAS_MS}/office/word/2010/11/wordml`]: \"w15\",\n [`${SCHEMAS_MS}/office/word/2012/wordml`]: \"w15\",\n [`${SCHEMAS_MS}/office/word/2016/wordml/cid`]: \"w16cid\",\n [`${SCHEMAS_MS}/office/word/2018/wordml`]: \"w16\",\n [`${SCHEMAS_MS}/office/word/2018/wordml/cex`]: \"w16cex\",\n [`${SCHEMAS_MS}/office/word/2020/wordml/sdtdatahash`]: \"w16sdtdh\",\n [`${SCHEMAS_MS}/office/word/2015/wordml/symex`]: \"w16se\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingDrawing`]: \"wp14\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingCanvas`]: \"wpc\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingGroup`]: \"wpg\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingInk`]: \"wpi\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingShape`]: \"wps\",\n\n // ── Drawing extensions ──\n [`${SCHEMAS_MS}/office/drawing/2010/main`]: \"a14\",\n [`${SCHEMAS_MS}/office/drawing/2014/main`]: \"a16\",\n [`${SCHEMAS_MS}/office/drawing/2016/ink`]: \"aink\",\n [`${SCHEMAS_MS}/office/drawing/2017/model3d`]: \"am3d\",\n [`${SCHEMAS_MS}/office/drawing/2016/SVG/main`]: \"asvg\",\n [`${SCHEMAS_MS}/office/drawing/2007/8/2/chart`]: \"c14\",\n [`${SCHEMAS_MS}/office/drawing/2008/diagram`]: \"dsp\",\n [`${SCHEMAS_MS}/office/drawing/2014/chartex`]: \"cx\",\n [`${SCHEMAS_MS}/office/drawing/2015/9/8/chartex`]: \"cx1\",\n [`${SCHEMAS_MS}/office/drawing/2015/10/21/chartex`]: \"cx2\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/9/chartex`]: \"cx3\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/10/chartex`]: \"cx4\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/11/chartex`]: \"cx5\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/12/chartex`]: \"cx6\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/13/chartex`]: \"cx7\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/14/chartex`]: \"cx8\",\n [`${SCHEMAS_MS}/office/2019/extlst`]: \"oel\",\n\n // ── PowerPoint extensions ──\n [`${SCHEMAS_MS}/office/powerpoint/2010/main`]: \"p14\",\n [`${SCHEMAS_MS}/office/powerpoint/2015/main`]: \"p15\",\n\n // ── Excel extensions ──\n [`${SCHEMAS_MS}/office/spreadsheetml/2009/9/main`]: \"x14\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2009/9/ac`]: \"x14ac\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2010/11/main`]: \"x15\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2010/11/ac`]: \"x15ac\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2014/revision`]: \"xr\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2015/revision2`]: \"xr2\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2016/revision3`]: \"xr3\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2016/revision6`]: \"xr6\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2016/revision10`]: \"xr10\",\n};\n","import { parse, stringify } from \"@office-open/xml\";\nimport type { Element, ParseOptions } from \"@office-open/xml\";\nimport { unzipSync, zipSync, strFromU8, strToU8, type ZipOptions, type Zippable } from \"fflate\";\n\nimport { OOXML_CANONICAL_PREFIXES } from \"./namespaces\";\nimport { levelForMediaName, ZIP_MEDIA_LEVEL } from \"./packer\";\nimport { hasNativeInflate, nativeUnzip } from \"./zip-native\";\n\nconst XML_PARSE_OPTIONS = {\n nativeTypeAttributes: true,\n captureSpacesBetweenElements: true,\n // Normalize namespace prefixes to the canonical ones the library itself\n // emits — sources binding the Word namespace to ns0: or the spreadsheet\n // namespace to x: parse into canonical names, so descriptor matching and\n // registry paths see the elements they address.\n normalizeNamespaces: OOXML_CANONICAL_PREFIXES,\n};\n\n/**\n * Parsed OOXML archive backed by an unzipped ZIP map.\n *\n * Provides unstorage-style API (get/set/getRaw/setRaw/remove/has/keys)\n * for reading and modifying individual parts, then serializing back to a ZIP buffer.\n */\nexport class ParsedArchive {\n private readonly zip: Map<string, Uint8Array>;\n private readonly modified = new Map<string, Uint8Array>();\n private readonly wrapperCache = new Map<string, Element>();\n\n public constructor(data: Uint8Array) {\n // Native inflate is the fast path; on any failure (unsupported ZIP variant\n // or corruption) fall back to fflate unzipSync, the reference implementation.\n let unzipped: Record<string, Uint8Array>;\n try {\n unzipped = hasNativeInflate() ? nativeUnzip(data) : unzipSync(data);\n } catch {\n unzipped = unzipSync(data);\n }\n this.zip = new Map(Object.entries(unzipped));\n }\n\n /**\n * Read an XML part as an Element tree. `parseOptions` extends the default\n * XML parse options for this part (e.g. `deferElements` to capture a hot\n * container's inner XML verbatim). Callers must use consistent options per\n * path — the wrapper cache is keyed by path only.\n */\n public get(path: string, parseOptions?: ParseOptions): Element | undefined {\n const opts = parseOptions ? { ...XML_PARSE_OPTIONS, ...parseOptions } : XML_PARSE_OPTIONS;\n // Check modified first\n const modData = this.modified.get(path);\n if (modData) {\n const wrapper = parse(strFromU8(modData), opts) as Element;\n this.wrapperCache.set(path, wrapper);\n return wrapper.elements?.find((e) => e.type === \"element\");\n }\n\n const data = this.zip.get(path);\n if (data === undefined) return undefined;\n\n // Try cache\n const cached = this.wrapperCache.get(path);\n if (cached) return cached.elements?.find((e) => e.type === \"element\");\n\n // Parse and cache\n const wrapper = parse(strFromU8(data), opts) as Element;\n this.wrapperCache.set(path, wrapper);\n return wrapper.elements?.find((e) => e.type === \"element\");\n }\n\n /** Write an XML part (Element → XML string). */\n public set(path: string, element: Element): void {\n const wrapper = this.wrapperCache.get(path);\n const doc: Element = wrapper\n ? { ...wrapper, elements: [{ ...element, type: \"element\" as const }] }\n : { elements: [{ ...element, type: \"element\" as const }] };\n const xml = stringify(doc);\n this.modified.set(path, strToU8(xml));\n }\n\n /** Read raw binary data (images, media, etc.). */\n public getRaw(path: string): Uint8Array | undefined {\n return this.modified.get(path) ?? this.zip.get(path);\n }\n\n /** Write raw binary data. */\n public setRaw(path: string, data: Uint8Array): void {\n this.modified.set(path, data);\n this.wrapperCache.delete(path);\n }\n\n /** Remove a part. Returns true if it existed. */\n public remove(path: string): boolean {\n this.wrapperCache.delete(path);\n return this.modified.delete(path) || this.zip.delete(path);\n }\n\n /** Check if a part exists. */\n public has(path: string): boolean {\n return this.modified.has(path) || this.zip.has(path);\n }\n\n /** List all paths matching an optional prefix. */\n public keys(prefix?: string): string[] {\n const all = new Set<string>();\n for (const key of this.zip.keys()) {\n if (!prefix || key.startsWith(prefix)) all.add(key);\n }\n for (const key of this.modified.keys()) {\n if (!prefix || key.startsWith(prefix)) all.add(key);\n }\n return [...all];\n }\n\n /** Serialize back to a ZIP buffer, merging original zip + modifications. */\n public save(): Uint8Array {\n const files: Zippable = {};\n for (const [path, data] of this.zip) {\n if (!this.modified.has(path)) {\n files[path] = [\n data,\n { level: levelForMediaName(path, ZIP_MEDIA_LEVEL) as ZipOptions[\"level\"] },\n ];\n }\n }\n for (const [path, data] of this.modified) {\n files[path] = [\n data,\n { level: levelForMediaName(path, ZIP_MEDIA_LEVEL) as ZipOptions[\"level\"] },\n ];\n }\n return zipSync(files);\n }\n}\n\n/** Parse an OOXML archive (.docx, .pptx, .xlsx) into a ParsedArchive. */\nexport function parseArchive(data: Uint8Array): ParsedArchive {\n return new ParsedArchive(data);\n}\n","/**\n * OPC (Open Packaging Convention) consistency validator.\n *\n * Pure function operating on an already-unzipped part map. Detects the three\n * classes of cross-part breakage that single-part XSD validation cannot see:\n *\n * - relationship integrity — dangling targets, undeclared r:id references,\n * duplicate rIds (O3/O4/O7)\n * - content-type integrity — parts with no Override/Default, stale\n * Overrides pointing at absent parts (O5/O6)\n * - structural integrity — missing `always` parts, undeclared orphans\n * (O1/O2)\n *\n * O3/O4/O5/O6/O7 are derived directly from the ZIP + `.rels` + `[Content_Types].xml`\n * and need no registry. O1/O2 consult {@link PackagePartRegistry}.\n *\n * Reference: ECMA-376 Part 2 (OPC).\n *\n * @module\n */\nimport { parse } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { PackagePartRegistry } from \"./part-registry\";\n\nexport type OpcSeverity = \"error\" | \"warn\";\n\nexport type OpcCode = \"O1\" | \"O2\" | \"O3\" | \"O4\" | \"O5\" | \"O6\" | \"O7\";\n\nexport interface OpcIssue {\n code: OpcCode;\n severity: OpcSeverity;\n /** Path of the offending part, `.rels`, or Override `PartName`. */\n part: string;\n message: string;\n}\n\ninterface RelationshipEntry {\n id: string;\n type: string;\n target: string;\n targetMode?: string;\n}\n\ninterface ParsedRels {\n relsPath: string;\n entries: readonly RelationshipEntry[];\n}\n\ninterface ContentTypesDoc {\n defaults: ReadonlyMap<string, string>;\n overrides: ReadonlyMap<string, string>;\n}\n\n// ── XML parsing helpers ─────────────────────────────────────────────────────\n\nfunction rootElement(xml: string): Element | undefined {\n try {\n const wrapper = parse(xml) as Element;\n return wrapper.elements?.find((e) => e.type === \"element\");\n } catch {\n return undefined;\n }\n}\n\nfunction parseContentTypes(entries: ReadonlyMap<string, string>): ContentTypesDoc {\n const defaults = new Map<string, string>();\n const overrides = new Map<string, string>();\n const xml = entries.get(\"[Content_Types].xml\");\n const root = xml ? rootElement(xml) : undefined;\n if (!root) return { defaults, overrides };\n for (const child of root.elements ?? []) {\n if (child.type !== \"element\") continue;\n if (child.name === \"Default\") {\n const ext = String(child.attributes?.Extension ?? \"\").toLowerCase();\n const ct = String(child.attributes?.ContentType ?? \"\");\n if (ext && ct) defaults.set(ext, ct);\n } else if (child.name === \"Override\") {\n const partName = normalizePartName(String(child.attributes?.PartName ?? \"\"));\n const ct = String(child.attributes?.ContentType ?? \"\");\n if (partName && ct) overrides.set(partName, ct);\n }\n }\n return { defaults, overrides };\n}\n\nfunction parseAllRels(entries: ReadonlyMap<string, string>): ParsedRels[] {\n const out: ParsedRels[] = [];\n for (const [relsPath, xml] of entries) {\n if (!relsPath.endsWith(\".rels\")) continue;\n const root = rootElement(xml);\n if (!root) continue;\n const list: RelationshipEntry[] = [];\n for (const child of root.elements ?? []) {\n if (child.type !== \"element\" || child.name !== \"Relationship\") continue;\n list.push({\n id: String(child.attributes?.Id ?? \"\"),\n type: String(child.attributes?.Type ?? \"\"),\n target: String(child.attributes?.Target ?? \"\"),\n targetMode: child.attributes?.TargetMode ? String(child.attributes?.TargetMode) : undefined,\n });\n }\n out.push({ relsPath, entries: list });\n }\n return out;\n}\n\n/** Strip the leading slash OPC uses on `PartName` to align with ZIP paths. */\nfunction normalizePartName(partName: string): string {\n return partName.startsWith(\"/\") ? partName.slice(1) : partName;\n}\n\n/**\n * Resolve a relationship `Target` (relative to its owning `.rels`) against the\n * ZIP root. Handles the `..` segments slides/masters use to reference siblings.\n */\nfunction resolveRelTarget(relsPath: string, target: string): string {\n const slash = relsPath.lastIndexOf(\"/\");\n const relsDir = slash === -1 ? \"\" : relsPath.slice(0, slash);\n // `<partDir>/_rels` → `<partDir>`; root-level `_rels` → \"\"\n const base =\n relsDir === \"_rels\" ? \"\" : relsDir.endsWith(\"/_rels\") ? relsDir.slice(0, -6) : relsDir;\n const segments = (base ? base.split(\"/\") : []).concat(target.split(\"/\"));\n const resolved: string[] = [];\n for (const seg of segments) {\n if (seg === \"\" || seg === \".\") continue;\n if (seg === \"..\") resolved.pop();\n else resolved.push(seg);\n }\n return resolved.join(\"/\");\n}\n\n/** Compile a registry path template (with `${i}`) into an anchored matcher. */\nfunction pathMatcher(template: string): RegExp {\n const marked = template.replace(/\\$\\{i\\}/g, \"\u0000\");\n const escaped = marked.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const pattern = escaped.replace(/\u0000/g, \"(\\\\d+)\");\n return new RegExp(`^${pattern}$`);\n}\n\nfunction extensionOf(path: string): string {\n const dot = path.lastIndexOf(\".\");\n return dot === -1 ? \"\" : path.slice(dot + 1).toLowerCase();\n}\n\n/**\n * Reference attributes in the officeDocument relationships namespace — every\n * one resolves against the owning part's `.rels`. Escaped text can never match\n * (a literal `\"` in text is `"`), so hits are always real attributes.\n */\nconst REL_REF_ATTR_RE = /\\br:(?:id|embed|link|dm|lo|qs|cs|pict)=\"([^\"]*)\"/g;\n\n/** `word/_rels/document.xml.rels` → `word/document.xml`; package rels → undefined. */\nfunction partOfRels(relsPath: string): string | undefined {\n const slash = relsPath.lastIndexOf(\"/\");\n const dir = slash === -1 ? \"\" : relsPath.slice(0, slash);\n const name = relsPath.slice(slash + 1).replace(/\\.rels$/, \"\");\n if (dir === \"_rels\") return name === \"\" ? undefined : name;\n if (dir.endsWith(\"/_rels\")) return `${dir.slice(0, -6)}/${name}`;\n return undefined;\n}\n\n// ── Validator ───────────────────────────────────────────────────────────────\n\n/**\n * Validate OPC consistency of an unzipped package.\n *\n * @param entries ZIP path → decoded XML/binary text. Binary parts (media,\n * fonts) are never parsed here — only their presence matters.\n * @param registry Declarative part expectations for the package format.\n * @returns Issues sorted by code then part. Empty array = consistent.\n */\nexport function validateOpcConsistency(\n entries: ReadonlyMap<string, string>,\n registry: PackagePartRegistry,\n): OpcIssue[] {\n const issues: OpcIssue[] = [];\n const contentTypes = parseContentTypes(entries);\n const relsFiles = parseAllRels(entries);\n\n // O2 — missing `always` part. Conditional/repeated absences are legitimate.\n for (const def of registry.parts) {\n if (def.presence.kind !== \"always\" || def.path.includes(\"${i}\")) continue;\n if (!entries.has(def.path)) {\n issues.push({\n code: \"O2\",\n severity: \"error\",\n part: def.path,\n message: `required ${registry.format} part is absent from the package`,\n });\n }\n }\n\n // O1 — orphan part: present but not declared and not whitelisted.\n const matchers = registry.parts.map((def) => pathMatcher(def.path));\n for (const path of entries.keys()) {\n if (path === \"[Content_Types].xml\") continue;\n if (path.endsWith(\".rels\")) continue;\n if (registry.orphanWhitelist.some((prefix) => path.startsWith(prefix))) continue;\n if (matchers.some((re) => re.test(path))) continue;\n issues.push({\n code: \"O1\",\n severity: \"warn\",\n part: path,\n message: `part not declared in the ${registry.format} registry (possible orphan)`,\n });\n }\n\n // O3 — dangling internal relationship target.\n for (const rf of relsFiles) {\n for (const rel of rf.entries) {\n if (rel.targetMode === \"External\") continue;\n if (/^https?:\\/\\//i.test(rel.target)) continue;\n const resolved = resolveRelTarget(rf.relsPath, rel.target);\n if (!resolved || entries.has(resolved)) continue;\n issues.push({\n code: \"O3\",\n severity: \"error\",\n part: rf.relsPath,\n message: `relationship ${rel.id || \"(no Id)\"} (${rel.type}) Target \"${rel.target}\" resolves to absent part \"${resolved}\"`,\n });\n }\n }\n\n // O4 — relationship reference integrity: every r:* reference attribute in a\n // part must be declared by that part's own .rels. An undeclared reference —\n // a hand-written rId, or an unreplaced `{key}` placeholder — makes Office\n // report the package as corrupt. External-mode relationships declare their\n // id like any other, so they satisfy references too.\n const relIdsByPart = new Map<string, Set<string>>();\n for (const rf of relsFiles) {\n const part = partOfRels(rf.relsPath);\n if (part === undefined) continue;\n const ids = relIdsByPart.get(part) ?? new Set<string>();\n for (const r of rf.entries) ids.add(r.id);\n relIdsByPart.set(part, ids);\n }\n for (const [path, xml] of entries) {\n if (path === \"[Content_Types].xml\" || path.endsWith(\".rels\") || !path.endsWith(\".xml\")) {\n continue;\n }\n const declared = relIdsByPart.get(path);\n const reported = new Set<string>();\n REL_REF_ATTR_RE.lastIndex = 0;\n for (let m = REL_REF_ATTR_RE.exec(xml); m; m = REL_REF_ATTR_RE.exec(xml)) {\n const ref = m[1]!;\n if (declared?.has(ref) || reported.has(ref)) continue;\n reported.add(ref);\n issues.push({\n code: \"O4\",\n severity: \"error\",\n part: path,\n message: `r:id/r:embed reference \"${ref}\" is not declared by the part's .rels`,\n });\n }\n }\n\n // O5 — part present but no Override covers it and no Default covers its\n // extension. Word rejects such parts as unreadable content.\n for (const path of entries.keys()) {\n if (path === \"[Content_Types].xml\" || path.endsWith(\".rels\")) continue;\n if (contentTypes.overrides.has(path)) continue;\n const ext = extensionOf(path);\n if (ext && contentTypes.defaults.has(ext)) continue;\n issues.push({\n code: \"O5\",\n severity: \"error\",\n part: path,\n message: `part has no [Content_Types] Override and no Default covers extension \"${ext || \"(none)\"}\"`,\n });\n }\n\n // O6 — stale Override: [Content_Types] declares a part that is not in the ZIP.\n for (const partName of contentTypes.overrides.keys()) {\n if (entries.has(partName)) continue;\n issues.push({\n code: \"O6\",\n severity: \"error\",\n part: `/${partName}`,\n message: `[Content_Types] Override references absent part \"${partName}\"`,\n });\n }\n\n // O7 — duplicate relationship Id within a single .rels part.\n for (const rf of relsFiles) {\n const counts = new Map<string, number>();\n for (const rel of rf.entries) {\n if (!rel.id) continue;\n counts.set(rel.id, (counts.get(rel.id) ?? 0) + 1);\n }\n for (const [id, count] of counts) {\n if (count <= 1) continue;\n issues.push({\n code: \"O7\",\n severity: \"warn\",\n part: rf.relsPath,\n message: `duplicate relationship Id \"${id}\" appears ${count} times`,\n });\n }\n }\n\n return issues.sort((a, b) =>\n a.code === b.code ? a.part.localeCompare(b.part) : a.code.localeCompare(b.code),\n );\n}\n\nexport function summarizeOpcIssues(issues: readonly OpcIssue[]): {\n errors: number;\n warnings: number;\n} {\n let errors = 0;\n let warnings = 0;\n for (const i of issues) {\n if (i.severity === \"error\") errors++;\n else warnings++;\n }\n return { errors, warnings };\n}\n","/**\n * Declarative part registry — the machine-readable source of truth for which\n * parts each OOXML package is expected to contain.\n *\n * Consumed by {@link validateOpcConsistency} to detect two failure classes the\n * XSD single-part validator cannot see:\n * - O1 orphan part — a part present in the ZIP that no rule accounts for\n * - O2 missing part — an `always` part the ZIP lacks\n *\n * Content-type and relationship integrity (O3/O5/O6/O7) are derived directly\n * from the ZIP + `.rels` + `[Content_Types].xml`, so they need no registry.\n *\n * Presence semantics:\n * - `always` — present in *any* valid package (content-types map,\n * root rels, main part only). O2 fires when absent. Kept\n * minimal so template/round-trip packages — whose\n * `[Content_Types]` and part set are passed through from a\n * source rather than rebuilt — do not false-positive.\n * - `conditional` — emitted by a fresh `compileDocument` run but a\n * round-tripped/template package may omit it. Absence is\n * legitimate; O6 (stale Override) still catches the case\n * where its content type is declared but the part is gone.\n * - `repeated` — one per index (slides, worksheets, headers, …).\n *\n * Reference: ECMA-376 Part 2 (OPC). Content-type values mirror the per-package\n * `content-types.ts` builders; relationship `@Type` URLs mirror\n * {@link RelationshipType}.\n *\n * @module\n */\n\nexport type PartPresence =\n | { readonly kind: \"always\" }\n | { readonly kind: \"conditional\"; readonly flag: string }\n | { readonly kind: \"repeated\"; readonly countFrom: string };\n\nexport interface PartDefinition {\n /**\n * ZIP path template. `${i}` expands per repeated index (1-based); a template\n * without the placeholder denotes a singleton part.\n */\n path: string;\n /**\n * `[Content_Types].xml` Override value the part carries when generated.\n * `undefined` when the part relies on a `<Default>` extension mapping\n * (e.g. media, fonts, docx theme under raw-part passthrough).\n */\n contentType?: string;\n presence: PartPresence;\n}\n\nexport interface PackagePartRegistry {\n format: \"docx\" | \"pptx\" | \"xlsx\";\n parts: readonly PartDefinition[];\n /**\n * Path prefixes that are always legitimate even when undeclared — media,\n * fonts, embeddings, altChunks, custom XML, and `.rels` parts. Used to\n * suppress O1 false positives from round-tripped / pass-through content.\n */\n orphanWhitelist: readonly string[];\n}\n\n// ── DOCX ────────────────────────────────────────────────────────────────────\n\nexport const DOCX_PARTS = {\n format: \"docx\",\n orphanWhitelist: [\n \"word/media/\",\n \"word/fonts/\",\n \"word/embeddings/\",\n \"word/afchunks/\",\n \"customXml/\",\n \"_rels/\",\n \"word/_rels/\",\n \"docProps/\",\n \"[Content_Types].xml\",\n ],\n parts: [\n { path: \"[Content_Types].xml\", presence: { kind: \"always\" } },\n { path: \"_rels/.rels\", presence: { kind: \"always\" } },\n {\n path: \"word/document.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\",\n presence: { kind: \"always\" },\n },\n {\n path: \"word/styles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n // Legacy Word 2010 styles-with-effects part (deprecated by ISO 29500);\n // round-tripped verbatim via rawParts. itemN.xml custom-XML parts need\n // no Override (the xml Default covers them), their itemProps do.\n path: \"word/stylesWithEffects.xml\",\n contentType: \"application/vnd.ms-word.stylesWithEffects+xml\",\n presence: { kind: \"conditional\", flag: \"source carried the legacy part\" },\n },\n {\n path: \"customXml/itemProps${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.customXmlProperties+xml\",\n presence: { kind: \"repeated\", countFrom: \"customXml items\" },\n },\n {\n path: \"word/numbering.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/footnotes.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/endnotes.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/settings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/fontTable.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/core.xml\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/app.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n // Emitted only when custom properties exist (parsed presence or fresh\n // authoring); Word omits both the part and its Override otherwise.\n path: \"docProps/custom.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.custom-properties+xml\",\n presence: { kind: \"conditional\", flag: \"hasCustomProperties\" },\n },\n {\n path: \"word/comments.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml\",\n presence: { kind: \"conditional\", flag: \"hasComments\" },\n },\n {\n // Word 2013+ comment infrastructure — emitted only when populated,\n // same rule as comments.xml.\n path: \"word/people.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml\",\n presence: { kind: \"conditional\", flag: \"hasPeople\" },\n },\n {\n path: \"word/commentsExtended.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml\",\n presence: { kind: \"conditional\", flag: \"hasCommentsExtended\" },\n },\n {\n path: \"word/header${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml\",\n presence: { kind: \"repeated\", countFrom: \"headerCount\" },\n },\n {\n path: \"word/footer${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml\",\n presence: { kind: \"repeated\", countFrom: \"footerCount\" },\n },\n {\n path: \"word/charts/chart${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\",\n presence: { kind: \"repeated\", countFrom: \"chartCount\" },\n },\n {\n path: \"word/charts/userShapes${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chartUserShapes+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts with user shapes\" },\n },\n {\n path: \"word/diagrams/data${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/layout${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/quickStyle${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/colors${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/drawing${i}.xml\",\n contentType: \"application/vnd.ms-office.drawingml.diagramDrawing+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/bibliography.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.bibliography+xml\",\n presence: { kind: \"conditional\", flag: \"hasBibliography\" },\n },\n {\n path: \"word/glossary/document.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml\",\n presence: { kind: \"conditional\", flag: \"hasGlossary\" },\n },\n {\n // Glossary companion parts — generate rebuilds only glossary document.xml;\n // the rest pass through rawParts so their Overrides stay derivable.\n path: \"word/glossary/styles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/glossary/settings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/glossary/fontTable.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/glossary/webSettings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/webSettings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\",\n presence: { kind: \"conditional\", flag: \"hasWebSettings\" },\n },\n // docx theme — fresh-compile generates a language-neutral default theme\n // (createThemeXml); round-trip passes the source theme through rawParts.\n // Declared as a theme+xml Override to match Word's own packages.\n {\n path: \"word/theme/theme1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.theme+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n ],\n} as const satisfies PackagePartRegistry;\n\n// ── PPTX ────────────────────────────────────────────────────────────────────\n\nexport const PPTX_PARTS = {\n format: \"pptx\",\n orphanWhitelist: [\n \"ppt/media/\",\n \"ppt/embeddings/\",\n \"_rels/\",\n \"ppt/_rels/\",\n \"ppt/slideMasters/_rels/\",\n \"ppt/slideLayouts/_rels/\",\n \"ppt/slides/_rels/\",\n \"ppt/notesMasters/_rels/\",\n \"ppt/notesSlides/_rels/\",\n \"ppt/charts/_rels/\",\n \"ppt/diagrams/_rels/\",\n \"docProps/\",\n \"[Content_Types].xml\",\n ],\n parts: [\n { path: \"[Content_Types].xml\", presence: { kind: \"always\" } },\n { path: \"_rels/.rels\", presence: { kind: \"always\" } },\n {\n path: \"ppt/presentation.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml\",\n presence: { kind: \"always\" },\n },\n {\n path: \"docProps/core.xml\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/app.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/custom.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.custom-properties+xml\",\n presence: { kind: \"conditional\", flag: \"has custom properties\" },\n },\n {\n // theme1 backs the slide master (static); theme2/theme3 back the\n // notes/handout masters when present — all share the theme+xml type.\n path: \"ppt/theme/theme${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.theme+xml\",\n presence: { kind: \"repeated\", countFrom: \"masters + notes/handout masters\" },\n },\n {\n // Per-layout theme deviations (CT_BaseStylesOverride subset).\n path: \"ppt/theme/themeOverride${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.themeOverride+xml\",\n presence: { kind: \"conditional\", flag: \"layout-level theme overrides\" },\n },\n {\n // Legacy empty theme manager part (CT_EmptyElement) from pre-2010 files.\n path: \"ppt/theme/themeManager1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.themeManager+xml\",\n presence: { kind: \"conditional\", flag: \"legacy themeManager part\" },\n },\n {\n path: \"ppt/presProps.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"ppt/viewProps.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"ppt/tableStyles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"ppt/slideMasters/slideMaster${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml\",\n presence: { kind: \"repeated\", countFrom: \"masters.length\" },\n },\n {\n path: \"ppt/slideLayouts/slideLayout${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml\",\n presence: { kind: \"repeated\", countFrom: \"layouts.length\" },\n },\n {\n path: \"ppt/slides/slide${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.slide+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides.length\" },\n },\n {\n path: \"ppt/notesMasters/notesMaster1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml\",\n presence: { kind: \"conditional\", flag: \"any slide has notes\" },\n },\n {\n path: \"ppt/handoutMasters/handoutMaster1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml\",\n presence: { kind: \"conditional\", flag: \"includeHandoutMaster\" },\n },\n {\n path: \"ppt/notesSlides/notesSlide${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides with notes\" },\n },\n {\n path: \"ppt/commentAuthors.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml\",\n presence: { kind: \"conditional\", flag: \"any slide has comments\" },\n },\n {\n path: \"ppt/comments/comment${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.comments+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides with comments\" },\n },\n {\n path: \"ppt/charts/chart${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts\" },\n },\n {\n path: \"ppt/charts/userShapes${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chartUserShapes+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts with user shapes\" },\n },\n {\n path: \"ppt/diagrams/data${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/layout${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/quickStyle${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/colors${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/drawing${i}.xml\",\n contentType: \"application/vnd.ms-office.drawingml.diagramDrawing+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/slideSyncPr/slideSyncPr${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.presentationml.slideUpdateInfo+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides with slideSync\" },\n },\n ],\n} as const satisfies PackagePartRegistry;\n\n// ── XLSX ────────────────────────────────────────────────────────────────────\n\nexport const XLSX_PARTS = {\n format: \"xlsx\",\n orphanWhitelist: [\n \"xl/media/\",\n \"xl/embeddings/\",\n \"_rels/\",\n \"xl/_rels/\",\n \"xl/worksheets/_rels/\",\n \"xl/chartsheets/_rels/\",\n \"xl/drawings/_rels/\",\n \"xl/pivotTables/_rels/\",\n \"xl/pivotCache/_rels/\",\n \"xl/externalLinks/_rels/\",\n \"docProps/\",\n \"[Content_Types].xml\",\n ],\n parts: [\n { path: \"[Content_Types].xml\", presence: { kind: \"always\" } },\n { path: \"_rels/.rels\", presence: { kind: \"always\" } },\n {\n path: \"xl/workbook.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\",\n presence: { kind: \"always\" },\n },\n {\n path: \"docProps/core.xml\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/app.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/custom.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.custom-properties+xml\",\n presence: { kind: \"conditional\", flag: \"has custom properties\" },\n },\n {\n path: \"xl/styles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"xl/theme/theme1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.theme+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n // Override is emitted unconditionally; the part file is only written\n // when the shared-strings table is non-empty — an O6 stale-Override\n // risk this registry exists to surface.\n path: \"xl/sharedStrings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\",\n presence: { kind: \"conditional\", flag: \"sharedStrings.count > 0\" },\n },\n {\n path: \"xl/worksheets/sheet${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\",\n presence: { kind: \"repeated\", countFrom: \"worksheets.length\" },\n },\n {\n path: \"xl/chartsheets/sheet${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml\",\n presence: { kind: \"repeated\", countFrom: \"chartsheets.length\" },\n },\n {\n path: \"xl/dialogSheets/sheet${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml\",\n presence: { kind: \"repeated\", countFrom: \"dialogsheets.length\" },\n },\n {\n path: \"xl/drawings/drawing${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawing+xml\",\n presence: { kind: \"conditional\", flag: \"worksheet has drawing\" },\n },\n {\n path: \"xl/comments${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml\",\n presence: { kind: \"conditional\", flag: \"worksheet.comments.length > 0\" },\n },\n {\n // Legacy VML drawing backing older comment anchors; relies on the `vml`\n // Default added by ContentTypes.addVmlDrawing().\n path: \"xl/drawings/vmlDrawing${i}.vml\",\n presence: { kind: \"conditional\", flag: \"worksheet.comments (legacy VML)\" },\n },\n {\n path: \"xl/charts/chart${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts\" },\n },\n {\n path: \"xl/charts/userShapes${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chartUserShapes+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts with user shapes\" },\n },\n {\n path: \"xl/pivotTables/pivotTable${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml\",\n presence: { kind: \"repeated\", countFrom: \"pivotTables\" },\n },\n {\n path: \"xl/pivotCache/pivotCacheDefinition${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml\",\n presence: { kind: \"repeated\", countFrom: \"pivotCaches\" },\n },\n {\n path: \"xl/pivotCache/pivotCacheRecords${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml\",\n presence: { kind: \"repeated\", countFrom: \"pivotCaches\" },\n },\n {\n path: \"xl/tables/table${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml\",\n presence: { kind: \"repeated\", countFrom: \"tables\" },\n },\n {\n path: \"xl/externalLinks/externalLink${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml\",\n presence: { kind: \"repeated\", countFrom: \"externalLinks.length\" },\n },\n {\n path: \"xl/connections.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml\",\n presence: { kind: \"conditional\", flag: \"connections\" },\n },\n {\n path: \"xl/queryTables/queryTable${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml\",\n presence: { kind: \"repeated\", countFrom: \"queryTables\" },\n },\n {\n path: \"xl/metadata.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml\",\n presence: { kind: \"conditional\", flag: \"metadata\" },\n },\n {\n path: \"xl/xmlMaps.xml\",\n contentType: \"application/xml\",\n presence: { kind: \"conditional\", flag: \"xmlMaps\" },\n },\n {\n path: \"xl/volTypes.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.volTypes+xml\",\n presence: { kind: \"conditional\", flag: \"volTypes\" },\n },\n {\n path: \"xl/tables/tableSingleCells${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml\",\n presence: { kind: \"repeated\", countFrom: \"singleXmlCells\" },\n },\n {\n path: \"xl/calcChain.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml\",\n presence: { kind: \"conditional\", flag: \"any formula cell\" },\n },\n {\n path: \"xl/revisionHeaders.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml\",\n presence: { kind: \"conditional\", flag: \"revisionLog\" },\n },\n {\n path: \"xl/revisions/revision${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml\",\n presence: { kind: \"repeated\", countFrom: \"revisionLog.logs.length\" },\n },\n {\n path: \"xl/users.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml\",\n presence: { kind: \"conditional\", flag: \"revisionLog.users\" },\n },\n ],\n} as const satisfies PackagePartRegistry;\n\nexport const PART_REGISTRIES: Record<PackagePartRegistry[\"format\"], PackagePartRegistry> = {\n docx: DOCX_PARTS,\n pptx: PPTX_PARTS,\n xlsx: XLSX_PARTS,\n};\n","/**\n * Build [Content_Types].xml Override entries from a part registry.\n *\n * The per-package content-types builders previously hand-wrote every Override\n * branch (header/footer counts, the hasComments gate, …), which drifted from\n * the part registry and caused OPC mismatches (#357: a comments Override\n * declared with no part, and vice-versa). This helper drives Overrides from\n * {@link PackagePartRegistry} so the part list and its content-type\n * declarations share one source of truth.\n *\n * Only parts carrying a `contentType` produce an Override — parts that rely on\n * a `<Default>` extension mapping (`[Content_Types].xml`, `.rels`, the\n * raw-passed theme) are skipped. Dynamic parts whose count or path is\n * runtime-determined (altChunks, sub-documents) stay out of the registry and\n * are appended by the caller.\n *\n * @module\n */\n\nimport type { PackagePartRegistry } from \"./part-registry\";\n\nexport interface ContentTypeOverrideEntry {\n partName: string;\n contentType: string;\n}\n\n/** Ensure a part path carries the leading slash an Override PartName requires. */\nfunction withLeadingSlash(partPath: string): string {\n return partPath.startsWith(\"/\") ? partPath : `/${partPath}`;\n}\n\n/**\n * Derive [Content_Types].xml Override entries for every registry part present\n * under `facts`. The `facts` keys mirror the registry's `flag` / `countFrom`\n * tokens: a boolean for `conditional` parts, a count for `repeated` parts.\n * Order follows `registry.parts`; OPC does not mandate Override order.\n */\nexport function buildContentTypeOverrides(\n registry: PackagePartRegistry,\n facts: ReadonlyMap<string, boolean | number>,\n): ContentTypeOverrideEntry[] {\n const overrides: ContentTypeOverrideEntry[] = [];\n for (const part of registry.parts) {\n // Parts without a contentType rely on a <Default> extension mapping.\n if (!part.contentType) continue;\n const presence = part.presence;\n if (presence.kind === \"always\") {\n // Singletons only — an `always` template with `${i}` would be a registry bug.\n if (!part.path.includes(\"${i}\")) {\n overrides.push({ partName: withLeadingSlash(part.path), contentType: part.contentType });\n }\n } else if (presence.kind === \"conditional\") {\n if (facts.get(presence.flag)) {\n overrides.push({ partName: withLeadingSlash(part.path), contentType: part.contentType });\n }\n } else {\n const count = Number(facts.get(presence.countFrom) ?? 0);\n for (let i = 1; i <= count; i++) {\n overrides.push({\n partName: withLeadingSlash(part.path.replace(\"${i}\", String(i))),\n contentType: part.contentType,\n });\n }\n }\n }\n return overrides;\n}\n","/**\n * Files-driven [Content_Types].xml derivation (part-centric).\n *\n * Walks the actual part paths written to the package and derives the\n * Default/Override entries from a path→contentType resolver plus an\n * extension→MIME map. The part set is the single source of truth, so the\n * content-type declarations cannot drift from what is written — the class of\n * bug that registry/facts builders exist to patch (#357). Sparse or index-based\n * part naming (e.g. pptx comments keyed by slide index rather than a dense\n * sequence) is handled naturally: every written file is declared regardless of\n * its naming scheme, because emission follows the files, not a count.\n *\n * Reference: ECMA-376 Part 2 §10; peer libraries (python-pptx, openpyxl) derive\n * [Content_Types] from the actual part set the same way.\n *\n * @module\n */\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport type { PackagePartRegistry } from \"./part-registry\";\n\n// ── Types ──\n\nexport interface ContentTypeDefault {\n extension: string;\n contentType: string;\n}\n\nexport interface ContentTypeOverride {\n partName: string;\n contentType: string;\n}\n\n/**\n * [Content_Types].xml source. Usually omitted — the compiler derives it from\n * the parts actually written; supply it only to override the derivation.\n */\nexport interface ContentTypesInput {\n defaults: ContentTypeDefault[];\n overrides: ContentTypeOverride[];\n}\n\n// ── Serializer ──\n\nexport const contentTypesDesc: CustomDescriptor<ContentTypesInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n const p: string[] = [\n '<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">',\n ];\n // OPC Default Extension and Override PartName matching are case-insensitive\n // (ECMA-376-2 §10.1.2/§10.1.4): a duplicate differing only in case makes\n // Word reject the package as unreadable content. Dedup case-insensitively\n // so no input path can emit a colliding pair.\n const seenDefault = new Set<string>();\n for (const d of opts.defaults) {\n const key = d.extension.toLowerCase();\n if (seenDefault.has(key)) continue;\n seenDefault.add(key);\n p.push(`<Default Extension=\"${d.extension}\" ContentType=\"${d.contentType}\"/>`);\n }\n const seenOverride = new Set<string>();\n for (const o of opts.overrides) {\n const key = o.partName.toLowerCase();\n if (seenOverride.has(key)) continue;\n seenOverride.add(key);\n p.push(`<Override PartName=\"${o.partName}\" ContentType=\"${o.contentType}\"/>`);\n }\n p.push(\"</Types>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const defaults: ContentTypeDefault[] = [];\n const overrides: ContentTypeOverride[] = [];\n for (const child of el.elements ?? []) {\n if (child.name === \"Default\") {\n const ext = child.attributes?.[\"Extension\"];\n const ct = child.attributes?.[\"ContentType\"];\n if (ext && ct) defaults.push({ extension: String(ext), contentType: String(ct) });\n } else if (child.name === \"Override\") {\n const pn = child.attributes?.[\"PartName\"];\n const ct = child.attributes?.[\"ContentType\"];\n if (pn && ct) overrides.push({ partName: String(pn), contentType: String(ct) });\n }\n }\n return { defaults, overrides };\n },\n};\n\n// ── Path → contentType resolver ──\n\nexport type PartContentTypeResolver = (partPath: string) => string | undefined;\n\n/** Convert a registry part path (with `${i}` placeholders) to an anchored RegExp. */\nfunction patternToRegExp(path: string): RegExp {\n const segments = path.split(\"${i}\");\n const escaped = segments.map((s) => s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"));\n return new RegExp(\"^\" + escaped.join(\"\\\\d+\") + \"$\");\n}\n\n/**\n * Build a path→contentType resolver from a part registry. Only the path pattern\n * and contentType are consulted; the presence/flag/countFrom fields are\n * irrelevant here because emission is driven by the files actually written, not\n * by a separate facts map. Any path the resolver does not recognize falls\n * through to extension-based Default handling (media, embeddings, .rels).\n */\nexport function resolverFromRegistry(registry: PackagePartRegistry): PartContentTypeResolver {\n const patterns: Array<{ re: RegExp; contentType: string }> = [];\n for (const part of registry.parts) {\n if (!part.contentType) continue;\n patterns.push({ re: patternToRegExp(part.path), contentType: part.contentType });\n }\n return (partPath: string) => patterns.find((p) => p.re.test(partPath))?.contentType;\n}\n\n// ── Derive ──\n\nconst BASE_DEFAULTS: ContentTypeDefault[] = [\n { extension: \"rels\", contentType: \"application/vnd.openxmlformats-package.relationships+xml\" },\n { extension: \"xml\", contentType: \"application/xml\" },\n];\n\nexport interface DeriveContentTypesOptions {\n /** Resolve an OOXML part path to its Override content type. Return undefined\n * for non-part files (media/embeddings/.rels) resolved via Default. */\n resolve: PartContentTypeResolver;\n /** Lowercase extension → MIME for media/embedding Default entries. */\n mediaContentTypes: Readonly<Record<string, string>>;\n /** Always-present Default entries. Defaults to rels + xml. */\n baseDefaults?: ContentTypeDefault[];\n /** Per-file Overrides for parts whose content type is data-driven and not\n * path-determinable — docx altChunks carry a caller-supplied MIME, and\n * sub-documents live at an arbitrary path. Each path is normalized to a\n * leading slash and takes precedence over a resolver match for the same\n * path. */\n overrides?: ReadonlyArray<{ path: string; contentType: string }>;\n /**\n * The source package's [Content_Types].xml (round-trip). Present, the\n * derived table is merged onto it: every source Default survives verbatim,\n * source Overrides survive for parts that still exist at the same path,\n * and derived entries only fill what the surviving source table leaves\n * uncovered or mistyped (renamed media, synthesized parts, a Default whose\n * type disagrees with a surviving part). Fresh generation (no source) is\n * unaffected.\n */\n source?: ContentTypesInput;\n /**\n * Paths whose bytes are carried verbatim from the source package (same form\n * as `filePaths` entries). With a source table present, derivation never\n * types these parts — whatever the surviving source table says about them\n * is their type, exactly as it was in the source. Only parts the compiler\n * (re)writes get derived declarations.\n */\n verbatimPaths?: ReadonlySet<string>;\n}\n\nfunction extensionOf(path: string): string | undefined {\n const slash = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"));\n const dot = path.slice(slash + 1).lastIndexOf(\".\");\n return dot > 0 ? path.slice(slash + 1 + dot + 1) : undefined;\n}\n\nfunction withLeadingSlash(path: string): string {\n return path.startsWith(\"/\") ? path : `/${path}`;\n}\n\n/**\n * Derive [Content_Types].xml entries from the actual part paths in the package.\n * Each path that the resolver maps to a content type becomes an Override; every\n * other file contributes a Default keyed by its extension (declared once).\n */\nexport function deriveContentTypes(\n filePaths: Iterable<string>,\n options: DeriveContentTypesOptions,\n): ContentTypesInput {\n const files = [...filePaths].filter((p) => p !== \"[Content_Types].xml\");\n const defaults: ContentTypeDefault[] = [...(options.baseDefaults ?? BASE_DEFAULTS)];\n const seenExt = new Set(defaults.map((d) => d.extension.toLowerCase()));\n // Keyed by lowercased PartName so explicit `overrides` entries (altChunks,\n // sub-documents) take precedence over a resolver match for the same path.\n const overrideMap = new Map<string, ContentTypeOverride>();\n // Per-part derived types (resolver match or extension MIME) — the merge with\n // a source table compares part types against surviving source Defaults.\n const partTypes: Array<{ partName: string; contentType: string }> = [];\n\n for (const path of files) {\n const partType = options.resolve(path);\n if (partType) {\n const partName = withLeadingSlash(path);\n overrideMap.set(partName.toLowerCase(), { partName, contentType: partType });\n partTypes.push({ partName, contentType: partType });\n continue;\n }\n const ext = extensionOf(path);\n if (!ext) continue;\n const key = ext.toLowerCase();\n const mime = options.mediaContentTypes[key];\n if (!seenExt.has(key) && mime) {\n defaults.push({ extension: ext, contentType: mime });\n seenExt.add(key);\n }\n if (mime) partTypes.push({ partName: withLeadingSlash(path), contentType: mime });\n }\n for (const extra of options.overrides ?? []) {\n const partName = withLeadingSlash(extra.path);\n overrideMap.set(partName.toLowerCase(), { partName, contentType: extra.contentType });\n }\n if (!options.source) return { defaults, overrides: [...overrideMap.values()] };\n return mergeSourceContentTypes(options.source, files, defaults, overrideMap, partTypes, {\n verbatim: options.verbatimPaths,\n });\n}\n\n/**\n * Merge derived declarations onto the source package's table (round-trip).\n *\n * - Source Defaults survive verbatim — extension-level entries are harmless\n * when unused, and dropping them (or retyping the shared .bin extension)\n * is what a purely derived table gets wrong.\n * - Source Overrides survive for parts that still exist at the same path;\n * media the pipeline renamed drops out.\n * - Derived Overrides fill only what the surviving source table leaves\n * uncovered: parts with no source Override whose covering source Default\n * disagrees with (or omits) their derived type. A part the compiler\n * rebuilds from its parsed source stays the same part kind, so a surviving\n * source Override (macro-enabled variants included) keeps the source type —\n * the static registry cannot know the package variant the source declared.\n * - A derived Default joins only when an output part of that extension is\n * still uncovered after Overrides — a source table that declares its .jpg\n * parts via per-part Overrides stays as-is.\n */\nfunction mergeSourceContentTypes(\n source: ContentTypesInput,\n files: string[],\n derivedDefaults: ContentTypeDefault[],\n derivedOverrides: Map<string, ContentTypeOverride>,\n partTypes: Array<{ partName: string; contentType: string }>,\n mergeOpts: { verbatim?: ReadonlySet<string> },\n): ContentTypesInput {\n const filePaths = new Set(files.map((p) => withLeadingSlash(p).toLowerCase()));\n // OPC part-name matching is case-insensitive (ECMA-376-2 §10.1.2.1), so the\n // verbatim lookup lowercases both sides.\n const verbatimLower = new Set([...(mergeOpts.verbatim ?? [])].map((p) => p.toLowerCase()));\n const isVerbatim = (partName: string) => verbatimLower.has(partName.slice(1).toLowerCase());\n const partExt = (partName: string) => {\n const dot = partName.lastIndexOf(\".\");\n return dot > partName.lastIndexOf(\"/\") ? partName.slice(dot + 1) : \"\";\n };\n // Candidate Default types (source wins per extension, derived fills the\n // rest) — membership in the emitted table is decided after Overrides.\n const defaultTypeByExt = new Map<string, string>();\n const derivedDefaultByExt = new Map<string, ContentTypeDefault>();\n for (const d of source.defaults) {\n const key = d.extension.toLowerCase();\n if (!defaultTypeByExt.has(key)) defaultTypeByExt.set(key, d.contentType);\n }\n for (const d of derivedDefaults) {\n const key = d.extension.toLowerCase();\n if (defaultTypeByExt.has(key)) continue;\n defaultTypeByExt.set(key, d.contentType);\n derivedDefaultByExt.set(key, d);\n }\n const overrides: ContentTypeOverride[] = [];\n const seenOverride = new Set<string>();\n const keptSourceTypeByPath = new Map<string, string>();\n for (const o of source.overrides) {\n const key = o.partName.toLowerCase();\n if (!filePaths.has(key)) continue; // renamed media or dropped part\n if (seenOverride.has(key)) continue;\n seenOverride.add(key);\n overrides.push(o);\n keptSourceTypeByPath.set(key, o.contentType);\n }\n for (const o of derivedOverrides.values()) {\n const key = o.partName.toLowerCase();\n if (isVerbatim(key)) continue; // source bytes, source declaration\n if (keptSourceTypeByPath.has(key)) continue; // rebuilt, same part kind — keep source type\n const ext = partExt(key);\n const coveringDefault = ext ? defaultTypeByExt.get(ext) : undefined;\n if (coveringDefault === o.contentType) continue; // covered by a Default\n seenOverride.add(key);\n overrides.push(o);\n }\n // Extension-typed parts (media, embeddings) whose surviving source Default\n // disagrees with the derived type need a per-part Override — e.g. a package\n // whose Default .bin types printer settings while an OLE .bin survives.\n for (const { partName, contentType } of partTypes) {\n const key = partName.toLowerCase();\n if (derivedOverrides.has(key) || keptSourceTypeByPath.has(key)) continue;\n if (isVerbatim(key)) continue; // source bytes, source declaration\n const ext = partExt(key);\n const coveringDefault = ext ? defaultTypeByExt.get(ext) : undefined;\n if (coveringDefault === undefined || coveringDefault === contentType) continue;\n if (seenOverride.has(key)) continue;\n seenOverride.add(key);\n overrides.push({ partName, contentType });\n }\n const defaults: ContentTypeDefault[] = [];\n const seenDefault = new Set<string>();\n for (const d of source.defaults) {\n const key = d.extension.toLowerCase();\n if (seenDefault.has(key)) continue;\n seenDefault.add(key);\n defaults.push(d);\n }\n for (const [key, d] of derivedDefaultByExt) {\n // A part of this extension with no Override is what makes the Default\n // load-bearing; extensions fully covered by Overrides stay undeclared,\n // matching a source table that never had them.\n const needed = files.some(\n (f) =>\n extensionOf(f)?.toLowerCase() === key &&\n !seenOverride.has(withLeadingSlash(f).toLowerCase()),\n );\n if (needed) defaults.push(d);\n }\n return { defaults, overrides };\n}\n\n/**\n * Extension → MIME for image media, shared by every format package.\n *\n * The three format compilers each declare a package-scoped media table made\n * of this image block plus format-specific extras (docx: odttf/bin fonts and\n * OLE; pptx: video/audio; xlsx: vml). Keeping the image half in one place\n * means a new image format lands everywhere at once.\n */\nexport const IMAGE_MEDIA_CONTENT_TYPES: Record<string, string> = {\n png: \"image/png\",\n jpeg: \"image/jpeg\",\n jpg: \"image/jpeg\",\n bmp: \"image/bmp\",\n gif: \"image/gif\",\n tif: \"image/tiff\",\n tiff: \"image/tiff\",\n emf: \"image/x-emf\",\n wmf: \"image/x-wmf\",\n ico: \"image/x-icon\",\n svg: \"image/svg+xml\",\n};\n","/**\n * Package-wide passthrough collection (SDK ExtendedPart analogue).\n *\n * The parse side of the \"maximum parse\" contract: every part the model did\n * NOT absorb is carried verbatim instead of dropped. Callers list the parts\n * their compiler rebuilds; everything else — unknown extensions, companion\n * .rels, media referenced only by passthrough parts — survives round-trip\n * with bytes and content-type declarations intact.\n *\n * Rebuilt parts whose source .rels referenced a passthrough part are captured\n * as relationship entries so the compiler can re-emit them verbatim (fresh\n * rId, unchanged target — passthrough paths never move).\n *\n * @module\n */\n\nimport { attr, escapeXml, type Element } from \"@office-open/xml\";\n\nimport {\n contentTypesDesc,\n type ContentTypeDefault,\n type ContentTypeOverride,\n} from \"./content-types-input\";\nimport { normalizeObsoleteNamespaceAliases } from \"./namespaces\";\nimport type { Zippable } from \"./packer\";\nimport type { ParsedArchive } from \"./parser\";\nimport { partPathToRelsPath, resolveRelationshipTarget } from \"./relationships\";\n\n// ── Types ──\n\nexport interface PassthroughPart {\n path: string;\n data: Uint8Array;\n /**\n * Content type borrowed from the source [Content_Types].xml: the part's\n * Override value, or its extension's Default. Undefined when the source\n * declared neither — carried through so the compiler can omit the entry\n * exactly like the source did.\n */\n contentType?: string;\n}\n\nexport interface PassthroughRelationship {\n /**\n * The rebuilt part whose source .rels referenced a passthrough part; \"\" for\n * root-level relationships from the always-rebuilt `_rels/.rels`.\n */\n source: string;\n relationshipType: string;\n /** Target exactly as written in the source .rels (relative form). */\n target: string;\n /** The relationship id as written in the source .rels (e.g. \"rId8\"). */\n rId: string;\n /** External target mode, retained only for package-root relationships. */\n targetMode?: \"External\";\n}\n\nexport interface PassthroughResult {\n parts: PassthroughPart[];\n relationships: PassthroughRelationship[];\n}\n\n// ── Collection ──\n\n/** Package-level files the packer always regenerates. */\nconst ALWAYS_REBUILT = new Set([\"[Content_Types].xml\", \"_rels/.rels\"]);\n\nfunction extensionOf(path: string): string | undefined {\n const slash = path.lastIndexOf(\"/\");\n const dot = path.slice(slash + 1).lastIndexOf(\".\");\n return dot > 0 ? path.slice(slash + 1 + dot + 1) : undefined;\n}\n\n/**\n * Collect passthrough parts and rebuilt→passthrough relationships.\n *\n * @param archive - Parsed source package.\n * @param rebuiltPaths - Parts (including their .rels) the compiler re-emits\n * from the model. Listing a part here without its .rels leaves the .rels\n * to pass through — used by docx glossary, where the document part is\n * rebuilt but its companion rels travel verbatim.\n */\nexport function collectPassthroughParts(\n archive: ParsedArchive,\n rebuiltPaths: Iterable<string>,\n): PassthroughResult {\n const rebuilt = new Set<string>(ALWAYS_REBUILT);\n for (const p of rebuiltPaths) rebuilt.add(p);\n\n // Borrowed content-type resolution: Override by part name first, then the\n // extension's Default (both case-insensitive, matching OPC matching rules).\n let defaults: ContentTypeDefault[] = [];\n let overrides: ContentTypeOverride[] = [];\n const ctEl = archive.get(\"[Content_Types].xml\");\n if (ctEl) {\n const parsed = contentTypesDesc.parse(ctEl, undefined as never);\n defaults = parsed.defaults;\n overrides = parsed.overrides;\n }\n const overrideMap = new Map(\n overrides.map((o) => [o.partName.toLowerCase(), o.contentType] as const),\n );\n const defaultMap = new Map(\n defaults.map((d) => [d.extension.toLowerCase(), d.contentType] as const),\n );\n const contentTypeFor = (path: string): string | undefined => {\n const override = overrideMap.get(`/${path}`.toLowerCase());\n if (override) return override;\n const ext = extensionOf(path);\n return ext ? defaultMap.get(ext.toLowerCase()) : undefined;\n };\n\n // Everything not rebuilt passes through. The default is \"keep\": companion\n // .rels of passthrough parts and media referenced only through them fall\n // out of this same loop — no closure walk needed, because not-rebuilt IS\n // the kept set.\n const parts: PassthroughPart[] = [];\n // OPC part-name matching is case-insensitive: a source can spell the rel\n // target with different casing than the ZIP entry (docProps/thumbnail.jpeg\n // vs docProps/Thumbnail.jpeg) and Office still resolves it.\n const kept = new Set<string>();\n for (const path of archive.keys()) {\n if (path.endsWith(\"/\") || rebuilt.has(path)) continue;\n const sourceData = archive.getRaw(path);\n if (!sourceData) continue;\n // Modeled XML is parsed through the same obsolete→final namespace aliases;\n // normalize raw XML/rels bytes as well so one generated package never mixes\n // both dialects. Non-XML binaries remain byte-identical.\n const data =\n path.endsWith(\".xml\") || path.endsWith(\".rels\")\n ? normalizeObsoleteNamespaceAliases(sourceData)\n : sourceData;\n kept.add(path.toLowerCase());\n const contentType = contentTypeFor(path);\n parts.push(contentType === undefined ? { path, data } : { path, data, contentType });\n }\n\n // Rebuilt parts whose source .rels point at passthrough parts: keep the\n // relationship so the rebuilt rels stay byte-equivalent to the source.\n // External targets (URLs) are not part references — the caller handles\n // those through their own model fields.\n const relationships: PassthroughRelationship[] = [];\n const captureRels = (relsEl: Element | undefined, source: string): void => {\n if (!relsEl) return;\n for (const rel of relsEl.elements ?? []) {\n if (rel.name !== \"Relationship\") continue;\n const targetMode = attr(rel, \"TargetMode\");\n const relationshipType = attr(rel, \"Type\");\n const target = attr(rel, \"Target\");\n const rId = attr(rel, \"Id\");\n if (!relationshipType || !target || !rId) continue;\n if (targetMode === \"External\") {\n // A rebuilt owner can only preserve an external relationship when its\n // modeled XML also remaps the local rId. Package-root relationships have\n // no owner XML, so they are safe to retain directly.\n if (source === \"\") {\n relationships.push({ source, relationshipType, target, rId, targetMode });\n }\n continue;\n }\n // Capture every source rel, including those pointing at rebuilt parts\n // (presProps/viewProps/theme/tableStyles all fit): the compiler's\n // pre-claim pass needs the source id to slot structure re-emissions in\n // after, preserving the source rId ordering on round-trip.\n if (kept.has(resolveRelationshipTarget(source, target).toLowerCase()) || source !== \"\") {\n relationships.push({ source, relationshipType, target, rId });\n }\n }\n };\n for (const source of rebuiltPaths) {\n captureRels(archive.get(partPathToRelsPath(source)), source);\n }\n // Root-level relationships (_rels/.rels, source \"\"): the root rels are\n // always rebuilt, so entries pointing at passthrough parts — the package\n // thumbnail above all — must be captured the same way.\n captureRels(archive.get(\"_rels/.rels\"), \"\");\n\n return { parts, relationships };\n}\n\n// ── Dangling-relationship guard ──\n\n/** Regex metacharacters in a literal target path (e.g. \".\" in file names). */\nconst RE_ESCAPE = /[.*+?^${}()|[\\]\\\\]/g;\n\n/**\n * Drop passthrough relationships whose target part is absent from the final\n * package: a dangling internal Target makes Office refuse to open the file,\n * and a hand-authored options JSON can reference parts it never carried in\n * `rawParts`. Parsed sources never produce this (their targets exist in the\n * source archive), so the guard only fires on the hand-authoring input face.\n * External and same-part `#fragment` targets are left alone.\n *\n * Runs after `compileMapping` on the assembled file map; rewrites the rebuilt\n * .rels part in place. Returns the number of relationships removed.\n */\nexport function dropDanglingPassthroughRels(\n files: Zippable,\n passthroughRelationships: readonly PassthroughRelationship[] | undefined,\n): number {\n if (!passthroughRelationships || passthroughRelationships.length === 0) return 0;\n // OPC part-name matching is case-insensitive — a source can spell the rel\n // target \"docProps/thumbnail.jpeg\" against the part \"docProps/Thumbnail.jpeg\"\n // (collectPassthroughParts' kept set is lowercase for the same reason).\n const paths = new Set(Object.keys(files).map((p) => p.toLowerCase()));\n const decoder = new TextDecoder();\n const encoder = new TextEncoder();\n let dropped = 0;\n for (const rel of passthroughRelationships) {\n if (rel.targetMode === \"External\" || rel.target.startsWith(\"#\")) continue;\n const relsPath = rel.source === \"\" ? \"_rels/.rels\" : partPathToRelsPath(rel.source);\n const entry = files[relsPath];\n // A .rels part is always a flat entry (Uint8Array or [Uint8Array, opts]);\n // nested Zippable directories never match a part path.\n const bytes =\n entry instanceof Uint8Array\n ? entry\n : Array.isArray(entry) && entry[0] instanceof Uint8Array\n ? entry[0]\n : undefined;\n if (!bytes) continue;\n const xml = decoder.decode(bytes);\n // claimSourceRel emits the captured target verbatim, so the emitted entry\n // carries the exact escaped string. Model-emitted rels always target parts\n // the compiler just produced, so they can never match a missing target.\n const escaped = escapeXml(rel.target).replace(RE_ESCAPE, \"\\\\$&\");\n if (!escaped) continue;\n const targetAttr = new RegExp(`(<Relationship\\\\b[^>]*\\\\bTarget=\"${escaped}\"[^>]*/>)`);\n const match = targetAttr.exec(xml);\n if (!match) continue;\n const resolved = resolveRelationshipTarget(rel.source, rel.target);\n if (paths.has(resolved.toLowerCase())) continue;\n const stripped = xml.slice(0, match.index) + xml.slice(match.index + match[1]!.length);\n const rewritten = encoder.encode(stripped);\n files[relsPath] = Array.isArray(entry) ? [rewritten, entry[1]] : rewritten;\n dropped++;\n }\n return dropped;\n}\n","import { pickNonVisualDrawingProperties } from \"../drawing\";\nimport type {\n ConnectorLockingOptions,\n EndpointConnectionOptions,\n NonVisualDrawingPropertiesOptions,\n} from \"../drawing\";\n\n/**\n * Base connector options — the shared shape across pptx (p:cxnSp) and xlsx\n * (xdr:cxnSp) connectors.\n *\n * Carries the non-visual drawing properties (name/description/title/hidden that\n * mirror a:CT_NonVisualDrawingProps) plus the connector-specific glue: locking\n * (a:cxnSpLocks) and the optional endpoint connections (a:stCxn/a:endCxn). The\n * line geometry, fill, and outline stay package-side (pptx surfaces them as\n * top-level convenience fields, xlsx nests them in spPr), as does positioning\n * (pptx two endpoints x1/y1/x2/y2, xlsx cell anchor).\n *\n * docx has no standalone connector element, so it does not extend this base.\n */\nexport interface BaseConnectorOptions extends NonVisualDrawingPropertiesOptions {\n /** a:cxnSpLocks — connector locking (inside cNvCxnSpPr). */\n locking?: ConnectorLockingOptions;\n /** a:stCxn — start endpoint glued to a shape connection site. */\n startConnection?: EndpointConnectionOptions;\n /** a:endCxn — end endpoint glued to a shape connection site. */\n endConnection?: EndpointConnectionOptions;\n}\n\n/**\n * Pick the connector base fields (cNvPr + locking + endpoint connections)\n * actually set on `opts`, dropping undefined. Used when bridging a package's\n * connector options onto the shared base during cross-format conversion.\n */\nexport function pickConnectorBase(\n opts: BaseConnectorOptions | undefined,\n): Partial<BaseConnectorOptions> {\n if (!opts) return {};\n return {\n ...pickNonVisualDrawingProperties(opts),\n ...(opts.locking !== undefined ? { locking: opts.locking } : {}),\n ...(opts.startConnection !== undefined ? { startConnection: opts.startConnection } : {}),\n ...(opts.endConnection !== undefined ? { endConnection: opts.endConnection } : {}),\n };\n}\n","import { pickNonVisualDrawingProperties } from \"../drawing\";\nimport type { NonVisualDrawingPropertiesOptions } from \"../drawing\";\nimport type { GroupLockingOptions } from \"../drawing/locking\";\n\n/**\n * Base group options — the shared shape across pptx (p:grpSp), xlsx (xdr:grpSp),\n * and docx (wpg:wgp) groups.\n *\n * Carries only the non-visual drawing properties (name/description/title/hidden\n * that mirror a:CT_NonVisualDrawingProps) — the part of a group that round-trips\n * losslessly across all three formats. The group transform (a:xfrm), fill,\n * effects, and children stay package-side: positioning models differ (pptx flat\n * x/y/w/h, xlsx cell anchor, docx transformation) and children types are\n * fundamentally different (LegacySlideChild vs shapes+connectors vs\n * GroupChildMediaData), so they cannot be unified without distorting each\n * package's model. docx bridges its cNvPr through altText (DocPropertiesOptions),\n * mirroring the picture base pattern.\n */\nexport interface BaseGroupOptions extends NonVisualDrawingPropertiesOptions {\n /**\n * Group shape locks (a:grpSpLocks inside cNvGrpSpPr) — the one shared field\n * beyond cNvPr. null keeps an explicit empty element (Office often emits\n * `<a:grpSpLocks/>`); see the module docstring for why grpSpPr content and\n * children stay per-package.\n */\n locking?: GroupLockingOptions | null;\n}\n\n/**\n * Pick the group base fields (cNvPr + locks) actually set on `opts`, dropping\n * undefined. Used when bridging a package's group options onto the shared base\n * during cross-format conversion.\n */\nexport function pickGroupBase(opts: BaseGroupOptions | undefined): Partial<BaseGroupOptions> {\n if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ACL,GAAG,+BAA+B,IAAI;EACtC,GAAI,KAAK,YAAY,KAAA,IAAY,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;CAChE;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["unzipSync","parse","strFromU8","stringify","zipSync","parse","extensionOf","withLeadingSlash","extensionOf"],"sources":["../src/opc/relationships.ts","../src/opc/media.ts","../src/opc/embeddings.ts","../src/opc/variant-types.ts","../src/opc/app-properties.ts","../src/opc/custom-properties.ts","../src/opc/encryption.ts","../src/opc/namespaces.ts","../src/opc/parser.ts","../src/opc/opc-consistency.ts","../src/opc/part-registry.ts","../src/opc/content-type-overrides.ts","../src/opc/content-types-input.ts","../src/opc/passthrough.ts","../src/connector/types.ts","../src/group/types.ts"],"sourcesContent":["import { escapeXml } from \"@office-open/xml\";\n\nimport type { XmlifyedFile } from \"./packer\";\n\nexport type RelationshipType =\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"\n | \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramLayout\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramStyle\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramColors\"\n | \"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing\"\n // WordprocessingML specific\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/attachedTemplate\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\"\n | \"http://schemas.microsoft.com/office/2011/relationships/people\"\n | \"http://schemas.microsoft.com/office/2011/relationships/commentsExtended\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/subDocument\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject\"\n // Native-format embedding (embedded xlsx/docx behind OLE objects)\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package\"\n | \"http://schemas.microsoft.com/office/2006/relationships/txbx\"\n // PresentationML specific\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideSyncProperties\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeManager\"\n | \"http://schemas.microsoft.com/office/2007/relationships/media\"\n // SpreadsheetML specific\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/users\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/xmlMaps\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/volTypes\"\n | \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells\";\n\nexport const TargetModeType = {\n EXTERNAL: \"External\",\n} as const;\n\ninterface RelationshipEntry {\n id: string;\n type: RelationshipType;\n target: string;\n targetMode?: string;\n}\n\n/**\n * Manages OOXML relationship entries and serializes to XML.\n *\n * Standalone class — no XmlComponent inheritance.\n * Pure string concatenation for zero-allocation XML output.\n */\nexport class Relationships {\n private entries: RelationshipEntry[] = [];\n // Max numeric id across entries, maintained on every mutation so the next\n // free id is O(1) instead of a full scan per read.\n private maxId = 0;\n\n private trackId(rid: string): void {\n const n = /^rId(\\d+)$/.exec(rid);\n if (n) this.maxId = Math.max(this.maxId, Number(n[1]));\n }\n\n public addRelationship(\n id: number | string,\n type: RelationshipType,\n target: string,\n targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType],\n ): void {\n // A string id is the full \"rIdN\" form (a passthrough source id) — prefix\n // only numbers, so \"rId2\" can't become \"rIdrId2\".\n const rid = typeof id === \"number\" ? `rId${id}` : id;\n this.trackId(rid);\n this.entries.push({ id: rid, type, target, targetMode });\n }\n\n /**\n * Register a relationship with an auto-allocated sequential id and return\n * the numeric id. Prefer this over the `relationshipCount + 1` +\n * `addRelationship` pair at every call site that wants the next id; reach\n * for `addRelationship` directly only when the id is externally determined\n * (a contiguous batch pre-computed from an offset, a fixed rId1, …).\n *\n * The id is max(existing) + 1, not count + 1 — externally-determined ids\n * (passthrough source ids) can leave gaps, and a gap-following count-based\n * id would collide with an existing entry (duplicate Relationship ids\n * corrupt the package for Office applications).\n */\n public add(\n type: RelationshipType,\n target: string,\n targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType],\n ): number {\n const id = this.maxId + 1;\n this.maxId = id;\n this.entries.push({ id: `rId${id}`, type, target, targetMode });\n return id;\n }\n\n public get relationshipCount(): number {\n return this.entries.length;\n }\n\n /** The next free numeric id (max existing + 1) — the safe offset base when\n * externally-determined ids (passthrough source ids) leave gaps below it. */\n public get nextRelationshipId(): number {\n return this.maxId + 1;\n }\n\n /** Pre-claim a source id without registering an entry. Reserving every\n * passthrough source id up front keeps auto-allocated ids (add(), next)\n * strictly above the source id space, so a part the source didn't carry\n * (a fresh comment, say) can never take an id a later source re-use will\n * need — re-emitting the source rel at a taken id corrupts the package.\n * Accepts the passthrough `rId` form (\"rId7\") or a bare number. */\n public reserveId(id: number | string): void {\n const n = typeof id === \"number\" ? id : /^rId(\\d+)$/.exec(id)?.[1];\n if (n !== undefined) this.trackId(`rId${n}`);\n }\n\n /** Reserve every passthrough id held by one source part — the uniform entry\n * point compilers call before filling a part's rels from the model. Without\n * it the model's batch allocations (offset snapshots, add()) can land on a\n * source id, forcing the later source re-emission to collide or renumber\n * (renumbering dangles the verbatim references that motivated keeping the\n * source id). Reserving is invisible to hasId/hasRelationship, so source\n * re-emission and rename-to-source-id still work. */\n public reserveSourceRids(\n source: string,\n passthrough: readonly { source: string; rId: string }[],\n ): void {\n for (const rel of passthrough) {\n if (rel.source === source) this.reserveId(rel.rId);\n }\n }\n\n /** Rename the first entry matching `type` to `newId` — used to promote a\n * structured rel (e.g. the slide layout) to its source id when the\n * source rId is free. No-op when the slot is taken or no match. */\n public renameEntryByType(type: string, newId: number): void {\n if (this.hasId(`rId${newId}`)) return;\n const entry = this.entries.find((e) => e.type === type);\n if (entry) {\n entry.id = `rId${newId}`;\n this.maxId = Math.max(this.maxId, newId);\n }\n }\n\n /** Numeric id of the first entry matching `kind` (last segment of the type\n * URI), or undefined when none is registered. */\n public idByKind(kind: string): number | undefined {\n const entry = this.entries.find((e) => e.type.split(\"/\").pop() === kind);\n if (!entry) return undefined;\n const m = /^rId(\\d+)$/.exec(entry.id);\n if (!m) return undefined;\n return Number(m[1]);\n }\n\n /**\n * Claim a captured source relationship (round-trip pre-claim). Verbatim\n * part content references the source rIds, so re-emit the rel at its exact\n * source id whenever that slot is still free — renumbering would dangle\n * those references. Skips rels already registered under the same\n * kind+target (the model absorbed them); falls back to an auto id for\n * non-numeric source ids.\n */\n public claimSourceRel(rel: {\n relationshipType: string;\n target: string;\n rId: string;\n targetMode?: \"External\";\n }): void {\n if (this.hasRelationship(rel.relationshipType, rel.target)) return;\n const numeric = /^rId(\\d+)$/.exec(rel.rId);\n if (numeric && !this.hasId(rel.rId)) {\n this.addRelationship(\n Number(numeric[1]),\n rel.relationshipType as RelationshipType,\n rel.target,\n rel.targetMode,\n );\n } else {\n this.add(rel.relationshipType as RelationshipType, rel.target, rel.targetMode);\n }\n }\n\n /**\n * True when a relationship of the same kind and target is already\n * registered. The kind compares only the relationship type's last path\n * segment, so the transitional and strict URI forms of the same\n * relationship compare equal — passthrough re-emission uses this to skip\n * relationships the compiler already wired (a duplicate entry corrupts the\n * package for Office applications).\n */\n public hasRelationship(type: string, target: string): boolean {\n const kind = type.split(\"/\").pop();\n return this.entries.some((e) => e.type.split(\"/\").pop() === kind && e.target === target);\n }\n\n /**\n * True when any entry carries the relationship kind (last type segment).\n * Round-trip re-emission uses this as the ownership test: a rebuilt part\n * that already registered a rel of this kind absorbed the concept, so the\n * captured source rel (possibly a renamed target or the ISO-strict type\n * dual) must not be re-emitted alongside it.\n */\n public hasRelationshipKind(kind: string): boolean {\n return this.entries.some((e) => e.type.split(\"/\").pop() === kind);\n }\n\n /** True when an entry already occupies this exact relationship id. */\n public hasId(id: string): boolean {\n return this.entries.some((e) => e.id === id);\n }\n\n /**\n * The id of the entry matching kind+target (same last-path-segment equality\n * as {@link hasRelationship}), or undefined when absent. Round-trip legs use\n * this to point a reference element at an already-registered relationship.\n */\n public idOf(type: string, target: string): string | undefined {\n const kind = type.split(\"/\").pop();\n return this.entries.find((e) => e.type.split(\"/\").pop() === kind && e.target === target)?.id;\n }\n\n /** Directly builds XML string — zero intermediate tree allocation. */\n public serialize(): string {\n const p: string[] = [\n '<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">',\n ];\n for (const e of this.entries) {\n const tm = e.targetMode ? ` TargetMode=\"${escapeXml(e.targetMode)}\"` : \"\";\n p.push(\n `<Relationship Id=\"${escapeXml(e.id)}\" Type=\"${escapeXml(e.type)}\" Target=\"${escapeXml(e.target)}\"${tm}/>`,\n );\n }\n p.push(\"</Relationships>\");\n return p.join(\"\");\n }\n}\n\n/**\n * Serialize a Relationships part only when it carries at least one\n * relationship. Optional parts (fontTable, headers, footers, charts, drawings,\n * worksheets, …) emit no .rels part when empty — Office strips empty rels\n * shells when re-saving, so skipping them keeps generated packages free of\n * redundant empty parts and matches Office's normalized output.\n *\n * Always-on parts (the package `_rels/.rels` and the main\n * document/presentation/workbook parts) carry relationships by construction\n * and must NOT use this gate.\n */\nexport function optionalRelsPart(\n rel: Relationships,\n xmlDeclaration: string,\n path: string,\n): XmlifyedFile | undefined {\n return rel.relationshipCount > 0 ? { data: xmlDeclaration + rel.serialize(), path } : undefined;\n}\n\n/** Build the package root relationships shared by docx, pptx, and xlsx. */\nexport function buildRootRelationships(\n mainPartTarget: string,\n includeCustomProperties: boolean,\n passthroughRelationships?: readonly {\n source: string;\n relationshipType: string;\n target: string;\n targetMode?: \"External\";\n }[],\n): Relationships {\n const rels = new Relationships();\n rels.addRelationship(\n 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\",\n mainPartTarget,\n );\n rels.addRelationship(\n 2,\n \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\",\n \"docProps/core.xml\",\n );\n rels.addRelationship(\n 3,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\",\n \"docProps/app.xml\",\n );\n if (includeCustomProperties) {\n rels.addRelationship(\n 4,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties\",\n \"docProps/custom.xml\",\n );\n }\n // Root-level passthrough relationships (round-trip): the source _rels/.rels\n // referenced parts the model carries verbatim — the package thumbnail above\n // all. Re-emitted as written; targets never move.\n for (const rel of passthroughRelationships ?? []) {\n if (rel.source !== \"\") continue;\n if (rels.hasRelationship(rel.relationshipType, rel.target)) continue;\n rels.add(rel.relationshipType as RelationshipType, rel.target, rel.targetMode);\n }\n return rels;\n}\n\n/**\n * Derive the .rels part path for a package part:\n * \"ppt/slides/slide1.xml\" → \"ppt/slides/_rels/slide1.xml.rels\".\n */\nexport function partPathToRelsPath(partPath: string): string {\n const idx = partPath.lastIndexOf(\"/\");\n const dir = partPath.substring(0, idx);\n const file = partPath.substring(idx + 1);\n return `${dir}/_rels/${file}.rels`;\n}\n\n/**\n * Resolve a relationship target against the referencing part's directory,\n * segment by segment: each \"..\" pops one directory level. A single\n * String.replace(\"../\", …) only strips the first occurrence and mis-resolves\n * deeper targets like \"../../media/image.png\".\n */\nexport function resolveRelationshipTarget(partPath: string, target: string): string {\n if (target.startsWith(\"/\")) return target.slice(1);\n const dir = partPath.substring(0, partPath.lastIndexOf(\"/\"));\n const dirParts = dir ? dir.split(\"/\") : [];\n for (const part of target.split(\"/\")) {\n if (part === \"..\") {\n dirParts.pop();\n } else if (part !== \".\" && part !== \"\") {\n dirParts.push(part);\n }\n }\n return dirParts.join(\"/\");\n}\n","/**\n * Content-deduplicated media collection for OOXML packages.\n *\n * Stores image entries keyed by file name. `addMedia` deduplicates by raw byte\n * content — byte-identical images referenced N times share one file, while\n * per-image metadata (transformation, extent, fallback) stays with each\n * reference in its own drawing XML and is passed via the `build` callback so it\n * never participates in the dedup key.\n *\n * Lookup is O(1) amortized: a `WeakMap` memoizes the resolved entry per input\n * `Uint8Array` (the hot path — a single document reuses the same buffer object\n * for repeated references), and a content-hash index (native CRC-32 where\n * available, FNV-1a fallback) resolves cross-object duplicates (e.g. a\n * freshly-decoded buffer carrying bytes already seen) with a one-time byte\n * verification to rule out hash collisions.\n *\n * @module\n */\n\nimport { nativeCrc32 } from \"./zip-native\";\n\n/**\n * Minimum fields every media entry carries. Package-specific entry types\n * extend this with their own transformation/extent/fallback fields.\n */\nexport interface BaseMediaEntry {\n fileName: string;\n data: Uint8Array;\n type: string;\n}\n\n/**\n * FNV-1a hash is a pure function of the bytes, so memoize it across\n * {@link Media} instances — repeated `generate()` calls that reuse the same\n * buffer objects (the common case) skip recomputation entirely.\n */\nconst hashKeyCache = new WeakMap<Uint8Array, string>();\n\n/**\n * Shared media collection for docx/pptx/xlsx. Generic over the package's entry\n * type so each package keeps its own metadata while sharing the registration +\n * dedup logic.\n */\nexport class Media<T extends BaseMediaEntry> {\n private readonly map = new Map<string, T>();\n /** FNV-1a content key (\"len:hash\") -> canonical file name, for cross-object dedup. */\n private readonly byContent = new Map<string, string>();\n /** Memoized result per input buffer — the repeated-reference hot path. */\n private readonly verified = new WeakMap<Uint8Array, string>();\n private counter = 0;\n /** Cached `array` snapshot — invalidated on add so compilers reading it per\n * part stop paying a fresh array copy per access. */\n private cachedArray: T[] | undefined;\n\n /**\n * Register media, reusing the existing entry when the bytes already exist.\n * Returns the canonical entry (shared across all identical references) —\n * callers read `entry.fileName` for placeholders/relationship targets or use\n * the whole entry (e.g. drawing XML). The `build` callback constructs the\n * package-specific entry from the allocated file name.\n *\n * Pass `fileName` to pin the name (round-trip scenarios preserving a source\n * file name); omit it to allocate the next sequential `imageN.ext`.\n */\n public addMedia(\n data: Uint8Array,\n type: string,\n build: (fileName: string) => T,\n fileName?: string,\n ): T {\n // Hot path: the same buffer object referenced repeatedly resolves instantly.\n // The cached entry must match the requested type — identical bytes registered\n // under a different type (e.g. EMF bytes also carried as WMF in an\n // mc:AlternateContent fallback) are distinct resources with different\n // content-types and must NOT collapse into one part.\n const verifiedName = this.verified.get(data);\n if (verifiedName !== undefined) {\n const existing = this.map.get(verifiedName)!;\n if (existing.type === type) return existing;\n }\n\n // Type-scoped content key: same bytes under different types stay separate.\n const key = `${type}:${this.contentKey(data)}`;\n const existingName = this.byContent.get(key);\n if (existingName !== undefined) {\n const existing = this.map.get(existingName)!;\n // Hash hit — confirm bytes + type match to exclude a collision, then memoize.\n if (existing.type === type && this.byteEqual(existing.data, data)) {\n this.verified.set(data, existingName);\n return existing;\n }\n }\n\n // A pinned name may already be taken by different bytes (e.g. a\n // counter-allocated name colliding with a source basename, or two round-trip\n // paths resolving to the same name). Re-allocate rather than overwrite —\n // overwriting would silently drop the prior media's bytes.\n const resolvedName = fileName ?? this.nextName(type);\n const finalName = this.map.has(resolvedName) ? this.nextName(type) : resolvedName;\n const entry = build(finalName);\n this.map.set(finalName, entry);\n this.cachedArray = undefined;\n this.byContent.set(key, finalName);\n this.verified.set(data, finalName);\n return entry;\n }\n\n /** Next sequential `imageN.${type}` that isn't already in use. */\n private nextName(type: string): string {\n let name = `image${++this.counter}.${type}`;\n while (this.map.has(name)) name = `image${++this.counter}.${type}`;\n return name;\n }\n\n /**\n * \"length:hash\" content key for `data`, memoized. Native CRC-32\n * (`zlib.crc32`) on Node/Bun — ~59× faster than JS hashing on 100 MB inputs;\n * FNV-1a fallback where no native zlib resolved. Both are 32-bit candidate\n * keys; the byte verification in `addMedia` rules out collisions, so the\n * weaker hash needs no collision handling of its own.\n */\n private contentKey(data: Uint8Array): string {\n const cached = hashKeyCache.get(data);\n if (cached !== undefined) return cached;\n const native = nativeCrc32(data);\n let key: string;\n if (native !== undefined) {\n key = `${data.length}:${(native >>> 0).toString(16)}`;\n } else {\n let hash = 0x811c9dc5;\n for (const byte of data) {\n hash ^= byte;\n hash = Math.imul(hash, 0x01000193);\n }\n key = `${data.length}:${(hash >>> 0).toString(16)}`;\n }\n hashKeyCache.set(data, key);\n return key;\n }\n\n /** Structural equality with early exit on the first mismatch. */\n private byteEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n\n /** All registered media entries (snapshot; stable between adds). */\n public get array(): T[] {\n if (this.cachedArray === undefined) this.cachedArray = [...this.map.values()];\n return this.cachedArray;\n }\n}\n","/**\n * OLE embedding collection shared by the format packages.\n *\n * Manages OLE object embeddings (word/embeddings/oleObjectN.bin,\n * ppt/embeddings/oleObjectN.bin) referenced by OLE object elements. Mirrors\n * the Media collection pattern but targets binary OLE container parts.\n *\n * @module\n */\n\n/** OLE embedding data stored under the package's embeddings/ directory. */\nexport interface EmbeddingData {\n /** File name within embeddings/ (e.g. \"oleObject1.bin\"). */\n fileName: string;\n /** Raw OLE container bytes. */\n data: Uint8Array;\n /** OLE program id (e.g. \"Excel.Sheet.12\") — informational only. */\n progId?: string;\n /**\n * Source relationship kind (round-trip): \"package\" for native-format\n * embeddings (xlsx/docx), \"oleObject\" for OLE compound binaries. Controls\n * the re-emitted relationship type; undefined (fresh authoring) means\n * oleObject.\n */\n relationshipType?: \"oleObject\" | \"package\";\n}\n\n/**\n * Collects OLE embeddings allocated during document generation. Each embedding\n * is stored under a sequential `oleObjectN.bin` name, mirroring MS Office's\n * numbering so output is deterministic and diffable.\n */\nexport class EmbeddingCollection {\n private map = new Map<string, EmbeddingData>();\n private counter = 0;\n /** Cached `array` snapshot — invalidated on add. */\n private cachedArray: EmbeddingData[] | undefined;\n\n /** Allocate the next sequential embedding file name (oleObject1.bin, …). */\n public nextEmbeddingName(): string {\n // Skip names already taken (e.g. round-tripped source basenames) — a\n // counter-allocated name colliding with a pinned one would overwrite it.\n let name = `oleObject${++this.counter}.bin`;\n while (this.map.has(name)) name = `oleObject${++this.counter}.bin`;\n return name;\n }\n\n /**\n * Register embedding bytes and return the stored entry. The requested name\n * is used when free or already claimed by identical bytes (two objects\n * sharing one embedded part); a name claimed by different bytes falls back\n * to a fresh sequential name — overwriting would silently drop the other\n * object's payload.\n */\n public addEmbedding(\n data: Uint8Array,\n requestedName?: string,\n progId?: string,\n relationshipType?: EmbeddingData[\"relationshipType\"],\n ): EmbeddingData {\n const requested = requestedName ?? this.nextEmbeddingName();\n const extras = {\n ...(progId !== undefined ? { progId } : {}),\n ...(relationshipType !== undefined ? { relationshipType } : {}),\n };\n const existing = this.map.get(requested);\n if (existing) {\n if (this.byteEqual(existing.data, data)) return existing;\n const fallbackName = this.nextEmbeddingName();\n const entry: EmbeddingData = { fileName: fallbackName, data, ...extras };\n this.map.set(fallbackName, entry);\n this.cachedArray = undefined;\n return entry;\n }\n const entry: EmbeddingData = { fileName: requested, data, ...extras };\n this.map.set(requested, entry);\n this.cachedArray = undefined;\n return entry;\n }\n\n /** All registered embeddings in insertion order (snapshot; stable between adds). */\n public get array(): EmbeddingData[] {\n if (this.cachedArray === undefined) this.cachedArray = [...this.map.values()];\n return this.cachedArray;\n }\n\n private byteEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n }\n}\n","/**\n * Variant value types (vt:*) — shared vocabulary for the docProps parts.\n *\n * custom.xml property values and app.xml vectors (HeadingPairs,\n * TitlesOfParts) are expressed with the vt:* element set defined in\n * shared-documentPropertiesVariantTypes.xsd. JS values map as:\n * string → vt:lpwstr, boolean → vt:bool, Date → vt:filetime, integers →\n * vt:i4, other numbers → vt:r8.\n *\n * The two domains spell strings differently and Excel enforces the split:\n * app.xml vectors (CT_VectorLpstr) must carry vt:lpstr — Excel refuses to\n * open a file whose HeadingPairs/TitlesOfParts use vt:lpwstr — while\n * custom.xml property values use vt:lpwstr, the spelling Office itself\n * writes there.\n *\n * @module\n */\n\nimport { escapeXml, textOf } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport { parseOnOff } from \"../util/values\";\n\n/** JS-level variant value carried by a vt:* element. */\nexport type VariantValue = string | number | boolean | Date;\n\n/** Numeric vt:* tags parsed back to a JS number. */\nconst NUMERIC_VT_TAGS = new Set([\n \"vt:i1\",\n \"vt:i2\",\n \"vt:i4\",\n \"vt:i8\",\n \"vt:ui1\",\n \"vt:ui2\",\n \"vt:ui4\",\n \"vt:ui8\",\n \"vt:int\",\n \"vt:uint\",\n \"vt:r4\",\n \"vt:r8\",\n \"vt:decimal\",\n]);\n\n/** Every scalar vt:* element stringifyVariantValue can emit. */\nconst VT_TAGS = new Set([\n ...NUMERIC_VT_TAGS,\n \"vt:lpwstr\",\n \"vt:lpstr\",\n \"vt:bstr\",\n \"vt:bool\",\n \"vt:date\",\n \"vt:filetime\",\n]);\n\n/** The vt:* element the default JS mapping picks for a value. */\nexport function defaultVariantTag(value: VariantValue): string {\n if (typeof value === \"string\") return \"vt:lpwstr\";\n if (typeof value === \"boolean\") return \"vt:bool\";\n if (value instanceof Date) return \"vt:filetime\";\n return Number.isInteger(value) ? \"vt:i4\" : \"vt:r8\";\n}\n\n/**\n * Serialize a JS value as its vt:* element (stringify side, custom.xml domain).\n *\n * Strings stay lpwstr (the spelling Office writes for custom property\n * values), integers become i4, other numbers r8, booleans bool, and Dates\n * filetime (xsd:dateTime form). A `sourceTag` captured at parse overrides the\n * default mapping so a source spelling the mapping would rewrite (an integer\n * carried as vt:r8, an lpstr string) round-trips unchanged.\n */\nexport function stringifyVariantValue(value: VariantValue, sourceTag?: string): string {\n const tag =\n sourceTag !== undefined && VT_TAGS.has(sourceTag) ? sourceTag : defaultVariantTag(value);\n let inner: string;\n if (tag === \"vt:bool\") inner = value ? \"true\" : \"false\";\n else if (tag === \"vt:date\" || tag === \"vt:filetime\")\n inner = value instanceof Date ? value.toISOString() : String(value);\n else if (typeof value === \"string\") inner = escapeXml(value);\n else inner = String(value);\n return `<${tag}>${inner}</${tag}>`;\n}\n\n/**\n * Parse a vt:* scalar element back to a JS value (parse side).\n *\n * Lenient about unknown tags: they round-trip as their text content, the\n * same fallback the previous string-only custom-properties parse used.\n */\nexport function parseVariantValue(el: Element): VariantValue | undefined {\n const text = textOf(el);\n switch (el.name) {\n case \"vt:lpwstr\":\n case \"vt:lpstr\":\n case \"vt:bstr\":\n return text;\n case \"vt:bool\":\n return parseOnOff(text) ?? false;\n case \"vt:date\":\n case \"vt:filetime\":\n return text ? new Date(text) : undefined;\n default:\n if (NUMERIC_VT_TAGS.has(el.name ?? \"\")) return text === \"\" ? undefined : Number(text);\n return text || undefined;\n }\n}\n\n/**\n * Serialize a vt:vector of lpstr entries (the TitlesOfParts shape).\n * lpstr is required: Excel refuses to open a file whose app.xml vectors\n * carry lpwstr (CT_VectorLpstr).\n */\nexport function stringifyStringVector(values: readonly string[]): string {\n const items = values.map((v) => `<vt:lpstr>${escapeXml(v)}</vt:lpstr>`).join(\"\");\n return `<vt:vector size=\"${values.length}\" baseType=\"lpstr\">${items}</vt:vector>`;\n}\n\n/**\n * Serialize a vt:vector of variant entries (the HLinks shape). Each value\n * keeps the element spelling stringifyVariantValue maps it to, wrapped in a\n * vt:variant carrier — round-trips whatever int/string mix the source carried.\n */\nexport function stringifyVariantVector(values: readonly VariantValue[]): string {\n const items = values.map((v) => `<vt:variant>${stringifyVariantValue(v)}</vt:variant>`).join(\"\");\n return `<vt:vector size=\"${values.length}\" baseType=\"variant\">${items}</vt:vector>`;\n}\n\n/** Parse a vt:vector with any scalar baseType into its JS values. */\nexport function parseVector(el: Element | undefined): VariantValue[] {\n if (!el || el.name !== \"vt:vector\") return [];\n const out: VariantValue[] = [];\n for (const child of el.elements ?? []) {\n // Whitespace text between entries (indentation) is not a value — the OPC\n // parser captures it, so filter to element children before dispatch.\n if (child.type !== \"element\") continue;\n // baseType=\"variant\" wraps each entry in a <vt:variant> carrier.\n const scalar =\n child.name === \"vt:variant\" ? child.elements?.find((e) => e.name?.startsWith(\"vt:\")) : child;\n if (!scalar) continue;\n const value = parseVariantValue(scalar);\n if (value !== undefined) out.push(value);\n }\n return out;\n}\n","/**\n * Extended (App) Properties module — shared OPC part (docProps/app.xml).\n *\n * Format-agnostic: CT_Properties (ISO-IEC29500-2_2016 shared-documentPropertiesExtended.xsd)\n * is identical across docx/pptx/xlsx. Each package surfaces only the fields it populates\n * (Pages/Words for docx, Slides for pptx, etc.) — all fields are optional.\n *\n * @module\n */\n\n// ── Descriptor ──\n\nimport { escapeXml } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport { parseOnOff } from \"../util/values\";\nimport { parseVector, stringifyStringVector, stringifyVariantVector } from \"./variant-types\";\nimport type { VariantValue } from \"./variant-types\";\n\n/** xsd:boolean lexical form — spec canonical form is \"true\"/\"false\" (Word's convention). */\nconst xsdBoolean = (value: boolean): string => (value ? \"true\" : \"false\");\n\n/**\n * Options for docProps/app.xml extended properties (CT_Properties).\n *\n * Property order follows the CT_Properties xsd:all sequence so the\n * emitted XML matches the reference schema ordering.\n */\nexport interface AppPropertiesOptions {\n /** Template name */\n template?: string;\n /** Manager name */\n manager?: string;\n /** Company name */\n company?: string;\n /** Page count */\n pages?: number;\n /** Word count */\n words?: number;\n /** Character count */\n characters?: number;\n /** Intended print/display format, e.g. \"Custom\" or \"A4 Paper\" */\n presentationFormat?: string;\n /** Line count */\n lines?: number;\n /** Paragraph count */\n paragraphs?: number;\n /** Notes count */\n notes?: number;\n /** Slides count */\n slides?: number;\n /** Total editing time (minutes) */\n totalTime?: number;\n /** Hidden slides count */\n hiddenSlides?: number;\n /** Multimedia clips count */\n mmClips?: number;\n /** Characters including spaces */\n charactersWithSpaces?: number;\n /** Document security level */\n docSecurity?: number;\n /** Hyperlink base URL */\n hyperlinkBase?: string;\n /**\n * Hyperlink metadata vector (HLinks) — Word's internal per-link records\n * (six entries per link). Round-trip only: fields are undocumented, so the\n * flat variant values are carried as-is.\n */\n hlinks?: VariantValue[];\n /** Application name */\n application?: string;\n /** Application version */\n appVersion?: string;\n /** Whether the document is scaled/cropped */\n scaleCrop?: boolean;\n /** Whether links are up to date */\n linksUpToDate?: boolean;\n /** Whether the document is shared */\n sharedDoc?: boolean;\n /** Whether hyperlinks changed */\n hyperlinksChanged?: boolean;\n /** Named part-group counters (Office always writes these) */\n headingPairs?: HeadingPairOptions[];\n /** Part titles (slide titles, sheet names, heading ranges) */\n titlesOfParts?: string[];\n /**\n * Emit the extended-properties vocabulary under the ap: prefix — the ISO\n * strict binding, where the source declares xmlns:ap explicitly instead of\n * using the namespace as the default. Round-trip only.\n */\n apPrefix?: true;\n}\n\n/** One HeadingPairs entry: a group name plus the number of parts it covers. */\nexport interface HeadingPairOptions {\n /** Group name (e.g. \"Fonts Used\", \"Theme\", \"Slide Titles\") */\n name: string;\n /** Number of parts in the group */\n count: number;\n}\n\n/** Subset of AppPropertiesOptions accepted by stringify. */\nexport type AppPropertiesInput = AppPropertiesOptions;\n\nexport const appPropertiesDesc: CustomDescriptor<AppPropertiesInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n // xsd:all is unordered, but emit in schema order for readability. The\n // ap-prefixed form (ISO strict round-trip) binds xmlns:ap explicitly;\n // vt: children keep their own prefix either way.\n const t = (name: string): string => (opts.apPrefix ? `ap:${name}` : name);\n const p: string[] = opts.apPrefix\n ? [\n '<ap:Properties xmlns:ap=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\"' +\n ' xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">',\n ]\n : [\n '<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\"' +\n ' xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">',\n ];\n\n // Schema order: Template, Manager, Company, Pages, Words, Characters,\n // PresentationFormat, Lines, Paragraphs, Slides, Notes, TotalTime,\n // HiddenSlides, MMClips, ScaleCrop, HeadingPairs, TitlesOfParts,\n // LinksUpToDate, CharactersWithSpaces, SharedDoc, HyperlinkBase, HLinks,\n // HyperlinksChanged, DigSig, Application, AppVersion, DocSecurity.\n if (opts.template !== undefined)\n p.push(`<${t(\"Template\")}>${escapeXml(opts.template)}</${t(\"Template\")}>`);\n if (opts.manager !== undefined)\n p.push(`<${t(\"Manager\")}>${escapeXml(opts.manager)}</${t(\"Manager\")}>`);\n if (opts.company !== undefined)\n p.push(`<${t(\"Company\")}>${escapeXml(opts.company)}</${t(\"Company\")}>`);\n if (opts.pages !== undefined) p.push(`<${t(\"Pages\")}>${opts.pages}</${t(\"Pages\")}>`);\n if (opts.words !== undefined) p.push(`<${t(\"Words\")}>${opts.words}</${t(\"Words\")}>`);\n if (opts.characters !== undefined)\n p.push(`<${t(\"Characters\")}>${opts.characters}</${t(\"Characters\")}>`);\n if (opts.presentationFormat !== undefined)\n p.push(\n `<${t(\"PresentationFormat\")}>${escapeXml(opts.presentationFormat)}</${t(\"PresentationFormat\")}>`,\n );\n if (opts.lines !== undefined) p.push(`<${t(\"Lines\")}>${opts.lines}</${t(\"Lines\")}>`);\n if (opts.paragraphs !== undefined)\n p.push(`<${t(\"Paragraphs\")}>${opts.paragraphs}</${t(\"Paragraphs\")}>`);\n if (opts.slides !== undefined) p.push(`<${t(\"Slides\")}>${opts.slides}</${t(\"Slides\")}>`);\n if (opts.notes !== undefined) p.push(`<${t(\"Notes\")}>${opts.notes}</${t(\"Notes\")}>`);\n if (opts.totalTime !== undefined)\n p.push(`<${t(\"TotalTime\")}>${opts.totalTime}</${t(\"TotalTime\")}>`);\n if (opts.hiddenSlides !== undefined)\n p.push(`<${t(\"HiddenSlides\")}>${opts.hiddenSlides}</${t(\"HiddenSlides\")}>`);\n if (opts.mmClips !== undefined) p.push(`<${t(\"MMClips\")}>${opts.mmClips}</${t(\"MMClips\")}>`);\n if (opts.scaleCrop !== undefined)\n p.push(`<${t(\"ScaleCrop\")}>${xsdBoolean(opts.scaleCrop)}</${t(\"ScaleCrop\")}>`);\n if (opts.headingPairs !== undefined && opts.headingPairs.length > 0) {\n // vt:lpstr is required here: Excel refuses to open a file whose\n // HeadingPairs variants carry lpwstr.\n const items = opts.headingPairs\n .map(\n (pair) =>\n `<vt:variant><vt:lpstr>${escapeXml(pair.name)}</vt:lpstr></vt:variant>` +\n `<vt:variant><vt:i4>${pair.count}</vt:i4></vt:variant>`,\n )\n .join(\"\");\n p.push(\n `<${t(\"HeadingPairs\")}><vt:vector size=\"${opts.headingPairs.length * 2}\" baseType=\"variant\">` +\n `${items}</vt:vector></${t(\"HeadingPairs\")}>`,\n );\n }\n if (opts.titlesOfParts !== undefined && opts.titlesOfParts.length > 0) {\n p.push(\n `<${t(\"TitlesOfParts\")}>${stringifyStringVector(opts.titlesOfParts)}</${t(\"TitlesOfParts\")}>`,\n );\n }\n if (opts.linksUpToDate !== undefined)\n p.push(`<${t(\"LinksUpToDate\")}>${xsdBoolean(opts.linksUpToDate)}</${t(\"LinksUpToDate\")}>`);\n if (opts.charactersWithSpaces !== undefined)\n p.push(\n `<${t(\"CharactersWithSpaces\")}>${opts.charactersWithSpaces}</${t(\"CharactersWithSpaces\")}>`,\n );\n if (opts.sharedDoc !== undefined)\n p.push(`<${t(\"SharedDoc\")}>${xsdBoolean(opts.sharedDoc)}</${t(\"SharedDoc\")}>`);\n if (opts.hyperlinkBase !== undefined)\n p.push(`<${t(\"HyperlinkBase\")}>${escapeXml(opts.hyperlinkBase)}</${t(\"HyperlinkBase\")}>`);\n if (opts.hlinks !== undefined && opts.hlinks.length > 0)\n p.push(`<${t(\"HLinks\")}>${stringifyVariantVector(opts.hlinks)}</${t(\"HLinks\")}>`);\n if (opts.hyperlinksChanged !== undefined)\n p.push(\n `<${t(\"HyperlinksChanged\")}>${xsdBoolean(opts.hyperlinksChanged)}</${t(\"HyperlinksChanged\")}>`,\n );\n if (opts.application !== undefined)\n p.push(`<${t(\"Application\")}>${escapeXml(opts.application)}</${t(\"Application\")}>`);\n if (opts.appVersion !== undefined)\n p.push(`<${t(\"AppVersion\")}>${escapeXml(opts.appVersion)}</${t(\"AppVersion\")}>`);\n if (opts.docSecurity !== undefined)\n p.push(`<${t(\"DocSecurity\")}>${opts.docSecurity}</${t(\"DocSecurity\")}>`);\n\n p.push(opts.apPrefix ? \"</ap:Properties>\" : \"</Properties>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const result: AppPropertiesOptions = {};\n // ISO strict binds the vocabulary under an explicit ap: prefix — strip\n // any prefix so ap:Template matches the local-name cases, and remember\n // the binding so stringify re-emits the same form.\n if (el.name === \"ap:Properties\") result.apPrefix = true;\n for (const child of el.elements ?? []) {\n if (typeof child.name !== \"string\") continue;\n const text = child.elements?.[0]?.text;\n // String fields are presence-based: Word writes empty elements\n // (\"<Company>\\n</Company>\", which the XML parser reduces to no text)\n // — capture \"\" so the element round-trips instead of being dropped.\n const str = String(text ?? \"\");\n const name = child.name.includes(\":\")\n ? child.name.slice(child.name.indexOf(\":\") + 1)\n : child.name;\n switch (name) {\n case \"Template\":\n result.template = str;\n break;\n case \"Manager\":\n result.manager = str;\n break;\n case \"Company\":\n result.company = str;\n break;\n case \"Pages\":\n if (typeof text === \"string\") result.pages = Number(text);\n break;\n case \"Words\":\n if (typeof text === \"string\") result.words = Number(text);\n break;\n case \"Characters\":\n if (typeof text === \"string\") result.characters = Number(text);\n break;\n case \"PresentationFormat\":\n result.presentationFormat = str;\n break;\n case \"Lines\":\n if (typeof text === \"string\") result.lines = Number(text);\n break;\n case \"Paragraphs\":\n if (typeof text === \"string\") result.paragraphs = Number(text);\n break;\n case \"Slides\":\n if (typeof text === \"string\") result.slides = Number(text);\n break;\n case \"Notes\":\n if (typeof text === \"string\") result.notes = Number(text);\n break;\n case \"TotalTime\":\n if (typeof text === \"string\") result.totalTime = Number(text);\n break;\n case \"HiddenSlides\":\n if (typeof text === \"string\") result.hiddenSlides = Number(text);\n break;\n case \"MMClips\":\n if (typeof text === \"string\") result.mmClips = Number(text);\n break;\n case \"HeadingPairs\": {\n const vector = child.elements?.find((e) => e.name === \"vt:vector\");\n const flat = parseVector(vector);\n const pairs: HeadingPairOptions[] = [];\n for (let i = 0; i + 1 < flat.length; i += 2) {\n const name = flat[i];\n const count = flat[i + 1];\n if (typeof name === \"string\" && typeof count === \"number\") {\n pairs.push({ name, count });\n }\n }\n if (pairs.length > 0) result.headingPairs = pairs;\n break;\n }\n case \"TitlesOfParts\": {\n const vector = child.elements?.find((e) => e.name === \"vt:vector\");\n const titles = parseVector(vector).filter((v): v is string => typeof v === \"string\");\n if (titles.length > 0) result.titlesOfParts = titles;\n break;\n }\n case \"ScaleCrop\":\n if (typeof text === \"string\") result.scaleCrop = parseOnOff(text) ?? false;\n break;\n case \"LinksUpToDate\":\n if (typeof text === \"string\") result.linksUpToDate = parseOnOff(text) ?? false;\n break;\n case \"CharactersWithSpaces\":\n if (typeof text === \"string\") result.charactersWithSpaces = Number(text);\n break;\n case \"SharedDoc\":\n if (typeof text === \"string\") result.sharedDoc = parseOnOff(text) ?? false;\n break;\n case \"HyperlinkBase\":\n result.hyperlinkBase = str;\n break;\n case \"HLinks\": {\n const vector = child.elements?.find((e) => e.name === \"vt:vector\");\n const values = parseVector(vector);\n if (values.length > 0) result.hlinks = values;\n break;\n }\n case \"HyperlinksChanged\":\n if (typeof text === \"string\") result.hyperlinksChanged = parseOnOff(text) ?? false;\n break;\n case \"Application\":\n result.application = str;\n break;\n case \"AppVersion\":\n result.appVersion = str;\n break;\n case \"DocSecurity\":\n if (typeof text === \"string\") result.docSecurity = Number(text);\n break;\n }\n }\n return result;\n },\n};\n","/**\n * Custom Properties module — shared OPC part (docProps/custom.xml).\n *\n * Format-agnostic: CT_CustomProperties (ISO-IEC29500-4_2016 shared-documentPropertiesCustom.xsd)\n * is identical across docx/pptx/xlsx.\n *\n * @module\n */\n\nimport { attr, escapeXml } from \"@office-open/xml\";\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport {\n defaultVariantTag,\n parseVariantValue,\n stringifyVariantValue,\n type VariantValue,\n} from \"./variant-types\";\n\n/**\n * Options for a single custom property.\n *\n * @property name - The property name\n * @property value - The property value; the JS type picks the vt:* element\n * (string → lpwstr, number → i4/r8, boolean → bool, Date → filetime)\n */\nexport interface CustomPropertyOptions {\n /** The property name */\n name: string;\n /** The property value (as string) */\n value: VariantValue;\n /**\n * Source vt:* element spelling (round-trip), set only when the default JS\n * mapping would rewrite it — an integer carried as vt:r8 would otherwise\n * re-emit as vt:i4.\n */\n valueType?: string;\n}\n\n/** Input shape for the custom-properties descriptor. */\nexport interface CustomPropertiesInput {\n properties: CustomPropertyOptions[];\n}\n\nexport const customPropertiesDesc: CustomDescriptor<CustomPropertiesInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n const p: string[] = [\n '<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties\"' +\n ' xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">',\n ];\n let pid = 2;\n for (const prop of opts.properties) {\n p.push(\n `<property fmtid=\"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}\" pid=\"${pid}\" name=\"${escapeXml(prop.name)}\">` +\n stringifyVariantValue(prop.value, prop.valueType) +\n `</property>`,\n );\n pid++;\n }\n p.push(\"</Properties>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const properties: CustomPropertyOptions[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"property\") continue;\n const name = attr(child, \"name\");\n if (!name) continue;\n\n // The value element is a single vt:* scalar (lpwstr, i4, bool, …)\n const valueEl = child.elements?.find((e) => e.name?.startsWith(\"vt:\"));\n if (valueEl) {\n const value = parseVariantValue(valueEl);\n if (value !== undefined) {\n const prop: CustomPropertyOptions = { name, value };\n if (valueEl.name && valueEl.name !== defaultVariantTag(value))\n prop.valueType = valueEl.name;\n properties.push(prop);\n }\n }\n }\n return { properties };\n },\n};\n","/**\n * Encrypted OOXML container detection and passthrough helpers.\n *\n * Password-protected OOXML files (ECMA-376 agile/standard encryption) wrap\n * the OPC package inside an OLE2/CFB compound file. The plaintext is not\n * recoverable without the password, so parse() carries the original bytes on\n * the options and generate() re-emits them verbatim instead of compiling.\n *\n * @module\n */\n\nimport type { DataType } from \"../util/data-type\";\nimport { toUint8Array } from \"../util/data-type\";\nimport type { OutputByType, OutputType } from \"./output\";\nimport { convertOutput } from \"./output\";\n\n/** OLE2/CFB compound-file signature shared by every encrypted OOXML file. */\nconst CFB_SIGNATURE = [0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1] as const;\n\n/**\n * Verbatim payload of a source file whose OOXML package is encrypted.\n * Round-trip only: the bytes are the only faithful representation until the\n * file is decrypted; every other options field stays empty.\n */\nexport interface EncryptedContainerOptions {\n /** Complete source file bytes (OLE2/CFB container). */\n data: DataType;\n}\n\n/** Whether `data` is an OLE2/CFB container — i.e. an encrypted OOXML file. */\nexport function isEncryptedContainer(data: Uint8Array): boolean {\n return data.length >= CFB_SIGNATURE.length && CFB_SIGNATURE.every((b, i) => data[i] === b);\n}\n\n/**\n * Converted output for an encrypted-container file, or `undefined` when the\n * options carry no encrypted payload (the normal compile path applies).\n */\nexport function encryptedContainerOutput<T extends OutputType>(\n file: { encrypted?: EncryptedContainerOptions },\n type: T,\n mimeType: string,\n): OutputByType[T] | undefined {\n const { encrypted } = file;\n if (!encrypted) return undefined;\n return convertOutput(toUint8Array(encrypted.data), type, mimeType);\n}\n\n/** Streaming variant of {@link encryptedContainerOutput}. */\nexport function encryptedContainerStream(file: {\n encrypted?: EncryptedContainerOptions;\n}): ReadableStream<Uint8Array> | undefined {\n const { encrypted } = file;\n if (!encrypted) return undefined;\n const bytes = toUint8Array(encrypted.data);\n return new ReadableStream<Uint8Array>({\n start(c) {\n c.enqueue(bytes);\n c.close();\n },\n });\n}\n\n/**\n * Reject encrypted passthrough mixed with real content: generate() re-emits\n * the encrypted bytes, so every other field would be silently dropped.\n *\n * `hasContent` is the package's primary content collection being non-empty\n * (e.g. `sections.length > 0`) — callers know their own shape.\n */\nexport function assertEncryptedExclusive(\n file: { encrypted?: EncryptedContainerOptions },\n hasContent: boolean,\n): void {\n if (file.encrypted && hasContent) {\n throw new Error(\n \"Encrypted passthrough carries no editable content — clear the content fields or drop `encrypted`.\",\n );\n }\n}\n","/**\n * Namespace URI → canonical prefix table for parse-time normalization.\n *\n * Producers are free to bind any prefix to a namespace (XML namespaces say\n * the prefix is arbitrary), and real-world generators do: pandoc writes\n * `ns0:`, ClosedXML binds the spreadsheet namespace to `x:`. Everything\n * downstream of the parser — descriptor `findChild(\"w:p\")` calls, registry\n * path matching — addresses elements by the canonical prefixes this library\n * itself emits, so non-canonical sources parsed blind.\n *\n * Feeding this table to the XML parser's `normalizeNamespaces` rewrites every\n * element and attribute name onto the canonical prefix (an empty value means\n * the canonical form is unprefixed — the sml and OPC namespaces), while\n * unknown URIs keep their source prefix and `xmlns` declarations follow the\n * rewrite so serialized output stays self-consistent.\n *\n * The table mirrors the prefixes this library's own stringify output uses —\n * when a new namespace appears in a part template, add it here in the same\n * change. Strict-OOXML variants (`purl.oclc.org`) are deliberately absent:\n * mapping them would silently convert strict packages to transitional.\n */\n\nconst SCHEMAS_OPENXML = \"http://schemas.openxmlformats.org\";\nconst SCHEMAS_MS = \"http://schemas.microsoft.com\";\n\n/**\n * Obsolete namespace URIs accepted by Office and the Open XML SDK, mapped to\n * their final standardized forms. A round-trip must normalize passthrough XML\n * too: rebuilding modeled parts with the final URI while carrying an obsolete\n * URI verbatim in a raw part creates a mixed-dialect package that Word rejects.\n *\n * Keep this aligned with Open XML SDK's OpenXmlNamespaceResolver\n * `_extendedNamespaces` table.\n */\nconst OOXML_OBSOLETE_NAMESPACE_ALIASES: Readonly<Record<string, string>> = {\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/3/main`]: `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`,\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/5/main`]: `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`,\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/6/main`]: `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`,\n [`${SCHEMAS_OPENXML}/spreadsheetml/2006/5/main`]: `${SCHEMAS_OPENXML}/spreadsheetml/2006/main`,\n [`${SCHEMAS_OPENXML}/spreadsheetml/2006/7/main`]: `${SCHEMAS_OPENXML}/spreadsheetml/2006/main`,\n [`${SCHEMAS_OPENXML}/presentationml/2006/3/main`]: `${SCHEMAS_OPENXML}/presentationml/2006/main`,\n [`${SCHEMAS_OPENXML}/drawingml/2006/3/main`]: `${SCHEMAS_OPENXML}/drawingml/2006/main`,\n [`${SCHEMAS_MS}/office/word/2010/11/wordml`]: `${SCHEMAS_MS}/office/word/2012/wordml`,\n};\n\n/**\n * Normalize obsolete OOXML namespace URI bytes without reparsing or\n * reserializing the XML. Byte-level replacement preserves every other source\n * detail (declaration, whitespace, prefix choices, attribute order, and line\n * endings), which is required for passthrough parts.\n */\nexport function normalizeObsoleteNamespaceAliases(data: Uint8Array): Uint8Array {\n let result = data;\n for (const pattern of OBSOLETE_PATTERNS) {\n result = replaceAsciiBytes(result, pattern);\n }\n return result;\n}\n\nfunction isNamespaceDeclarationValue(\n data: Uint8Array,\n valueOffset: number,\n valueLength: number,\n): boolean {\n const quote = data[valueOffset - 1];\n if ((quote !== 34 && quote !== 39) || data[valueOffset + valueLength] !== quote) return false;\n let i = valueOffset - 2;\n while (i >= 0 && (data[i] === 32 || data[i] === 9 || data[i] === 10 || data[i] === 13)) i--;\n if (data[i] !== 61) return false; // =\n i--;\n while (i >= 0 && (data[i] === 32 || data[i] === 9 || data[i] === 10 || data[i] === 13)) i--;\n const nameEnd = i + 1;\n while (\n i >= 0 &&\n ((data[i]! >= 65 && data[i]! <= 90) ||\n (data[i]! >= 97 && data[i]! <= 122) ||\n (data[i]! >= 48 && data[i]! <= 57) ||\n data[i] === 58 ||\n data[i] === 45 ||\n data[i] === 95)\n ) {\n i--;\n }\n // Byte compare against \"xmlns\"/\"xmlns:…\" — a decode would allocate a string\n // per hit just to test a fixed prefix. The name is the full attribute name,\n // so \"xmlns:foo\" (any prefix length) qualifies too.\n const nameStart = i + 1;\n const nameLen = nameEnd - nameStart;\n if (nameLen < 5) return false;\n for (let k = 0; k < 5; k++) {\n if (data[nameStart + k] !== XMLNS_BYTES[k]) return false;\n }\n return nameLen === 5 || data[nameStart + 5] === 58; // ':'\n}\n\n/** \"xmlns\" as bytes — module constant so the hit-path compare allocates nothing. */\nconst XMLNS_BYTES = Uint8Array.from([120, 109, 108, 110, 115]);\n\nfunction replaceAsciiBytes(\n data: Uint8Array,\n pattern: { needle: Uint8Array; value: Uint8Array },\n): Uint8Array {\n const { needle, value } = pattern;\n const positions: number[] = [];\n // Candidate scan driven by Uint8Array.indexOf (a native memchr in V8/JSC):\n // a per-byte loop walked every offset of multi-MB passthrough parts, while\n // indexOf skips between first-byte candidates at memory bandwidth.\n const first = needle[0]!;\n const lastStart = data.length - needle.length;\n let i = data.indexOf(first);\n while (i !== -1) {\n if (i <= lastStart) {\n let matches = true;\n for (let j = 1; j < needle.length; j++) {\n if (data[i + j] !== needle[j]!) {\n matches = false;\n break;\n }\n }\n if (matches && isNamespaceDeclarationValue(data, i, needle.length)) {\n positions.push(i);\n i += needle.length - 1; // skip past the match (the +1 below resumes after it)\n }\n }\n i = data.indexOf(first, i + 1);\n }\n if (positions.length === 0) return data;\n\n const out = new Uint8Array(data.length + positions.length * (value.length - needle.length));\n let sourceOffset = 0;\n let targetOffset = 0;\n for (const position of positions) {\n const prefix = data.subarray(sourceOffset, position);\n out.set(prefix, targetOffset);\n targetOffset += prefix.length;\n out.set(value, targetOffset);\n targetOffset += value.length;\n sourceOffset = position + needle.length;\n }\n out.set(data.subarray(sourceOffset), targetOffset);\n return out;\n}\n\n// Needle/value pairs encoded once at module load — the per-call\n// TextEncoder().encode() pair allocated on every passthrough part.\nconst OBSOLETE_PATTERNS: ReadonlyArray<{ needle: Uint8Array; value: Uint8Array }> = Object.entries(\n OOXML_OBSOLETE_NAMESPACE_ALIASES,\n).map(([obsolete, finalUri]) => ({\n needle: new TextEncoder().encode(obsolete),\n value: new TextEncoder().encode(finalUri),\n}));\n\nexport const OOXML_CANONICAL_PREFIXES: Readonly<Record<string, string>> = {\n // Obsolete aliases resolve through their final namespace's canonical prefix.\n ...Object.fromEntries(\n Object.entries(OOXML_OBSOLETE_NAMESPACE_ALIASES).map(([oldUri, finalUri]) => [\n oldUri,\n finalUri === `${SCHEMAS_OPENXML}/spreadsheetml/2006/main`\n ? \"\"\n : finalUri === `${SCHEMAS_OPENXML}/presentationml/2006/main`\n ? \"p\"\n : finalUri === `${SCHEMAS_OPENXML}/drawingml/2006/main`\n ? \"a\"\n : finalUri === `${SCHEMAS_OPENXML}/wordprocessingml/2006/main`\n ? \"w\"\n : \"w15\",\n ]),\n ),\n\n // ── Main format namespaces ──\n [`${SCHEMAS_OPENXML}/wordprocessingml/2006/main`]: \"w\",\n [`${SCHEMAS_OPENXML}/presentationml/2006/main`]: \"p\",\n // spreadsheetml canonical form is the default (unprefixed) namespace\n [`${SCHEMAS_OPENXML}/spreadsheetml/2006/main`]: \"\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/main`]: \"a\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/relationships`]: \"r\",\n [`${SCHEMAS_OPENXML}/markup-compatibility/2006`]: \"mc\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/math`]: \"m\",\n\n // ── DrawingML variants ──\n [`${SCHEMAS_OPENXML}/drawingml/2006/wordprocessingDrawing`]: \"wp\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/spreadsheetDrawing`]: \"xdr\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/chart`]: \"c\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/chartDrawing`]: \"cdr\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/diagram`]: \"dgm\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/lockedCanvas`]: \"lc\",\n [`${SCHEMAS_OPENXML}/drawingml/2006/picture`]: \"pic\",\n\n // ── OPC package namespaces (canonical form: unprefixed) ──\n [`${SCHEMAS_OPENXML}/package/2006/relationships`]: \"\",\n [`${SCHEMAS_OPENXML}/package/2006/content-types`]: \"\",\n [`${SCHEMAS_OPENXML}/package/2006/metadata/core-properties`]: \"\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/extended-properties`]: \"\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/custom-properties`]: \"\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/docPropsVTypes`]: \"vt\",\n [`${SCHEMAS_OPENXML}/officeDocument/2006/bibliography`]: \"b\",\n\n // ── VML family ──\n \"urn:schemas-microsoft-com:vml\": \"v\",\n \"urn:schemas-microsoft-com:office:office\": \"o\",\n \"urn:schemas-microsoft-com:office:word\": \"w10\",\n \"urn:schemas-microsoft-com:office:excel\": \"x\",\n \"urn:schemas-microsoft-com:office:powerpoint\": \"pvml\",\n\n // ── Word extensions ──\n [`${SCHEMAS_MS}/office/word/2006/wordml`]: \"wne\",\n [`${SCHEMAS_MS}/office/word/2010/wordml`]: \"w14\",\n [`${SCHEMAS_MS}/office/word/2010/11/wordml`]: \"w15\",\n [`${SCHEMAS_MS}/office/word/2012/wordml`]: \"w15\",\n [`${SCHEMAS_MS}/office/word/2016/wordml/cid`]: \"w16cid\",\n [`${SCHEMAS_MS}/office/word/2018/wordml`]: \"w16\",\n [`${SCHEMAS_MS}/office/word/2018/wordml/cex`]: \"w16cex\",\n [`${SCHEMAS_MS}/office/word/2020/wordml/sdtdatahash`]: \"w16sdtdh\",\n [`${SCHEMAS_MS}/office/word/2015/wordml/symex`]: \"w16se\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingDrawing`]: \"wp14\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingCanvas`]: \"wpc\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingGroup`]: \"wpg\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingInk`]: \"wpi\",\n [`${SCHEMAS_MS}/office/word/2010/wordprocessingShape`]: \"wps\",\n\n // ── Drawing extensions ──\n [`${SCHEMAS_MS}/office/drawing/2010/main`]: \"a14\",\n [`${SCHEMAS_MS}/office/drawing/2014/main`]: \"a16\",\n [`${SCHEMAS_MS}/office/drawing/2016/ink`]: \"aink\",\n [`${SCHEMAS_MS}/office/drawing/2017/model3d`]: \"am3d\",\n [`${SCHEMAS_MS}/office/drawing/2016/SVG/main`]: \"asvg\",\n [`${SCHEMAS_MS}/office/drawing/2007/8/2/chart`]: \"c14\",\n [`${SCHEMAS_MS}/office/drawing/2008/diagram`]: \"dsp\",\n [`${SCHEMAS_MS}/office/drawing/2014/chartex`]: \"cx\",\n [`${SCHEMAS_MS}/office/drawing/2015/9/8/chartex`]: \"cx1\",\n [`${SCHEMAS_MS}/office/drawing/2015/10/21/chartex`]: \"cx2\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/9/chartex`]: \"cx3\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/10/chartex`]: \"cx4\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/11/chartex`]: \"cx5\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/12/chartex`]: \"cx6\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/13/chartex`]: \"cx7\",\n [`${SCHEMAS_MS}/office/drawing/2016/5/14/chartex`]: \"cx8\",\n [`${SCHEMAS_MS}/office/2019/extlst`]: \"oel\",\n\n // ── PowerPoint extensions ──\n [`${SCHEMAS_MS}/office/powerpoint/2010/main`]: \"p14\",\n [`${SCHEMAS_MS}/office/powerpoint/2015/main`]: \"p15\",\n\n // ── Excel extensions ──\n [`${SCHEMAS_MS}/office/spreadsheetml/2009/9/main`]: \"x14\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2009/9/ac`]: \"x14ac\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2010/11/main`]: \"x15\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2010/11/ac`]: \"x15ac\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2014/revision`]: \"xr\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2015/revision2`]: \"xr2\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2016/revision3`]: \"xr3\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2016/revision6`]: \"xr6\",\n [`${SCHEMAS_MS}/office/spreadsheetml/2016/revision10`]: \"xr10\",\n};\n","import { parse, stringify } from \"@office-open/xml\";\nimport type { Element, ParseOptions } from \"@office-open/xml\";\nimport { unzipSync, zipSync, strFromU8, strToU8, type ZipOptions, type Zippable } from \"fflate\";\n\nimport { OOXML_CANONICAL_PREFIXES } from \"./namespaces\";\nimport { levelForMediaName, ZIP_MEDIA_LEVEL } from \"./packer\";\nimport { hasNativeInflate, nativeUnzip } from \"./zip-native\";\n\nconst XML_PARSE_OPTIONS = {\n nativeTypeAttributes: true,\n captureSpacesBetweenElements: true,\n // Normalize namespace prefixes to the canonical ones the library itself\n // emits — sources binding the Word namespace to ns0: or the spreadsheet\n // namespace to x: parse into canonical names, so descriptor matching and\n // registry paths see the elements they address.\n normalizeNamespaces: OOXML_CANONICAL_PREFIXES,\n};\n\n/**\n * Parsed OOXML archive backed by an unzipped ZIP map.\n *\n * Provides unstorage-style API (get/set/getRaw/setRaw/remove/has/keys)\n * for reading and modifying individual parts, then serializing back to a ZIP buffer.\n */\nexport class ParsedArchive {\n private readonly zip: Map<string, Uint8Array>;\n private readonly modified = new Map<string, Uint8Array>();\n private readonly wrapperCache = new Map<string, Element>();\n\n public constructor(data: Uint8Array) {\n // Native inflate is the fast path; on any failure (unsupported ZIP variant\n // or corruption) fall back to fflate unzipSync, the reference implementation.\n let unzipped: Record<string, Uint8Array>;\n try {\n unzipped = hasNativeInflate() ? nativeUnzip(data) : unzipSync(data);\n } catch {\n unzipped = unzipSync(data);\n }\n this.zip = new Map(Object.entries(unzipped));\n }\n\n /**\n * Read an XML part as an Element tree. `parseOptions` extends the default\n * XML parse options for this part (e.g. `deferElements` to capture a hot\n * container's inner XML verbatim). Callers must use consistent options per\n * path — the wrapper cache is keyed by path only.\n */\n public get(path: string, parseOptions?: ParseOptions): Element | undefined {\n const opts = parseOptions ? { ...XML_PARSE_OPTIONS, ...parseOptions } : XML_PARSE_OPTIONS;\n // Check modified first\n const modData = this.modified.get(path);\n if (modData) {\n const wrapper = parse(strFromU8(modData), opts) as Element;\n this.wrapperCache.set(path, wrapper);\n return wrapper.elements?.find((e) => e.type === \"element\");\n }\n\n const data = this.zip.get(path);\n if (data === undefined) return undefined;\n\n // Try cache\n const cached = this.wrapperCache.get(path);\n if (cached) return cached.elements?.find((e) => e.type === \"element\");\n\n // Parse and cache\n const wrapper = parse(strFromU8(data), opts) as Element;\n this.wrapperCache.set(path, wrapper);\n return wrapper.elements?.find((e) => e.type === \"element\");\n }\n\n /** Write an XML part (Element → XML string). */\n public set(path: string, element: Element): void {\n const wrapper = this.wrapperCache.get(path);\n const doc: Element = wrapper\n ? { ...wrapper, elements: [{ ...element, type: \"element\" as const }] }\n : { elements: [{ ...element, type: \"element\" as const }] };\n const xml = stringify(doc);\n this.modified.set(path, strToU8(xml));\n }\n\n /** Read raw binary data (images, media, etc.). */\n public getRaw(path: string): Uint8Array | undefined {\n return this.modified.get(path) ?? this.zip.get(path);\n }\n\n /** Write raw binary data. */\n public setRaw(path: string, data: Uint8Array): void {\n this.modified.set(path, data);\n this.wrapperCache.delete(path);\n }\n\n /** Remove a part. Returns true if it existed. */\n public remove(path: string): boolean {\n this.wrapperCache.delete(path);\n return this.modified.delete(path) || this.zip.delete(path);\n }\n\n /** Check if a part exists. */\n public has(path: string): boolean {\n return this.modified.has(path) || this.zip.has(path);\n }\n\n /** List all paths matching an optional prefix. */\n public keys(prefix?: string): string[] {\n const all = new Set<string>();\n for (const key of this.zip.keys()) {\n if (!prefix || key.startsWith(prefix)) all.add(key);\n }\n for (const key of this.modified.keys()) {\n if (!prefix || key.startsWith(prefix)) all.add(key);\n }\n return [...all];\n }\n\n /** Serialize back to a ZIP buffer, merging original zip + modifications. */\n public save(): Uint8Array {\n const files: Zippable = {};\n for (const [path, data] of this.zip) {\n if (!this.modified.has(path)) {\n files[path] = [\n data,\n { level: levelForMediaName(path, ZIP_MEDIA_LEVEL) as ZipOptions[\"level\"] },\n ];\n }\n }\n for (const [path, data] of this.modified) {\n files[path] = [\n data,\n { level: levelForMediaName(path, ZIP_MEDIA_LEVEL) as ZipOptions[\"level\"] },\n ];\n }\n return zipSync(files);\n }\n}\n\n/** Parse an OOXML archive (.docx, .pptx, .xlsx) into a ParsedArchive. */\nexport function parseArchive(data: Uint8Array): ParsedArchive {\n return new ParsedArchive(data);\n}\n","/**\n * OPC (Open Packaging Convention) consistency validator.\n *\n * Pure function operating on an already-unzipped part map. Detects the three\n * classes of cross-part breakage that single-part XSD validation cannot see:\n *\n * - relationship integrity — dangling targets, undeclared r:id references,\n * duplicate rIds (O3/O4/O7)\n * - content-type integrity — parts with no Override/Default, stale\n * Overrides pointing at absent parts (O5/O6)\n * - structural integrity — missing `always` parts, undeclared orphans\n * (O1/O2)\n *\n * O3/O4/O5/O6/O7 are derived directly from the ZIP + `.rels` + `[Content_Types].xml`\n * and need no registry. O1/O2 consult {@link PackagePartRegistry}.\n *\n * Reference: ECMA-376 Part 2 (OPC).\n *\n * @module\n */\nimport { parse } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\n\nimport type { PackagePartRegistry } from \"./part-registry\";\n\nexport type OpcSeverity = \"error\" | \"warn\";\n\nexport type OpcCode = \"O1\" | \"O2\" | \"O3\" | \"O4\" | \"O5\" | \"O6\" | \"O7\";\n\nexport interface OpcIssue {\n code: OpcCode;\n severity: OpcSeverity;\n /** Path of the offending part, `.rels`, or Override `PartName`. */\n part: string;\n message: string;\n}\n\ninterface RelationshipEntry {\n id: string;\n type: string;\n target: string;\n targetMode?: string;\n}\n\ninterface ParsedRels {\n relsPath: string;\n entries: readonly RelationshipEntry[];\n}\n\ninterface ContentTypesDoc {\n defaults: ReadonlyMap<string, string>;\n overrides: ReadonlyMap<string, string>;\n}\n\n// ── XML parsing helpers ─────────────────────────────────────────────────────\n\nfunction rootElement(xml: string): Element | undefined {\n try {\n const wrapper = parse(xml) as Element;\n return wrapper.elements?.find((e) => e.type === \"element\");\n } catch {\n return undefined;\n }\n}\n\nfunction parseContentTypes(entries: ReadonlyMap<string, string>): ContentTypesDoc {\n const defaults = new Map<string, string>();\n const overrides = new Map<string, string>();\n const xml = entries.get(\"[Content_Types].xml\");\n const root = xml ? rootElement(xml) : undefined;\n if (!root) return { defaults, overrides };\n for (const child of root.elements ?? []) {\n if (child.type !== \"element\") continue;\n if (child.name === \"Default\") {\n const ext = String(child.attributes?.Extension ?? \"\").toLowerCase();\n const ct = String(child.attributes?.ContentType ?? \"\");\n if (ext && ct) defaults.set(ext, ct);\n } else if (child.name === \"Override\") {\n const partName = normalizePartName(String(child.attributes?.PartName ?? \"\"));\n const ct = String(child.attributes?.ContentType ?? \"\");\n if (partName && ct) overrides.set(partName, ct);\n }\n }\n return { defaults, overrides };\n}\n\nfunction parseAllRels(entries: ReadonlyMap<string, string>): ParsedRels[] {\n const out: ParsedRels[] = [];\n for (const [relsPath, xml] of entries) {\n if (!relsPath.endsWith(\".rels\")) continue;\n const root = rootElement(xml);\n if (!root) continue;\n const list: RelationshipEntry[] = [];\n for (const child of root.elements ?? []) {\n if (child.type !== \"element\" || child.name !== \"Relationship\") continue;\n list.push({\n id: String(child.attributes?.Id ?? \"\"),\n type: String(child.attributes?.Type ?? \"\"),\n target: String(child.attributes?.Target ?? \"\"),\n targetMode: child.attributes?.TargetMode ? String(child.attributes?.TargetMode) : undefined,\n });\n }\n out.push({ relsPath, entries: list });\n }\n return out;\n}\n\n/** Strip the leading slash OPC uses on `PartName` to align with ZIP paths. */\nfunction normalizePartName(partName: string): string {\n return partName.startsWith(\"/\") ? partName.slice(1) : partName;\n}\n\n/**\n * Resolve a relationship `Target` (relative to its owning `.rels`) against the\n * ZIP root. Handles the `..` segments slides/masters use to reference siblings.\n */\nfunction resolveRelTarget(relsPath: string, target: string): string {\n const slash = relsPath.lastIndexOf(\"/\");\n const relsDir = slash === -1 ? \"\" : relsPath.slice(0, slash);\n // `<partDir>/_rels` → `<partDir>`; root-level `_rels` → \"\"\n const base =\n relsDir === \"_rels\" ? \"\" : relsDir.endsWith(\"/_rels\") ? relsDir.slice(0, -6) : relsDir;\n const segments = (base ? base.split(\"/\") : []).concat(target.split(\"/\"));\n const resolved: string[] = [];\n for (const seg of segments) {\n if (seg === \"\" || seg === \".\") continue;\n if (seg === \"..\") resolved.pop();\n else resolved.push(seg);\n }\n return resolved.join(\"/\");\n}\n\n/** Compile a registry path template (with `${i}`) into an anchored matcher. */\nfunction pathMatcher(template: string): RegExp {\n const marked = template.replace(/\\$\\{i\\}/g, \"\u0000\");\n const escaped = marked.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const pattern = escaped.replace(/\u0000/g, \"(\\\\d+)\");\n return new RegExp(`^${pattern}$`);\n}\n\nfunction extensionOf(path: string): string {\n const dot = path.lastIndexOf(\".\");\n return dot === -1 ? \"\" : path.slice(dot + 1).toLowerCase();\n}\n\n/**\n * Reference attributes in the officeDocument relationships namespace — every\n * one resolves against the owning part's `.rels`. Escaped text can never match\n * (a literal `\"` in text is `"`), so hits are always real attributes.\n */\nconst REL_REF_ATTR_RE = /\\br:(?:id|embed|link|dm|lo|qs|cs|pict)=\"([^\"]*)\"/g;\n\n/** `word/_rels/document.xml.rels` → `word/document.xml`; package rels → undefined. */\nfunction partOfRels(relsPath: string): string | undefined {\n const slash = relsPath.lastIndexOf(\"/\");\n const dir = slash === -1 ? \"\" : relsPath.slice(0, slash);\n const name = relsPath.slice(slash + 1).replace(/\\.rels$/, \"\");\n if (dir === \"_rels\") return name === \"\" ? undefined : name;\n if (dir.endsWith(\"/_rels\")) return `${dir.slice(0, -6)}/${name}`;\n return undefined;\n}\n\n// ── Validator ───────────────────────────────────────────────────────────────\n\n/**\n * Validate OPC consistency of an unzipped package.\n *\n * @param entries ZIP path → decoded XML/binary text. Binary parts (media,\n * fonts) are never parsed here — only their presence matters.\n * @param registry Declarative part expectations for the package format.\n * @returns Issues sorted by code then part. Empty array = consistent.\n */\nexport function validateOpcConsistency(\n entries: ReadonlyMap<string, string>,\n registry: PackagePartRegistry,\n): OpcIssue[] {\n const issues: OpcIssue[] = [];\n const contentTypes = parseContentTypes(entries);\n const relsFiles = parseAllRels(entries);\n\n // O2 — missing `always` part. Conditional/repeated absences are legitimate.\n for (const def of registry.parts) {\n if (def.presence.kind !== \"always\" || def.path.includes(\"${i}\")) continue;\n if (!entries.has(def.path)) {\n issues.push({\n code: \"O2\",\n severity: \"error\",\n part: def.path,\n message: `required ${registry.format} part is absent from the package`,\n });\n }\n }\n\n // O1 — orphan part: present but not declared and not whitelisted.\n const matchers = registry.parts.map((def) => pathMatcher(def.path));\n for (const path of entries.keys()) {\n if (path === \"[Content_Types].xml\") continue;\n if (path.endsWith(\".rels\")) continue;\n if (registry.orphanWhitelist.some((prefix) => path.startsWith(prefix))) continue;\n if (matchers.some((re) => re.test(path))) continue;\n issues.push({\n code: \"O1\",\n severity: \"warn\",\n part: path,\n message: `part not declared in the ${registry.format} registry (possible orphan)`,\n });\n }\n\n // O3 — dangling internal relationship target.\n for (const rf of relsFiles) {\n for (const rel of rf.entries) {\n if (rel.targetMode === \"External\") continue;\n if (/^https?:\\/\\//i.test(rel.target)) continue;\n const resolved = resolveRelTarget(rf.relsPath, rel.target);\n if (!resolved || entries.has(resolved)) continue;\n issues.push({\n code: \"O3\",\n severity: \"error\",\n part: rf.relsPath,\n message: `relationship ${rel.id || \"(no Id)\"} (${rel.type}) Target \"${rel.target}\" resolves to absent part \"${resolved}\"`,\n });\n }\n }\n\n // O4 — relationship reference integrity: every r:* reference attribute in a\n // part must be declared by that part's own .rels. An undeclared reference —\n // a hand-written rId, or an unreplaced `{key}` placeholder — makes Office\n // report the package as corrupt. External-mode relationships declare their\n // id like any other, so they satisfy references too.\n const relIdsByPart = new Map<string, Set<string>>();\n for (const rf of relsFiles) {\n const part = partOfRels(rf.relsPath);\n if (part === undefined) continue;\n const ids = relIdsByPart.get(part) ?? new Set<string>();\n for (const r of rf.entries) ids.add(r.id);\n relIdsByPart.set(part, ids);\n }\n for (const [path, xml] of entries) {\n if (path === \"[Content_Types].xml\" || path.endsWith(\".rels\") || !path.endsWith(\".xml\")) {\n continue;\n }\n const declared = relIdsByPart.get(path);\n const reported = new Set<string>();\n REL_REF_ATTR_RE.lastIndex = 0;\n for (let m = REL_REF_ATTR_RE.exec(xml); m; m = REL_REF_ATTR_RE.exec(xml)) {\n const ref = m[1]!;\n if (declared?.has(ref) || reported.has(ref)) continue;\n reported.add(ref);\n issues.push({\n code: \"O4\",\n severity: \"error\",\n part: path,\n message: `r:id/r:embed reference \"${ref}\" is not declared by the part's .rels`,\n });\n }\n }\n\n // O5 — part present but no Override covers it and no Default covers its\n // extension. Word rejects such parts as unreadable content.\n for (const path of entries.keys()) {\n if (path === \"[Content_Types].xml\" || path.endsWith(\".rels\")) continue;\n if (contentTypes.overrides.has(path)) continue;\n const ext = extensionOf(path);\n if (ext && contentTypes.defaults.has(ext)) continue;\n issues.push({\n code: \"O5\",\n severity: \"error\",\n part: path,\n message: `part has no [Content_Types] Override and no Default covers extension \"${ext || \"(none)\"}\"`,\n });\n }\n\n // O6 — stale Override: [Content_Types] declares a part that is not in the ZIP.\n for (const partName of contentTypes.overrides.keys()) {\n if (entries.has(partName)) continue;\n issues.push({\n code: \"O6\",\n severity: \"error\",\n part: `/${partName}`,\n message: `[Content_Types] Override references absent part \"${partName}\"`,\n });\n }\n\n // O7 — duplicate relationship Id within a single .rels part.\n for (const rf of relsFiles) {\n const counts = new Map<string, number>();\n for (const rel of rf.entries) {\n if (!rel.id) continue;\n counts.set(rel.id, (counts.get(rel.id) ?? 0) + 1);\n }\n for (const [id, count] of counts) {\n if (count <= 1) continue;\n issues.push({\n code: \"O7\",\n severity: \"warn\",\n part: rf.relsPath,\n message: `duplicate relationship Id \"${id}\" appears ${count} times`,\n });\n }\n }\n\n return issues.sort((a, b) =>\n a.code === b.code ? a.part.localeCompare(b.part) : a.code.localeCompare(b.code),\n );\n}\n\nexport function summarizeOpcIssues(issues: readonly OpcIssue[]): {\n errors: number;\n warnings: number;\n} {\n let errors = 0;\n let warnings = 0;\n for (const i of issues) {\n if (i.severity === \"error\") errors++;\n else warnings++;\n }\n return { errors, warnings };\n}\n","/**\n * Declarative part registry — the machine-readable source of truth for which\n * parts each OOXML package is expected to contain.\n *\n * Consumed by {@link validateOpcConsistency} to detect two failure classes the\n * XSD single-part validator cannot see:\n * - O1 orphan part — a part present in the ZIP that no rule accounts for\n * - O2 missing part — an `always` part the ZIP lacks\n *\n * Content-type and relationship integrity (O3/O5/O6/O7) are derived directly\n * from the ZIP + `.rels` + `[Content_Types].xml`, so they need no registry.\n *\n * Presence semantics:\n * - `always` — present in *any* valid package (content-types map,\n * root rels, main part only). O2 fires when absent. Kept\n * minimal so template/round-trip packages — whose\n * `[Content_Types]` and part set are passed through from a\n * source rather than rebuilt — do not false-positive.\n * - `conditional` — emitted by a fresh `compileDocument` run but a\n * round-tripped/template package may omit it. Absence is\n * legitimate; O6 (stale Override) still catches the case\n * where its content type is declared but the part is gone.\n * - `repeated` — one per index (slides, worksheets, headers, …).\n *\n * Reference: ECMA-376 Part 2 (OPC). Content-type values mirror the per-package\n * `content-types.ts` builders; relationship `@Type` URLs mirror\n * {@link RelationshipType}.\n *\n * @module\n */\n\nexport type PartPresence =\n | { readonly kind: \"always\" }\n | { readonly kind: \"conditional\"; readonly flag: string }\n | { readonly kind: \"repeated\"; readonly countFrom: string };\n\nexport interface PartDefinition {\n /**\n * ZIP path template. `${i}` expands per repeated index (1-based); a template\n * without the placeholder denotes a singleton part.\n */\n path: string;\n /**\n * `[Content_Types].xml` Override value the part carries when generated.\n * `undefined` when the part relies on a `<Default>` extension mapping\n * (e.g. media, fonts, docx theme under raw-part passthrough).\n */\n contentType?: string;\n presence: PartPresence;\n}\n\nexport interface PackagePartRegistry {\n format: \"docx\" | \"pptx\" | \"xlsx\";\n parts: readonly PartDefinition[];\n /**\n * Path prefixes that are always legitimate even when undeclared — media,\n * fonts, embeddings, altChunks, custom XML, and `.rels` parts. Used to\n * suppress O1 false positives from round-tripped / pass-through content.\n */\n orphanWhitelist: readonly string[];\n}\n\n// ── DOCX ────────────────────────────────────────────────────────────────────\n\nexport const DOCX_PARTS = {\n format: \"docx\",\n orphanWhitelist: [\n \"word/media/\",\n \"word/fonts/\",\n \"word/embeddings/\",\n \"word/afchunks/\",\n \"customXml/\",\n \"_rels/\",\n \"word/_rels/\",\n \"docProps/\",\n \"[Content_Types].xml\",\n ],\n parts: [\n { path: \"[Content_Types].xml\", presence: { kind: \"always\" } },\n { path: \"_rels/.rels\", presence: { kind: \"always\" } },\n {\n path: \"word/document.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\",\n presence: { kind: \"always\" },\n },\n {\n path: \"word/styles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n // Legacy Word 2010 styles-with-effects part (deprecated by ISO 29500);\n // round-tripped verbatim via rawParts. itemN.xml custom-XML parts need\n // no Override (the xml Default covers them), their itemProps do.\n path: \"word/stylesWithEffects.xml\",\n contentType: \"application/vnd.ms-word.stylesWithEffects+xml\",\n presence: { kind: \"conditional\", flag: \"source carried the legacy part\" },\n },\n {\n path: \"customXml/itemProps${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.customXmlProperties+xml\",\n presence: { kind: \"repeated\", countFrom: \"customXml items\" },\n },\n {\n path: \"word/numbering.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/footnotes.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/endnotes.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/settings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"word/fontTable.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/core.xml\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/app.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n // Emitted only when custom properties exist (parsed presence or fresh\n // authoring); Word omits both the part and its Override otherwise.\n path: \"docProps/custom.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.custom-properties+xml\",\n presence: { kind: \"conditional\", flag: \"hasCustomProperties\" },\n },\n {\n path: \"word/comments.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml\",\n presence: { kind: \"conditional\", flag: \"hasComments\" },\n },\n {\n // Word 2013+ comment infrastructure — emitted only when populated,\n // same rule as comments.xml.\n path: \"word/people.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml\",\n presence: { kind: \"conditional\", flag: \"hasPeople\" },\n },\n {\n path: \"word/commentsExtended.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml\",\n presence: { kind: \"conditional\", flag: \"hasCommentsExtended\" },\n },\n {\n path: \"word/header${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml\",\n presence: { kind: \"repeated\", countFrom: \"headerCount\" },\n },\n {\n path: \"word/footer${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml\",\n presence: { kind: \"repeated\", countFrom: \"footerCount\" },\n },\n {\n path: \"word/charts/chart${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\",\n presence: { kind: \"repeated\", countFrom: \"chartCount\" },\n },\n {\n path: \"word/charts/userShapes${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chartUserShapes+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts with user shapes\" },\n },\n {\n path: \"word/diagrams/data${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/layout${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/quickStyle${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/colors${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/diagrams/drawing${i}.xml\",\n contentType: \"application/vnd.ms-office.drawingml.diagramDrawing+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArtCount\" },\n },\n {\n path: \"word/bibliography.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.bibliography+xml\",\n presence: { kind: \"conditional\", flag: \"hasBibliography\" },\n },\n {\n path: \"word/glossary/document.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml\",\n presence: { kind: \"conditional\", flag: \"hasGlossary\" },\n },\n {\n // Glossary companion parts — generate rebuilds only glossary document.xml;\n // the rest pass through rawParts so their Overrides stay derivable.\n path: \"word/glossary/styles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/glossary/settings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/glossary/fontTable.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/glossary/webSettings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\",\n presence: { kind: \"conditional\", flag: \"glossary companion parts\" },\n },\n {\n path: \"word/webSettings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\",\n presence: { kind: \"conditional\", flag: \"hasWebSettings\" },\n },\n // docx theme — fresh-compile generates a language-neutral default theme\n // (createThemeXml); round-trip passes the source theme through rawParts.\n // Declared as a theme+xml Override to match Word's own packages.\n {\n path: \"word/theme/theme1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.theme+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n ],\n} as const satisfies PackagePartRegistry;\n\n// ── PPTX ────────────────────────────────────────────────────────────────────\n\nexport const PPTX_PARTS = {\n format: \"pptx\",\n orphanWhitelist: [\n \"ppt/media/\",\n \"ppt/embeddings/\",\n \"_rels/\",\n \"ppt/_rels/\",\n \"ppt/slideMasters/_rels/\",\n \"ppt/slideLayouts/_rels/\",\n \"ppt/slides/_rels/\",\n \"ppt/notesMasters/_rels/\",\n \"ppt/notesSlides/_rels/\",\n \"ppt/charts/_rels/\",\n \"ppt/diagrams/_rels/\",\n \"docProps/\",\n \"[Content_Types].xml\",\n ],\n parts: [\n { path: \"[Content_Types].xml\", presence: { kind: \"always\" } },\n { path: \"_rels/.rels\", presence: { kind: \"always\" } },\n {\n path: \"ppt/presentation.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml\",\n presence: { kind: \"always\" },\n },\n {\n path: \"docProps/core.xml\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/app.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/custom.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.custom-properties+xml\",\n presence: { kind: \"conditional\", flag: \"has custom properties\" },\n },\n {\n // theme1 backs the slide master (static); theme2/theme3 back the\n // notes/handout masters when present — all share the theme+xml type.\n path: \"ppt/theme/theme${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.theme+xml\",\n presence: { kind: \"repeated\", countFrom: \"masters + notes/handout masters\" },\n },\n {\n // Per-layout theme deviations (CT_BaseStylesOverride subset).\n path: \"ppt/theme/themeOverride${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.themeOverride+xml\",\n presence: { kind: \"conditional\", flag: \"layout-level theme overrides\" },\n },\n {\n // Legacy empty theme manager part (CT_EmptyElement) from pre-2010 files.\n path: \"ppt/theme/themeManager1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.themeManager+xml\",\n presence: { kind: \"conditional\", flag: \"legacy themeManager part\" },\n },\n {\n path: \"ppt/presProps.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"ppt/viewProps.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"ppt/tableStyles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"ppt/slideMasters/slideMaster${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml\",\n presence: { kind: \"repeated\", countFrom: \"masters.length\" },\n },\n {\n path: \"ppt/slideLayouts/slideLayout${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml\",\n presence: { kind: \"repeated\", countFrom: \"layouts.length\" },\n },\n {\n path: \"ppt/slides/slide${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.slide+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides.length\" },\n },\n {\n path: \"ppt/notesMasters/notesMaster1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml\",\n presence: { kind: \"conditional\", flag: \"any slide has notes\" },\n },\n {\n path: \"ppt/handoutMasters/handoutMaster1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml\",\n presence: { kind: \"conditional\", flag: \"includeHandoutMaster\" },\n },\n {\n path: \"ppt/notesSlides/notesSlide${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides with notes\" },\n },\n {\n path: \"ppt/commentAuthors.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml\",\n presence: { kind: \"conditional\", flag: \"any slide has comments\" },\n },\n {\n path: \"ppt/comments/comment${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.presentationml.comments+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides with comments\" },\n },\n {\n path: \"ppt/charts/chart${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts\" },\n },\n {\n path: \"ppt/charts/userShapes${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chartUserShapes+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts with user shapes\" },\n },\n {\n path: \"ppt/diagrams/data${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/layout${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/quickStyle${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/colors${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/diagrams/drawing${i}.xml\",\n contentType: \"application/vnd.ms-office.drawingml.diagramDrawing+xml\",\n presence: { kind: \"repeated\", countFrom: \"smartArts\" },\n },\n {\n path: \"ppt/slideSyncPr/slideSyncPr${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.presentationml.slideUpdateInfo+xml\",\n presence: { kind: \"repeated\", countFrom: \"slides with slideSync\" },\n },\n ],\n} as const satisfies PackagePartRegistry;\n\n// ── XLSX ────────────────────────────────────────────────────────────────────\n\nexport const XLSX_PARTS = {\n format: \"xlsx\",\n orphanWhitelist: [\n \"xl/media/\",\n \"xl/embeddings/\",\n \"_rels/\",\n \"xl/_rels/\",\n \"xl/worksheets/_rels/\",\n \"xl/chartsheets/_rels/\",\n \"xl/drawings/_rels/\",\n \"xl/pivotTables/_rels/\",\n \"xl/pivotCache/_rels/\",\n \"xl/externalLinks/_rels/\",\n \"docProps/\",\n \"[Content_Types].xml\",\n ],\n parts: [\n { path: \"[Content_Types].xml\", presence: { kind: \"always\" } },\n { path: \"_rels/.rels\", presence: { kind: \"always\" } },\n {\n path: \"xl/workbook.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\",\n presence: { kind: \"always\" },\n },\n {\n path: \"docProps/core.xml\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/app.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"docProps/custom.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.custom-properties+xml\",\n presence: { kind: \"conditional\", flag: \"has custom properties\" },\n },\n {\n path: \"xl/styles.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n path: \"xl/theme/theme1.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.theme+xml\",\n presence: { kind: \"conditional\", flag: \"freshCompile\" },\n },\n {\n // Override is emitted unconditionally; the part file is only written\n // when the shared-strings table is non-empty — an O6 stale-Override\n // risk this registry exists to surface.\n path: \"xl/sharedStrings.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\",\n presence: { kind: \"conditional\", flag: \"sharedStrings.count > 0\" },\n },\n {\n path: \"xl/worksheets/sheet${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\",\n presence: { kind: \"repeated\", countFrom: \"worksheets.length\" },\n },\n {\n path: \"xl/chartsheets/sheet${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml\",\n presence: { kind: \"repeated\", countFrom: \"chartsheets.length\" },\n },\n {\n path: \"xl/dialogSheets/sheet${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml\",\n presence: { kind: \"repeated\", countFrom: \"dialogsheets.length\" },\n },\n {\n path: \"xl/drawings/drawing${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawing+xml\",\n presence: { kind: \"conditional\", flag: \"worksheet has drawing\" },\n },\n {\n path: \"xl/comments${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml\",\n presence: { kind: \"conditional\", flag: \"worksheet.comments.length > 0\" },\n },\n {\n // Legacy VML drawing backing older comment anchors; relies on the `vml`\n // Default added by ContentTypes.addVmlDrawing().\n path: \"xl/drawings/vmlDrawing${i}.vml\",\n presence: { kind: \"conditional\", flag: \"worksheet.comments (legacy VML)\" },\n },\n {\n path: \"xl/charts/chart${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts\" },\n },\n {\n path: \"xl/charts/userShapes${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawingml.chartUserShapes+xml\",\n presence: { kind: \"repeated\", countFrom: \"charts with user shapes\" },\n },\n {\n path: \"xl/pivotTables/pivotTable${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml\",\n presence: { kind: \"repeated\", countFrom: \"pivotTables\" },\n },\n {\n path: \"xl/pivotCache/pivotCacheDefinition${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml\",\n presence: { kind: \"repeated\", countFrom: \"pivotCaches\" },\n },\n {\n path: \"xl/pivotCache/pivotCacheRecords${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml\",\n presence: { kind: \"repeated\", countFrom: \"pivotCaches\" },\n },\n {\n path: \"xl/tables/table${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml\",\n presence: { kind: \"repeated\", countFrom: \"tables\" },\n },\n {\n path: \"xl/externalLinks/externalLink${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml\",\n presence: { kind: \"repeated\", countFrom: \"externalLinks.length\" },\n },\n {\n path: \"xl/connections.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml\",\n presence: { kind: \"conditional\", flag: \"connections\" },\n },\n {\n path: \"xl/queryTables/queryTable${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml\",\n presence: { kind: \"repeated\", countFrom: \"queryTables\" },\n },\n {\n path: \"xl/metadata.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml\",\n presence: { kind: \"conditional\", flag: \"metadata\" },\n },\n {\n path: \"xl/xmlMaps.xml\",\n contentType: \"application/xml\",\n presence: { kind: \"conditional\", flag: \"xmlMaps\" },\n },\n {\n path: \"xl/volTypes.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.volTypes+xml\",\n presence: { kind: \"conditional\", flag: \"volTypes\" },\n },\n {\n path: \"xl/tables/tableSingleCells${i}.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml\",\n presence: { kind: \"repeated\", countFrom: \"singleXmlCells\" },\n },\n {\n path: \"xl/calcChain.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml\",\n presence: { kind: \"conditional\", flag: \"any formula cell\" },\n },\n {\n path: \"xl/revisionHeaders.xml\",\n contentType:\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml\",\n presence: { kind: \"conditional\", flag: \"revisionLog\" },\n },\n {\n path: \"xl/revisions/revision${i}.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml\",\n presence: { kind: \"repeated\", countFrom: \"revisionLog.logs.length\" },\n },\n {\n path: \"xl/users.xml\",\n contentType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml\",\n presence: { kind: \"conditional\", flag: \"revisionLog.users\" },\n },\n ],\n} as const satisfies PackagePartRegistry;\n\nexport const PART_REGISTRIES: Record<PackagePartRegistry[\"format\"], PackagePartRegistry> = {\n docx: DOCX_PARTS,\n pptx: PPTX_PARTS,\n xlsx: XLSX_PARTS,\n};\n","/**\n * Build [Content_Types].xml Override entries from a part registry.\n *\n * The per-package content-types builders previously hand-wrote every Override\n * branch (header/footer counts, the hasComments gate, …), which drifted from\n * the part registry and caused OPC mismatches (#357: a comments Override\n * declared with no part, and vice-versa). This helper drives Overrides from\n * {@link PackagePartRegistry} so the part list and its content-type\n * declarations share one source of truth.\n *\n * Only parts carrying a `contentType` produce an Override — parts that rely on\n * a `<Default>` extension mapping (`[Content_Types].xml`, `.rels`, the\n * raw-passed theme) are skipped. Dynamic parts whose count or path is\n * runtime-determined (altChunks, sub-documents) stay out of the registry and\n * are appended by the caller.\n *\n * @module\n */\n\nimport type { PackagePartRegistry } from \"./part-registry\";\n\nexport interface ContentTypeOverrideEntry {\n partName: string;\n contentType: string;\n}\n\n/** Ensure a part path carries the leading slash an Override PartName requires. */\nfunction withLeadingSlash(partPath: string): string {\n return partPath.startsWith(\"/\") ? partPath : `/${partPath}`;\n}\n\n/**\n * Derive [Content_Types].xml Override entries for every registry part present\n * under `facts`. The `facts` keys mirror the registry's `flag` / `countFrom`\n * tokens: a boolean for `conditional` parts, a count for `repeated` parts.\n * Order follows `registry.parts`; OPC does not mandate Override order.\n */\nexport function buildContentTypeOverrides(\n registry: PackagePartRegistry,\n facts: ReadonlyMap<string, boolean | number>,\n): ContentTypeOverrideEntry[] {\n const overrides: ContentTypeOverrideEntry[] = [];\n for (const part of registry.parts) {\n // Parts without a contentType rely on a <Default> extension mapping.\n if (!part.contentType) continue;\n const presence = part.presence;\n if (presence.kind === \"always\") {\n // Singletons only — an `always` template with `${i}` would be a registry bug.\n if (!part.path.includes(\"${i}\")) {\n overrides.push({ partName: withLeadingSlash(part.path), contentType: part.contentType });\n }\n } else if (presence.kind === \"conditional\") {\n if (facts.get(presence.flag)) {\n overrides.push({ partName: withLeadingSlash(part.path), contentType: part.contentType });\n }\n } else {\n const count = Number(facts.get(presence.countFrom) ?? 0);\n for (let i = 1; i <= count; i++) {\n overrides.push({\n partName: withLeadingSlash(part.path.replace(\"${i}\", String(i))),\n contentType: part.contentType,\n });\n }\n }\n }\n return overrides;\n}\n","/**\n * Files-driven [Content_Types].xml derivation (part-centric).\n *\n * Walks the actual part paths written to the package and derives the\n * Default/Override entries from a path→contentType resolver plus an\n * extension→MIME map. The part set is the single source of truth, so the\n * content-type declarations cannot drift from what is written — the class of\n * bug that registry/facts builders exist to patch (#357). Sparse or index-based\n * part naming (e.g. pptx comments keyed by slide index rather than a dense\n * sequence) is handled naturally: every written file is declared regardless of\n * its naming scheme, because emission follows the files, not a count.\n *\n * Reference: ECMA-376 Part 2 §10; peer libraries (python-pptx, openpyxl) derive\n * [Content_Types] from the actual part set the same way.\n *\n * @module\n */\n\nimport type { CustomDescriptor } from \"../descriptor\";\nimport type { PackagePartRegistry } from \"./part-registry\";\n\n// ── Types ──\n\nexport interface ContentTypeDefault {\n extension: string;\n contentType: string;\n}\n\nexport interface ContentTypeOverride {\n partName: string;\n contentType: string;\n}\n\n/**\n * [Content_Types].xml source. Usually omitted — the compiler derives it from\n * the parts actually written; supply it only to override the derivation.\n */\nexport interface ContentTypesInput {\n defaults: ContentTypeDefault[];\n overrides: ContentTypeOverride[];\n}\n\n// ── Serializer ──\n\nexport const contentTypesDesc: CustomDescriptor<ContentTypesInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n const p: string[] = [\n '<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">',\n ];\n // OPC Default Extension and Override PartName matching are case-insensitive\n // (ECMA-376-2 §10.1.2/§10.1.4): a duplicate differing only in case makes\n // Word reject the package as unreadable content. Dedup case-insensitively\n // so no input path can emit a colliding pair.\n const seenDefault = new Set<string>();\n for (const d of opts.defaults) {\n const key = d.extension.toLowerCase();\n if (seenDefault.has(key)) continue;\n seenDefault.add(key);\n p.push(`<Default Extension=\"${d.extension}\" ContentType=\"${d.contentType}\"/>`);\n }\n const seenOverride = new Set<string>();\n for (const o of opts.overrides) {\n const key = o.partName.toLowerCase();\n if (seenOverride.has(key)) continue;\n seenOverride.add(key);\n p.push(`<Override PartName=\"${o.partName}\" ContentType=\"${o.contentType}\"/>`);\n }\n p.push(\"</Types>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const defaults: ContentTypeDefault[] = [];\n const overrides: ContentTypeOverride[] = [];\n for (const child of el.elements ?? []) {\n if (child.name === \"Default\") {\n const ext = child.attributes?.[\"Extension\"];\n const ct = child.attributes?.[\"ContentType\"];\n if (ext && ct) defaults.push({ extension: String(ext), contentType: String(ct) });\n } else if (child.name === \"Override\") {\n const pn = child.attributes?.[\"PartName\"];\n const ct = child.attributes?.[\"ContentType\"];\n if (pn && ct) overrides.push({ partName: String(pn), contentType: String(ct) });\n }\n }\n return { defaults, overrides };\n },\n};\n\n// ── Path → contentType resolver ──\n\nexport type PartContentTypeResolver = (partPath: string) => string | undefined;\n\n/** Convert a registry part path (with `${i}` placeholders) to an anchored RegExp. */\nfunction patternToRegExp(path: string): RegExp {\n const segments = path.split(\"${i}\");\n const escaped = segments.map((s) => s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"));\n return new RegExp(\"^\" + escaped.join(\"\\\\d+\") + \"$\");\n}\n\n/**\n * Build a path→contentType resolver from a part registry. Only the path pattern\n * and contentType are consulted; the presence/flag/countFrom fields are\n * irrelevant here because emission is driven by the files actually written, not\n * by a separate facts map. Any path the resolver does not recognize falls\n * through to extension-based Default handling (media, embeddings, .rels).\n */\nexport function resolverFromRegistry(registry: PackagePartRegistry): PartContentTypeResolver {\n const patterns: Array<{ re: RegExp; contentType: string }> = [];\n for (const part of registry.parts) {\n if (!part.contentType) continue;\n patterns.push({ re: patternToRegExp(part.path), contentType: part.contentType });\n }\n return (partPath: string) => patterns.find((p) => p.re.test(partPath))?.contentType;\n}\n\n// ── Derive ──\n\nconst BASE_DEFAULTS: ContentTypeDefault[] = [\n { extension: \"rels\", contentType: \"application/vnd.openxmlformats-package.relationships+xml\" },\n { extension: \"xml\", contentType: \"application/xml\" },\n];\n\nexport interface DeriveContentTypesOptions {\n /** Resolve an OOXML part path to its Override content type. Return undefined\n * for non-part files (media/embeddings/.rels) resolved via Default. */\n resolve: PartContentTypeResolver;\n /** Lowercase extension → MIME for media/embedding Default entries. */\n mediaContentTypes: Readonly<Record<string, string>>;\n /** Always-present Default entries. Defaults to rels + xml. */\n baseDefaults?: ContentTypeDefault[];\n /** Per-file Overrides for parts whose content type is data-driven and not\n * path-determinable — docx altChunks carry a caller-supplied MIME, and\n * sub-documents live at an arbitrary path. Each path is normalized to a\n * leading slash and takes precedence over a resolver match for the same\n * path. */\n overrides?: ReadonlyArray<{ path: string; contentType: string }>;\n /**\n * The source package's [Content_Types].xml (round-trip). Present, the\n * derived table is merged onto it: every source Default survives verbatim,\n * source Overrides survive for parts that still exist at the same path,\n * and derived entries only fill what the surviving source table leaves\n * uncovered or mistyped (renamed media, synthesized parts, a Default whose\n * type disagrees with a surviving part). Fresh generation (no source) is\n * unaffected.\n */\n source?: ContentTypesInput;\n /**\n * Paths whose bytes are carried verbatim from the source package (same form\n * as `filePaths` entries). With a source table present, derivation never\n * types these parts — whatever the surviving source table says about them\n * is their type, exactly as it was in the source. Only parts the compiler\n * (re)writes get derived declarations.\n */\n verbatimPaths?: ReadonlySet<string>;\n}\n\nfunction extensionOf(path: string): string | undefined {\n const slash = Math.max(path.lastIndexOf(\"/\"), path.lastIndexOf(\"\\\\\"));\n const dot = path.slice(slash + 1).lastIndexOf(\".\");\n return dot > 0 ? path.slice(slash + 1 + dot + 1) : undefined;\n}\n\nfunction withLeadingSlash(path: string): string {\n return path.startsWith(\"/\") ? path : `/${path}`;\n}\n\n/**\n * Derive [Content_Types].xml entries from the actual part paths in the package.\n * Each path that the resolver maps to a content type becomes an Override; every\n * other file contributes a Default keyed by its extension (declared once).\n */\nexport function deriveContentTypes(\n filePaths: Iterable<string>,\n options: DeriveContentTypesOptions,\n): ContentTypesInput {\n const files = [...filePaths].filter((p) => p !== \"[Content_Types].xml\");\n const defaults: ContentTypeDefault[] = [...(options.baseDefaults ?? BASE_DEFAULTS)];\n const seenExt = new Set(defaults.map((d) => d.extension.toLowerCase()));\n // Keyed by lowercased PartName so explicit `overrides` entries (altChunks,\n // sub-documents) take precedence over a resolver match for the same path.\n const overrideMap = new Map<string, ContentTypeOverride>();\n // Per-part derived types (resolver match or extension MIME) — the merge with\n // a source table compares part types against surviving source Defaults.\n const partTypes: Array<{ partName: string; contentType: string }> = [];\n\n for (const path of files) {\n const partType = options.resolve(path);\n if (partType) {\n const partName = withLeadingSlash(path);\n overrideMap.set(partName.toLowerCase(), { partName, contentType: partType });\n partTypes.push({ partName, contentType: partType });\n continue;\n }\n const ext = extensionOf(path);\n if (!ext) continue;\n const key = ext.toLowerCase();\n const mime = options.mediaContentTypes[key];\n if (!seenExt.has(key) && mime) {\n defaults.push({ extension: ext, contentType: mime });\n seenExt.add(key);\n }\n if (mime) partTypes.push({ partName: withLeadingSlash(path), contentType: mime });\n }\n for (const extra of options.overrides ?? []) {\n const partName = withLeadingSlash(extra.path);\n overrideMap.set(partName.toLowerCase(), { partName, contentType: extra.contentType });\n }\n if (!options.source) return { defaults, overrides: [...overrideMap.values()] };\n return mergeSourceContentTypes(options.source, files, defaults, overrideMap, partTypes, {\n verbatim: options.verbatimPaths,\n });\n}\n\n/**\n * Merge derived declarations onto the source package's table (round-trip).\n *\n * - Source Defaults survive verbatim — extension-level entries are harmless\n * when unused, and dropping them (or retyping the shared .bin extension)\n * is what a purely derived table gets wrong.\n * - Source Overrides survive for parts that still exist at the same path;\n * media the pipeline renamed drops out.\n * - Derived Overrides fill only what the surviving source table leaves\n * uncovered: parts with no source Override whose covering source Default\n * disagrees with (or omits) their derived type. A part the compiler\n * rebuilds from its parsed source stays the same part kind, so a surviving\n * source Override (macro-enabled variants included) keeps the source type —\n * the static registry cannot know the package variant the source declared.\n * - A derived Default joins only when an output part of that extension is\n * still uncovered after Overrides — a source table that declares its .jpg\n * parts via per-part Overrides stays as-is.\n */\nfunction mergeSourceContentTypes(\n source: ContentTypesInput,\n files: string[],\n derivedDefaults: ContentTypeDefault[],\n derivedOverrides: Map<string, ContentTypeOverride>,\n partTypes: Array<{ partName: string; contentType: string }>,\n mergeOpts: { verbatim?: ReadonlySet<string> },\n): ContentTypesInput {\n const filePaths = new Set(files.map((p) => withLeadingSlash(p).toLowerCase()));\n // OPC part-name matching is case-insensitive (ECMA-376-2 §10.1.2.1), so the\n // verbatim lookup lowercases both sides.\n const verbatimLower = new Set([...(mergeOpts.verbatim ?? [])].map((p) => p.toLowerCase()));\n const isVerbatim = (partName: string) => verbatimLower.has(partName.slice(1).toLowerCase());\n const partExt = (partName: string) => {\n const dot = partName.lastIndexOf(\".\");\n return dot > partName.lastIndexOf(\"/\") ? partName.slice(dot + 1) : \"\";\n };\n // Candidate Default types (source wins per extension, derived fills the\n // rest) — membership in the emitted table is decided after Overrides.\n const defaultTypeByExt = new Map<string, string>();\n const derivedDefaultByExt = new Map<string, ContentTypeDefault>();\n for (const d of source.defaults) {\n const key = d.extension.toLowerCase();\n if (!defaultTypeByExt.has(key)) defaultTypeByExt.set(key, d.contentType);\n }\n for (const d of derivedDefaults) {\n const key = d.extension.toLowerCase();\n if (defaultTypeByExt.has(key)) continue;\n defaultTypeByExt.set(key, d.contentType);\n derivedDefaultByExt.set(key, d);\n }\n const overrides: ContentTypeOverride[] = [];\n const seenOverride = new Set<string>();\n const keptSourceTypeByPath = new Map<string, string>();\n for (const o of source.overrides) {\n const key = o.partName.toLowerCase();\n if (!filePaths.has(key)) continue; // renamed media or dropped part\n if (seenOverride.has(key)) continue;\n seenOverride.add(key);\n overrides.push(o);\n keptSourceTypeByPath.set(key, o.contentType);\n }\n for (const o of derivedOverrides.values()) {\n const key = o.partName.toLowerCase();\n if (isVerbatim(key)) continue; // source bytes, source declaration\n if (keptSourceTypeByPath.has(key)) continue; // rebuilt, same part kind — keep source type\n const ext = partExt(key);\n const coveringDefault = ext ? defaultTypeByExt.get(ext) : undefined;\n if (coveringDefault === o.contentType) continue; // covered by a Default\n seenOverride.add(key);\n overrides.push(o);\n }\n // Extension-typed parts (media, embeddings) whose surviving source Default\n // disagrees with the derived type need a per-part Override — e.g. a package\n // whose Default .bin types printer settings while an OLE .bin survives.\n for (const { partName, contentType } of partTypes) {\n const key = partName.toLowerCase();\n if (derivedOverrides.has(key) || keptSourceTypeByPath.has(key)) continue;\n if (isVerbatim(key)) continue; // source bytes, source declaration\n const ext = partExt(key);\n const coveringDefault = ext ? defaultTypeByExt.get(ext) : undefined;\n if (coveringDefault === undefined || coveringDefault === contentType) continue;\n if (seenOverride.has(key)) continue;\n seenOverride.add(key);\n overrides.push({ partName, contentType });\n }\n const defaults: ContentTypeDefault[] = [];\n const seenDefault = new Set<string>();\n for (const d of source.defaults) {\n const key = d.extension.toLowerCase();\n if (seenDefault.has(key)) continue;\n seenDefault.add(key);\n defaults.push(d);\n }\n for (const [key, d] of derivedDefaultByExt) {\n // A part of this extension with no Override is what makes the Default\n // load-bearing; extensions fully covered by Overrides stay undeclared,\n // matching a source table that never had them.\n const needed = files.some(\n (f) =>\n extensionOf(f)?.toLowerCase() === key &&\n !seenOverride.has(withLeadingSlash(f).toLowerCase()),\n );\n if (needed) defaults.push(d);\n }\n return { defaults, overrides };\n}\n\n/**\n * Extension → MIME for image media, shared by every format package.\n *\n * The three format compilers each declare a package-scoped media table made\n * of this image block plus format-specific extras (docx: odttf/bin fonts and\n * OLE; pptx: video/audio; xlsx: vml). Keeping the image half in one place\n * means a new image format lands everywhere at once.\n */\nexport const IMAGE_MEDIA_CONTENT_TYPES: Record<string, string> = {\n png: \"image/png\",\n jpeg: \"image/jpeg\",\n jpg: \"image/jpeg\",\n bmp: \"image/bmp\",\n gif: \"image/gif\",\n tif: \"image/tiff\",\n tiff: \"image/tiff\",\n emf: \"image/x-emf\",\n wmf: \"image/x-wmf\",\n ico: \"image/x-icon\",\n svg: \"image/svg+xml\",\n};\n","/**\n * Package-wide passthrough collection (SDK ExtendedPart analogue).\n *\n * The parse side of the \"maximum parse\" contract: every part the model did\n * NOT absorb is carried verbatim instead of dropped. Callers list the parts\n * their compiler rebuilds; everything else — unknown extensions, companion\n * .rels, media referenced only by passthrough parts — survives round-trip\n * with bytes and content-type declarations intact.\n *\n * Rebuilt parts whose source .rels referenced a passthrough part are captured\n * as relationship entries so the compiler can re-emit them verbatim (fresh\n * rId, unchanged target — passthrough paths never move).\n *\n * @module\n */\n\nimport { attr, escapeXml, type Element } from \"@office-open/xml\";\n\nimport {\n contentTypesDesc,\n type ContentTypeDefault,\n type ContentTypeOverride,\n} from \"./content-types-input\";\nimport { normalizeObsoleteNamespaceAliases } from \"./namespaces\";\nimport type { Zippable } from \"./packer\";\nimport type { ParsedArchive } from \"./parser\";\nimport { partPathToRelsPath, resolveRelationshipTarget } from \"./relationships\";\n\n// ── Types ──\n\nexport interface PassthroughPart {\n path: string;\n data: Uint8Array;\n /**\n * Content type borrowed from the source [Content_Types].xml: the part's\n * Override value, or its extension's Default. Undefined when the source\n * declared neither — carried through so the compiler can omit the entry\n * exactly like the source did.\n */\n contentType?: string;\n}\n\nexport interface PassthroughRelationship {\n /**\n * The rebuilt part whose source .rels referenced a passthrough part; \"\" for\n * root-level relationships from the always-rebuilt `_rels/.rels`.\n */\n source: string;\n relationshipType: string;\n /** Target exactly as written in the source .rels (relative form). */\n target: string;\n /** The relationship id as written in the source .rels (e.g. \"rId8\"). */\n rId: string;\n /** External target mode, retained only for package-root relationships. */\n targetMode?: \"External\";\n}\n\nexport interface PassthroughResult {\n parts: PassthroughPart[];\n relationships: PassthroughRelationship[];\n}\n\n// ── Collection ──\n\n/** Package-level files the packer always regenerates. */\nconst ALWAYS_REBUILT = new Set([\"[Content_Types].xml\", \"_rels/.rels\"]);\n\nfunction extensionOf(path: string): string | undefined {\n const slash = path.lastIndexOf(\"/\");\n const dot = path.slice(slash + 1).lastIndexOf(\".\");\n return dot > 0 ? path.slice(slash + 1 + dot + 1) : undefined;\n}\n\n/**\n * Collect passthrough parts and rebuilt→passthrough relationships.\n *\n * @param archive - Parsed source package.\n * @param rebuiltPaths - Parts (including their .rels) the compiler re-emits\n * from the model. Listing a part here without its .rels leaves the .rels\n * to pass through — used by docx glossary, where the document part is\n * rebuilt but its companion rels travel verbatim.\n */\nexport function collectPassthroughParts(\n archive: ParsedArchive,\n rebuiltPaths: Iterable<string>,\n): PassthroughResult {\n const rebuilt = new Set<string>(ALWAYS_REBUILT);\n for (const p of rebuiltPaths) rebuilt.add(p);\n\n // Borrowed content-type resolution: Override by part name first, then the\n // extension's Default (both case-insensitive, matching OPC matching rules).\n let defaults: ContentTypeDefault[] = [];\n let overrides: ContentTypeOverride[] = [];\n const ctEl = archive.get(\"[Content_Types].xml\");\n if (ctEl) {\n const parsed = contentTypesDesc.parse(ctEl, undefined as never);\n defaults = parsed.defaults;\n overrides = parsed.overrides;\n }\n const overrideMap = new Map(\n overrides.map((o) => [o.partName.toLowerCase(), o.contentType] as const),\n );\n const defaultMap = new Map(\n defaults.map((d) => [d.extension.toLowerCase(), d.contentType] as const),\n );\n const contentTypeFor = (path: string): string | undefined => {\n const override = overrideMap.get(`/${path}`.toLowerCase());\n if (override) return override;\n const ext = extensionOf(path);\n return ext ? defaultMap.get(ext.toLowerCase()) : undefined;\n };\n\n // Everything not rebuilt passes through. The default is \"keep\": companion\n // .rels of passthrough parts and media referenced only through them fall\n // out of this same loop — no closure walk needed, because not-rebuilt IS\n // the kept set.\n const parts: PassthroughPart[] = [];\n // OPC part-name matching is case-insensitive: a source can spell the rel\n // target with different casing than the ZIP entry (docProps/thumbnail.jpeg\n // vs docProps/Thumbnail.jpeg) and Office still resolves it.\n const kept = new Set<string>();\n for (const path of archive.keys()) {\n if (path.endsWith(\"/\") || rebuilt.has(path)) continue;\n const sourceData = archive.getRaw(path);\n if (!sourceData) continue;\n // Modeled XML is parsed through the same obsolete→final namespace aliases;\n // normalize raw XML/rels bytes as well so one generated package never mixes\n // both dialects. Non-XML binaries remain byte-identical.\n const data =\n path.endsWith(\".xml\") || path.endsWith(\".rels\")\n ? normalizeObsoleteNamespaceAliases(sourceData)\n : sourceData;\n kept.add(path.toLowerCase());\n const contentType = contentTypeFor(path);\n parts.push(contentType === undefined ? { path, data } : { path, data, contentType });\n }\n\n // Rebuilt parts whose source .rels point at passthrough parts: keep the\n // relationship so the rebuilt rels stay byte-equivalent to the source.\n // External targets (URLs) are not part references — the caller handles\n // those through their own model fields.\n const relationships: PassthroughRelationship[] = [];\n const captureRels = (relsEl: Element | undefined, source: string): void => {\n if (!relsEl) return;\n for (const rel of relsEl.elements ?? []) {\n if (rel.name !== \"Relationship\") continue;\n const targetMode = attr(rel, \"TargetMode\");\n const relationshipType = attr(rel, \"Type\");\n const target = attr(rel, \"Target\");\n const rId = attr(rel, \"Id\");\n if (!relationshipType || !target || !rId) continue;\n if (targetMode === \"External\") {\n // A rebuilt owner can only preserve an external relationship when its\n // modeled XML also remaps the local rId. Package-root relationships have\n // no owner XML, so they are safe to retain directly.\n if (source === \"\") {\n relationships.push({ source, relationshipType, target, rId, targetMode });\n }\n continue;\n }\n // Capture every source rel, including those pointing at rebuilt parts\n // (presProps/viewProps/theme/tableStyles all fit): the compiler's\n // pre-claim pass needs the source id to slot structure re-emissions in\n // after, preserving the source rId ordering on round-trip.\n if (kept.has(resolveRelationshipTarget(source, target).toLowerCase()) || source !== \"\") {\n relationships.push({ source, relationshipType, target, rId });\n }\n }\n };\n for (const source of rebuiltPaths) {\n captureRels(archive.get(partPathToRelsPath(source)), source);\n }\n // Root-level relationships (_rels/.rels, source \"\"): the root rels are\n // always rebuilt, so entries pointing at passthrough parts — the package\n // thumbnail above all — must be captured the same way.\n captureRels(archive.get(\"_rels/.rels\"), \"\");\n\n return { parts, relationships };\n}\n\n// ── Dangling-relationship guard ──\n\n/** Regex metacharacters in a literal target path (e.g. \".\" in file names). */\nconst RE_ESCAPE = /[.*+?^${}()|[\\]\\\\]/g;\n\n/**\n * Drop passthrough relationships whose target part is absent from the final\n * package: a dangling internal Target makes Office refuse to open the file,\n * and a hand-authored options JSON can reference parts it never carried in\n * `rawParts`. Parsed sources never produce this (their targets exist in the\n * source archive), so the guard only fires on the hand-authoring input face.\n * External and same-part `#fragment` targets are left alone.\n *\n * Runs after `compileMapping` on the assembled file map; rewrites the rebuilt\n * .rels part in place. Returns the number of relationships removed.\n */\nexport function dropDanglingPassthroughRels(\n files: Zippable,\n passthroughRelationships: readonly PassthroughRelationship[] | undefined,\n): number {\n if (!passthroughRelationships || passthroughRelationships.length === 0) return 0;\n // OPC part-name matching is case-insensitive — a source can spell the rel\n // target \"docProps/thumbnail.jpeg\" against the part \"docProps/Thumbnail.jpeg\"\n // (collectPassthroughParts' kept set is lowercase for the same reason).\n const paths = new Set(Object.keys(files).map((p) => p.toLowerCase()));\n const decoder = new TextDecoder();\n const encoder = new TextEncoder();\n let dropped = 0;\n for (const rel of passthroughRelationships) {\n if (rel.targetMode === \"External\" || rel.target.startsWith(\"#\")) continue;\n const relsPath = rel.source === \"\" ? \"_rels/.rels\" : partPathToRelsPath(rel.source);\n const entry = files[relsPath];\n // A .rels part is always a flat entry (Uint8Array or [Uint8Array, opts]);\n // nested Zippable directories never match a part path.\n const bytes =\n entry instanceof Uint8Array\n ? entry\n : Array.isArray(entry) && entry[0] instanceof Uint8Array\n ? entry[0]\n : undefined;\n if (!bytes) continue;\n const xml = decoder.decode(bytes);\n // claimSourceRel emits the captured target verbatim, so the emitted entry\n // carries the exact escaped string. Model-emitted rels always target parts\n // the compiler just produced, so they can never match a missing target.\n const escaped = escapeXml(rel.target).replace(RE_ESCAPE, \"\\\\$&\");\n if (!escaped) continue;\n const targetAttr = new RegExp(`(<Relationship\\\\b[^>]*\\\\bTarget=\"${escaped}\"[^>]*/>)`);\n const match = targetAttr.exec(xml);\n if (!match) continue;\n const resolved = resolveRelationshipTarget(rel.source, rel.target);\n if (paths.has(resolved.toLowerCase())) continue;\n const stripped = xml.slice(0, match.index) + xml.slice(match.index + match[1]!.length);\n const rewritten = encoder.encode(stripped);\n files[relsPath] = Array.isArray(entry) ? [rewritten, entry[1]] : rewritten;\n dropped++;\n }\n return dropped;\n}\n","import { pickNonVisualDrawingProperties } from \"../drawing\";\nimport type {\n ConnectorLockingOptions,\n EndpointConnectionOptions,\n NonVisualDrawingPropertiesOptions,\n} from \"../drawing\";\n\n/**\n * Base connector options — the shared shape across pptx (p:cxnSp) and xlsx\n * (xdr:cxnSp) connectors.\n *\n * Carries the non-visual drawing properties (name/description/title/hidden that\n * mirror a:CT_NonVisualDrawingProps) plus the connector-specific glue: locking\n * (a:cxnSpLocks) and the optional endpoint connections (a:stCxn/a:endCxn). The\n * line geometry, fill, and outline stay package-side (pptx surfaces them as\n * top-level convenience fields, xlsx nests them in spPr), as does positioning\n * (pptx two endpoints x1/y1/x2/y2, xlsx cell anchor).\n *\n * docx has no standalone connector element, so it does not extend this base.\n */\nexport interface BaseConnectorOptions extends NonVisualDrawingPropertiesOptions {\n /** a:cxnSpLocks — connector locking (inside cNvCxnSpPr). */\n locking?: ConnectorLockingOptions;\n /** a:stCxn — start endpoint glued to a shape connection site. */\n startConnection?: EndpointConnectionOptions;\n /** a:endCxn — end endpoint glued to a shape connection site. */\n endConnection?: EndpointConnectionOptions;\n}\n\n/**\n * Pick the connector base fields (cNvPr + locking + endpoint connections)\n * actually set on `opts`, dropping undefined. Used when bridging a package's\n * connector options onto the shared base during cross-format conversion.\n */\nexport function pickConnectorBase(\n opts: BaseConnectorOptions | undefined,\n): Partial<BaseConnectorOptions> {\n if (!opts) return {};\n return {\n ...pickNonVisualDrawingProperties(opts),\n ...(opts.locking !== undefined ? { locking: opts.locking } : {}),\n ...(opts.startConnection !== undefined ? { startConnection: opts.startConnection } : {}),\n ...(opts.endConnection !== undefined ? { endConnection: opts.endConnection } : {}),\n };\n}\n","import { pickNonVisualDrawingProperties } from \"../drawing\";\nimport type { NonVisualDrawingPropertiesOptions } from \"../drawing\";\nimport type { GroupLockingOptions } from \"../drawing/locking\";\n\n/**\n * Base group options — the shared shape across pptx (p:grpSp), xlsx (xdr:grpSp),\n * and docx (wpg:wgp) groups.\n *\n * Carries only the non-visual drawing properties (name/description/title/hidden\n * that mirror a:CT_NonVisualDrawingProps) — the part of a group that round-trips\n * losslessly across all three formats. The group transform (a:xfrm), fill,\n * effects, and children stay package-side: positioning models differ (pptx flat\n * x/y/w/h, xlsx cell anchor, docx transformation) and children types are\n * fundamentally different (LegacySlideChild vs shapes+connectors vs\n * GroupChildMediaData), so they cannot be unified without distorting each\n * package's model. docx bridges its cNvPr through altText (DocPropertiesOptions),\n * mirroring the picture base pattern.\n */\nexport interface BaseGroupOptions extends NonVisualDrawingPropertiesOptions {\n /**\n * Group shape locks (a:grpSpLocks inside cNvGrpSpPr) — the one shared field\n * beyond cNvPr. null keeps an explicit empty element (Office often emits\n * `<a:grpSpLocks/>`); see the module docstring for why grpSpPr content and\n * children stay per-package.\n */\n locking?: GroupLockingOptions | null;\n}\n\n/**\n * Pick the group base fields (cNvPr + locks) actually set on `opts`, dropping\n * undefined. Used when bridging a package's group options onto the shared base\n * during cross-format conversion.\n */\nexport function pickGroupBase(opts: BaseGroupOptions | undefined): Partial<BaseGroupOptions> {\n if (!opts) return {};\n return {\n ...pickNonVisualDrawingProperties(opts),\n ...(opts.locking !== undefined ? { locking: opts.locking } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAuFA,MAAa,iBAAiB,EAC5B,UAAU,WACZ;;;;;;;AAeA,IAAa,gBAAb,MAA2B;CACzB,UAAuC,CAAC;CAGxC,QAAgB;CAEhB,QAAgB,KAAmB;EACjC,MAAM,IAAI,aAAa,KAAK,GAAG;EAC/B,IAAI,GAAG,KAAK,QAAQ,KAAK,IAAI,KAAK,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C,GAAI,KAAK,YAAY,KAAA,IAAY,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;CAChE;AACF"}
|
package/dist/util/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { i as toUint8Array, n as ToUint8ArrayOptions, r as isBase64DataURL, t as DataType } from "../data-type-CZMKVaaT.mjs";
|
|
2
2
|
import { A as positiveUniversalMeasureValue, C as hexColorValue, D as parseOnOff, E as measurementOrPercentValue, F as twipsMeasureValue, I as uCharHexNumber, L as universalMeasureValue, M as signedHpsMeasureValue, N as signedTwipsMeasureValue, O as percentageValue, P as stripColorHashPrefix, R as unsignedDecimalNumber, S as hexBinary, T as longHexNumber, _ as UniversalMeasure, a as HexColor, b as decimalNumber, c as Panose, d as PositiveUniversalMeasure, f as RelativeMeasure, g as UcharHexNumber, h as ThemeFont, i as Guid, j as shortHexNumber, k as pointMeasureValue, l as Percentage, m as ThemeColor, n as Base64, o as HexColorOrAuto, p as ShortHexNumber, r as DateTime, s as LongHexNumber, t as ArgbHexColor, u as PositivePercentage, v as UnsignedShortHex, w as hpsMeasureValue, x as eighthPointMeasureValue, y as dateTimeValue } from "../values-BECDm4zr.mjs";
|
|
3
|
-
import { $ as xsdLightRigDirection, $t as convertTwipToEmu, A as xsdAnimValueType, At as UniqueNumericIdCreator, B as xsdCompoundLine, Bt as convertEmuToPixels, C as replacePlaceholders, Ct as xsdTextVerticalType, D as xsdAnimCalcMode, Dt as xsdVerticalMergeRev, E as invertMap, Et as xsdUnderlineStyle, F as xsdAxisOrientation, Ft as extUriMatches, G as xsdEffectContainer, Gt as convertMillimetersToTwip, H as xsdDataLabelPosition, Ht as convertEmuToTwip, I as xsdAxisPosition, It as derivePasswordHash, J as xsdHierBranch, Jt as convertPointsToTwip, K as xsdErrorValueType, Kt as convertPixelsToEmu, L as xsdBlendMode, Lt as hashPasswordAgile, M as xsdAxisCrossBetween, Mt as uniqueId, N as xsdAxisCrosses, Nt as uniqueNumericIdCreator, O as xsdAnimClass, Ot as ImageFileType, P as xsdAxisLabelAlignment, Pt as uniqueUuid, Q as xsdLegendPosition, Qt as convertToTwip, R as xsdChartBuild, Rt as randomBytes, S as replaceOlePlaceholders, St as xsdTextTabAlignment, T as replaceVideoPlaceholders, Tt as xsdTrendlineType, U as xsdDiagramBuild, Ut as convertInchesToEmu, V as xsdConsolidateFunction, Vt as convertEmuToPoints, W as xsdDiagramDirection, Wt as convertInchesToTwip, X as xsdIterateType, Xt as convertToInch, Y as xsdHueDirection, Yt as convertToEmu, Z as xsdJcAlignment, Zt as convertToPt, _ as replaceImageLinkPlaceholders, _t as xsdTableWidthType, a as findAndReplaceImagePlaceholders, an as emitPercent, at as xsdPathFillMode, b as replaceNumberingPlaceholders, bt as xsdTextBuild, c as getMediaRefs, cn as parsePercent, ct as xsdPlaceholderType, d as getVideoRefs, dn as XmlifyedFileEntry, dt as xsdResizeHandles, en as convertUniversalMeasureToEmu, et as xsdLineCap, f as hasPlaceholders, fn as addBinaryFile, ft as xsdShadingPattern, g as replaceHyperlinkPlaceholders, gt as xsdStrikeStyle, h as replaceChartPlaceholders, ht as xsdSplitType, i as collectPlaceholderKeys, in as emitAngle, it as xsdOrient, j as xsdAnimationDgmBuild, jt as hashedId, k as xsdAnimLevel, kt as imageTypeFromPath, l as getOleRefs, ln as parsePercentAttr, lt as xsdPresetShadow, m as replaceAudioPlaceholders, mt as xsdSlideLayoutType, n as SmartArtRelOptions, nn as convertUniversalMeasureToPt, nt as xsdMaterialType, o as formatId, on as mapOptional, ot as xsdPattern, p as replaceAllPlaceholders, pn as compileMapping, pt as xsdSizeRepresents, q as xsdFontAlignment, qt as convertPointsToEmu, r as addSmartArtRelationships, rn as convertUniversalMeasureToTwip, rt as xsdMathStyle, s as getAudioRefs, sn as parseAngle, st as xsdPenAlignment, t as IdFormat, tn as convertUniversalMeasureToInch, tt as xsdLineEndSize, u as getReferencedMedia, un as parseUniversalMeasure, ut as xsdRectAlignment, v as replaceImagePlaceholders, vt as xsdTextAlign, w as replaceSmartArtPlaceholders, wt as xsdTotalsRowFunction, x as replaceOleLinkPlaceholders, xt as xsdTextCaps, y as replaceMediaPlaceholders, yt as xsdTextAnchor, z as xsdComments, zt as convertEmuToInches } from "../index-
|
|
3
|
+
import { $ as xsdLightRigDirection, $t as convertTwipToEmu, A as xsdAnimValueType, At as UniqueNumericIdCreator, B as xsdCompoundLine, Bt as convertEmuToPixels, C as replacePlaceholders, Ct as xsdTextVerticalType, D as xsdAnimCalcMode, Dt as xsdVerticalMergeRev, E as invertMap, Et as xsdUnderlineStyle, F as xsdAxisOrientation, Ft as extUriMatches, G as xsdEffectContainer, Gt as convertMillimetersToTwip, H as xsdDataLabelPosition, Ht as convertEmuToTwip, I as xsdAxisPosition, It as derivePasswordHash, J as xsdHierBranch, Jt as convertPointsToTwip, K as xsdErrorValueType, Kt as convertPixelsToEmu, L as xsdBlendMode, Lt as hashPasswordAgile, M as xsdAxisCrossBetween, Mt as uniqueId, N as xsdAxisCrosses, Nt as uniqueNumericIdCreator, O as xsdAnimClass, Ot as ImageFileType, P as xsdAxisLabelAlignment, Pt as uniqueUuid, Q as xsdLegendPosition, Qt as convertToTwip, R as xsdChartBuild, Rt as randomBytes, S as replaceOlePlaceholders, St as xsdTextTabAlignment, T as replaceVideoPlaceholders, Tt as xsdTrendlineType, U as xsdDiagramBuild, Ut as convertInchesToEmu, V as xsdConsolidateFunction, Vt as convertEmuToPoints, W as xsdDiagramDirection, Wt as convertInchesToTwip, X as xsdIterateType, Xt as convertToInch, Y as xsdHueDirection, Yt as convertToEmu, Z as xsdJcAlignment, Zt as convertToPt, _ as replaceImageLinkPlaceholders, _t as xsdTableWidthType, a as findAndReplaceImagePlaceholders, an as emitPercent, at as xsdPathFillMode, b as replaceNumberingPlaceholders, bt as xsdTextBuild, c as getMediaRefs, cn as parsePercent, ct as xsdPlaceholderType, d as getVideoRefs, dn as XmlifyedFileEntry, dt as xsdResizeHandles, en as convertUniversalMeasureToEmu, et as xsdLineCap, f as hasPlaceholders, fn as addBinaryFile, ft as xsdShadingPattern, g as replaceHyperlinkPlaceholders, gt as xsdStrikeStyle, h as replaceChartPlaceholders, ht as xsdSplitType, i as collectPlaceholderKeys, in as emitAngle, it as xsdOrient, j as xsdAnimationDgmBuild, jt as hashedId, k as xsdAnimLevel, kt as imageTypeFromPath, l as getOleRefs, ln as parsePercentAttr, lt as xsdPresetShadow, m as replaceAudioPlaceholders, mt as xsdSlideLayoutType, n as SmartArtRelOptions, nn as convertUniversalMeasureToPt, nt as xsdMaterialType, o as formatId, on as mapOptional, ot as xsdPattern, p as replaceAllPlaceholders, pn as compileMapping, pt as xsdSizeRepresents, q as xsdFontAlignment, qt as convertPointsToEmu, r as addSmartArtRelationships, rn as convertUniversalMeasureToTwip, rt as xsdMathStyle, s as getAudioRefs, sn as parseAngle, st as xsdPenAlignment, t as IdFormat, tn as convertUniversalMeasureToInch, tt as xsdLineEndSize, u as getReferencedMedia, un as parseUniversalMeasure, ut as xsdRectAlignment, v as replaceImagePlaceholders, vt as xsdTextAlign, w as replaceSmartArtPlaceholders, wt as xsdTotalsRowFunction, x as replaceOleLinkPlaceholders, xt as xsdTextCaps, y as replaceMediaPlaceholders, yt as xsdTextAnchor, z as xsdComments, zt as convertEmuToInches } from "../index-Cd0lFS5x.mjs";
|
|
4
4
|
export { ArgbHexColor, Base64, DataType, DateTime, Guid, HexColor, HexColorOrAuto, IdFormat, ImageFileType, LongHexNumber, Panose, Percentage, PositivePercentage, PositiveUniversalMeasure, RelativeMeasure, ShortHexNumber, SmartArtRelOptions, ThemeColor, ThemeFont, ToUint8ArrayOptions, UcharHexNumber, UniqueNumericIdCreator, UniversalMeasure, UnsignedShortHex, XmlifyedFileEntry, addBinaryFile, addSmartArtRelationships, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertEmuToTwip, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertPointsToEmu, convertPointsToTwip, convertToEmu, convertToInch, convertToPt, convertToTwip, convertTwipToEmu, convertUniversalMeasureToEmu, convertUniversalMeasureToInch, convertUniversalMeasureToPt, convertUniversalMeasureToTwip, dateTimeValue, decimalNumber, derivePasswordHash, eighthPointMeasureValue, emitAngle, emitPercent, extUriMatches, findAndReplaceImagePlaceholders, formatId, getAudioRefs, getMediaRefs, getOleRefs, getReferencedMedia, getVideoRefs, hasPlaceholders, hashPasswordAgile, hashedId, hexBinary, hexColorValue, hpsMeasureValue, imageTypeFromPath, invertMap, isBase64DataURL, longHexNumber, mapOptional, measurementOrPercentValue, parseAngle, parseOnOff, parsePercent, parsePercentAttr, parseUniversalMeasure, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, randomBytes, replaceAllPlaceholders, replaceAudioPlaceholders, replaceChartPlaceholders, replaceHyperlinkPlaceholders, replaceImageLinkPlaceholders, replaceImagePlaceholders, replaceMediaPlaceholders, replaceNumberingPlaceholders, replaceOleLinkPlaceholders, replaceOlePlaceholders, replacePlaceholders, replaceSmartArtPlaceholders, replaceVideoPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, stripColorHashPrefix, toUint8Array, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, xsdAnimCalcMode, xsdAnimClass, xsdAnimLevel, xsdAnimValueType, xsdAnimationDgmBuild, xsdAxisCrossBetween, xsdAxisCrosses, xsdAxisLabelAlignment, xsdAxisOrientation, xsdAxisPosition, xsdBlendMode, xsdChartBuild, xsdComments, xsdCompoundLine, xsdConsolidateFunction, xsdDataLabelPosition, xsdDiagramBuild, xsdDiagramDirection, xsdEffectContainer, xsdErrorValueType, xsdFontAlignment, xsdHierBranch, xsdHueDirection, xsdIterateType, xsdJcAlignment, xsdLegendPosition, xsdLightRigDirection, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdMathStyle, xsdOrient, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPlaceholderType, xsdPresetShadow, xsdRectAlignment, xsdResizeHandles, xsdShadingPattern, xsdSizeRepresents, xsdSlideLayoutType, xsdSplitType, xsdStrikeStyle, xsdTableWidthType, xsdTextAlign, xsdTextAnchor, xsdTextBuild, xsdTextCaps, xsdTextTabAlignment, xsdTextVerticalType, xsdTotalsRowFunction, xsdTrendlineType, xsdUnderlineStyle, xsdVerticalMergeRev };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-open/core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Shared OOXML infrastructure for office-open — part descriptors, charts, drawings, tables, VML, and unit converters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@noble/hashes": "2.3.0",
|
|
78
78
|
"fflate": "0.8.3",
|
|
79
|
-
"@office-open/xml": "0.13.
|
|
79
|
+
"@office-open/xml": "0.13.1"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"dev": "basis build --stub",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-B8LomQWM.d.mts","names":[],"sources":["../src/opc/packer.ts","../src/opc/relationships.ts","../src/util/compile.ts","../src/util/converters.ts","../src/util/crypto.ts","../src/util/ext-uri.ts","../src/util/generators.ts","../src/util/image-type.ts","../src/util/mappings.ts","../src/util/placeholder.ts"],"mappings":";;;;;UAiCiB;EACf;EACA,eAAe;;cAIJ;cAQA;cAiCA,oBAAqB,kBAAkB;UAOnC;EAEf;EAMA;;UAIe,cAAc,UAAU;EAEvC,OAAO;EAEP,YAAY;EAEZ,cAAc;;cAaH,gBAAuB,UAAU,YAC5C,OAAO,UACP,MAAM,GACN,kBACA,mBACC,QAAQ,aAAa;cAsBX,oBAAqB,UAAU,YAC1C,OAAO,UACP,MAAM,GACN,kBACA,mBACC,aAA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