@office-open/core 0.12.2 → 0.12.3

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/README.md CHANGED
@@ -85,10 +85,25 @@ gen(); // → 1, 2, 3, ...
85
85
  | `@office-open/core/util` | Validators, converters, ID generators, mappings, crypto, base64 |
86
86
  | `@office-open/core/chart` | Chart types, series data, chart collection, title |
87
87
  | `@office-open/core/smartart` | SmartArt data model, tree-to-model, definitions |
88
- | `@office-open/core/drawingml` | DrawingML fills, outlines, effects, geometry, text body |
88
+ | `@office-open/core/drawing` | DrawingML fills, outlines, effects, geometry, text body |
89
+ | `@office-open/core/vector` | Structured VML vocabulary (shapes, strokes, legacy anchors) |
89
90
  | `@office-open/core/patch` | Template patching utilities (replacer, traverser, token replacer) |
90
91
  | `@office-open/core/theme` | Theme definitions and color schemes |
91
92
 
93
+ ## Documentation
94
+
95
+ - [Documentation](https://www.office-open.com/en/core/) — guides, API reference, and examples
96
+ - [Changelog](https://github.com/DemoMacro/office-open/releases) — release notes
97
+ - [Report Issues](https://github.com/DemoMacro/office-open/issues) — bug reports and feature requests
98
+
99
+ ## Related Packages
100
+
101
+ - [office-open](https://www.npmjs.com/package/office-open) — all formats + CLI + AI SDK tools in one install
102
+ - [@office-open/docx](https://www.npmjs.com/package/@office-open/docx) — Word (.docx)
103
+ - [@office-open/pptx](https://www.npmjs.com/package/@office-open/pptx) — PowerPoint (.pptx)
104
+ - [@office-open/xlsx](https://www.npmjs.com/package/@office-open/xlsx) — Excel (.xlsx)
105
+ - [@office-open/xml](https://www.npmjs.com/package/@office-open/xml) — XML parsing and serialization
106
+
92
107
  ## License
93
108
 
94
- - [MIT](LICENSE) © [Demo Macro](https://www.demomacro.com/)
109
+ - [MIT](https://github.com/DemoMacro/office-open/blob/main/LICENSE) © [Demo Macro](https://www.demomacro.com/)
@@ -30,6 +30,7 @@ declare class ZipStreamWriter {
30
30
  private readonly defaultLevel;
31
31
  private readonly zip;
32
32
  private current;
33
+ private readonly nativeEntry;
33
34
  private readonly mainThread;
34
35
  constructor(ondata: (err: Error | null, chunk: Uint8Array, final: boolean) => void, defaultLevel?: number);
35
36
  addPart(name: string, level?: number): ZipPartSink;
@@ -589,4 +590,4 @@ declare function replaceOleLinkPlaceholders(xml: string, links: {
589
590
  }[], offset: number): string;
590
591
  //#endregion
591
592
  export { xsdLegendPosition as $, convertToPt as $t, xsdAnimValueType as A, ZIP_STORED_LEVEL as An, ImageFileType as At, xsdCompoundLine as B, zipAndConvert as Bn, randomBytes as Bt, replacePlaceholders as C, resolveRelationshipTarget as Cn, xsdTextCaps as Ct, xsdAnimCalcMode as D, PackerOptions as Dn, xsdTrendlineType as Dt, invertMap as E, Packer as En, xsdTotalsRowFunction as Et, xsdAxisOrientation as F, createPacker as Fn, uniqueNumericIdCreator as Ft, xsdDiagramDirection as G, convertInchesToEmu as Gt, xsdDashStyle as H, zipSyncAndConvert as Hn, convertEmuToPixels as Ht, xsdAxisPosition as I, createZipStream as In, uniqueUuid as It, xsdFontAlignment as J, convertPixelsToEmu as Jt, xsdEffectContainer as K, convertInchesToTwip as Kt, xsdBlendMode as L, levelForMediaName as Ln, extUriMatches as Lt, xsdAxisCrossBetween as M, ZipPartSink as Mn, UniqueNumericIdCreator as Mt, xsdAxisCrosses as N, ZipStreamWriter as Nn, hashedId as Nt, xsdAnimClass as O, XmlifyedFile as On, xsdUnderlineStyle as Ot, xsdAxisLabelAlignment as P, Zippable$1 as Pn, uniqueId as Pt, xsdJcAlignment as Q, convertToInch as Qt, xsdChartBuild as R, strFromU8$1 as Rn, derivePasswordHash as Rt, replaceOlePlaceholders as S, partPathToRelsPath as Sn, xsdTextBuild as St, replaceVideoPlaceholders as T, CompressionOptions as Tn, xsdTextVerticalType as Tt, xsdDataLabelPosition as U, convertEmuToPoints as Ut, xsdConsolidateFunction as V, zipSync$1 as Vn, convertEmuToInches as Vt, xsdDiagramBuild as W, convertEmuToTwip as Wt, xsdHueDirection as X, convertPointsToTwip as Xt, xsdHierBranch as Y, convertPointsToEmu as Yt, xsdIterateType as Z, convertToEmu as Zt, replaceImageLinkPlaceholders as _, RelationshipType as _n, xsdSplitType as _t, findAndReplaceImagePlaceholders as a, convertUniversalMeasureToPt as an, xsdOnOffStyle as at, replaceNumberingPlaceholders as b, buildRootRelationships as bn, xsdTextAlign as bt, getMediaRefs as c, emitPercent as cn, xsdPattern as ct, getVideoRefs as d, parsePercent as dn, xsdPresetShadow as dt, convertToTwip as en, xsdLightRigDirection as et, hasPlaceholders as f, parsePercentAttr as fn, xsdRectAlignment as ft, replaceHyperlinkPlaceholders as g, compileMapping as gn, xsdSlideLayoutType as gt, replaceChartPlaceholders as h, addBinaryFile as hn, xsdSizeRepresents as ht, collectPlaceholderKeys as i, convertUniversalMeasureToInch as in, xsdMathStyle as it, xsdAnimationDgmBuild as j, ZipOptions as jn, imageTypeFromPath as jt, xsdAnimLevel as k, ZIP_DEFLATE_LEVEL as kn, xsdVerticalMergeRev as kt, getOleRefs as l, mapOptional as ln, xsdPenAlignment as lt, replaceAudioPlaceholders as m, XmlifyedFileEntry as mn, xsdShadingPattern as mt, SmartArtRelOptions as n, convertTwipToPoints as nn, xsdLineEndSize as nt, formatId as o, convertUniversalMeasureToTwip as on, xsdOrient as ot, replaceAllPlaceholders as p, parseUniversalMeasure as pn, xsdResizeHandles as pt, xsdErrorValueType as q, convertMillimetersToTwip as qt, addSmartArtRelationships as r, convertUniversalMeasureToEmu as rn, xsdMaterialType as rt, getAudioRefs as s, emitAngle as sn, xsdPathFillMode as st, IdFormat as t, convertTwipToEmu as tn, xsdLineCap as tt, getReferencedMedia as u, parseAngle as un, xsdPlaceholderType as ut, replaceImagePlaceholders as v, Relationships as vn, xsdStrikeStyle as vt, replaceSmartArtPlaceholders as w, CompileFn as wn, xsdTextTabAlignment as wt, replaceOleLinkPlaceholders as x, optionalRelsPart as xn, xsdTextAnchor as xt, replaceMediaPlaceholders as y, TargetModeType as yn, xsdTableWidthType as yt, xsdComments as z, unzipSync$1 as zn, hashPasswordAgile as zt };
592
- //# sourceMappingURL=index-DF3lKLF_.d.mts.map
593
+ //# sourceMappingURL=index-DfFszyH1.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DfFszyH1.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;EAEf,KAAK,OAAO;EAEZ,IAAI,YAAY;;cAcL;mBAWQ;mBAVF;UACT;mBAIS;mBACA;EAGf,YAAA,SAAS,KAAK,cAAc,OAAO,YAAY,yBAC9B;EAMnB,QAAQ,cAAc,iBAAoC;EA2B1D;;KAWU,UAAU,UACpB,MAAM,OACN,YAAY,gBACZ,wBACG;UASY,OAAO;EAEtB,SAAS,UAAU;EAGnB,KAAK,UAAU,2BACb,MAAM,OACN,UAAU,cAAc,KACvB,QAAQ,aAAa;EAExB,SAAS,UAAU,2BACjB,MAAM,OACN,UAAU,cAAc,KACvB,aAAa;EAGhB,QAAQ,MAAM,OAAO,UAAU,gBAAgB,QAAQ;EAEvD,YAAY,MAAM,OAAO,UAAU,gBAAgB;EAGnD,SAAS,MAAM,OAAO,UAAU,gBAAgB;EAEhD,aAAa,MAAM,OAAO,UAAU;EAGpC,SAAS,MAAM,OAAO,UAAU,gBAAgB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AwCK,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 SchemeColorOptions, $i as FillOptions, $n as createGroupFill, $r as TextShapePreset, $t as pickNonVisualDrawingProperties, A as patternFillDesc, Aa as PatternFillOptions, Ai as PresetDash, An as parseTableStyle, Ar as DEFAULT_SHADOW_BLUR_RADIUS, At as AnimateOneByOneOptions, B as solidFillDesc, Ba as createGradientFill, Bi as ShapeType, Bn as Transform2DOptions, Br as TextFieldOptions, Bt as createAdjustList, C as pictureLockingDesc, Ca as InnerShadowEffectOptions, Ci as createScene3D, Cn as TableStyleListOptions, Cr as BulletCharOptions, Ct as createLayoutDefinitionHeader, D as fillDesc, Da as BlendMode, Di as OutlineFillProperties, Dn as ThemeableLineStyleOptions, Dr as BulletStyleOptions, Dt as AdjustListOptions, E as emitFillXml, Ea as createGlowEffect, Ei as LineJoin, En as TableTextStyleOptions, Er as BulletPictureOptions, Et as createStyleDefinitionHeaderList, F as parseColorChoiceElement, Fa as GradientStop, Fi as LineEndWidth, Fn as scene3DDesc, Fr as TabStopOptions, Ft as MaxChildrenOptions, G as DiagramTextPropertiesOptions, Ga as createTileInfo, Gi as PathCommand, Gn as BlipFillOptions, Gr as TextTabAlignment, Gt as createOrgChart, H as systemColorDesc, Ha as TileAlignment, Hi as ConnectionSite, Hn as createTransform2D, Hr as TextHyperlinkOptions, Ht as createAnimationLevel, I as presetColorDesc, Ia as LinearShadeOptions, Ii as createLineEnd, In as shape3DDesc, Ir as TextAlignment, It as OrgChartOptions, J as createDiagramTextProperties, Ja as createSolidFill, Ji as createCustomGeometry, Jn as BlipOptions, Jr as FlatTextOptions, Jt as NonVisualContentPartPropertiesOptions, K as createDiagramExtensionList, Ka as SolidFillOptions, Ki as PathFillMode, Kn as createBlipFill, Kr as UnderlineStyle, Kt as createPreferredChildren, L as rgbColorDesc, La as PathShade, Li as DashStop, Ln as StyleMatrixReferenceOptions, Lr as TextBreakOptions, Lt as PreferredChildrenOptions, M as hslColorDesc, Ma as createPatternFill, Mi as LineEndLength, Mn as Cell3DOptions, Mr as DEFAULT_SHADOW_DISTANCE, Mt as AnimationLevelOptions, N as isPlainRgbColor, Na as GradientFillOptions, Ni as LineEndOptions, Nn as bevelDesc, Nr as RunFont, Nt as HierBranch, O as findFillChild, Oa as FillOverlayEffectOptions, Oi as OutlineOptions, On as createTableStyle, Or as DEFAULT_OUTLINE_WIDTH, Ot as AdjustOptions, P as parseColorChoice, Pa as GradientShadeOptions, Pi as LineEndType, Pn as cell3DDesc, Pr as StrikeStyle, Pt as HierBranchOptions, Q as ColorMethod, Qa as SchemeColor, Qi as BlipFillMediaData, Qn as stringifyLineProperties, Qr as TextHorzOverflow, Qt as parseNonVisualDrawingProperties, R as scRgbColorDesc, Ra as PathShadeOptions, Ri as createCustomDash, Rn as BlackWhiteMode, Rr as TextCapitalization, Rt as PresentationLayoutVariablesOptions, S as groupLockingDesc, Sa as createOuterShadowEffect, Si as Vector3D, Sn as TablePartStyleOptions, Sr as BulletAutoNumOptions, St as createColorsDefinitionHeaderList, T as effectListDesc, Ta as GlowEffectOptions, Ti as LineCap, Tn as TableStyleRegion, Tr as BulletOptions, Tt as createStyleDefinitionHeader, U as DiagramExtensionListOptions, Ua as TileFlipMode, Ui as CustomGeometryOptions, Un as stringifyStretch, Ur as TextParagraphPropertiesOptions, Ut as createHierBranch, V as stringifyColorChoice, Va as createGradientStop, Vi as stringifyPresetGeometry, Vn as createGroupTransform2D, Vr as TextFont, Vt as createAnimateOneByOne, W as DiagramExtensionOptions, Wa as TileOptions, Wi as GeomRect, Wn as createExtensionList, Wr as TextRunOptions, Wt as createMaxChildren, X as createDiagramRelationshipIds, Xa as SystemColorOptions, Xi as stringifyAdjustmentValues, Xn as createSoftEdgeEffect, Xr as PresetTextShapeOptions, Xt as stringifyNonVisualContentPartProperties, Y as DiagramRelationshipIdsOptions, Ya as SystemColor, Yi as GeometryGuide, Yn as createBlip, Yr as NormalAutofitOptions, Yt as parseNonVisualContentPartProperties, Z as ColorListOptions, Za as createSystemColor, Zi as BlipFillConfigOptions, Zn as outlineDesc, Zr as TextBodyWrapping, Zt as NonVisualDrawingPropertiesOptions, _ as transform2DDesc, _a as PresetShadow, _i as CameraOptions, _n as OnOffStyleType, _r as stringifyTextListStyleTag, _t as LayoutDefinitionHeaderListOptions, a as BlipDescriptorOptions, aa as EffectContainer, ai as parseBodyProperties, an as ContentPartLockingOptions, ao as PresetColor, ar as readParagraphProperties, at as createEffectColorList, b as connectorLockingDesc, ba as OuterShadowEffectOptions, bi as Scene3DOptions, bn as TableCellStyleOptions, br as textStylesDesc, bt as StyleDefinitionHeaderOptions, c as sourceRectangleDesc, ca as BlipEffectsOptions, ci as shapePropertiesDesc, cn as PictureLockingOptions, co as HslColorOptions, cr as buildHyperlinkElement, ct as createStyleLabel, d as tileDesc, da as EffectExtent, di as createShape3D, dn as createContentPartLocking, do as createColorTransforms, dr as runPropertiesDesc, dt as createTextLineColorList, ea as GradientStopOptions, ei as TextVertOverflow, en as stringifyNonVisualDrawingProperties, eo as createSchemeColor, er as createNoFill, et as DiagramStyleOptions, f as stringifyTextRun, fa as EffectListOptions, fi as BevelOptions, fn as createGraphicFrameLocking, fr as stringifyRunProperties, ft as ColorsDefinitionHeaderListOptions, g as groupTransform2DDesc, ga as createReflectionEffect, gi as BackdropOptions, gn as CompoundLineType, gr as parseTextStyles, gt as DiagramNameOptions, h as groupShapePropertiesDesc, ha as ReflectionEffectOptions, hi as createBottomBevel, hn as createShapeLocking, hr as TextStylesOptions, ht as DiagramDescriptionOptions, i as presentationLayoutVariablesDesc, ia as createSourceRectangle, ii as createBodyProperties, in as ConnectorLockingOptions, io as createRgbColor, ir as paragraphDesc, it as createDiagramStyle, j as emitColorChoice, ja as PresetPattern, ji as createOutline, jn as parseTableStyleList, jr as DEFAULT_SHADOW_DIRECTION, jt as AnimationLevel, k as gradientFillDesc, ka as createFillOverlayEffect, ki as PenAlignment, kn as createTableStyleList, kr as DEFAULT_SHADOW_ALPHA, kt as AnimateOneByOne, l as stretchDesc, la as createBlipEffects, li as PresetMaterial, ln as ShapeLockingOptions, lo as createHslColor, lr as readHyperlink, lt as createTextEffectColorList, m as GroupShapePropertiesOptions, ma as createEffectList, mi as createBevel, mn as createPictureLocking, mr as TextListStyleOptions, mt as DiagramCategoryOptions, n as diagramRelationshipIdsDesc, na as extractBlipFillMedia, ni as VerticalAnchor, nn as parseEndpointConnection, no as createScRgbColor, nr as textBodyDesc, nt as HueDirection, o as blipDesc, oa as EffectDagOptions, oi as ShapePropertiesExtensionOptions, on as GraphicFrameLockingOptions, oo as PresetColorOptions, or as stringifyParagraphPropertiesElement, ot as createFillColorList, p as textRunDesc, pa as calculateEffectExtent, pi as BevelPreset, pn as createGroupLocking, pr as DEFAULT_TEXT_STYLES, pt as ColorsDefinitionHeaderOptions, q as createDiagramShape3D, qa as createColorElement, qi as PathOptions, qn as BlipCompression, qr as BodyPropertiesOptions, qt as createPresentationLayoutVariables, r as diagramStyleDesc, ra as SourceRectangleOptions, ri as bodyPropertiesDesc, rn as stringifyEndpointConnection, ro as RgbColorOptions, rr as ParagraphDescriptorOptions, rt as StyleMatrixIndex, s as blipFillDesc, sa as createEffectDag, si as ShapePropertiesOptions, sn as GroupLockingOptions, so as createPresetColor, sr as Mutable, st as createLineColorList, t as diagramExtensionListDesc, ta as buildFill, ti as TextVertical, tn as EndpointConnectionOptions, to as ScRgbColorOptions, tr as TextBodyOptions, tt as FontCollectionIndex, u as stringifyBlipEffects, ua as BlurEffectOptions, ui as Shape3DOptions, un as createConnectorLocking, uo as ColorTransformOptions, ur as registerHyperlink, ut as createTextFillColorList, v as customGeometryDesc, va as PresetShadowEffectOptions, vi as LightRigOptions, vn as TableBackgroundStyleOptions, vr as stringifyTextStyles, vt as LayoutDefinitionHeaderOptions, w as shapeLockingDesc, wa as createInnerShadowEffect, wi as CompoundLine, wn as TableStyleOptions, wr as BulletNoneOption, wt as createLayoutDefinitionHeaderList, x as graphicFrameLockingDesc, xa as RectAlignment, xi as SphereCoords, xn as TableFontReferenceOptions, xr as AutoNumberFormat, xt as createColorsDefinitionHeader, y as presetGeometryDesc, ya as createPresetShadowEffect, yi as Point3D, yn as TableCellBorderOptions, yr as textListStyleDesc, yt as StyleDefinitionHeaderListOptions, z as schemeColorDesc, za as RelativeRect, zi as PresetGeometryOptions, zn as GroupTransform2DOptions, zr as TextCharacterPropertiesOptions, zt as createAdjust } from "./index-DPkf_CtG.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-kO89NUEX.mjs";
7
7
  import { i as convertOutput, n as OutputByType, r as OutputType, t as OoxmlMimeType } from "./output-yyxdkG0C.mjs";
8
- import { $ as xsdLegendPosition, $t as convertToPt, A as xsdAnimValueType, An as ZIP_STORED_LEVEL, At as ImageFileType, B as xsdCompoundLine, Bn as zipAndConvert, Bt as randomBytes, C as replacePlaceholders, Cn as resolveRelationshipTarget, Ct as xsdTextCaps, D as xsdAnimCalcMode, Dn as PackerOptions, Dt as xsdTrendlineType, E as invertMap, En as Packer, Et as xsdTotalsRowFunction, F as xsdAxisOrientation, Fn as createPacker, Ft as uniqueNumericIdCreator, G as xsdDiagramDirection, Gt as convertInchesToEmu, H as xsdDashStyle, Hn as zipSyncAndConvert, Ht as convertEmuToPixels, I as xsdAxisPosition, In as createZipStream, It as uniqueUuid, J as xsdFontAlignment, Jt as convertPixelsToEmu, K as xsdEffectContainer, Kt as convertInchesToTwip, L as xsdBlendMode, Ln as levelForMediaName, Lt as extUriMatches, M as xsdAxisCrossBetween, Mn as ZipPartSink, Mt as UniqueNumericIdCreator, N as xsdAxisCrosses, Nn as ZipStreamWriter, Nt as hashedId, O as xsdAnimClass, On as XmlifyedFile, Ot as xsdUnderlineStyle, P as xsdAxisLabelAlignment, Pn as Zippable, Pt as uniqueId, Q as xsdJcAlignment, Qt as convertToInch, R as xsdChartBuild, Rn as strFromU8, Rt as derivePasswordHash, S as replaceOlePlaceholders, Sn as partPathToRelsPath, St as xsdTextBuild, T as replaceVideoPlaceholders, Tn as CompressionOptions, Tt as xsdTextVerticalType, U as xsdDataLabelPosition, Ut as convertEmuToPoints, V as xsdConsolidateFunction, Vn as zipSync, Vt as convertEmuToInches, W as xsdDiagramBuild, Wt as convertEmuToTwip, X as xsdHueDirection, Xt as convertPointsToTwip, Y as xsdHierBranch, Yt as convertPointsToEmu, Z as xsdIterateType, Zt as convertToEmu, _ as replaceImageLinkPlaceholders, _n as RelationshipType, _t as xsdSplitType, a as findAndReplaceImagePlaceholders, an as convertUniversalMeasureToPt, at as xsdOnOffStyle, b as replaceNumberingPlaceholders, bn as buildRootRelationships, bt as xsdTextAlign, c as getMediaRefs, cn as emitPercent, ct as xsdPattern, d as getVideoRefs, dn as parsePercent, dt as xsdPresetShadow, en as convertToTwip, et as xsdLightRigDirection, f as hasPlaceholders, fn as parsePercentAttr, ft as xsdRectAlignment, g as replaceHyperlinkPlaceholders, gn as compileMapping, gt as xsdSlideLayoutType, h as replaceChartPlaceholders, hn as addBinaryFile, ht as xsdSizeRepresents, i as collectPlaceholderKeys, in as convertUniversalMeasureToInch, it as xsdMathStyle, j as xsdAnimationDgmBuild, jn as ZipOptions, jt as imageTypeFromPath, k as xsdAnimLevel, kn as ZIP_DEFLATE_LEVEL, kt as xsdVerticalMergeRev, l as getOleRefs, ln as mapOptional, lt as xsdPenAlignment, m as replaceAudioPlaceholders, mn as XmlifyedFileEntry, mt as xsdShadingPattern, n as SmartArtRelOptions, nn as convertTwipToPoints, nt as xsdLineEndSize, o as formatId, on as convertUniversalMeasureToTwip, ot as xsdOrient, p as replaceAllPlaceholders, pn as parseUniversalMeasure, pt as xsdResizeHandles, q as xsdErrorValueType, qt as convertMillimetersToTwip, r as addSmartArtRelationships, rn as convertUniversalMeasureToEmu, rt as xsdMaterialType, s as getAudioRefs, sn as emitAngle, st as xsdPathFillMode, t as IdFormat, tn as convertTwipToEmu, tt as xsdLineCap, u as getReferencedMedia, un as parseAngle, ut as xsdPlaceholderType, v as replaceImagePlaceholders, vn as Relationships, vt as xsdStrikeStyle, w as replaceSmartArtPlaceholders, wn as CompileFn, wt as xsdTextTabAlignment, x as replaceOleLinkPlaceholders, xn as optionalRelsPart, xt as xsdTextAnchor, y as replaceMediaPlaceholders, yn as TargetModeType, yt as xsdTableWidthType, z as xsdComments, zn as unzipSync, zt as hashPasswordAgile } from "./index-DF3lKLF_.mjs";
8
+ import { $ as xsdLegendPosition, $t as convertToPt, A as xsdAnimValueType, An as ZIP_STORED_LEVEL, At as ImageFileType, B as xsdCompoundLine, Bn as zipAndConvert, Bt as randomBytes, C as replacePlaceholders, Cn as resolveRelationshipTarget, Ct as xsdTextCaps, D as xsdAnimCalcMode, Dn as PackerOptions, Dt as xsdTrendlineType, E as invertMap, En as Packer, Et as xsdTotalsRowFunction, F as xsdAxisOrientation, Fn as createPacker, Ft as uniqueNumericIdCreator, G as xsdDiagramDirection, Gt as convertInchesToEmu, H as xsdDashStyle, Hn as zipSyncAndConvert, Ht as convertEmuToPixels, I as xsdAxisPosition, In as createZipStream, It as uniqueUuid, J as xsdFontAlignment, Jt as convertPixelsToEmu, K as xsdEffectContainer, Kt as convertInchesToTwip, L as xsdBlendMode, Ln as levelForMediaName, Lt as extUriMatches, M as xsdAxisCrossBetween, Mn as ZipPartSink, Mt as UniqueNumericIdCreator, N as xsdAxisCrosses, Nn as ZipStreamWriter, Nt as hashedId, O as xsdAnimClass, On as XmlifyedFile, Ot as xsdUnderlineStyle, P as xsdAxisLabelAlignment, Pn as Zippable, Pt as uniqueId, Q as xsdJcAlignment, Qt as convertToInch, R as xsdChartBuild, Rn as strFromU8, Rt as derivePasswordHash, S as replaceOlePlaceholders, Sn as partPathToRelsPath, St as xsdTextBuild, T as replaceVideoPlaceholders, Tn as CompressionOptions, Tt as xsdTextVerticalType, U as xsdDataLabelPosition, Ut as convertEmuToPoints, V as xsdConsolidateFunction, Vn as zipSync, Vt as convertEmuToInches, W as xsdDiagramBuild, Wt as convertEmuToTwip, X as xsdHueDirection, Xt as convertPointsToTwip, Y as xsdHierBranch, Yt as convertPointsToEmu, Z as xsdIterateType, Zt as convertToEmu, _ as replaceImageLinkPlaceholders, _n as RelationshipType, _t as xsdSplitType, a as findAndReplaceImagePlaceholders, an as convertUniversalMeasureToPt, at as xsdOnOffStyle, b as replaceNumberingPlaceholders, bn as buildRootRelationships, bt as xsdTextAlign, c as getMediaRefs, cn as emitPercent, ct as xsdPattern, d as getVideoRefs, dn as parsePercent, dt as xsdPresetShadow, en as convertToTwip, et as xsdLightRigDirection, f as hasPlaceholders, fn as parsePercentAttr, ft as xsdRectAlignment, g as replaceHyperlinkPlaceholders, gn as compileMapping, gt as xsdSlideLayoutType, h as replaceChartPlaceholders, hn as addBinaryFile, ht as xsdSizeRepresents, i as collectPlaceholderKeys, in as convertUniversalMeasureToInch, it as xsdMathStyle, j as xsdAnimationDgmBuild, jn as ZipOptions, jt as imageTypeFromPath, k as xsdAnimLevel, kn as ZIP_DEFLATE_LEVEL, kt as xsdVerticalMergeRev, l as getOleRefs, ln as mapOptional, lt as xsdPenAlignment, m as replaceAudioPlaceholders, mn as XmlifyedFileEntry, mt as xsdShadingPattern, n as SmartArtRelOptions, nn as convertTwipToPoints, nt as xsdLineEndSize, o as formatId, on as convertUniversalMeasureToTwip, ot as xsdOrient, p as replaceAllPlaceholders, pn as parseUniversalMeasure, pt as xsdResizeHandles, q as xsdErrorValueType, qt as convertMillimetersToTwip, r as addSmartArtRelationships, rn as convertUniversalMeasureToEmu, rt as xsdMaterialType, s as getAudioRefs, sn as emitAngle, st as xsdPathFillMode, t as IdFormat, tn as convertTwipToEmu, tt as xsdLineCap, u as getReferencedMedia, un as parseAngle, ut as xsdPlaceholderType, v as replaceImagePlaceholders, vn as Relationships, vt as xsdStrikeStyle, w as replaceSmartArtPlaceholders, wn as CompileFn, wt as xsdTextTabAlignment, x as replaceOleLinkPlaceholders, xn as optionalRelsPart, xt as xsdTextAnchor, y as replaceMediaPlaceholders, yn as TargetModeType, yt as xsdTableWidthType, z as xsdComments, zn as unzipSync, zt as hashPasswordAgile } from "./index-DfFszyH1.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-DRggxtp7.mjs";
11
11
  import { $ as stringifyVmlGroup, $n as stringifyVmlCallout, $t as stringifyVmlPath, A as VmlPolylineOptions, An as VmlExtrusionType, Ar as VmlOfficeShapeAttributes, At as stringifyVmlTextbox, B as parseVmlGroup, Bn as VmlSkewOptions, Br as stringifyVmlTrueFalseBlank, Bt as stringifyVmlStroke, C as VmlBaseShapeFields, Cn as VmlDiagramRelationOptions, Cr as VmlConnectType, Ct as stringifyVmlWrap, D as VmlImageOptions, Dn as VmlExtrusionOptions, Dr as VmlHorizontalRuleAlign, Dt as stringifyVmlTextPath, E as VmlGroupOptions, En as VmlExtensionMode, Er as VmlDiagramLayout, Et as parseVmlTextPath, F as VmlShapetypeOptions, Fn as VmlOleDrawAspect, Fr as parseVmlAttributes, Ft as VmlStrokeEndCap, G as parseVmlRect, Gn as parseVmlEquationXml, Gr as stringifyVmlStyle, Gt as VmlIsCommentOptions, H as parseVmlLine, Hn as parseVmlClipPath, Hr as VmlShapeStyle, Ht as VmlShadowType, I as nextVmlShapeId, In as VmlOleObjectOptions, Ir as parseVmlTrueFalse, It as VmlStrokeJoinStyle, J as parseVmlShapeChild, Jn as parseVmlLock, Jt as parseVmlTextData, K as parseVmlRoundRect, Kn as parseVmlExtrusion, Kr as styleToKeyMap, Kt as VmlTextDataOptions, L as parseVmlArc, Ln as VmlOleObjectType, Lr as parseVmlTrueFalseBlank, Lt as VmlStrokeLineStyle, M as VmlRoundRectOptions, Mn as VmlLockOptions, Mr as VmlShapeAttributes, Mt as VmlStrokeArrowType, N as VmlShapeChild, Nn as VmlOfficeFillOptions, Nr as VmlTrueFalse, Nt as VmlStrokeArrowWidth, O as VmlLineOptions, On as VmlExtrusionPlane, Or as VmlInsetMode, Ot as VmlTextboxOptions, P as VmlShapeOptions, Pn as VmlOfficeFillType, Pr as VmlTrueFalseBlank, Pt as VmlStrokeChildOptions, Q as stringifyVmlCurve, Qn as parseVmlSkew, Qt as parseVmlPath, R as parseVmlBackground, Rn as VmlOleUpdateMode, Rr as stringifyVmlAttributes, Rt as VmlStrokeOptions, S as VmlBackgroundOptions, Sn as VmlDiagramOptions, Sr as VmlColor, St as stringifyVmlBorder, T as VmlEditAs, Tn as VmlExtAttribute, Tr as VmlCoreAttributes, Tt as VmlTextPathStyle, U as parseVmlOval, Un as parseVmlComplex, Ur as parseVmlShapeStyle, Ut as parseVmlShadow, V as parseVmlImage, Vn as parseVmlCallout, Vr as LengthUnit, Vt as VmlShadowOptions, W as parseVmlPolyline, Wn as parseVmlDiagram, Wr as parseVmlStyle, Wt as stringifyVmlShadow, X as stringifyVmlArc, Xn as parseVmlOleObject, Xt as stringifyVmlTextData, Y as parseVmlShapetype, Yn as parseVmlOfficeFill, Yt as stringifyVmlIsComment, Z as stringifyVmlBackground, Zn as parseVmlSignatureLine, Zt as VmlPathOptions, _ as stringifyVmlColorMenu, _n as VmlCalloutAngle, _r as VML_OFFICE_SHAPE_ATTRS, _t as VmlWrapType, a as VmlRegroupTableOptions, an as parseVmlHandles, ar as stringifyVmlInk, at as stringifyVmlRoundRect, b as stringifyVmlShapeLayout, bn as VmlColorMode, br as VmlAttrSpec, bt as parseVmlWrap, c as VmlRuleProxyOptions, cn as parseVmlFormulas, cr as stringifyVmlOleObject, ct as stringifyVmlShapetype, d as VmlShapeDefaultsOptions, dn as VmlFillOptions, dr as VmlClientDataOptions, dt as VmlBorderOptions, en as VmlImageDataOptions, er as stringifyVmlClipPath, et as stringifyVmlImage, f as VmlShapeLayoutOptions, fn as VmlFillType, fr as VmlClientObjectType, ft as VmlBorderType, g as parseVmlShapeLayout, gn as EXT_ATTR, gr as VML_OFFICE_CORE_ATTRS, gt as VmlWrapSide, h as parseVmlShapeDefaults, hn as stringifyVmlFill, hr as VML_CORE_ATTRS, ht as VmlWrapOptions, i as VmlRegroupEntryOptions, in as VmlHandlesOptions, ir as stringifyVmlExtrusion, it as stringifyVmlRect, j as VmlRectOptions, jn as VmlInkOptions, jr as VmlScreenSize, jt as VmlStrokeArrowLength, k as VmlOvalOptions, kn as VmlExtrusionRender, kr as VmlOfficeCoreAttributes, kt as parseVmlTextbox, l as VmlRuleType, ln as stringifyVmlFormulas, lr as stringifyVmlSignatureLine, lt as VML_BORDER_TAGS, m as parseVmlColorMru, mn as parseVmlFill, mr as stringifyVmlClientData, mt as VmlVerticalAnchor, n as VmlColorMruOptions, nn as stringifyVmlImageData, nr as stringifyVmlDiagram, nt as stringifyVmlOval, o as VmlRuleHow, on as stringifyVmlHandles, or as stringifyVmlLock, ot as stringifyVmlShape, p as parseVmlColorMenu, pn as VmlImageAspect, pr as parseVmlClientData, pt as VmlHorizontalAnchor, q as parseVmlShape, qn as parseVmlInk, qt as parseVmlIsComment, r as VmlIdMapOptions, rn as VmlHandleOptions, rr as stringifyVmlEquationXml, rt as stringifyVmlPolyline, s as VmlRuleOptions, sn as VmlFormulasOptions, sr as stringifyVmlOfficeFill, st as stringifyVmlShapeChild, t as VmlColorMenuOptions, tn as parseVmlImageData, tr as stringifyVmlComplex, tt as stringifyVmlLine, u as VmlRulesOptions, un as VmlFillMethod, ur as stringifyVmlSkew, ut as VmlAnchorLockOptions, v as stringifyVmlColorMru, vn as VmlCalloutOptions, vr as VML_SHAPE_ATTRS, vt as parseVmlAnchorLock, w as VmlCurveOptions, wn as VmlEquationXmlOptions, wr as VmlConnectorType, wt as VmlTextPathOptions, x as VmlArcOptions, xn as VmlComplexOptions, xr as VmlBlackWhiteMode, xt as stringifyVmlAnchorLock, y as stringifyVmlShapeDefaults, yn as VmlClipPathOptions, yr as VmlAttrKind, yt as parseVmlBorder, z as parseVmlCurve, zn as VmlSignatureLineOptions, zr as stringifyVmlTrueFalse, zt as parseVmlStroke } from "./index-L6AXewfV.mjs";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ZIP_STORED_LEVEL, B as OoxmlMimeType, C as replaceVideoPlaceholders, D as addBinaryFile, E as randomBytes, F as strFromU8, H as hasNativeInflate, I as unzipSync, L as zipAndConvert, M as createPacker, N as createZipStream, O as compileMapping, P as levelForMediaName, R as zipSync, S as replaceSmartArtPlaceholders, T as hashPasswordAgile, U as nativeCrc32, V as convertOutput, W as nativeUnzip, _ as replaceMediaPlaceholders, a as getAudioRefs, b as replaceOlePlaceholders, c as getReferencedMedia, d as replaceAllPlaceholders, f as replaceAudioPlaceholders, g as replaceImagePlaceholders, h as replaceImageLinkPlaceholders, i as formatId, j as ZipStreamWriter, k as ZIP_DEFLATE_LEVEL, l as getVideoRefs, m as replaceHyperlinkPlaceholders, n as collectPlaceholderKeys, o as getMediaRefs, p as replaceChartPlaceholders, r as findAndReplaceImagePlaceholders, s as getOleRefs, t as addSmartArtRelationships, u as hasPlaceholders, v as replaceNumberingPlaceholders, w as derivePasswordHash, x as replacePlaceholders, y as replaceOleLinkPlaceholders, z as zipSyncAndConvert } from "./util-Cr7rwR6t.mjs";
1
+ import { A as ZIP_STORED_LEVEL, B as OoxmlMimeType, C as replaceVideoPlaceholders, D as addBinaryFile, E as randomBytes, F as strFromU8, H as hasNativeInflate, I as unzipSync, L as zipAndConvert, M as createPacker, N as createZipStream, O as compileMapping, P as levelForMediaName, R as zipSync, S as replaceSmartArtPlaceholders, T as hashPasswordAgile, U as nativeCrc32, V as convertOutput, W as nativeUnzip, _ as replaceMediaPlaceholders, a as getAudioRefs, b as replaceOlePlaceholders, c as getReferencedMedia, d as replaceAllPlaceholders, f as replaceAudioPlaceholders, g as replaceImagePlaceholders, h as replaceImageLinkPlaceholders, i as formatId, j as ZipStreamWriter, k as ZIP_DEFLATE_LEVEL, l as getVideoRefs, m as replaceHyperlinkPlaceholders, n as collectPlaceholderKeys, o as getMediaRefs, p as replaceChartPlaceholders, r as findAndReplaceImagePlaceholders, s as getOleRefs, t as addSmartArtRelationships, u as hasPlaceholders, v as replaceNumberingPlaceholders, w as derivePasswordHash, x as replacePlaceholders, y as replaceOleLinkPlaceholders, z as zipSyncAndConvert } from "./util-iHHKF2Rx.mjs";
2
2
  import { _ as toJson, a as appendOverride, b as buildCorePropertiesXmlString, c as createTraverser, d as TokenNotFoundError, f as createSplitInject, g as patchSpaceAttribute, h as nextNumericId, i as appendContentType, l as createRunRenderer, m as getFirstLevelElements, n as appendRelationship, o as removeOverride, p as createTextElementContents, r as getNextRelationshipIndex, s as createReplacer, t as applyCorePropertiesOverride, u as createTokenReplacer, v as DOCX_NS, x as parseCorePropsElement, y as PPTX_NS } from "./patch-AkQY17CD.mjs";
3
3
  import { $ as xsdDiagramDirection, $t as pointMeasureValue, A as parseAngle, At as xsdTextBuild, B as xsdAxisCrossBetween, Bt as decodeBase64, C as convertUniversalMeasureToEmu, Ct as xsdSizeRepresents, D as emitAngle, Dt as xsdTableWidthType, E as convertUniversalMeasureToTwip, Et as xsdStrikeStyle, F as xsdAnimCalcMode, Ft as xsdTrendlineType, G as xsdBlendMode, Gt as eighthPointMeasureValue, H as xsdAxisLabelAlignment, I as xsdAnimClass, It as xsdUnderlineStyle, J as xsdCompoundLine, Jt as hpsMeasureValue, K as xsdChartBuild, Kt as hexBinary, L as xsdAnimLevel, Lt as xsdVerticalMergeRev, M as parsePercentAttr, Mt as xsdTextTabAlignment, N as parseUniversalMeasure, Nt as xsdTextVerticalType, O as emitPercent, Ot as xsdTextAlign, P as invertMap, Pt as xsdTotalsRowFunction, Q as xsdDiagramBuild, Qt as percentageValue, R as xsdAnimValueType, Rt as isBase64DataURL, S as convertTwipToPoints, St as xsdShadingPattern, T as convertUniversalMeasureToPt, Tt as xsdSplitType, U as xsdAxisOrientation, Ut as dateTimeValue, V as xsdAxisCrosses, Vt as encodeBase64, W as xsdAxisPosition, Wt as decimalNumber, X as xsdDashStyle, Xt as measurementOrPercentValue, Y as xsdConsolidateFunction, Yt as longHexNumber, Z as xsdDataLabelPosition, Zt as parseOnOff, _ as convertToEmu, _t as xsdPenAlignment, a as uniqueNumericIdCreator, an as twipsMeasureValue, at as xsdIterateType, b as convertToTwip, bt as xsdRectAlignment, c as convertEmuToPixels, cn as unsignedDecimalNumber, ct as xsdLightRigDirection, d as convertInchesToEmu, dt as xsdMaterialType, en as positiveUniversalMeasureValue, et as xsdEffectContainer, f as convertInchesToTwip, ft as xsdMathStyle, g as convertPointsToTwip, gt as xsdPattern, h as convertPointsToEmu, ht as xsdPathFillMode, i as uniqueId, in as stripColorHashPrefix, it as xsdHueDirection, j as parsePercent, jt as xsdTextCaps, k as mapOptional, kt as xsdTextAnchor, l as convertEmuToPoints, lt as xsdLineCap, m as convertPixelsToEmu, mt as xsdOrient, n as imageTypeFromPath, nn as signedHpsMeasureValue, nt as xsdFontAlignment, o as uniqueUuid, on as uCharHexNumber, ot as xsdJcAlignment, p as convertMillimetersToTwip, pt as xsdOnOffStyle, q as xsdComments, qt as hexColorValue, r as hashedId, rn as signedTwipsMeasureValue, rt as xsdHierBranch, s as convertEmuToInches, sn as universalMeasureValue, st as xsdLegendPosition, t as extUriMatches, tn as shortHexNumber, tt as xsdErrorValueType, u as convertEmuToTwip, ut as xsdLineEndSize, v as convertToInch, vt as xsdPlaceholderType, w as convertUniversalMeasureToInch, wt as xsdSlideLayoutType, x as convertTwipToEmu, xt as xsdResizeHandles, y as convertToPt, yt as xsdPresetShadow, z as xsdAnimationDgmBuild, zt as toUint8Array } from "./ext-uri-BHBcIrW7.mjs";
4
4
  import { C as stringifyDataModelOptions, D as COLOR_CATEGORIES, E as stringifyConnection, O as LAYOUT_CATEGORIES, S as stringifyDataModel, T as stringifyTransPoint, _ as parseLayoutDefinition, a as getColorXml, b as withDiagramNamespaces, c as parseStyleDefinition, d as styleDefDesc, f as colorsDefDesc, g as layoutDefDesc, h as stringifyColorDefinitionPart, i as DEFAULT_DRAWING_XML, k as STYLE_CATEGORIES, l as stringifyStyleDefinition, m as stringifyColorDefinition, n as SmartArtCollection, o as getLayoutXml, p as parseColorDefinition, r as definitionId, s as getStyleXml, t as createDataModel, u as stringifyStyleDefinitionPart, v as stringifyLayoutDefinition, w as stringifyPoint, x as parseDataModelOptions, y as stringifyLayoutDefinitionPart } from "./smartart-YH87Emca.mjs";
@@ -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 xsdLegendPosition, $t as convertToPt, A as xsdAnimValueType, At as ImageFileType, B as xsdCompoundLine, Bt as randomBytes, C as replacePlaceholders, Ct as xsdTextCaps, D as xsdAnimCalcMode, Dt as xsdTrendlineType, E as invertMap, Et as xsdTotalsRowFunction, F as xsdAxisOrientation, Ft as uniqueNumericIdCreator, G as xsdDiagramDirection, Gt as convertInchesToEmu, H as xsdDashStyle, Ht as convertEmuToPixels, I as xsdAxisPosition, It as uniqueUuid, J as xsdFontAlignment, Jt as convertPixelsToEmu, K as xsdEffectContainer, Kt as convertInchesToTwip, L as xsdBlendMode, Lt as extUriMatches, M as xsdAxisCrossBetween, Mt as UniqueNumericIdCreator, N as xsdAxisCrosses, Nt as hashedId, O as xsdAnimClass, Ot as xsdUnderlineStyle, P as xsdAxisLabelAlignment, Pt as uniqueId, Q as xsdJcAlignment, Qt as convertToInch, R as xsdChartBuild, Rt as derivePasswordHash, S as replaceOlePlaceholders, St as xsdTextBuild, T as replaceVideoPlaceholders, Tt as xsdTextVerticalType, U as xsdDataLabelPosition, Ut as convertEmuToPoints, V as xsdConsolidateFunction, Vt as convertEmuToInches, W as xsdDiagramBuild, Wt as convertEmuToTwip, X as xsdHueDirection, Xt as convertPointsToTwip, Y as xsdHierBranch, Yt as convertPointsToEmu, Z as xsdIterateType, Zt as convertToEmu, _ as replaceImageLinkPlaceholders, _t as xsdSplitType, a as findAndReplaceImagePlaceholders, an as convertUniversalMeasureToPt, at as xsdOnOffStyle, b as replaceNumberingPlaceholders, bt as xsdTextAlign, c as getMediaRefs, cn as emitPercent, ct as xsdPattern, d as getVideoRefs, dn as parsePercent, dt as xsdPresetShadow, en as convertToTwip, et as xsdLightRigDirection, f as hasPlaceholders, fn as parsePercentAttr, ft as xsdRectAlignment, g as replaceHyperlinkPlaceholders, gn as compileMapping, gt as xsdSlideLayoutType, h as replaceChartPlaceholders, hn as addBinaryFile, ht as xsdSizeRepresents, i as collectPlaceholderKeys, in as convertUniversalMeasureToInch, it as xsdMathStyle, j as xsdAnimationDgmBuild, jt as imageTypeFromPath, k as xsdAnimLevel, kt as xsdVerticalMergeRev, l as getOleRefs, ln as mapOptional, lt as xsdPenAlignment, m as replaceAudioPlaceholders, mn as XmlifyedFileEntry, mt as xsdShadingPattern, n as SmartArtRelOptions, nn as convertTwipToPoints, nt as xsdLineEndSize, o as formatId, on as convertUniversalMeasureToTwip, ot as xsdOrient, p as replaceAllPlaceholders, pn as parseUniversalMeasure, pt as xsdResizeHandles, q as xsdErrorValueType, qt as convertMillimetersToTwip, r as addSmartArtRelationships, rn as convertUniversalMeasureToEmu, rt as xsdMaterialType, s as getAudioRefs, sn as emitAngle, st as xsdPathFillMode, t as IdFormat, tn as convertTwipToEmu, tt as xsdLineCap, u as getReferencedMedia, un as parseAngle, ut as xsdPlaceholderType, v as replaceImagePlaceholders, vt as xsdStrikeStyle, w as replaceSmartArtPlaceholders, wt as xsdTextTabAlignment, x as replaceOleLinkPlaceholders, xt as xsdTextAnchor, y as replaceMediaPlaceholders, yt as xsdTableWidthType, z as xsdComments, zt as hashPasswordAgile } from "../index-DF3lKLF_.mjs";
3
+ import { $ as xsdLegendPosition, $t as convertToPt, A as xsdAnimValueType, At as ImageFileType, B as xsdCompoundLine, Bt as randomBytes, C as replacePlaceholders, Ct as xsdTextCaps, D as xsdAnimCalcMode, Dt as xsdTrendlineType, E as invertMap, Et as xsdTotalsRowFunction, F as xsdAxisOrientation, Ft as uniqueNumericIdCreator, G as xsdDiagramDirection, Gt as convertInchesToEmu, H as xsdDashStyle, Ht as convertEmuToPixels, I as xsdAxisPosition, It as uniqueUuid, J as xsdFontAlignment, Jt as convertPixelsToEmu, K as xsdEffectContainer, Kt as convertInchesToTwip, L as xsdBlendMode, Lt as extUriMatches, M as xsdAxisCrossBetween, Mt as UniqueNumericIdCreator, N as xsdAxisCrosses, Nt as hashedId, O as xsdAnimClass, Ot as xsdUnderlineStyle, P as xsdAxisLabelAlignment, Pt as uniqueId, Q as xsdJcAlignment, Qt as convertToInch, R as xsdChartBuild, Rt as derivePasswordHash, S as replaceOlePlaceholders, St as xsdTextBuild, T as replaceVideoPlaceholders, Tt as xsdTextVerticalType, U as xsdDataLabelPosition, Ut as convertEmuToPoints, V as xsdConsolidateFunction, Vt as convertEmuToInches, W as xsdDiagramBuild, Wt as convertEmuToTwip, X as xsdHueDirection, Xt as convertPointsToTwip, Y as xsdHierBranch, Yt as convertPointsToEmu, Z as xsdIterateType, Zt as convertToEmu, _ as replaceImageLinkPlaceholders, _t as xsdSplitType, a as findAndReplaceImagePlaceholders, an as convertUniversalMeasureToPt, at as xsdOnOffStyle, b as replaceNumberingPlaceholders, bt as xsdTextAlign, c as getMediaRefs, cn as emitPercent, ct as xsdPattern, d as getVideoRefs, dn as parsePercent, dt as xsdPresetShadow, en as convertToTwip, et as xsdLightRigDirection, f as hasPlaceholders, fn as parsePercentAttr, ft as xsdRectAlignment, g as replaceHyperlinkPlaceholders, gn as compileMapping, gt as xsdSlideLayoutType, h as replaceChartPlaceholders, hn as addBinaryFile, ht as xsdSizeRepresents, i as collectPlaceholderKeys, in as convertUniversalMeasureToInch, it as xsdMathStyle, j as xsdAnimationDgmBuild, jt as imageTypeFromPath, k as xsdAnimLevel, kt as xsdVerticalMergeRev, l as getOleRefs, ln as mapOptional, lt as xsdPenAlignment, m as replaceAudioPlaceholders, mn as XmlifyedFileEntry, mt as xsdShadingPattern, n as SmartArtRelOptions, nn as convertTwipToPoints, nt as xsdLineEndSize, o as formatId, on as convertUniversalMeasureToTwip, ot as xsdOrient, p as replaceAllPlaceholders, pn as parseUniversalMeasure, pt as xsdResizeHandles, q as xsdErrorValueType, qt as convertMillimetersToTwip, r as addSmartArtRelationships, rn as convertUniversalMeasureToEmu, rt as xsdMaterialType, s as getAudioRefs, sn as emitAngle, st as xsdPathFillMode, t as IdFormat, tn as convertTwipToEmu, tt as xsdLineCap, u as getReferencedMedia, un as parseAngle, ut as xsdPlaceholderType, v as replaceImagePlaceholders, vt as xsdStrikeStyle, w as replaceSmartArtPlaceholders, wt as xsdTextTabAlignment, x as replaceOleLinkPlaceholders, xt as xsdTextAnchor, y as replaceMediaPlaceholders, yt as xsdTableWidthType, z as xsdComments, zt as hashPasswordAgile } from "../index-DfFszyH1.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, convertTwipToPoints, 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, xsdDashStyle, xsdDataLabelPosition, xsdDiagramBuild, xsdDiagramDirection, xsdEffectContainer, xsdErrorValueType, xsdFontAlignment, xsdHierBranch, xsdHueDirection, xsdIterateType, xsdJcAlignment, xsdLegendPosition, xsdLightRigDirection, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdMathStyle, xsdOnOffStyle, xsdOrient, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPlaceholderType, xsdPresetShadow, xsdRectAlignment, xsdResizeHandles, xsdShadingPattern, xsdSizeRepresents, xsdSlideLayoutType, xsdSplitType, xsdStrikeStyle, xsdTableWidthType, xsdTextAlign, xsdTextAnchor, xsdTextBuild, xsdTextCaps, xsdTextTabAlignment, xsdTextVerticalType, xsdTotalsRowFunction, xsdTrendlineType, xsdUnderlineStyle, xsdVerticalMergeRev };
@@ -1,3 +1,3 @@
1
- import { C as replaceVideoPlaceholders, D as addBinaryFile, E as randomBytes, O as compileMapping, S as replaceSmartArtPlaceholders, T as hashPasswordAgile, _ as replaceMediaPlaceholders, a as getAudioRefs, b as replaceOlePlaceholders, c as getReferencedMedia, d as replaceAllPlaceholders, f as replaceAudioPlaceholders, g as replaceImagePlaceholders, h as replaceImageLinkPlaceholders, i as formatId, l as getVideoRefs, m as replaceHyperlinkPlaceholders, n as collectPlaceholderKeys, o as getMediaRefs, p as replaceChartPlaceholders, r as findAndReplaceImagePlaceholders, s as getOleRefs, t as addSmartArtRelationships, u as hasPlaceholders, v as replaceNumberingPlaceholders, w as derivePasswordHash, x as replacePlaceholders, y as replaceOleLinkPlaceholders } from "../util-Cr7rwR6t.mjs";
1
+ import { C as replaceVideoPlaceholders, D as addBinaryFile, E as randomBytes, O as compileMapping, S as replaceSmartArtPlaceholders, T as hashPasswordAgile, _ as replaceMediaPlaceholders, a as getAudioRefs, b as replaceOlePlaceholders, c as getReferencedMedia, d as replaceAllPlaceholders, f as replaceAudioPlaceholders, g as replaceImagePlaceholders, h as replaceImageLinkPlaceholders, i as formatId, l as getVideoRefs, m as replaceHyperlinkPlaceholders, n as collectPlaceholderKeys, o as getMediaRefs, p as replaceChartPlaceholders, r as findAndReplaceImagePlaceholders, s as getOleRefs, t as addSmartArtRelationships, u as hasPlaceholders, v as replaceNumberingPlaceholders, w as derivePasswordHash, x as replacePlaceholders, y as replaceOleLinkPlaceholders } from "../util-iHHKF2Rx.mjs";
2
2
  import { $ as xsdDiagramDirection, $t as pointMeasureValue, A as parseAngle, At as xsdTextBuild, B as xsdAxisCrossBetween, C as convertUniversalMeasureToEmu, Ct as xsdSizeRepresents, D as emitAngle, Dt as xsdTableWidthType, E as convertUniversalMeasureToTwip, Et as xsdStrikeStyle, F as xsdAnimCalcMode, Ft as xsdTrendlineType, G as xsdBlendMode, Gt as eighthPointMeasureValue, H as xsdAxisLabelAlignment, I as xsdAnimClass, It as xsdUnderlineStyle, J as xsdCompoundLine, Jt as hpsMeasureValue, K as xsdChartBuild, Kt as hexBinary, L as xsdAnimLevel, Lt as xsdVerticalMergeRev, M as parsePercentAttr, Mt as xsdTextTabAlignment, N as parseUniversalMeasure, Nt as xsdTextVerticalType, O as emitPercent, Ot as xsdTextAlign, P as invertMap, Pt as xsdTotalsRowFunction, Q as xsdDiagramBuild, Qt as percentageValue, R as xsdAnimValueType, Rt as isBase64DataURL, S as convertTwipToPoints, St as xsdShadingPattern, T as convertUniversalMeasureToPt, Tt as xsdSplitType, U as xsdAxisOrientation, Ut as dateTimeValue, V as xsdAxisCrosses, W as xsdAxisPosition, Wt as decimalNumber, X as xsdDashStyle, Xt as measurementOrPercentValue, Y as xsdConsolidateFunction, Yt as longHexNumber, Z as xsdDataLabelPosition, Zt as parseOnOff, _ as convertToEmu, _t as xsdPenAlignment, a as uniqueNumericIdCreator, an as twipsMeasureValue, at as xsdIterateType, b as convertToTwip, bt as xsdRectAlignment, c as convertEmuToPixels, cn as unsignedDecimalNumber, ct as xsdLightRigDirection, d as convertInchesToEmu, dt as xsdMaterialType, en as positiveUniversalMeasureValue, et as xsdEffectContainer, f as convertInchesToTwip, ft as xsdMathStyle, g as convertPointsToTwip, gt as xsdPattern, h as convertPointsToEmu, ht as xsdPathFillMode, i as uniqueId, in as stripColorHashPrefix, it as xsdHueDirection, j as parsePercent, jt as xsdTextCaps, k as mapOptional, kt as xsdTextAnchor, l as convertEmuToPoints, lt as xsdLineCap, m as convertPixelsToEmu, mt as xsdOrient, n as imageTypeFromPath, nn as signedHpsMeasureValue, nt as xsdFontAlignment, o as uniqueUuid, on as uCharHexNumber, ot as xsdJcAlignment, p as convertMillimetersToTwip, pt as xsdOnOffStyle, q as xsdComments, qt as hexColorValue, r as hashedId, rn as signedTwipsMeasureValue, rt as xsdHierBranch, s as convertEmuToInches, sn as universalMeasureValue, st as xsdLegendPosition, t as extUriMatches, tn as shortHexNumber, tt as xsdErrorValueType, u as convertEmuToTwip, ut as xsdLineEndSize, v as convertToInch, vt as xsdPlaceholderType, w as convertUniversalMeasureToInch, wt as xsdSlideLayoutType, x as convertTwipToEmu, xt as xsdResizeHandles, y as convertToPt, yt as xsdPresetShadow, z as xsdAnimationDgmBuild, zt as toUint8Array } from "../ext-uri-BHBcIrW7.mjs";
3
3
  export { addBinaryFile, addSmartArtRelationships, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertEmuToTwip, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertPixelsToEmu, convertPointsToEmu, convertPointsToTwip, convertToEmu, convertToInch, convertToPt, convertToTwip, convertTwipToEmu, convertTwipToPoints, 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, xsdDashStyle, xsdDataLabelPosition, xsdDiagramBuild, xsdDiagramDirection, xsdEffectContainer, xsdErrorValueType, xsdFontAlignment, xsdHierBranch, xsdHueDirection, xsdIterateType, xsdJcAlignment, xsdLegendPosition, xsdLightRigDirection, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdMathStyle, xsdOnOffStyle, xsdOrient, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPlaceholderType, xsdPresetShadow, xsdRectAlignment, xsdResizeHandles, xsdShadingPattern, xsdSizeRepresents, xsdSlideLayoutType, xsdSplitType, xsdStrikeStyle, xsdTableWidthType, xsdTextAlign, xsdTextAnchor, xsdTextBuild, xsdTextCaps, xsdTextTabAlignment, xsdTextVerticalType, xsdTotalsRowFunction, xsdTrendlineType, xsdUnderlineStyle, xsdVerticalMergeRev };
@@ -17,6 +17,7 @@ let _nativeDeflate;
17
17
  let _nativeDeflateAsync;
18
18
  let _nativeInflate;
19
19
  let _nativeCrc32;
20
+ let _zlibModule;
20
21
  const bunApi = globalThis.Bun;
21
22
  if (typeof bunApi?.deflateSync === "function") {
22
23
  _nativeDeflate = (data, level) => bunApi.deflateSync(data, { level });
@@ -25,6 +26,7 @@ if (typeof bunApi?.deflateSync === "function") {
25
26
  try {
26
27
  const zlib = await import("node:zlib");
27
28
  if (typeof zlib.deflateRawSync !== "function") throw new Error("no native deflate");
29
+ _zlibModule = zlib;
28
30
  if (_nativeDeflate === void 0) _nativeDeflate = (data, level) => zlib.deflateRawSync(data, { level });
29
31
  _nativeDeflateAsync = (data, level) => new Promise((resolve, reject) => zlib.deflateRaw(data, { level }, (err, result) => {
30
32
  if (err) reject(err);
@@ -35,12 +37,18 @@ try {
35
37
  } catch {}
36
38
  const hasNativeDeflate = () => _nativeDeflate !== void 0;
37
39
  const hasNativeInflate = () => _nativeInflate !== void 0;
38
- const _prefersMainThreadDeflate = typeof bunApi?.deflateSync === "function";
39
40
  /**
40
- * True when DEFLATE work should run on the main thread instead of fflate's
41
- * per-entry workers (Bun). See {@link createZipStream} in packer.ts.
41
+ * True when incremental DEFLATE should run on the main thread instead of
42
+ * fflate's per-entry workers (Node/Bun). See {@link ZipStreamWriter} in
43
+ * packer.ts.
42
44
  */
43
- const prefersMainThreadDeflate = () => _prefersMainThreadDeflate;
45
+ const prefersMainThreadDeflate = () => _nativeDeflate !== void 0;
46
+ /**
47
+ * True under Bun. Used to keep Bun off `nativeZipAsync`-backed paths: its
48
+ * node:zlib compat layer schedules async calls poorly (bench: async ~1/3 of
49
+ * its sync throughput), so fflate main-thread deflate is the better trade.
50
+ */
51
+ const isBunRuntime = () => typeof bunApi?.deflateSync === "function";
44
52
  /**
45
53
  * Synchronous native CRC-32 (`zlib.crc32`, Node/Bun only) — undefined where no
46
54
  * native zlib resolved (browsers/Deno). Used by media dedup as a fast content
@@ -203,6 +211,27 @@ async function nativeZipAsync(files, level = 6) {
203
211
  };
204
212
  }))).filter((e) => e !== null));
205
213
  }
214
+ const STREAM_CHUNK_SIZE = 65536;
215
+ /**
216
+ * Streaming counterpart of {@link nativeZipAsync}: compresses on the libuv
217
+ * thread pool, then emits the finished archive through a `ReadableStream` in
218
+ * fixed-size chunks. Node only — Bun and browsers keep fflate's incremental
219
+ * path (see {@link prefersMainThreadDeflate}). The memory shape matches the
220
+ * fflate stream (entries are fully resident post-compile either way); the win
221
+ * is dropping fflate's per-entry worker spawn, which costs milliseconds per
222
+ * part on Node's worker_threads and dominates small-package streams.
223
+ */
224
+ function nativeZipStream(files, level = 6) {
225
+ return new ReadableStream({ async start(controller) {
226
+ try {
227
+ const buf = await nativeZipAsync(files, level);
228
+ for (let o = 0; o < buf.length; o += STREAM_CHUNK_SIZE) controller.enqueue(buf.subarray(o, Math.min(o + STREAM_CHUNK_SIZE, buf.length)));
229
+ controller.close();
230
+ } catch (err) {
231
+ controller.error(err instanceof Error ? err : new Error(String(err)));
232
+ }
233
+ } });
234
+ }
206
235
  function rU16(b, o) {
207
236
  return b[o] | b[o + 1] << 8;
208
237
  }
@@ -266,6 +295,42 @@ function nativeUnzip(buf) {
266
295
  }
267
296
  return out;
268
297
  }
298
+ /**
299
+ * Streaming DEFLATE ZIP entry backed by `zlib.createDeflateRaw` instead of
300
+ * fflate's JS engine or per-entry worker — Node only (constructor throws when
301
+ * no native zlib resolved; callers pick the fflate entries elsewhere).
302
+ *
303
+ * Implements fflate's Zip entry contract by subclassing `ZipPassThrough` and
304
+ * overriding `process` — fflate's documented subclassing point — to feed a
305
+ * libuv-pool deflate stream: zero thread spawn (AsyncZipDeflate costs ~5-10ms
306
+ * per part on worker_threads, dominating the many-small-parts OPC shape) while
307
+ * compression still runs off the main thread, so chunked generation overlaps
308
+ * with deflate. `compression`/`flag` mirror what ZipDeflate sets (flag = the
309
+ * same deflate-level hint bits fflate computes), which Zip reads for the
310
+ * local header.
311
+ */
312
+ var NativeZipDeflate = class extends ZipPassThrough {
313
+ /** General-purpose flag bits, mirroring ZipDeflate's level hint. */
314
+ flag;
315
+ z;
316
+ constructor(filename, opts) {
317
+ super(filename);
318
+ if (_zlibModule === void 0) throw new Error("Native deflate not available");
319
+ const level = opts?.level;
320
+ this.flag = level === 1 ? 3 : level !== void 0 && level < 6 ? 2 : level === 9 ? 1 : 0;
321
+ this.compression = 8;
322
+ this.z = _zlibModule.createDeflateRaw({ level });
323
+ this.z.on("data", (dat) => this.ondata(null, dat, false));
324
+ this.z.on("error", (err) => this.ondata(err, /* @__PURE__ */ new Uint8Array(0), true));
325
+ this.z.on("end", () => this.ondata(null, /* @__PURE__ */ new Uint8Array(0), true));
326
+ }
327
+ /** Feed a source chunk; `final` ends the deflate stream. */
328
+ process(chunk, final) {
329
+ this.z.write(chunk);
330
+ if (final) this.z.end();
331
+ else this.z.flush();
332
+ }
333
+ };
269
334
  //#endregion
270
335
  //#region src/opc/output.ts
271
336
  /**
@@ -378,6 +443,7 @@ const zipSyncAndConvert = (files, type, mimeType, level = 1) => {
378
443
  * Works in both Node.js and browsers (Web Streams API).
379
444
  */
380
445
  const createZipStream = (files, defaultLevel = 1) => {
446
+ if (hasNativeDeflate() && !isBunRuntime()) return nativeZipStream(files, defaultLevel);
381
447
  const mainThread = prefersMainThreadDeflate();
382
448
  return new ReadableStream({ start(controller) {
383
449
  try {
@@ -418,6 +484,7 @@ var ZipStreamWriter = class {
418
484
  defaultLevel;
419
485
  zip;
420
486
  current;
487
+ nativeEntry = hasNativeDeflate() && !isBunRuntime();
421
488
  mainThread = prefersMainThreadDeflate();
422
489
  constructor(ondata, defaultLevel = 1) {
423
490
  this.defaultLevel = defaultLevel;
@@ -426,8 +493,9 @@ var ZipStreamWriter = class {
426
493
  /** Add a part and return its incremental sink. `end()` the previous first. */
427
494
  addPart(name, level = this.defaultLevel) {
428
495
  if (this.current) throw new Error(`ZipStreamWriter: previous part not finalized`);
429
- const workerPath = level !== 0 && !this.mainThread;
430
- const entry = level === 0 ? new ZipPassThrough(name) : workerPath ? new AsyncZipDeflate(name, { level }) : new ZipDeflate(name, { level });
496
+ const deflatePath = level !== 0;
497
+ const workerPath = deflatePath && !this.mainThread;
498
+ const entry = !deflatePath ? new ZipPassThrough(name) : this.nativeEntry ? new NativeZipDeflate(name, { level }) : workerPath ? new AsyncZipDeflate(name, { level }) : new ZipDeflate(name, { level });
431
499
  this.zip.add(entry);
432
500
  this.current = entry;
433
501
  return {
@@ -888,4 +956,4 @@ function replaceOleLinkPlaceholders(xml, links, offset) {
888
956
  //#endregion
889
957
  export { ZIP_STORED_LEVEL as A, OoxmlMimeType as B, replaceVideoPlaceholders as C, addBinaryFile as D, randomBytes as E, strFromU8$1 as F, hasNativeInflate as H, unzipSync$1 as I, zipAndConvert as L, createPacker as M, createZipStream as N, compileMapping as O, levelForMediaName as P, zipSync$1 as R, replaceSmartArtPlaceholders as S, hashPasswordAgile as T, nativeCrc32 as U, convertOutput as V, nativeUnzip as W, replaceMediaPlaceholders as _, getAudioRefs as a, replaceOlePlaceholders as b, getReferencedMedia as c, replaceAllPlaceholders as d, replaceAudioPlaceholders as f, replaceImagePlaceholders as g, replaceImageLinkPlaceholders as h, formatId as i, ZipStreamWriter as j, ZIP_DEFLATE_LEVEL as k, getVideoRefs as l, replaceHyperlinkPlaceholders as m, collectPlaceholderKeys as n, getMediaRefs as o, replaceChartPlaceholders as p, findAndReplaceImagePlaceholders as r, getOleRefs as s, addSmartArtRelationships as t, hasPlaceholders as u, replaceNumberingPlaceholders as v, derivePasswordHash as w, replacePlaceholders as x, replaceOleLinkPlaceholders as y, zipSyncAndConvert as z };
890
958
 
891
- //# sourceMappingURL=util-Cr7rwR6t.mjs.map
959
+ //# sourceMappingURL=util-iHHKF2Rx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util-iHHKF2Rx.mjs","names":[],"sources":["../src/opc/zip-native.ts","../src/opc/output.ts","../src/opc/packer.ts","../src/util/compile.ts","../src/util/crypto.ts","../src/util/placeholder.ts"],"sourcesContent":["/**\n * Native ZIP reader/writer with automatic fallback to fflate.\n *\n * `node:zlib` resolves in Node and Bun (via its Node compat layer), giving\n * `deflateRawSync` / `inflateRawSync` for DEFLATE/INFLATE and `zlib.crc32`\n * for CRC-32 — ~2-3x faster than fflate's pure-JS implementation. Browsers\n * and Deno lack a resolvable `node:zlib`, so the dynamic import rejects and\n * packer.ts falls back to fflate. We probe via the import itself rather than\n * `process.versions.node`: core's `shims: true` swaps `process` for a browser\n * stub that drops `versions.node`, which would silently disable native zlib\n * in any package consuming core's polyfilled build.\n *\n * @module\n */\n\nimport type * as ZlibNode from \"node:zlib\";\n\nimport { ZipPassThrough } from \"fflate\";\nimport type { FlateError, Zippable, ZipOptions } from \"fflate\";\n\n// ── CRC-32 lookup table ──\n\nconst CRC_TABLE = new Int32Array(256);\nfor (let i = 0; i < 256; i++) {\n let c = i;\n for (let k = 0; k < 8; k++) c = c & 1 ? (c >>> 1) ^ -306674912 : c >>> 1;\n CRC_TABLE[i] = c;\n}\n\nfunction computeCrc32(data: Uint8Array): number {\n let crc = -1;\n // CRC_TABLE is a fixed 256-entry lookup; the index is masked to [0,255], so the\n // access is guaranteed in-bounds — the `!` is a compile-time narrow, not a runtime check.\n for (const byte of data) {\n crc = CRC_TABLE[(crc ^ byte) & 0xff]! ^ (crc >>> 8);\n }\n return ~crc;\n}\n\n// ── Native zlib detection (Node.js ESM) ──\n\ntype DeflateFn = (data: Uint8Array, level: number) => Uint8Array;\ntype AsyncDeflateFn = (data: Uint8Array, level: number) => Promise<Uint8Array>;\ntype InflateFn = (data: Uint8Array) => Uint8Array;\ntype Crc32Fn = (data: Uint8Array) => number;\n\nlet _nativeDeflate: DeflateFn | undefined;\nlet _nativeDeflateAsync: AsyncDeflateFn | undefined;\nlet _nativeInflate: InflateFn | undefined;\nlet _nativeCrc32: Crc32Fn | undefined;\nlet _zlibModule: typeof ZlibNode | undefined;\n\n// Bun-specific fast path: Bun.deflateSync/Bun.inflateSync emit/accept RAW\n// deflate (bit-identical to deflateRawSync output) but skip the node:zlib\n// compat wrapper — ~10x on the small parts that dominate OPC packages, ~2x\n// on inflate, ~1.3x on large buffers. Probed off globalThis since core ships\n// no bun-types dependency.\nconst bunApi = (\n globalThis as {\n Bun?: {\n deflateSync?: (data: Uint8Array, opts?: { level?: number }) => Uint8Array;\n inflateSync?: (data: Uint8Array) => Uint8Array;\n };\n }\n).Bun;\nif (typeof bunApi?.deflateSync === \"function\") {\n _nativeDeflate = (data: Uint8Array, level: number): Uint8Array =>\n bunApi.deflateSync!(data, { level });\n if (typeof bunApi.inflateSync === \"function\") {\n _nativeInflate = (data: Uint8Array): Uint8Array => bunApi.inflateSync!(data);\n }\n}\n\n// `node:zlib` resolves in Node and Bun (via its Node compat layer); in\n// browsers and Deno the dynamic import rejects, so we fall back to fflate.\n// The import itself is the probe — do NOT gate on `process.versions.node`:\n// core's `shims: true` swaps `process` for a browser stub that drops\n// `versions.node`, which would silently disable native zlib in any package\n// that consumes core's polyfilled build.\ntry {\n // top-level await — ESM standard. Resolves to zlib with deflateRawSync;\n // rejects (or yields a stub without it) on incomplete polyfills.\n const zlib = await import(\"node:zlib\");\n if (typeof zlib.deflateRawSync !== \"function\") throw new Error(\"no native deflate\");\n _zlibModule = zlib;\n if (_nativeDeflate === undefined) {\n _nativeDeflate = (data: Uint8Array, level: number): Uint8Array =>\n zlib.deflateRawSync(data, { level });\n }\n _nativeDeflateAsync = (data: Uint8Array, level: number): Promise<Uint8Array> =>\n new Promise<Uint8Array>((resolve, reject) =>\n zlib.deflateRaw(data, { level }, (err, result) => {\n if (err) reject(err);\n else resolve(result);\n }),\n );\n _nativeCrc32 =\n typeof zlib.crc32 === \"function\" ? (data: Uint8Array) => zlib.crc32(data) : computeCrc32;\n // Inflate is optional (deflate presence doesn't guarantee it), so probe\n // separately — nativeUnzip only becomes available when this resolves.\n if (typeof zlib.inflateRawSync === \"function\" && _nativeInflate === undefined) {\n _nativeInflate = (data: Uint8Array): Uint8Array => zlib.inflateRawSync(data);\n }\n} catch {\n // Browser/Deno or Node-like runtime without usable zlib — fflate fallback\n}\n\nexport const hasNativeDeflate = (): boolean => _nativeDeflate !== undefined;\n\nexport const hasNativeInflate = (): boolean => _nativeInflate !== undefined;\n\n// fflate's async zip entries hand every chunk to a dedicated worker via\n// postMessage with a transfer list — one thread spawn per part (~5-10ms each\n// on Node's worker_threads), which dominates the many-small-parts OPC shape.\n// Bun additionally measured worker teardown lag on back-to-back generations\n// (0.4s → 4.4s per drain on a 130-part deck) and embedded-pool crashes.\n// Where a native zlib resolved (Node/Bun), deflate inline on the main thread;\n// only browsers/Deno keep the workers, where spawn is cheap and off-thread\n// deflate keeps the UI responsive.\n/**\n * True when incremental DEFLATE should run on the main thread instead of\n * fflate's per-entry workers (Node/Bun). See {@link ZipStreamWriter} in\n * packer.ts.\n */\nexport const prefersMainThreadDeflate = (): boolean => _nativeDeflate !== undefined;\n\n/**\n * True under Bun. Used to keep Bun off `nativeZipAsync`-backed paths: its\n * node:zlib compat layer schedules async calls poorly (bench: async ~1/3 of\n * its sync throughput), so fflate main-thread deflate is the better trade.\n */\nexport const isBunRuntime = (): boolean => typeof bunApi?.deflateSync === \"function\";\n\n/**\n * Synchronous native CRC-32 (`zlib.crc32`, Node/Bun only) — undefined where no\n * native zlib resolved (browsers/Deno). Used by media dedup as a fast content\n * key; callers keep their own JS fallback. ~59× faster than a JS hash on\n * 100 MB inputs.\n */\nexport function nativeCrc32(data: Uint8Array): number | undefined {\n return _nativeCrc32?.(data);\n}\n\n// ── LE write helpers ──\n\nfunction wU16(b: Uint8Array, o: number, v: number): void {\n b[o] = v & 0xff;\n b[o + 1] = (v >> 8) & 0xff;\n}\n\nfunction wU32(b: Uint8Array, o: number, v: number): void {\n b[o] = v & 0xff;\n b[o + 1] = (v >> 8) & 0xff;\n b[o + 2] = (v >> 16) & 0xff;\n b[o + 3] = (v >> 24) & 0xff;\n}\n\n// ── Per-entry metadata ──\n\ninterface Entry {\n filename: Uint8Array;\n data: Uint8Array;\n uncompressedSize: number;\n crc: number;\n method: number; // 0 = STORE, 8 = DEFLATE\n localOffset: number;\n}\n\n// ── Phase 1 helpers ──\n\nfunction resolveEntryData(\n raw: Zippable[string],\n defaultLevel: number,\n): { data: Uint8Array; level: number } {\n if (Array.isArray(raw)) {\n return { data: raw[0] as Uint8Array, level: (raw[1] as ZipOptions).level ?? defaultLevel };\n }\n return { data: raw as Uint8Array, level: defaultLevel };\n}\n\nfunction compressOne(\n data: Uint8Array,\n level: number,\n deflate: DeflateFn,\n): { compressed: Uint8Array; method: number } {\n if (level === 0) return { compressed: data, method: 0 };\n const compressed = deflate(data, level);\n if (compressed.length >= data.length) return { compressed: data, method: 0 };\n return { compressed, method: 8 };\n}\n\nasync function compressOneAsync(\n data: Uint8Array,\n level: number,\n deflate: AsyncDeflateFn,\n): Promise<{ compressed: Uint8Array; method: number }> {\n if (level === 0) return { compressed: data, method: 0 };\n const compressed = await deflate(data, level);\n if (compressed.length >= data.length) return { compressed: data, method: 0 };\n return { compressed, method: 8 };\n}\n\n// ── Phase 2+3: calculate sizes + write ZIP buffer ──\n\nfunction writeZipBuffer(entries: Entry[]): Uint8Array {\n let totalSize = 0;\n for (const e of entries) {\n totalSize += 30 + e.filename.length + e.data.length;\n }\n const cdOffset = totalSize;\n let cdSize = 0;\n for (const e of entries) {\n cdSize += 46 + e.filename.length;\n }\n totalSize += cdSize + 22;\n\n const buf = new Uint8Array(totalSize);\n let offset = 0;\n\n // Local file headers + data\n for (const e of entries) {\n e.localOffset = offset;\n wU32(buf, offset, 0x04034b50); // signature\n wU16(buf, offset + 4, 20); // version needed\n wU16(buf, offset + 6, 0); // flags\n wU16(buf, offset + 8, e.method); // compression method\n wU16(buf, offset + 10, 0); // mod time\n wU16(buf, offset + 12, 0); // mod date\n wU32(buf, offset + 14, e.crc);\n wU32(buf, offset + 18, e.data.length); // compressed size\n wU32(buf, offset + 22, e.uncompressedSize);\n wU16(buf, offset + 26, e.filename.length);\n wU16(buf, offset + 28, 0); // extra field length\n offset += 30;\n\n buf.set(e.filename, offset);\n offset += e.filename.length;\n\n buf.set(e.data, offset);\n offset += e.data.length;\n }\n\n // Central directory\n for (const e of entries) {\n wU32(buf, offset, 0x02014b50); // signature\n wU16(buf, offset + 4, 20); // version made by\n wU16(buf, offset + 6, 20); // version needed\n wU16(buf, offset + 8, 0); // flags\n wU16(buf, offset + 10, e.method);\n wU16(buf, offset + 12, 0); // mod time\n wU16(buf, offset + 14, 0); // mod date\n wU32(buf, offset + 16, e.crc);\n wU32(buf, offset + 20, e.data.length);\n wU32(buf, offset + 24, e.uncompressedSize);\n wU16(buf, offset + 28, e.filename.length);\n wU16(buf, offset + 30, 0); // extra field length\n wU16(buf, offset + 32, 0); // comment length\n wU16(buf, offset + 34, 0); // disk number start\n wU16(buf, offset + 36, 0); // internal attrs\n wU32(buf, offset + 38, 0); // external attrs\n wU32(buf, offset + 42, e.localOffset);\n offset += 46;\n\n buf.set(e.filename, offset);\n offset += e.filename.length;\n }\n\n // End of Central Directory Record\n wU32(buf, offset, 0x06054b50);\n wU16(buf, offset + 4, 0); // disk number\n wU16(buf, offset + 6, 0); // CD disk\n wU16(buf, offset + 8, entries.length);\n wU16(buf, offset + 10, entries.length);\n wU32(buf, offset + 12, cdSize);\n wU32(buf, offset + 16, cdOffset);\n wU16(buf, offset + 20, 0); // comment length\n\n return buf;\n}\n\n// ── Public API ──\n\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\n\nexport function nativeZip(files: Zippable, level: number = 6): Uint8Array {\n if (!_nativeDeflate) throw new Error(\"Native deflate not available\");\n const crc = _nativeCrc32 ?? computeCrc32;\n const entries: Entry[] = [];\n\n for (const key of Object.keys(files)) {\n const raw = files[key];\n if (raw === undefined) continue; // Object.keys guarantees presence; guard narrows the type\n const { data, level: entryLevel } = resolveEntryData(raw, level);\n const c = crc(data);\n const { compressed, method } = compressOne(data, entryLevel, _nativeDeflate);\n entries.push({\n filename: textEncoder.encode(key),\n data: compressed,\n uncompressedSize: data.length,\n crc: c,\n method,\n localOffset: 0,\n });\n }\n\n return writeZipBuffer(entries);\n}\n\nexport async function nativeZipAsync(files: Zippable, level: number = 6): Promise<Uint8Array> {\n const deflateAsync = _nativeDeflateAsync;\n if (!deflateAsync) throw new Error(\"Native async deflate not available\");\n const crc = _nativeCrc32 ?? computeCrc32;\n\n // All entries deflate in parallel — node:zlib async calls run on the libuv\n // thread pool, so a multi-part package compresses in roughly one-deflate\n // wall clock instead of the sum (pool size caps true parallelism; task\n // queueing is cheap relative to the deflate work itself). CRC runs inline\n // on the main thread before each entry's first await.\n const entries = (\n await Promise.all(\n Object.keys(files).map(async (key): Promise<Entry | null> => {\n const raw = files[key];\n if (raw === undefined) return null; // Object.keys guarantees presence; guard narrows the type\n const { data, level: entryLevel } = resolveEntryData(raw, level);\n const c = crc(data);\n const { compressed, method } = await compressOneAsync(data, entryLevel, deflateAsync);\n return {\n filename: textEncoder.encode(key),\n data: compressed,\n uncompressedSize: data.length,\n crc: c,\n method,\n localOffset: 0,\n };\n }),\n )\n ).filter((e): e is Entry => e !== null);\n\n return writeZipBuffer(entries);\n}\n\n// Fixed-size chunks fed to the ReadableStream — large enough to amortize the\n// per-enqueue cost, small enough to keep an interactive consumer's first read.\nconst STREAM_CHUNK_SIZE = 1 << 16;\n\n/**\n * Streaming counterpart of {@link nativeZipAsync}: compresses on the libuv\n * thread pool, then emits the finished archive through a `ReadableStream` in\n * fixed-size chunks. Node only — Bun and browsers keep fflate's incremental\n * path (see {@link prefersMainThreadDeflate}). The memory shape matches the\n * fflate stream (entries are fully resident post-compile either way); the win\n * is dropping fflate's per-entry worker spawn, which costs milliseconds per\n * part on Node's worker_threads and dominates small-package streams.\n */\nexport function nativeZipStream(files: Zippable, level: number = 6): ReadableStream<Uint8Array> {\n return new ReadableStream<Uint8Array>({\n async start(controller) {\n try {\n const buf = await nativeZipAsync(files, level);\n for (let o = 0; o < buf.length; o += STREAM_CHUNK_SIZE) {\n controller.enqueue(buf.subarray(o, Math.min(o + STREAM_CHUNK_SIZE, buf.length)));\n }\n controller.close();\n } catch (err) {\n controller.error(err instanceof Error ? err : new Error(String(err)));\n }\n },\n });\n}\n\n// ── LE read helpers (ZIP parsing) ──\n\nfunction rU16(b: Uint8Array, o: number): number {\n return b[o]! | (b[o + 1]! << 8);\n}\n\nfunction rU32(b: Uint8Array, o: number): number {\n return (b[o]! | (b[o + 1]! << 8) | (b[o + 2]! << 16) | (b[o + 3]! << 24)) >>> 0;\n}\n\n// ── ZIP central-directory parsing ──\n\nconst EOCD_MAGIC = 0x06054b50;\nconst CD_MAGIC = 0x02014b50;\n\ninterface ZipEntryMeta {\n name: string;\n method: number;\n compSize: number;\n crc: number;\n dataStart: number;\n}\n\n/** Locate the End-of-Central-Directory record (within a 64 KB comment window). */\nfunction findEocd(b: Uint8Array): number {\n const min = Math.max(0, b.length - 65557); // 22-byte EOCD + up to 65535-byte comment\n for (let i = b.length - 22; i >= min; i--) {\n if (rU32(b, i) === EOCD_MAGIC) return i;\n }\n throw new Error(\"ZIP EOCD record not found\");\n}\n\n/** Walk the central directory and resolve each entry's payload offset. */\nfunction readCentralDirectory(buf: Uint8Array): ZipEntryMeta[] {\n const eocd = findEocd(buf);\n const count = rU16(buf, eocd + 10);\n const cdOffset = rU32(buf, eocd + 16);\n const entries: ZipEntryMeta[] = [];\n let p = cdOffset;\n for (let i = 0; i < count; i++) {\n if (rU32(buf, p) !== CD_MAGIC) throw new Error(`ZIP central directory corrupt at offset ${p}`);\n const method = rU16(buf, p + 10);\n const crc = rU32(buf, p + 16);\n const compSize = rU32(buf, p + 20);\n const nameLen = rU16(buf, p + 28);\n const extraLen = rU16(buf, p + 30);\n const cmtLen = rU16(buf, p + 32);\n const localOff = rU32(buf, p + 42);\n // Uint8Array.toString() yields \"120,46,...\" (comma-joined bytes), not the\n // UTF-8 string — decode explicitly so entry names are real paths.\n const name = textDecoder.decode(buf.subarray(p + 46, p + 46 + nameLen));\n // The local header carries its own name/extra lengths, which can differ\n // from the CD's; read them to locate the entry's payload precisely.\n const lNameLen = rU16(buf, localOff + 26);\n const lExtraLen = rU16(buf, localOff + 28);\n entries.push({\n name,\n method,\n compSize,\n crc,\n dataStart: localOff + 30 + lNameLen + lExtraLen,\n });\n p += 46 + nameLen + extraLen + cmtLen;\n }\n return entries;\n}\n\n/**\n * Decompress a ZIP archive via `node:zlib` `inflateRawSync`, mirroring fflate's\n * `unzipSync` signature and CRC-32 integrity check. Node/Bun only — callers\n * gate on {@link hasNativeInflate} and fall back to fflate `unzipSync` elsewhere.\n * Measured ~2x faster than fflate on large OOXML packages.\n */\nexport function nativeUnzip(buf: Uint8Array): Record<string, Uint8Array> {\n if (!_nativeInflate) throw new Error(\"Native inflate not available\");\n const inflate = _nativeInflate;\n const crc = _nativeCrc32 ?? computeCrc32;\n const out: Record<string, Uint8Array> = {};\n for (const e of readCentralDirectory(buf)) {\n const raw = buf.subarray(e.dataStart, e.dataStart + e.compSize);\n const dec = e.method === 0 ? raw.slice() : inflate(raw);\n // >>> 0 normalizes the signed CRC_TABLE accumulation against zlib's unsigned crc32.\n if (crc(dec) >>> 0 !== e.crc) throw new Error(`ZIP CRC-32 mismatch: ${e.name}`);\n out[e.name] = dec;\n }\n return out;\n}\n\n// ── Native streaming DEFLATE entry ──\n\n/**\n * Streaming DEFLATE ZIP entry backed by `zlib.createDeflateRaw` instead of\n * fflate's JS engine or per-entry worker — Node only (constructor throws when\n * no native zlib resolved; callers pick the fflate entries elsewhere).\n *\n * Implements fflate's Zip entry contract by subclassing `ZipPassThrough` and\n * overriding `process` — fflate's documented subclassing point — to feed a\n * libuv-pool deflate stream: zero thread spawn (AsyncZipDeflate costs ~5-10ms\n * per part on worker_threads, dominating the many-small-parts OPC shape) while\n * compression still runs off the main thread, so chunked generation overlaps\n * with deflate. `compression`/`flag` mirror what ZipDeflate sets (flag = the\n * same deflate-level hint bits fflate computes), which Zip reads for the\n * local header.\n */\nexport class NativeZipDeflate extends ZipPassThrough {\n /** General-purpose flag bits, mirroring ZipDeflate's level hint. */\n readonly flag: 0 | 1 | 2 | 3;\n private readonly z: ZlibNode.DeflateRaw;\n\n constructor(filename: string, opts?: { level?: ZipOptions[\"level\"] }) {\n super(filename);\n if (_zlibModule === undefined) throw new Error(\"Native deflate not available\");\n const level = opts?.level;\n this.flag = level === 1 ? 3 : level !== undefined && level < 6 ? 2 : level === 9 ? 1 : 0;\n this.compression = 8;\n this.z = _zlibModule.createDeflateRaw({ level });\n // 'data' arrives on the microtask queue after each libuv-pool flush; Zip\n // buffers entry output until its own ordering pass, so async ondata is\n // contract-legal (AsyncZipDeflate delivers the same way). 'end' fires\n // after the final 'data', closing the entry with an empty final chunk.\n // zlib chunks are never shared-memory buffers; the cast only widens the\n // declared ArrayBufferLike to fflate's ArrayBuffer parameter type.\n this.z.on(\"data\", (dat: Uint8Array) =>\n this.ondata(null, dat as Uint8Array<ArrayBuffer>, false),\n );\n this.z.on(\"error\", (err: Error) => this.ondata(err as FlateError, new Uint8Array(0), true));\n this.z.on(\"end\", () => this.ondata(null, new Uint8Array(0), true));\n }\n\n /** Feed a source chunk; `final` ends the deflate stream. */\n protected process(chunk: Uint8Array<ArrayBuffer>, final: boolean): void {\n // write() backpressure is ignored on purpose: the producer is a\n // synchronous serialize loop, and zlib's internal buffer is bounded by\n // how fast the pool drains — the same regime the worker path had.\n this.z.write(chunk);\n if (final) this.z.end();\n else this.z.flush(); // Z_SYNC_FLUSH — emit each chunk's bytes promptly\n }\n}\n","/**\n * Output type definitions for OOXML document export.\n *\n * @module\n */\n\nimport { strFromU8 } from \"fflate\";\n\nimport { encodeBase64 } from \"../util/base64\";\n\nexport interface OutputByType {\n base64: string;\n string: string;\n text: string;\n binarystring: string;\n array: readonly number[];\n uint8array: Uint8Array;\n arraybuffer: ArrayBuffer;\n blob: Blob;\n nodebuffer: Buffer;\n}\n\nexport type OutputType = keyof OutputByType;\n\n/* V8 ignore start */\nexport const OoxmlMimeType = {\n DOCX: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n PPTX: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n XLSX: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n} as const;\n\nexport const convertOutput = <T extends OutputType>(\n data: Uint8Array,\n type: T,\n mimeType: string = OoxmlMimeType.DOCX,\n): OutputByType[T] => {\n switch (type) {\n case \"nodebuffer\":\n // Zero-copy: wrap the zip output's underlying ArrayBuffer as a Buffer\n // view instead of copying it (~11MB for an image-heavy file) on every\n // generate(). Safe because the source buffer is freshly allocated and\n // never mutated after this point.\n return Buffer.from(data.buffer, data.byteOffset, data.byteLength) as OutputByType[T];\n case \"blob\":\n return new Blob(\n [(data.buffer as ArrayBuffer).slice(data.byteOffset, data.byteOffset + data.byteLength)],\n { type: mimeType },\n ) as OutputByType[T];\n case \"arraybuffer\":\n return data.buffer.slice(\n data.byteOffset,\n data.byteOffset + data.byteLength,\n ) as OutputByType[T];\n case \"uint8array\":\n return data as OutputByType[T];\n case \"base64\":\n return encodeBase64(data) as OutputByType[T];\n case \"string\":\n case \"text\":\n case \"binarystring\":\n return strFromU8(data, true) as OutputByType[T];\n case \"array\":\n return [...data] as unknown as OutputByType[T];\n /* V8 ignore next */\n default:\n return data as unknown as OutputByType[T];\n }\n};\n/* V8 ignore stop */\n","/**\n * Shared packer utilities for OOXML document generation.\n *\n * @module\n */\n\nimport {\n type AsyncZippable,\n type ZipOptions,\n type Zippable,\n AsyncZipDeflate,\n Zip,\n ZipDeflate,\n ZipPassThrough,\n zip,\n zipSync,\n} from \"fflate\";\n\nimport { convertOutput } from \"./output\";\nimport type { OutputByType, OutputType } from \"./output\";\nimport {\n hasNativeDeflate,\n isBunRuntime,\n NativeZipDeflate,\n nativeZip,\n nativeZipAsync,\n nativeZipStream,\n prefersMainThreadDeflate,\n} from \"./zip-native\";\n\nexport type { Zippable, ZipOptions } from \"fflate\";\nexport { strFromU8, unzipSync, zipSync } from \"fflate\";\n\nexport interface XmlifyedFile {\n path: string;\n data: string | Uint8Array;\n}\n\n/** Default DEFLATE level for XML entries (SuperFast, matching MS Office). */\nexport const ZIP_DEFLATE_LEVEL = 1;\n\n/** Default DEFLATE level for compressible media (EMF/WMF/BMP/TIFF/SVG). MS\n * Office uses CompressionOption.Normal (~zlib 6); SuperFast (1) inflates EMF\n * output ~15% (measured against a real Office-generated package). */\nexport const ZIP_MEDIA_LEVEL = 6;\n\n/** Level for already-compressed media — STORE (no compression). */\nexport const ZIP_STORED_LEVEL = 0;\n\n/**\n * Media formats already compressed internally (DEFLATE for PNG, DCT for JPEG,\n * LZW for GIF; video/audio containers carry their own codec streams).\n * Re-compressing via zip DEFLATE wastes CPU and often inflates the data, so\n * MS Office STORE-s these (CompressionOption.NotCompressed → zip method 0).\n * Everything else (EMF/WMF/BMP/TIFF/SVG/WAV…) is compressible → DEFLATE —\n * measured on a real Office package, EMF at zlib level 6 matches Office\n * output where SuperFast inflates ~15%.\n */\nconst PRECOMPRESSED_MEDIA_EXT = new Set([\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"gif\",\n \"mp4\",\n \"mov\",\n \"wmv\",\n \"mpg\",\n \"mpeg\",\n \"mp3\",\n \"wma\",\n \"aac\",\n]);\n\n/**\n * Resolve the ZIP level for a media entry by file-name extension, matching MS\n * Office: already-compressed raster formats → STORE (0), everything else →\n * DEFLATE (`mediaLevel`, default Normal). A `compression.media` override\n * therefore applies only to compressible formats, never forcing DEFLATE onto\n * pre-compressed assets.\n */\nexport const levelForMediaName = (fileName: string, mediaLevel: number): number => {\n const dot = fileName.lastIndexOf(\".\");\n const ext = dot < 0 ? \"\" : fileName.slice(dot + 1).toLowerCase();\n return PRECOMPRESSED_MEDIA_EXT.has(ext) ? ZIP_STORED_LEVEL : mediaLevel;\n};\n\n/** Compression options for ZIP output (zlib levels 0-9, matching fflate). */\nexport interface CompressionOptions {\n /** DEFLATE level for XML files. Default: 1 (SuperFast, matching MS Office). */\n xml?: number;\n /**\n * DEFLATE level for compressible media (EMF/WMF/BMP/TIFF/…). Already-compressed\n * formats (PNG/JPEG/GIF) are always STOREd regardless, matching MS Office.\n * Default: 6 (Normal, matching MS Office for EMF/WMF).\n */\n media?: number;\n}\n\n/** Options for Packer output methods. */\nexport interface PackerOptions<T extends OutputType = \"nodebuffer\"> {\n /** Output format. Defaults to `\"nodebuffer\"` (Node.js Buffer). */\n type?: T;\n /** Custom XML/ZIP file overrides. */\n overrides?: XmlifyedFile[];\n /** Compression levels for ZIP entries. */\n compression?: CompressionOptions;\n}\n\n/**\n * Asynchronously compress files and convert to the requested output format.\n *\n * Where a native zlib resolved (Node/Bun), entries deflate in parallel on the\n * libuv thread pool; elsewhere fflate compresses off the main thread.\n * XML entries use DEFLATE level 1 (SuperFast) by default. Media entries are\n * split by type, matching MS Office: already-compressed formats (PNG/JPEG/GIF)\n * are STOREd, everything else uses the `media` level (default Normal).\n * Set `{ media: ZIP_STORED_LEVEL }` to STORE all compressible media too.\n */\nexport const zipAndConvert = async <T extends OutputType>(\n files: Zippable,\n type: T,\n mimeType: string,\n level: number = ZIP_DEFLATE_LEVEL,\n): Promise<OutputByType[T]> => {\n const zipped = hasNativeDeflate()\n ? await nativeZipAsync(files, level)\n : await new Promise<Uint8Array>((resolve, reject) => {\n zip(\n files as AsyncZippable,\n { level: level as ZipOptions[\"level\"], consume: true },\n (err, data) => {\n if (err) reject(err);\n else resolve(data);\n },\n );\n });\n return convertOutput(zipped, type, mimeType);\n};\n\n/**\n * Synchronously compress files and convert to the requested output format.\n *\n * Uses synchronous DEFLATE compression for maximum throughput.\n * Blocks the event loop — prefer {@link zipAndConvert} in server contexts.\n */\nexport const zipSyncAndConvert = <T extends OutputType>(\n files: Zippable,\n type: T,\n mimeType: string,\n level: number = ZIP_DEFLATE_LEVEL,\n): OutputByType[T] => {\n const zipped = hasNativeDeflate()\n ? nativeZip(files, level)\n : zipSync(files, { level: level as ZipOptions[\"level\"] });\n return convertOutput(zipped, type, mimeType);\n};\n\n/**\n * Create a `ReadableStream<Uint8Array>` from compressed file entries.\n *\n * Uses fflate's `AsyncZipDeflate` for non-blocking DEFLATE compression.\n * `STORED` entries (media) pass through synchronously.\n * Works in both Node.js and browsers (Web Streams API).\n */\nexport const createZipStream = (\n files: Zippable,\n defaultLevel: number = ZIP_DEFLATE_LEVEL,\n): ReadableStream<Uint8Array> => {\n // Node's native zlib compresses the entries in parallel on the libuv pool —\n // vastly faster than fflate's per-entry workers, whose spawn cost dominates\n // small packages (~20 vs ~2700 ops/s on a 12-part stream, measured). Bun\n // stays on fflate main-thread deflate (see isBunRuntime), browsers/Deno on\n // the worker paths below.\n if (hasNativeDeflate() && !isBunRuntime()) {\n return nativeZipStream(files, defaultLevel);\n }\n // Remaining runtimes: Bun deflates on the main thread (its worker teardown\n // lags creation, accumulating cost across back-to-back generations — see\n // prefersMainThreadDeflate); browsers/Deno keep AsyncZipDeflate, where web\n // workers are cheap to spawn and deflate off the main thread for real.\n const mainThread = prefersMainThreadDeflate();\n return new ReadableStream<Uint8Array>({\n start(controller) {\n try {\n const zip = new Zip((err, chunk, _final) => {\n if (err) {\n controller.error(err);\n return;\n }\n controller.enqueue(chunk);\n if (_final) {\n controller.close();\n }\n });\n\n for (const [name, data] of Object.entries(files)) {\n const raw = Array.isArray(data) ? (data[0] as Uint8Array) : (data as Uint8Array);\n const level = Array.isArray(data)\n ? ((data[1] as ZipOptions).level ?? defaultLevel)\n : defaultLevel;\n const workerPath = level !== ZIP_STORED_LEVEL && !mainThread;\n const entry =\n level === ZIP_STORED_LEVEL\n ? new ZipPassThrough(name)\n : workerPath\n ? new AsyncZipDeflate(name, { level: level as ZipOptions[\"level\"] })\n : new ZipDeflate(name, { level: level as ZipOptions[\"level\"] });\n zip.add(entry);\n // AsyncZipDeflate transfers each pushed buffer to its worker\n // (postMessage move semantics), detaching the caller's view —\n // regenerating from the same files would push an already-detached\n // buffer and throw DataCloneError. Only the worker entry needs the\n // copy; pass-through and main-thread entries keep zero-copy.\n entry.push(workerPath ? raw.slice() : raw, true);\n }\n\n zip.end();\n } catch (err) {\n controller.error(err instanceof Error ? err : new Error(String(err)));\n }\n },\n });\n};\n\n// ── Streaming ZIP writer ──\n\n/**\n * Incremental sink for one ZIP part. Feed chunks as they are produced; the\n * entry's local header is emitted on {@link ZipStreamWriter.addPart} and the\n * trailing CRC/sizes on {@link end} — the part's full content never has to\n * exist in memory at once.\n */\nexport interface ZipPartSink {\n /** Append a chunk to the part. */\n push(chunk: Uint8Array): void;\n /** Finalize the part, optionally with a final chunk. Must be called before adding the next one. */\n end(lastChunk?: Uint8Array): void;\n}\n\n/**\n * Incremental ZIP archive writer over fflate's streaming `Zip` — parts are\n * added and completed one at a time; compressed output flows to `ondata` as\n * it is produced. This is the constant-memory counterpart to\n * {@link createZipStream} (which requires the complete `Zippable` up front):\n * serialize each part chunk-wise into the returned sink instead of building\n * the full part string.\n *\n * Parts must be added in order — `[Content_Types].xml` first per OPC. The\n * whole archive finishes when {@link ZipStreamWriter.end} is called.\n */\nexport class ZipStreamWriter {\n private readonly zip: Zip;\n private current: AsyncZipDeflate | NativeZipDeflate | ZipDeflate | ZipPassThrough | undefined;\n // Node streams each part through a native zlib DeflateRaw on the libuv pool\n // (no spawn, compression overlaps with chunk production). Bun deflates on\n // the main thread; browsers/Deno use fflate's per-entry workers.\n private readonly nativeEntry = hasNativeDeflate() && !isBunRuntime();\n private readonly mainThread = prefersMainThreadDeflate();\n\n constructor(\n ondata: (err: Error | null, chunk: Uint8Array, final: boolean) => void,\n private readonly defaultLevel: number = ZIP_DEFLATE_LEVEL,\n ) {\n this.zip = new Zip(ondata);\n }\n\n /** Add a part and return its incremental sink. `end()` the previous first. */\n addPart(name: string, level: number = this.defaultLevel): ZipPartSink {\n if (this.current) throw new Error(`ZipStreamWriter: previous part not finalized`);\n const deflatePath = level !== ZIP_STORED_LEVEL;\n const workerPath = deflatePath && !this.mainThread;\n const entry = !deflatePath\n ? new ZipPassThrough(name)\n : this.nativeEntry\n ? new NativeZipDeflate(name, { level: level as ZipOptions[\"level\"] })\n : workerPath\n ? new AsyncZipDeflate(name, { level: level as ZipOptions[\"level\"] })\n : new ZipDeflate(name, { level: level as ZipOptions[\"level\"] });\n // AsyncZipDeflate hands chunks to a worker; ondata delivery is asynchronous,\n // so ordering between parts is preserved by fflate's internal queue. The\n // worker transfer-detaches every chunk it is handed, so sinks receive\n // copies — a caller-held buffer must survive repeated generations.\n this.zip.add(entry);\n this.current = entry;\n return {\n push: (chunk) => entry.push(workerPath ? chunk.slice() : chunk, false),\n end: (lastChunk?: Uint8Array) => {\n entry.push((workerPath ? lastChunk?.slice() : lastChunk) ?? new Uint8Array(0), true);\n this.current = undefined;\n },\n };\n }\n\n /** Finish the archive (central directory + EOCD). */\n end(): void {\n if (this.current) throw new Error(`ZipStreamWriter: unclosed part at end()`);\n this.zip.end();\n }\n}\n\n// ── Factory function ──\n\n/**\n * Compile function provided by each package to convert a file object into a Zippable map.\n */\nexport type CompileFn<TFile> = (\n file: TFile,\n overrides?: XmlifyedFile[],\n mediaLevel?: number,\n) => Zippable;\n\n/**\n * Packer interface returned by {@link createPacker}.\n *\n * Async methods use fflate Web Workers for non-blocking compression.\n * Sync methods use synchronous compression for maximum throughput in\n * CLI scripts and build tools.\n */\nexport interface Packer<TFile> {\n /** Compile file to Zippable map (synchronous). */\n compile: CompileFn<TFile>;\n\n /** Generic async output — returns the requested OutputType. */\n pack<T extends OutputType = \"nodebuffer\">(\n file: TFile,\n options?: PackerOptions<T>,\n ): Promise<OutputByType[T]>;\n /** Generic sync output — returns the requested OutputType. */\n packSync<T extends OutputType = \"nodebuffer\">(\n file: TFile,\n options?: PackerOptions<T>,\n ): OutputByType[T];\n\n /** Async → `Promise<Uint8Array>` (like `Response.bytes()`). */\n toBytes(file: TFile, options?: PackerOptions): Promise<Uint8Array>;\n /** Sync → `Uint8Array`. */\n toBytesSync(file: TFile, options?: PackerOptions): Uint8Array;\n\n /** Async → `Promise<string>` (raw ZIP content as string). */\n toString(file: TFile, options?: PackerOptions): Promise<string>;\n /** Sync → `string`. */\n toStringSync(file: TFile, options?: PackerOptions): string;\n\n /** Async → `Promise<Buffer>` (Node.js). */\n toBuffer(file: TFile, options?: PackerOptions): Promise<Buffer>;\n /** Sync → `Buffer` (Node.js). */\n toBufferSync(file: TFile, options?: PackerOptions): Buffer;\n\n /** Async → `Promise<string>` (base64-encoded). */\n toBase64(file: TFile, options?: PackerOptions): Promise<string>;\n /** Sync → `string` (base64-encoded). */\n toBase64Sync(file: TFile, options?: PackerOptions): string;\n\n /** Async → `Promise<Blob>` (browser). */\n toBlob(file: TFile, options?: PackerOptions): Promise<Blob>;\n /** Sync → `Blob`. */\n toBlobSync(file: TFile, options?: PackerOptions): Blob;\n\n /** Async → `Promise<ArrayBuffer>`. */\n toArrayBuffer(file: TFile, options?: PackerOptions): Promise<ArrayBuffer>;\n /** Sync → `ArrayBuffer`. */\n toArrayBufferSync(file: TFile, options?: PackerOptions): ArrayBuffer;\n\n /** Streaming output via `ReadableStream<Uint8Array>` (cross-platform, uses Web Workers). */\n toStream(file: TFile, options?: PackerOptions): ReadableStream<Uint8Array>;\n}\n\n/**\n * Create a Packer object with all output format methods.\n *\n * Centralises the ZIP → convert pipeline and the streaming implementation\n * so that each OOXML package only needs to provide a `compile` function and\n * a MIME type.\n */\nexport const createPacker = <TFile>(options: {\n compile: CompileFn<TFile>;\n mimeType: string;\n}): Packer<TFile> => {\n const { compile, mimeType } = options;\n\n const pack = async <T extends OutputType = \"nodebuffer\">(\n file: TFile,\n opts?: PackerOptions<T>,\n ): Promise<OutputByType[T]> => {\n const type = opts?.type ?? (\"nodebuffer\" as T);\n const files = compile(file, opts?.overrides ?? [], opts?.compression?.media ?? ZIP_MEDIA_LEVEL);\n return zipAndConvert(files, type, mimeType, opts?.compression?.xml ?? ZIP_DEFLATE_LEVEL);\n };\n\n const toBytes = (file: TFile, opts?: PackerOptions) =>\n pack(file, { ...opts, type: \"uint8array\" });\n const toString = (file: TFile, opts?: PackerOptions) => pack(file, { ...opts, type: \"string\" });\n const toBuffer = (file: TFile, opts?: PackerOptions) =>\n pack(file, { ...opts, type: \"nodebuffer\" });\n const toBase64 = (file: TFile, opts?: PackerOptions) => pack(file, { ...opts, type: \"base64\" });\n const toBlob = (file: TFile, opts?: PackerOptions) => pack(file, { ...opts, type: \"blob\" });\n const toArrayBuffer = (file: TFile, opts?: PackerOptions) =>\n pack(file, { ...opts, type: \"arraybuffer\" });\n\n // ── Sync methods (zipSync, maximum throughput) ──\n\n const packSync = <T extends OutputType = \"nodebuffer\">(\n file: TFile,\n opts?: PackerOptions<T>,\n ): OutputByType[T] => {\n const type = opts?.type ?? (\"nodebuffer\" as T);\n const files = compile(file, opts?.overrides ?? [], opts?.compression?.media ?? ZIP_MEDIA_LEVEL);\n return zipSyncAndConvert(files, type, mimeType, opts?.compression?.xml ?? ZIP_DEFLATE_LEVEL);\n };\n\n const toBytesSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"uint8array\" });\n const toStringSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"string\" });\n const toBufferSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"nodebuffer\" });\n const toBase64Sync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"base64\" });\n const toBlobSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"blob\" });\n const toArrayBufferSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"arraybuffer\" });\n\n // ── Stream ──\n\n const toStream = (file: TFile, opts?: PackerOptions) => {\n const mediaLevel = opts?.compression?.media ?? ZIP_MEDIA_LEVEL;\n let files: Zippable;\n try {\n files = compile(file, opts?.overrides ?? [], mediaLevel);\n } catch (err) {\n return new ReadableStream<Uint8Array>({\n start(controller) {\n controller.error(err instanceof Error ? err : new Error(String(err)));\n },\n });\n }\n return createZipStream(files, opts?.compression?.xml ?? ZIP_DEFLATE_LEVEL);\n };\n\n return {\n compile,\n pack,\n packSync,\n toBytes,\n toBytesSync,\n toString,\n toStringSync,\n toBuffer,\n toBufferSync,\n toBase64,\n toBase64Sync,\n toBlob,\n toBlobSync,\n toArrayBuffer,\n toArrayBufferSync,\n toStream,\n };\n};\n","/**\n * Shared compiler utilities for OOXML document generation.\n *\n * @module\n */\n\nimport { levelForMediaName } from \"../opc/packer\";\nimport type { XmlifyedFile, ZipOptions, Zippable } from \"../opc/packer\";\n\n/** Reusable TextEncoder instance (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\nexport type XmlifyedFileEntry = XmlifyedFile | readonly XmlifyedFile[] | undefined;\n\n/** Add one binary ZIP entry using the shared media compression policy. */\nexport function addBinaryFile(\n files: Zippable,\n path: string,\n data: Uint8Array,\n mediaLevel: number,\n): void {\n files[path] = [data, { level: levelForMediaName(path, mediaLevel) as ZipOptions[\"level\"] }];\n}\n\n/**\n * Convert XML files, overrides, and media into a Zippable structure.\n *\n * Mapping values may be optional arrays so package compilers can pass their\n * natural part mappings without reimplementing flattening and byte encoding.\n */\nexport function compileMapping<T extends object>(\n mapping: T & { [K in keyof T]: XmlifyedFileEntry },\n overrides?: readonly XmlifyedFile[],\n media?: readonly { data: Uint8Array; path: string }[],\n mediaLevel: number = 0,\n): Zippable {\n const files: Zippable = {};\n for (const entry of Object.values(mapping) as XmlifyedFileEntry[]) {\n if (entry === undefined) continue;\n const entries = Array.isArray(entry) ? entry : [entry];\n for (const file of entries) {\n files[file.path] = typeof file.data === \"string\" ? encoder.encode(file.data) : file.data;\n }\n }\n for (const override of overrides ?? []) {\n files[override.path] =\n typeof override.data === \"string\" ? encoder.encode(override.data) : override.data;\n }\n for (const file of media ?? []) {\n addBinaryFile(files, file.path, file.data, mediaLevel);\n }\n return files;\n}\n","/**\n * Password hashing utilities for OOXML document protection.\n *\n * Implements ECMA-376 Agile Encryption password derivation.\n * Passwords are encoded as UTF-16LE per the OOXML specification.\n *\n * Uses `@noble`/hashes for SHA-512 — audited, cross-platform,\n * and comparable in speed to node:crypto for this workload.\n *\n * @module\n */\n\nimport { sha512 } from \"@noble/hashes/sha2.js\";\n\nimport { encodeBase64 } from \"./base64\";\n\n// ── Helpers ──\n\nfunction utf16leEncode(str: string): Uint8Array {\n const bytes = new Uint8Array(str.length * 2);\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n bytes[i * 2] = code & 0xff;\n bytes[i * 2 + 1] = (code >> 8) & 0xff;\n }\n return bytes;\n}\n\n// ── Public API ──\n\nexport function randomBytes(length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof crypto !== \"undefined\" && crypto.getRandomValues) {\n crypto.getRandomValues(bytes);\n } else {\n for (let i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256);\n }\n }\n return bytes;\n}\n\n/**\n * Computes the ECMA-376 Agile Encryption hash for a password.\n *\n * Algorithm: SHA-512(salt + UTF-16LE(password)), then iterate\n * SHA-512(hash + i.toUint32LE()) spinCount times.\n */\nexport function hashPasswordAgile(password: string, salt: Uint8Array, spinCount: number): string {\n const pwBytes = utf16leEncode(password);\n\n // h = SHA-512(salt + password_utf16le)\n const initial = new Uint8Array(salt.length + pwBytes.length);\n initial.set(salt, 0);\n initial.set(pwBytes, salt.length);\n\n let h = sha512(initial);\n // SHA-512 digest is a fixed 64 bytes, so the counter buffer is allocated\n // once and only the 4 little-endian counter bytes are rewritten per spin.\n const buf = new Uint8Array(h.length + 4);\n for (let i = 0; i < spinCount; i++) {\n buf.set(h, 0);\n buf[h.length] = i & 0xff;\n buf[h.length + 1] = (i >> 8) & 0xff;\n buf[h.length + 2] = (i >> 16) & 0xff;\n buf[h.length + 3] = (i >> 24) & 0xff;\n h = sha512(buf);\n }\n\n return encodeBase64(new Uint8Array(h));\n}\n\n/**\n * Derives a password hash for OOXML document protection.\n *\n * Returns base64-encoded hashValue, saltValue, spinCount, and algorithmName\n * suitable for direct use in document protection options.\n */\nexport function derivePasswordHash(\n password: string,\n spinCount = 100000,\n): { hashValue: string; saltValue: string; spinCount: number; algorithmName: string } {\n const salt = randomBytes(16);\n const hashValue = hashPasswordAgile(password, salt, spinCount);\n return {\n hashValue,\n saltValue: encodeBase64(salt),\n spinCount,\n algorithmName: \"SHA-512\",\n };\n}\n","/**\n * Placeholder detection and replacement utilities for compiler post-processing.\n *\n * Both DOCX and PPTX compilers use placeholder tokens (e.g. `{chart:key}`)\n * in XML strings to defer relationship ID assignment. This module provides\n * fast pre-check utilities and shared replacement functions.\n */\n\nexport type IdFormat = \"rId\" | \"plain\";\n\nexport const formatId = (offset: number, index: number, style: IdFormat): string =>\n style === \"rId\" ? `rId${offset + index}` : `${offset + index}`;\n\n/**\n * Find the next `{key}` placeholder at/after `from`. Returns `[open, close]`\n * brace indices, or undefined when none remain. Mirrors the semantics of\n * `/\\{([^{}]+)\\}/g`: empty keys and keys containing `{` are skipped (the scan\n * restarts after the nested brace), matching what the regex would accept.\n */\nfunction nextPlaceholder(xml: string, from: number): [number, number] | undefined {\n let pos = from;\n for (;;) {\n const open = xml.indexOf(\"{\", pos);\n if (open === -1) return undefined;\n const close = xml.indexOf(\"}\", open + 1);\n if (close === -1) return undefined;\n const keyLen = close - open - 1;\n if (keyLen === 0) {\n pos = open + 1;\n continue;\n }\n const nextOpen = xml.indexOf(\"{\", open + 1);\n if (nextOpen !== -1 && nextOpen < close) {\n // Nested \"{\" inside the candidate key — the regex would restart there.\n pos = open + 1;\n continue;\n }\n return [open, close];\n }\n}\n\n/** Replace `{name}` placeholders with the given values (missing keys stay). */\nexport function replacePlaceholders(xml: string, map: Map<string, string>): string {\n const parts: string[] = [];\n let last = 0;\n let pos = 0;\n for (;;) {\n const found = nextPlaceholder(xml, pos);\n if (found === undefined) break;\n const [open, close] = found;\n const replacement = map.get(xml.substring(open + 1, close));\n if (replacement !== undefined) {\n parts.push(xml.substring(last, open), replacement);\n last = close + 1;\n }\n pos = close + 1;\n }\n if (last === 0) return xml;\n parts.push(xml.substring(last));\n return parts.join(\"\");\n}\n\nexport function hasPlaceholders(xml: string): boolean {\n return xml.includes(\"{\");\n}\n\nexport function collectPlaceholderKeys(xml: string, prefix: string): string[] {\n const keys = new Set<string>();\n const search = `{${prefix}`;\n let pos = 0;\n\n while ((pos = xml.indexOf(search, pos)) !== -1) {\n const keyStart = pos + search.length;\n const keyEnd = xml.indexOf(\"}\", keyStart);\n if (keyEnd === -1) break;\n\n const key = xml.substring(keyStart, keyEnd);\n if (key.length > 0) keys.add(key);\n pos = keyEnd + 1;\n }\n\n return [...keys];\n}\n\nexport function replaceImagePlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n idFormat: IdFormat = \"rId\",\n): string {\n if (mediaData.length === 0) return xml;\n const map = new Map<string, string>();\n for (const [i, item] of mediaData.entries()) {\n map.set(item.fileName, formatId(offset, i, idFormat));\n }\n return replacePlaceholders(xml, map);\n}\n\nexport function getReferencedMedia(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n // Substring search, not brace-pair scanning: callers pass JSON.stringify\n // output (the patch path) where nested object braces would derail a\n // brace-pair walk past the actual placeholder tokens.\n return mediaArray.filter((image) => xml.includes(`{${image.fileName}}`));\n}\n\n/**\n * Combined find + replace for image placeholders in a single pass.\n *\n * Scans XML for `{fileName}` placeholders, replaces them with formatted IDs,\n * and returns the list of referenced media items for relationship registration.\n * More efficient than calling getReferencedMedia() + replaceImagePlaceholders() separately.\n */\nexport function findAndReplaceImagePlaceholders(\n xml: string,\n mediaArray: { fileName: string }[],\n offset: number,\n idFormat: IdFormat = \"rId\",\n sourceRids?: ReadonlyMap<string, string>,\n): { xml: string; referenced: { fileName: string }[] } {\n if (mediaArray.length === 0 || !hasPlaceholders(xml)) {\n return { xml, referenced: [] };\n }\n // Build fileName → mediaItem lookup\n const itemMap = new Map<string, { fileName: string }>();\n for (const item of mediaArray) {\n itemMap.set(item.fileName, item);\n }\n\n const referenced: { fileName: string }[] = [];\n const replaceMap = new Map<string, string>();\n const parts: string[] = [];\n let last = 0;\n let pos = 0;\n\n for (;;) {\n const found = nextPlaceholder(xml, pos);\n if (found === undefined) break;\n const [open, close] = found;\n const key = xml.substring(open + 1, close);\n const item = itemMap.get(key);\n if (item !== undefined) {\n let id = replaceMap.get(key);\n if (id === undefined) {\n // Source round-trip: when the source rels captured the rId for this\n // media file, the body XML must reference that exact rId — the\n // structured compiler's rels will then point to the same target. Using\n // an offset-derived id here would dangle the body's `r:embed` against\n // a rel pointing at a different media item.\n const override = sourceRids?.get(key);\n // Use the referenced-local position (not the global media index) so the\n // generated IDs align with the caller's per-part addRelationship(offset+i)\n // loop. Using the global index desyncs the body's r:embed from the part's\n // .rels when a part references only a subset of the global media array\n // (e.g. headers/footers, whose images sit at high global indices).\n id = override ?? formatId(offset, referenced.length, idFormat);\n replaceMap.set(key, id);\n referenced.push(item);\n }\n parts.push(xml.substring(last, open), id);\n last = close + 1;\n }\n pos = close + 1;\n }\n\n if (last === 0) return { xml, referenced: [] };\n parts.push(xml.substring(last));\n return { xml: parts.join(\"\"), referenced };\n}\n\n/**\n * Replace all placeholder types in a single pass.\n *\n * Combines image, chart, smartart, and arbitrary key-value replacements\n * into one regex scan of the XML string. Used by compilers to avoid\n * multiple full-string passes on large documents.\n */\nexport function replaceAllPlaceholders(\n xml: string,\n entries: Array<{ prefix?: string; key: string; value: string }>,\n): string {\n if (entries.length === 0 || !hasPlaceholders(xml)) return xml;\n const map = new Map<string, string>();\n for (const { prefix, key, value } of entries) {\n map.set(prefix ? `${prefix}${key}` : key, value);\n }\n return replacePlaceholders(xml, map);\n}\n\nexport function replaceChartPlaceholders(\n xml: string,\n chartKeys: string[],\n offset: number,\n idFormat: IdFormat = \"rId\",\n): string {\n if (chartKeys.length === 0) return xml;\n const map = new Map<string, string>();\n for (let i = 0; i < chartKeys.length; i++) {\n map.set(`chart:${chartKeys[i]}`, formatId(offset, i, idFormat));\n }\n return replacePlaceholders(xml, map);\n}\n\nimport type { RelationshipType } from \"../opc/relationships\";\n\nexport interface SmartArtRelOptions {\n pathPrefix: string;\n styleRelType: RelationshipType;\n /**\n * Whether a SmartArt carries the optional diagramDrawing part (the Office\n * render cache). Unset means every SmartArt does — a fresh authoring\n * package never carries it, so round-trip callers pass the source fact.\n */\n hasDrawing?: (key: string) => boolean;\n}\n\nexport function replaceSmartArtPlaceholders(\n xml: string,\n keys: string[],\n dataOffset: number,\n idFormat: IdFormat = \"rId\",\n): string {\n if (keys.length === 0) return xml;\n const count = keys.length;\n const loOffset = dataOffset + count;\n const qsOffset = loOffset + count;\n const csOffset = qsOffset + count;\n\n const map = new Map<string, string>();\n for (let i = 0; i < count; i++) {\n map.set(`smartart:${keys[i]}`, formatId(dataOffset, i, idFormat));\n map.set(`smartart-lo:${keys[i]}`, formatId(loOffset, i, idFormat));\n map.set(`smartart-qs:${keys[i]}`, formatId(qsOffset, i, idFormat));\n map.set(`smartart-cs:${keys[i]}`, formatId(csOffset, i, idFormat));\n }\n return replacePlaceholders(xml, map);\n}\n\nexport function addSmartArtRelationships(\n keys: string[],\n addRel: (id: number, type: RelationshipType, target: string, targetMode?: string) => void,\n baseOffset: number,\n globalStartIndex: number,\n options: SmartArtRelOptions,\n): void {\n const { pathPrefix, styleRelType, hasDrawing } = options;\n const count = keys.length;\n const loOffset = baseOffset + count;\n const qsOffset = loOffset + count;\n const csOffset = qsOffset + count;\n\n for (let i = 0; i < keys.length; i++) {\n const gi = globalStartIndex + i;\n addRel(\n baseOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData\",\n `${pathPrefix}diagrams/data${gi + 1}.xml`,\n );\n addRel(\n loOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout\",\n `${pathPrefix}diagrams/layout${gi + 1}.xml`,\n );\n addRel(qsOffset + i, styleRelType, `${pathPrefix}diagrams/quickStyle${gi + 1}.xml`);\n addRel(\n csOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors\",\n `${pathPrefix}diagrams/colors${gi + 1}.xml`,\n );\n if (hasDrawing === undefined || hasDrawing(keys[i]!)) {\n const drOffset = csOffset + count;\n addRel(\n drOffset + i,\n \"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing\",\n `${pathPrefix}diagrams/drawing${gi + 1}.xml`,\n );\n }\n }\n}\n\n// ── Numbering placeholders (DOCX) ──\n\n/** Replace `{reference-instance}` placeholders with numId values. */\nexport function replaceNumberingPlaceholders(\n xml: string,\n concreteNumberings: readonly { reference: string; instance: number; numId: number }[],\n): string {\n if (concreteNumberings.length === 0) return xml;\n const map = new Map<string, string>();\n for (const { reference, instance, numId } of concreteNumberings) {\n map.set(`${reference}-${instance}`, numId.toString());\n }\n return replacePlaceholders(xml, map);\n}\n\n// ── Media/Video placeholders (PPTX) ──\n\n/** Replace `{media:fileName}` placeholders with relationship IDs. */\nexport function replaceMediaPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, mediaData, offset, \"media:\");\n}\n\n/** Replace `{video:fileName}` placeholders with relationship IDs. */\nexport function replaceVideoPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, mediaData, offset, \"video:\");\n}\n\n/** Replace `{audio:fileName}` placeholders with relationship IDs. */\nexport function replaceAudioPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, mediaData, offset, \"audio:\");\n}\n\n/** Replace `{ole:fileName}` placeholders with relationship IDs. */\nexport function replaceOlePlaceholders(\n xml: string,\n embeddings: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, embeddings, offset, \"ole:\");\n}\n\nfunction replacePrefixedPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n prefix: string,\n): string {\n if (mediaData.length === 0) return xml;\n const map = new Map<string, string>();\n for (const [i, item] of mediaData.entries()) {\n map.set(`${prefix}${item.fileName}`, formatId(offset, i, \"rId\"));\n }\n return replacePlaceholders(xml, map);\n}\n\n/** Collect media items referenced by `{media:...}` placeholders in XML. */\nexport function getMediaRefs(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"media:\", mediaArray);\n}\n\n/** Collect media items referenced by `{video:...}` placeholders in XML. */\nexport function getVideoRefs(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"video:\", mediaArray);\n}\n\n/** Collect media items referenced by `{audio:...}` placeholders in XML. */\nexport function getAudioRefs(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"audio:\", mediaArray);\n}\n\n/** Collect OLE embeddings referenced by `{ole:...}` placeholders in XML. */\nexport function getOleRefs(\n xml: string,\n embeddings: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"ole:\", embeddings);\n}\n\nfunction collectPrefixedRefs(\n xml: string,\n prefix: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n const keys = new Set<string>();\n const search = `{${prefix}`;\n let pos = 0;\n while ((pos = xml.indexOf(search, pos)) !== -1) {\n const keyStart = pos + search.length;\n const keyEnd = xml.indexOf(\"}\", keyStart);\n if (keyEnd === -1) break;\n keys.add(xml.substring(keyStart, keyEnd));\n pos = keyEnd + 1;\n }\n return mediaArray.filter((m) => keys.has(m.fileName));\n}\n\n// ── Hyperlink placeholders (PPTX) ──\n\n/** Replace `{prefix:key}` placeholders with relationship IDs. */\nfunction replaceKeyedPlaceholders(\n xml: string,\n items: { key: string }[],\n offset: number,\n prefix: string,\n): string {\n if (items.length === 0) return xml;\n const map = new Map<string, string>();\n for (const [i, item] of items.entries()) {\n map.set(`${prefix}${item.key}`, formatId(offset, i, \"rId\"));\n }\n return replacePlaceholders(xml, map);\n}\n\n/** Replace `{hlink:key}` placeholders with relationship IDs. */\nexport function replaceHyperlinkPlaceholders(\n xml: string,\n hyperlinks: { key: string }[],\n offset: number,\n): string {\n return replaceKeyedPlaceholders(xml, hyperlinks, offset, \"hlink:\");\n}\n\n/** Replace `{img-link:key}` placeholders with relationship IDs. */\nexport function replaceImageLinkPlaceholders(\n xml: string,\n links: { key: string }[],\n offset: number,\n): string {\n return replaceKeyedPlaceholders(xml, links, offset, \"img-link:\");\n}\n\n/** Replace `{ole-link:key}` placeholders with relationship IDs. */\nexport function replaceOleLinkPlaceholders(\n xml: string,\n links: { key: string }[],\n offset: number,\n): string {\n return replaceKeyedPlaceholders(xml, links, offset, \"ole-link:\");\n}\n"],"mappings":";;;;AAsBA,MAAM,4BAAY,IAAI,WAAW,GAAG;AACpC,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,KAAK;CAC5B,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK,IAAI,IAAI,IAAK,MAAM,IAAK,aAAa,MAAM;CACvE,UAAU,KAAK;AACjB;AAEA,SAAS,aAAa,MAA0B;CAC9C,IAAI,MAAM;CAGV,KAAK,MAAM,QAAQ,MACjB,MAAM,WAAW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C,GAAG,SAAS,MAAM,QAAQ,GACpC,IAAI,IAAI,GAAG,SAAS,KAAK,OAAO,SAAS,QAAQ,GAAG,KAAK,CAAC;CAE5D,OAAO,oBAAoB,KAAK,GAAG;AACrC;;AAGA,SAAgB,6BACd,KACA,YACA,QACQ;CACR,OAAO,yBAAyB,KAAK,YAAY,QAAQ,QAAQ;AACnE;;AAGA,SAAgB,6BACd,KACA,OACA,QACQ;CACR,OAAO,yBAAyB,KAAK,OAAO,QAAQ,WAAW;AACjE;;AAGA,SAAgB,2BACd,KACA,OACA,QACQ;CACR,OAAO,yBAAyB,KAAK,OAAO,QAAQ,WAAW;AACjE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-open/core",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "Shared OOXML infrastructure for office-open — part descriptors, charts, drawings, tables, VML, and unit converters",
5
5
  "keywords": [
6
6
  "chart",
@@ -25,7 +25,8 @@
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "git+https://github.com/DemoMacro/office-open.git"
28
+ "url": "git+https://github.com/DemoMacro/office-open.git",
29
+ "directory": "packages/core"
29
30
  },
30
31
  "files": [
31
32
  "dist"
@@ -75,7 +76,7 @@
75
76
  "dependencies": {
76
77
  "@noble/hashes": "2.3.0",
77
78
  "fflate": "0.8.3",
78
- "@office-open/xml": "0.12.2"
79
+ "@office-open/xml": "0.12.3"
79
80
  },
80
81
  "scripts": {
81
82
  "dev": "basis build --stub",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DF3lKLF_.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":";;;;;UA8BiB;EACf;EACA,eAAe;;cAIJ;cAQA;cAiCA,oBAAqB,kBAAkB;UAOn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t.mjs","names":[],"sources":["../src/opc/zip-native.ts","../src/opc/output.ts","../src/opc/packer.ts","../src/util/compile.ts","../src/util/crypto.ts","../src/util/placeholder.ts"],"sourcesContent":["/**\n * Native ZIP reader/writer with automatic fallback to fflate.\n *\n * `node:zlib` resolves in Node and Bun (via its Node compat layer), giving\n * `deflateRawSync` / `inflateRawSync` for DEFLATE/INFLATE and `zlib.crc32`\n * for CRC-32 — ~2-3x faster than fflate's pure-JS implementation. Browsers\n * and Deno lack a resolvable `node:zlib`, so the dynamic import rejects and\n * packer.ts falls back to fflate. We probe via the import itself rather than\n * `process.versions.node`: core's `shims: true` swaps `process` for a browser\n * stub that drops `versions.node`, which would silently disable native zlib\n * in any package consuming core's polyfilled build.\n *\n * @module\n */\n\nimport type { Zippable, ZipOptions } from \"fflate\";\n\n// ── CRC-32 lookup table ──\n\nconst CRC_TABLE = new Int32Array(256);\nfor (let i = 0; i < 256; i++) {\n let c = i;\n for (let k = 0; k < 8; k++) c = c & 1 ? (c >>> 1) ^ -306674912 : c >>> 1;\n CRC_TABLE[i] = c;\n}\n\nfunction computeCrc32(data: Uint8Array): number {\n let crc = -1;\n // CRC_TABLE is a fixed 256-entry lookup; the index is masked to [0,255], so the\n // access is guaranteed in-bounds — the `!` is a compile-time narrow, not a runtime check.\n for (const byte of data) {\n crc = CRC_TABLE[(crc ^ byte) & 0xff]! ^ (crc >>> 8);\n }\n return ~crc;\n}\n\n// ── Native zlib detection (Node.js ESM) ──\n\ntype DeflateFn = (data: Uint8Array, level: number) => Uint8Array;\ntype AsyncDeflateFn = (data: Uint8Array, level: number) => Promise<Uint8Array>;\ntype InflateFn = (data: Uint8Array) => Uint8Array;\ntype Crc32Fn = (data: Uint8Array) => number;\n\nlet _nativeDeflate: DeflateFn | undefined;\nlet _nativeDeflateAsync: AsyncDeflateFn | undefined;\nlet _nativeInflate: InflateFn | undefined;\nlet _nativeCrc32: Crc32Fn | undefined;\n\n// Bun-specific fast path: Bun.deflateSync/Bun.inflateSync emit/accept RAW\n// deflate (bit-identical to deflateRawSync output) but skip the node:zlib\n// compat wrapper — ~10x on the small parts that dominate OPC packages, ~2x\n// on inflate, ~1.3x on large buffers. Probed off globalThis since core ships\n// no bun-types dependency.\nconst bunApi = (\n globalThis as {\n Bun?: {\n deflateSync?: (data: Uint8Array, opts?: { level?: number }) => Uint8Array;\n inflateSync?: (data: Uint8Array) => Uint8Array;\n };\n }\n).Bun;\nif (typeof bunApi?.deflateSync === \"function\") {\n _nativeDeflate = (data: Uint8Array, level: number): Uint8Array =>\n bunApi.deflateSync!(data, { level });\n if (typeof bunApi.inflateSync === \"function\") {\n _nativeInflate = (data: Uint8Array): Uint8Array => bunApi.inflateSync!(data);\n }\n}\n\n// `node:zlib` resolves in Node and Bun (via its Node compat layer); in\n// browsers and Deno the dynamic import rejects, so we fall back to fflate.\n// The import itself is the probe — do NOT gate on `process.versions.node`:\n// core's `shims: true` swaps `process` for a browser stub that drops\n// `versions.node`, which would silently disable native zlib in any package\n// that consumes core's polyfilled build.\ntry {\n // top-level await — ESM standard. Resolves to zlib with deflateRawSync;\n // rejects (or yields a stub without it) on incomplete polyfills.\n const zlib = await import(\"node:zlib\");\n if (typeof zlib.deflateRawSync !== \"function\") throw new Error(\"no native deflate\");\n if (_nativeDeflate === undefined) {\n _nativeDeflate = (data: Uint8Array, level: number): Uint8Array =>\n zlib.deflateRawSync(data, { level });\n }\n _nativeDeflateAsync = (data: Uint8Array, level: number): Promise<Uint8Array> =>\n new Promise<Uint8Array>((resolve, reject) =>\n zlib.deflateRaw(data, { level }, (err, result) => {\n if (err) reject(err);\n else resolve(result);\n }),\n );\n _nativeCrc32 =\n typeof zlib.crc32 === \"function\" ? (data: Uint8Array) => zlib.crc32(data) : computeCrc32;\n // Inflate is optional (deflate presence doesn't guarantee it), so probe\n // separately — nativeUnzip only becomes available when this resolves.\n if (typeof zlib.inflateRawSync === \"function\" && _nativeInflate === undefined) {\n _nativeInflate = (data: Uint8Array): Uint8Array => zlib.inflateRawSync(data);\n }\n} catch {\n // Browser/Deno or Node-like runtime without usable zlib — fflate fallback\n}\n\nexport const hasNativeDeflate = (): boolean => _nativeDeflate !== undefined;\n\nexport const hasNativeInflate = (): boolean => _nativeInflate !== undefined;\n\n// fflate's async zip entries hand every chunk to a dedicated worker via\n// postMessage with a transfer list. On Bun that worker pool hurts: teardown\n// lags creation, so back-to-back stream generations accumulate cost (measured\n// 0.4s → 4.4s per drain on a 130-part deck) and embedded pools crash outright\n// (vitest bench: \"Worker exited unexpectedly\"). Main-thread deflate is the\n// better trade there; Node keeps the worker path for its parallel libuv pool.\nconst _prefersMainThreadDeflate = typeof bunApi?.deflateSync === \"function\";\n\n/**\n * True when DEFLATE work should run on the main thread instead of fflate's\n * per-entry workers (Bun). See {@link createZipStream} in packer.ts.\n */\nexport const prefersMainThreadDeflate = (): boolean => _prefersMainThreadDeflate;\n\n/**\n * Synchronous native CRC-32 (`zlib.crc32`, Node/Bun only) — undefined where no\n * native zlib resolved (browsers/Deno). Used by media dedup as a fast content\n * key; callers keep their own JS fallback. ~59× faster than a JS hash on\n * 100 MB inputs.\n */\nexport function nativeCrc32(data: Uint8Array): number | undefined {\n return _nativeCrc32?.(data);\n}\n\n// ── LE write helpers ──\n\nfunction wU16(b: Uint8Array, o: number, v: number): void {\n b[o] = v & 0xff;\n b[o + 1] = (v >> 8) & 0xff;\n}\n\nfunction wU32(b: Uint8Array, o: number, v: number): void {\n b[o] = v & 0xff;\n b[o + 1] = (v >> 8) & 0xff;\n b[o + 2] = (v >> 16) & 0xff;\n b[o + 3] = (v >> 24) & 0xff;\n}\n\n// ── Per-entry metadata ──\n\ninterface Entry {\n filename: Uint8Array;\n data: Uint8Array;\n uncompressedSize: number;\n crc: number;\n method: number; // 0 = STORE, 8 = DEFLATE\n localOffset: number;\n}\n\n// ── Phase 1 helpers ──\n\nfunction resolveEntryData(\n raw: Zippable[string],\n defaultLevel: number,\n): { data: Uint8Array; level: number } {\n if (Array.isArray(raw)) {\n return { data: raw[0] as Uint8Array, level: (raw[1] as ZipOptions).level ?? defaultLevel };\n }\n return { data: raw as Uint8Array, level: defaultLevel };\n}\n\nfunction compressOne(\n data: Uint8Array,\n level: number,\n deflate: DeflateFn,\n): { compressed: Uint8Array; method: number } {\n if (level === 0) return { compressed: data, method: 0 };\n const compressed = deflate(data, level);\n if (compressed.length >= data.length) return { compressed: data, method: 0 };\n return { compressed, method: 8 };\n}\n\nasync function compressOneAsync(\n data: Uint8Array,\n level: number,\n deflate: AsyncDeflateFn,\n): Promise<{ compressed: Uint8Array; method: number }> {\n if (level === 0) return { compressed: data, method: 0 };\n const compressed = await deflate(data, level);\n if (compressed.length >= data.length) return { compressed: data, method: 0 };\n return { compressed, method: 8 };\n}\n\n// ── Phase 2+3: calculate sizes + write ZIP buffer ──\n\nfunction writeZipBuffer(entries: Entry[]): Uint8Array {\n let totalSize = 0;\n for (const e of entries) {\n totalSize += 30 + e.filename.length + e.data.length;\n }\n const cdOffset = totalSize;\n let cdSize = 0;\n for (const e of entries) {\n cdSize += 46 + e.filename.length;\n }\n totalSize += cdSize + 22;\n\n const buf = new Uint8Array(totalSize);\n let offset = 0;\n\n // Local file headers + data\n for (const e of entries) {\n e.localOffset = offset;\n wU32(buf, offset, 0x04034b50); // signature\n wU16(buf, offset + 4, 20); // version needed\n wU16(buf, offset + 6, 0); // flags\n wU16(buf, offset + 8, e.method); // compression method\n wU16(buf, offset + 10, 0); // mod time\n wU16(buf, offset + 12, 0); // mod date\n wU32(buf, offset + 14, e.crc);\n wU32(buf, offset + 18, e.data.length); // compressed size\n wU32(buf, offset + 22, e.uncompressedSize);\n wU16(buf, offset + 26, e.filename.length);\n wU16(buf, offset + 28, 0); // extra field length\n offset += 30;\n\n buf.set(e.filename, offset);\n offset += e.filename.length;\n\n buf.set(e.data, offset);\n offset += e.data.length;\n }\n\n // Central directory\n for (const e of entries) {\n wU32(buf, offset, 0x02014b50); // signature\n wU16(buf, offset + 4, 20); // version made by\n wU16(buf, offset + 6, 20); // version needed\n wU16(buf, offset + 8, 0); // flags\n wU16(buf, offset + 10, e.method);\n wU16(buf, offset + 12, 0); // mod time\n wU16(buf, offset + 14, 0); // mod date\n wU32(buf, offset + 16, e.crc);\n wU32(buf, offset + 20, e.data.length);\n wU32(buf, offset + 24, e.uncompressedSize);\n wU16(buf, offset + 28, e.filename.length);\n wU16(buf, offset + 30, 0); // extra field length\n wU16(buf, offset + 32, 0); // comment length\n wU16(buf, offset + 34, 0); // disk number start\n wU16(buf, offset + 36, 0); // internal attrs\n wU32(buf, offset + 38, 0); // external attrs\n wU32(buf, offset + 42, e.localOffset);\n offset += 46;\n\n buf.set(e.filename, offset);\n offset += e.filename.length;\n }\n\n // End of Central Directory Record\n wU32(buf, offset, 0x06054b50);\n wU16(buf, offset + 4, 0); // disk number\n wU16(buf, offset + 6, 0); // CD disk\n wU16(buf, offset + 8, entries.length);\n wU16(buf, offset + 10, entries.length);\n wU32(buf, offset + 12, cdSize);\n wU32(buf, offset + 16, cdOffset);\n wU16(buf, offset + 20, 0); // comment length\n\n return buf;\n}\n\n// ── Public API ──\n\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\n\nexport function nativeZip(files: Zippable, level: number = 6): Uint8Array {\n if (!_nativeDeflate) throw new Error(\"Native deflate not available\");\n const crc = _nativeCrc32 ?? computeCrc32;\n const entries: Entry[] = [];\n\n for (const key of Object.keys(files)) {\n const raw = files[key];\n if (raw === undefined) continue; // Object.keys guarantees presence; guard narrows the type\n const { data, level: entryLevel } = resolveEntryData(raw, level);\n const c = crc(data);\n const { compressed, method } = compressOne(data, entryLevel, _nativeDeflate);\n entries.push({\n filename: textEncoder.encode(key),\n data: compressed,\n uncompressedSize: data.length,\n crc: c,\n method,\n localOffset: 0,\n });\n }\n\n return writeZipBuffer(entries);\n}\n\nexport async function nativeZipAsync(files: Zippable, level: number = 6): Promise<Uint8Array> {\n const deflateAsync = _nativeDeflateAsync;\n if (!deflateAsync) throw new Error(\"Native async deflate not available\");\n const crc = _nativeCrc32 ?? computeCrc32;\n\n // All entries deflate in parallel — node:zlib async calls run on the libuv\n // thread pool, so a multi-part package compresses in roughly one-deflate\n // wall clock instead of the sum (pool size caps true parallelism; task\n // queueing is cheap relative to the deflate work itself). CRC runs inline\n // on the main thread before each entry's first await.\n const entries = (\n await Promise.all(\n Object.keys(files).map(async (key): Promise<Entry | null> => {\n const raw = files[key];\n if (raw === undefined) return null; // Object.keys guarantees presence; guard narrows the type\n const { data, level: entryLevel } = resolveEntryData(raw, level);\n const c = crc(data);\n const { compressed, method } = await compressOneAsync(data, entryLevel, deflateAsync);\n return {\n filename: textEncoder.encode(key),\n data: compressed,\n uncompressedSize: data.length,\n crc: c,\n method,\n localOffset: 0,\n };\n }),\n )\n ).filter((e): e is Entry => e !== null);\n\n return writeZipBuffer(entries);\n}\n\n// ── LE read helpers (ZIP parsing) ──\n\nfunction rU16(b: Uint8Array, o: number): number {\n return b[o]! | (b[o + 1]! << 8);\n}\n\nfunction rU32(b: Uint8Array, o: number): number {\n return (b[o]! | (b[o + 1]! << 8) | (b[o + 2]! << 16) | (b[o + 3]! << 24)) >>> 0;\n}\n\n// ── ZIP central-directory parsing ──\n\nconst EOCD_MAGIC = 0x06054b50;\nconst CD_MAGIC = 0x02014b50;\n\ninterface ZipEntryMeta {\n name: string;\n method: number;\n compSize: number;\n crc: number;\n dataStart: number;\n}\n\n/** Locate the End-of-Central-Directory record (within a 64 KB comment window). */\nfunction findEocd(b: Uint8Array): number {\n const min = Math.max(0, b.length - 65557); // 22-byte EOCD + up to 65535-byte comment\n for (let i = b.length - 22; i >= min; i--) {\n if (rU32(b, i) === EOCD_MAGIC) return i;\n }\n throw new Error(\"ZIP EOCD record not found\");\n}\n\n/** Walk the central directory and resolve each entry's payload offset. */\nfunction readCentralDirectory(buf: Uint8Array): ZipEntryMeta[] {\n const eocd = findEocd(buf);\n const count = rU16(buf, eocd + 10);\n const cdOffset = rU32(buf, eocd + 16);\n const entries: ZipEntryMeta[] = [];\n let p = cdOffset;\n for (let i = 0; i < count; i++) {\n if (rU32(buf, p) !== CD_MAGIC) throw new Error(`ZIP central directory corrupt at offset ${p}`);\n const method = rU16(buf, p + 10);\n const crc = rU32(buf, p + 16);\n const compSize = rU32(buf, p + 20);\n const nameLen = rU16(buf, p + 28);\n const extraLen = rU16(buf, p + 30);\n const cmtLen = rU16(buf, p + 32);\n const localOff = rU32(buf, p + 42);\n // Uint8Array.toString() yields \"120,46,...\" (comma-joined bytes), not the\n // UTF-8 string — decode explicitly so entry names are real paths.\n const name = textDecoder.decode(buf.subarray(p + 46, p + 46 + nameLen));\n // The local header carries its own name/extra lengths, which can differ\n // from the CD's; read them to locate the entry's payload precisely.\n const lNameLen = rU16(buf, localOff + 26);\n const lExtraLen = rU16(buf, localOff + 28);\n entries.push({\n name,\n method,\n compSize,\n crc,\n dataStart: localOff + 30 + lNameLen + lExtraLen,\n });\n p += 46 + nameLen + extraLen + cmtLen;\n }\n return entries;\n}\n\n/**\n * Decompress a ZIP archive via `node:zlib` `inflateRawSync`, mirroring fflate's\n * `unzipSync` signature and CRC-32 integrity check. Node/Bun only — callers\n * gate on {@link hasNativeInflate} and fall back to fflate `unzipSync` elsewhere.\n * Measured ~2x faster than fflate on large OOXML packages.\n */\nexport function nativeUnzip(buf: Uint8Array): Record<string, Uint8Array> {\n if (!_nativeInflate) throw new Error(\"Native inflate not available\");\n const inflate = _nativeInflate;\n const crc = _nativeCrc32 ?? computeCrc32;\n const out: Record<string, Uint8Array> = {};\n for (const e of readCentralDirectory(buf)) {\n const raw = buf.subarray(e.dataStart, e.dataStart + e.compSize);\n const dec = e.method === 0 ? raw.slice() : inflate(raw);\n // >>> 0 normalizes the signed CRC_TABLE accumulation against zlib's unsigned crc32.\n if (crc(dec) >>> 0 !== e.crc) throw new Error(`ZIP CRC-32 mismatch: ${e.name}`);\n out[e.name] = dec;\n }\n return out;\n}\n","/**\n * Output type definitions for OOXML document export.\n *\n * @module\n */\n\nimport { strFromU8 } from \"fflate\";\n\nimport { encodeBase64 } from \"../util/base64\";\n\nexport interface OutputByType {\n base64: string;\n string: string;\n text: string;\n binarystring: string;\n array: readonly number[];\n uint8array: Uint8Array;\n arraybuffer: ArrayBuffer;\n blob: Blob;\n nodebuffer: Buffer;\n}\n\nexport type OutputType = keyof OutputByType;\n\n/* V8 ignore start */\nexport const OoxmlMimeType = {\n DOCX: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n PPTX: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n XLSX: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n} as const;\n\nexport const convertOutput = <T extends OutputType>(\n data: Uint8Array,\n type: T,\n mimeType: string = OoxmlMimeType.DOCX,\n): OutputByType[T] => {\n switch (type) {\n case \"nodebuffer\":\n // Zero-copy: wrap the zip output's underlying ArrayBuffer as a Buffer\n // view instead of copying it (~11MB for an image-heavy file) on every\n // generate(). Safe because the source buffer is freshly allocated and\n // never mutated after this point.\n return Buffer.from(data.buffer, data.byteOffset, data.byteLength) as OutputByType[T];\n case \"blob\":\n return new Blob(\n [(data.buffer as ArrayBuffer).slice(data.byteOffset, data.byteOffset + data.byteLength)],\n { type: mimeType },\n ) as OutputByType[T];\n case \"arraybuffer\":\n return data.buffer.slice(\n data.byteOffset,\n data.byteOffset + data.byteLength,\n ) as OutputByType[T];\n case \"uint8array\":\n return data as OutputByType[T];\n case \"base64\":\n return encodeBase64(data) as OutputByType[T];\n case \"string\":\n case \"text\":\n case \"binarystring\":\n return strFromU8(data, true) as OutputByType[T];\n case \"array\":\n return [...data] as unknown as OutputByType[T];\n /* V8 ignore next */\n default:\n return data as unknown as OutputByType[T];\n }\n};\n/* V8 ignore stop */\n","/**\n * Shared packer utilities for OOXML document generation.\n *\n * @module\n */\n\nimport {\n type AsyncZippable,\n type ZipOptions,\n type Zippable,\n AsyncZipDeflate,\n Zip,\n ZipDeflate,\n ZipPassThrough,\n zip,\n zipSync,\n} from \"fflate\";\n\nimport { convertOutput } from \"./output\";\nimport type { OutputByType, OutputType } from \"./output\";\nimport {\n hasNativeDeflate,\n nativeZip,\n nativeZipAsync,\n prefersMainThreadDeflate,\n} from \"./zip-native\";\n\nexport type { Zippable, ZipOptions } from \"fflate\";\nexport { strFromU8, unzipSync, zipSync } from \"fflate\";\n\nexport interface XmlifyedFile {\n path: string;\n data: string | Uint8Array;\n}\n\n/** Default DEFLATE level for XML entries (SuperFast, matching MS Office). */\nexport const ZIP_DEFLATE_LEVEL = 1;\n\n/** Default DEFLATE level for compressible media (EMF/WMF/BMP/TIFF/SVG). MS\n * Office uses CompressionOption.Normal (~zlib 6); SuperFast (1) inflates EMF\n * output ~15% (measured against a real Office-generated package). */\nexport const ZIP_MEDIA_LEVEL = 6;\n\n/** Level for already-compressed media — STORE (no compression). */\nexport const ZIP_STORED_LEVEL = 0;\n\n/**\n * Media formats already compressed internally (DEFLATE for PNG, DCT for JPEG,\n * LZW for GIF; video/audio containers carry their own codec streams).\n * Re-compressing via zip DEFLATE wastes CPU and often inflates the data, so\n * MS Office STORE-s these (CompressionOption.NotCompressed → zip method 0).\n * Everything else (EMF/WMF/BMP/TIFF/SVG/WAV…) is compressible → DEFLATE —\n * measured on a real Office package, EMF at zlib level 6 matches Office\n * output where SuperFast inflates ~15%.\n */\nconst PRECOMPRESSED_MEDIA_EXT = new Set([\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"gif\",\n \"mp4\",\n \"mov\",\n \"wmv\",\n \"mpg\",\n \"mpeg\",\n \"mp3\",\n \"wma\",\n \"aac\",\n]);\n\n/**\n * Resolve the ZIP level for a media entry by file-name extension, matching MS\n * Office: already-compressed raster formats → STORE (0), everything else →\n * DEFLATE (`mediaLevel`, default Normal). A `compression.media` override\n * therefore applies only to compressible formats, never forcing DEFLATE onto\n * pre-compressed assets.\n */\nexport const levelForMediaName = (fileName: string, mediaLevel: number): number => {\n const dot = fileName.lastIndexOf(\".\");\n const ext = dot < 0 ? \"\" : fileName.slice(dot + 1).toLowerCase();\n return PRECOMPRESSED_MEDIA_EXT.has(ext) ? ZIP_STORED_LEVEL : mediaLevel;\n};\n\n/** Compression options for ZIP output (zlib levels 0-9, matching fflate). */\nexport interface CompressionOptions {\n /** DEFLATE level for XML files. Default: 1 (SuperFast, matching MS Office). */\n xml?: number;\n /**\n * DEFLATE level for compressible media (EMF/WMF/BMP/TIFF/…). Already-compressed\n * formats (PNG/JPEG/GIF) are always STOREd regardless, matching MS Office.\n * Default: 6 (Normal, matching MS Office for EMF/WMF).\n */\n media?: number;\n}\n\n/** Options for Packer output methods. */\nexport interface PackerOptions<T extends OutputType = \"nodebuffer\"> {\n /** Output format. Defaults to `\"nodebuffer\"` (Node.js Buffer). */\n type?: T;\n /** Custom XML/ZIP file overrides. */\n overrides?: XmlifyedFile[];\n /** Compression levels for ZIP entries. */\n compression?: CompressionOptions;\n}\n\n/**\n * Asynchronously compress files and convert to the requested output format.\n *\n * Where a native zlib resolved (Node/Bun), entries deflate in parallel on the\n * libuv thread pool; elsewhere fflate compresses off the main thread.\n * XML entries use DEFLATE level 1 (SuperFast) by default. Media entries are\n * split by type, matching MS Office: already-compressed formats (PNG/JPEG/GIF)\n * are STOREd, everything else uses the `media` level (default Normal).\n * Set `{ media: ZIP_STORED_LEVEL }` to STORE all compressible media too.\n */\nexport const zipAndConvert = async <T extends OutputType>(\n files: Zippable,\n type: T,\n mimeType: string,\n level: number = ZIP_DEFLATE_LEVEL,\n): Promise<OutputByType[T]> => {\n const zipped = hasNativeDeflate()\n ? await nativeZipAsync(files, level)\n : await new Promise<Uint8Array>((resolve, reject) => {\n zip(\n files as AsyncZippable,\n { level: level as ZipOptions[\"level\"], consume: true },\n (err, data) => {\n if (err) reject(err);\n else resolve(data);\n },\n );\n });\n return convertOutput(zipped, type, mimeType);\n};\n\n/**\n * Synchronously compress files and convert to the requested output format.\n *\n * Uses synchronous DEFLATE compression for maximum throughput.\n * Blocks the event loop — prefer {@link zipAndConvert} in server contexts.\n */\nexport const zipSyncAndConvert = <T extends OutputType>(\n files: Zippable,\n type: T,\n mimeType: string,\n level: number = ZIP_DEFLATE_LEVEL,\n): OutputByType[T] => {\n const zipped = hasNativeDeflate()\n ? nativeZip(files, level)\n : zipSync(files, { level: level as ZipOptions[\"level\"] });\n return convertOutput(zipped, type, mimeType);\n};\n\n/**\n * Create a `ReadableStream<Uint8Array>` from compressed file entries.\n *\n * Uses fflate's `AsyncZipDeflate` for non-blocking DEFLATE compression.\n * `STORED` entries (media) pass through synchronously.\n * Works in both Node.js and browsers (Web Streams API).\n */\nexport const createZipStream = (\n files: Zippable,\n defaultLevel: number = ZIP_DEFLATE_LEVEL,\n): ReadableStream<Uint8Array> => {\n // Bun's worker teardown lags creation, so per-entry workers accumulate cost\n // across back-to-back generations — see prefersMainThreadDeflate(). Node\n // keeps AsyncZipDeflate for its parallel libuv thread pool.\n const mainThread = prefersMainThreadDeflate();\n return new ReadableStream<Uint8Array>({\n start(controller) {\n try {\n const zip = new Zip((err, chunk, _final) => {\n if (err) {\n controller.error(err);\n return;\n }\n controller.enqueue(chunk);\n if (_final) {\n controller.close();\n }\n });\n\n for (const [name, data] of Object.entries(files)) {\n const raw = Array.isArray(data) ? (data[0] as Uint8Array) : (data as Uint8Array);\n const level = Array.isArray(data)\n ? ((data[1] as ZipOptions).level ?? defaultLevel)\n : defaultLevel;\n const workerPath = level !== ZIP_STORED_LEVEL && !mainThread;\n const entry =\n level === ZIP_STORED_LEVEL\n ? new ZipPassThrough(name)\n : workerPath\n ? new AsyncZipDeflate(name, { level: level as ZipOptions[\"level\"] })\n : new ZipDeflate(name, { level: level as ZipOptions[\"level\"] });\n zip.add(entry);\n // AsyncZipDeflate transfers each pushed buffer to its worker\n // (postMessage move semantics), detaching the caller's view —\n // regenerating from the same files would push an already-detached\n // buffer and throw DataCloneError. Only the worker entry needs the\n // copy; pass-through and main-thread entries keep zero-copy.\n entry.push(workerPath ? raw.slice() : raw, true);\n }\n\n zip.end();\n } catch (err) {\n controller.error(err instanceof Error ? err : new Error(String(err)));\n }\n },\n });\n};\n\n// ── Streaming ZIP writer ──\n\n/**\n * Incremental sink for one ZIP part. Feed chunks as they are produced; the\n * entry's local header is emitted on {@link ZipStreamWriter.addPart} and the\n * trailing CRC/sizes on {@link end} — the part's full content never has to\n * exist in memory at once.\n */\nexport interface ZipPartSink {\n /** Append a chunk to the part. */\n push(chunk: Uint8Array): void;\n /** Finalize the part, optionally with a final chunk. Must be called before adding the next one. */\n end(lastChunk?: Uint8Array): void;\n}\n\n/**\n * Incremental ZIP archive writer over fflate's streaming `Zip` — parts are\n * added and completed one at a time; compressed output flows to `ondata` as\n * it is produced. This is the constant-memory counterpart to\n * {@link createZipStream} (which requires the complete `Zippable` up front):\n * serialize each part chunk-wise into the returned sink instead of building\n * the full part string.\n *\n * Parts must be added in order — `[Content_Types].xml` first per OPC. The\n * whole archive finishes when {@link ZipStreamWriter.end} is called.\n */\nexport class ZipStreamWriter {\n private readonly zip: Zip;\n private current: AsyncZipDeflate | ZipDeflate | ZipPassThrough | undefined;\n private readonly mainThread = prefersMainThreadDeflate();\n\n constructor(\n ondata: (err: Error | null, chunk: Uint8Array, final: boolean) => void,\n private readonly defaultLevel: number = ZIP_DEFLATE_LEVEL,\n ) {\n this.zip = new Zip(ondata);\n }\n\n /** Add a part and return its incremental sink. `end()` the previous first. */\n addPart(name: string, level: number = this.defaultLevel): ZipPartSink {\n if (this.current) throw new Error(`ZipStreamWriter: previous part not finalized`);\n const workerPath = level !== ZIP_STORED_LEVEL && !this.mainThread;\n const entry =\n level === ZIP_STORED_LEVEL\n ? new ZipPassThrough(name)\n : workerPath\n ? new AsyncZipDeflate(name, { level: level as ZipOptions[\"level\"] })\n : new ZipDeflate(name, { level: level as ZipOptions[\"level\"] });\n // AsyncZipDeflate hands chunks to a worker; ondata delivery is asynchronous,\n // so ordering between parts is preserved by fflate's internal queue. The\n // worker transfer-detaches every chunk it is handed, so sinks receive\n // copies — a caller-held buffer must survive repeated generations.\n this.zip.add(entry);\n this.current = entry;\n return {\n push: (chunk) => entry.push(workerPath ? chunk.slice() : chunk, false),\n end: (lastChunk?: Uint8Array) => {\n entry.push((workerPath ? lastChunk?.slice() : lastChunk) ?? new Uint8Array(0), true);\n this.current = undefined;\n },\n };\n }\n\n /** Finish the archive (central directory + EOCD). */\n end(): void {\n if (this.current) throw new Error(`ZipStreamWriter: unclosed part at end()`);\n this.zip.end();\n }\n}\n\n// ── Factory function ──\n\n/**\n * Compile function provided by each package to convert a file object into a Zippable map.\n */\nexport type CompileFn<TFile> = (\n file: TFile,\n overrides?: XmlifyedFile[],\n mediaLevel?: number,\n) => Zippable;\n\n/**\n * Packer interface returned by {@link createPacker}.\n *\n * Async methods use fflate Web Workers for non-blocking compression.\n * Sync methods use synchronous compression for maximum throughput in\n * CLI scripts and build tools.\n */\nexport interface Packer<TFile> {\n /** Compile file to Zippable map (synchronous). */\n compile: CompileFn<TFile>;\n\n /** Generic async output — returns the requested OutputType. */\n pack<T extends OutputType = \"nodebuffer\">(\n file: TFile,\n options?: PackerOptions<T>,\n ): Promise<OutputByType[T]>;\n /** Generic sync output — returns the requested OutputType. */\n packSync<T extends OutputType = \"nodebuffer\">(\n file: TFile,\n options?: PackerOptions<T>,\n ): OutputByType[T];\n\n /** Async → `Promise<Uint8Array>` (like `Response.bytes()`). */\n toBytes(file: TFile, options?: PackerOptions): Promise<Uint8Array>;\n /** Sync → `Uint8Array`. */\n toBytesSync(file: TFile, options?: PackerOptions): Uint8Array;\n\n /** Async → `Promise<string>` (raw ZIP content as string). */\n toString(file: TFile, options?: PackerOptions): Promise<string>;\n /** Sync → `string`. */\n toStringSync(file: TFile, options?: PackerOptions): string;\n\n /** Async → `Promise<Buffer>` (Node.js). */\n toBuffer(file: TFile, options?: PackerOptions): Promise<Buffer>;\n /** Sync → `Buffer` (Node.js). */\n toBufferSync(file: TFile, options?: PackerOptions): Buffer;\n\n /** Async → `Promise<string>` (base64-encoded). */\n toBase64(file: TFile, options?: PackerOptions): Promise<string>;\n /** Sync → `string` (base64-encoded). */\n toBase64Sync(file: TFile, options?: PackerOptions): string;\n\n /** Async → `Promise<Blob>` (browser). */\n toBlob(file: TFile, options?: PackerOptions): Promise<Blob>;\n /** Sync → `Blob`. */\n toBlobSync(file: TFile, options?: PackerOptions): Blob;\n\n /** Async → `Promise<ArrayBuffer>`. */\n toArrayBuffer(file: TFile, options?: PackerOptions): Promise<ArrayBuffer>;\n /** Sync → `ArrayBuffer`. */\n toArrayBufferSync(file: TFile, options?: PackerOptions): ArrayBuffer;\n\n /** Streaming output via `ReadableStream<Uint8Array>` (cross-platform, uses Web Workers). */\n toStream(file: TFile, options?: PackerOptions): ReadableStream<Uint8Array>;\n}\n\n/**\n * Create a Packer object with all output format methods.\n *\n * Centralises the ZIP → convert pipeline and the streaming implementation\n * so that each OOXML package only needs to provide a `compile` function and\n * a MIME type.\n */\nexport const createPacker = <TFile>(options: {\n compile: CompileFn<TFile>;\n mimeType: string;\n}): Packer<TFile> => {\n const { compile, mimeType } = options;\n\n const pack = async <T extends OutputType = \"nodebuffer\">(\n file: TFile,\n opts?: PackerOptions<T>,\n ): Promise<OutputByType[T]> => {\n const type = opts?.type ?? (\"nodebuffer\" as T);\n const files = compile(file, opts?.overrides ?? [], opts?.compression?.media ?? ZIP_MEDIA_LEVEL);\n return zipAndConvert(files, type, mimeType, opts?.compression?.xml ?? ZIP_DEFLATE_LEVEL);\n };\n\n const toBytes = (file: TFile, opts?: PackerOptions) =>\n pack(file, { ...opts, type: \"uint8array\" });\n const toString = (file: TFile, opts?: PackerOptions) => pack(file, { ...opts, type: \"string\" });\n const toBuffer = (file: TFile, opts?: PackerOptions) =>\n pack(file, { ...opts, type: \"nodebuffer\" });\n const toBase64 = (file: TFile, opts?: PackerOptions) => pack(file, { ...opts, type: \"base64\" });\n const toBlob = (file: TFile, opts?: PackerOptions) => pack(file, { ...opts, type: \"blob\" });\n const toArrayBuffer = (file: TFile, opts?: PackerOptions) =>\n pack(file, { ...opts, type: \"arraybuffer\" });\n\n // ── Sync methods (zipSync, maximum throughput) ──\n\n const packSync = <T extends OutputType = \"nodebuffer\">(\n file: TFile,\n opts?: PackerOptions<T>,\n ): OutputByType[T] => {\n const type = opts?.type ?? (\"nodebuffer\" as T);\n const files = compile(file, opts?.overrides ?? [], opts?.compression?.media ?? ZIP_MEDIA_LEVEL);\n return zipSyncAndConvert(files, type, mimeType, opts?.compression?.xml ?? ZIP_DEFLATE_LEVEL);\n };\n\n const toBytesSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"uint8array\" });\n const toStringSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"string\" });\n const toBufferSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"nodebuffer\" });\n const toBase64Sync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"base64\" });\n const toBlobSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"blob\" });\n const toArrayBufferSync = (file: TFile, opts?: PackerOptions) =>\n packSync(file, { ...opts, type: \"arraybuffer\" });\n\n // ── Stream ──\n\n const toStream = (file: TFile, opts?: PackerOptions) => {\n const mediaLevel = opts?.compression?.media ?? ZIP_MEDIA_LEVEL;\n let files: Zippable;\n try {\n files = compile(file, opts?.overrides ?? [], mediaLevel);\n } catch (err) {\n return new ReadableStream<Uint8Array>({\n start(controller) {\n controller.error(err instanceof Error ? err : new Error(String(err)));\n },\n });\n }\n return createZipStream(files, opts?.compression?.xml ?? ZIP_DEFLATE_LEVEL);\n };\n\n return {\n compile,\n pack,\n packSync,\n toBytes,\n toBytesSync,\n toString,\n toStringSync,\n toBuffer,\n toBufferSync,\n toBase64,\n toBase64Sync,\n toBlob,\n toBlobSync,\n toArrayBuffer,\n toArrayBufferSync,\n toStream,\n };\n};\n","/**\n * Shared compiler utilities for OOXML document generation.\n *\n * @module\n */\n\nimport { levelForMediaName } from \"../opc/packer\";\nimport type { XmlifyedFile, ZipOptions, Zippable } from \"../opc/packer\";\n\n/** Reusable TextEncoder instance (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\nexport type XmlifyedFileEntry = XmlifyedFile | readonly XmlifyedFile[] | undefined;\n\n/** Add one binary ZIP entry using the shared media compression policy. */\nexport function addBinaryFile(\n files: Zippable,\n path: string,\n data: Uint8Array,\n mediaLevel: number,\n): void {\n files[path] = [data, { level: levelForMediaName(path, mediaLevel) as ZipOptions[\"level\"] }];\n}\n\n/**\n * Convert XML files, overrides, and media into a Zippable structure.\n *\n * Mapping values may be optional arrays so package compilers can pass their\n * natural part mappings without reimplementing flattening and byte encoding.\n */\nexport function compileMapping<T extends object>(\n mapping: T & { [K in keyof T]: XmlifyedFileEntry },\n overrides?: readonly XmlifyedFile[],\n media?: readonly { data: Uint8Array; path: string }[],\n mediaLevel: number = 0,\n): Zippable {\n const files: Zippable = {};\n for (const entry of Object.values(mapping) as XmlifyedFileEntry[]) {\n if (entry === undefined) continue;\n const entries = Array.isArray(entry) ? entry : [entry];\n for (const file of entries) {\n files[file.path] = typeof file.data === \"string\" ? encoder.encode(file.data) : file.data;\n }\n }\n for (const override of overrides ?? []) {\n files[override.path] =\n typeof override.data === \"string\" ? encoder.encode(override.data) : override.data;\n }\n for (const file of media ?? []) {\n addBinaryFile(files, file.path, file.data, mediaLevel);\n }\n return files;\n}\n","/**\n * Password hashing utilities for OOXML document protection.\n *\n * Implements ECMA-376 Agile Encryption password derivation.\n * Passwords are encoded as UTF-16LE per the OOXML specification.\n *\n * Uses `@noble`/hashes for SHA-512 — audited, cross-platform,\n * and comparable in speed to node:crypto for this workload.\n *\n * @module\n */\n\nimport { sha512 } from \"@noble/hashes/sha2.js\";\n\nimport { encodeBase64 } from \"./base64\";\n\n// ── Helpers ──\n\nfunction utf16leEncode(str: string): Uint8Array {\n const bytes = new Uint8Array(str.length * 2);\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n bytes[i * 2] = code & 0xff;\n bytes[i * 2 + 1] = (code >> 8) & 0xff;\n }\n return bytes;\n}\n\n// ── Public API ──\n\nexport function randomBytes(length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (typeof crypto !== \"undefined\" && crypto.getRandomValues) {\n crypto.getRandomValues(bytes);\n } else {\n for (let i = 0; i < length; i++) {\n bytes[i] = Math.floor(Math.random() * 256);\n }\n }\n return bytes;\n}\n\n/**\n * Computes the ECMA-376 Agile Encryption hash for a password.\n *\n * Algorithm: SHA-512(salt + UTF-16LE(password)), then iterate\n * SHA-512(hash + i.toUint32LE()) spinCount times.\n */\nexport function hashPasswordAgile(password: string, salt: Uint8Array, spinCount: number): string {\n const pwBytes = utf16leEncode(password);\n\n // h = SHA-512(salt + password_utf16le)\n const initial = new Uint8Array(salt.length + pwBytes.length);\n initial.set(salt, 0);\n initial.set(pwBytes, salt.length);\n\n let h = sha512(initial);\n // SHA-512 digest is a fixed 64 bytes, so the counter buffer is allocated\n // once and only the 4 little-endian counter bytes are rewritten per spin.\n const buf = new Uint8Array(h.length + 4);\n for (let i = 0; i < spinCount; i++) {\n buf.set(h, 0);\n buf[h.length] = i & 0xff;\n buf[h.length + 1] = (i >> 8) & 0xff;\n buf[h.length + 2] = (i >> 16) & 0xff;\n buf[h.length + 3] = (i >> 24) & 0xff;\n h = sha512(buf);\n }\n\n return encodeBase64(new Uint8Array(h));\n}\n\n/**\n * Derives a password hash for OOXML document protection.\n *\n * Returns base64-encoded hashValue, saltValue, spinCount, and algorithmName\n * suitable for direct use in document protection options.\n */\nexport function derivePasswordHash(\n password: string,\n spinCount = 100000,\n): { hashValue: string; saltValue: string; spinCount: number; algorithmName: string } {\n const salt = randomBytes(16);\n const hashValue = hashPasswordAgile(password, salt, spinCount);\n return {\n hashValue,\n saltValue: encodeBase64(salt),\n spinCount,\n algorithmName: \"SHA-512\",\n };\n}\n","/**\n * Placeholder detection and replacement utilities for compiler post-processing.\n *\n * Both DOCX and PPTX compilers use placeholder tokens (e.g. `{chart:key}`)\n * in XML strings to defer relationship ID assignment. This module provides\n * fast pre-check utilities and shared replacement functions.\n */\n\nexport type IdFormat = \"rId\" | \"plain\";\n\nexport const formatId = (offset: number, index: number, style: IdFormat): string =>\n style === \"rId\" ? `rId${offset + index}` : `${offset + index}`;\n\n/**\n * Find the next `{key}` placeholder at/after `from`. Returns `[open, close]`\n * brace indices, or undefined when none remain. Mirrors the semantics of\n * `/\\{([^{}]+)\\}/g`: empty keys and keys containing `{` are skipped (the scan\n * restarts after the nested brace), matching what the regex would accept.\n */\nfunction nextPlaceholder(xml: string, from: number): [number, number] | undefined {\n let pos = from;\n for (;;) {\n const open = xml.indexOf(\"{\", pos);\n if (open === -1) return undefined;\n const close = xml.indexOf(\"}\", open + 1);\n if (close === -1) return undefined;\n const keyLen = close - open - 1;\n if (keyLen === 0) {\n pos = open + 1;\n continue;\n }\n const nextOpen = xml.indexOf(\"{\", open + 1);\n if (nextOpen !== -1 && nextOpen < close) {\n // Nested \"{\" inside the candidate key — the regex would restart there.\n pos = open + 1;\n continue;\n }\n return [open, close];\n }\n}\n\n/** Replace `{name}` placeholders with the given values (missing keys stay). */\nexport function replacePlaceholders(xml: string, map: Map<string, string>): string {\n const parts: string[] = [];\n let last = 0;\n let pos = 0;\n for (;;) {\n const found = nextPlaceholder(xml, pos);\n if (found === undefined) break;\n const [open, close] = found;\n const replacement = map.get(xml.substring(open + 1, close));\n if (replacement !== undefined) {\n parts.push(xml.substring(last, open), replacement);\n last = close + 1;\n }\n pos = close + 1;\n }\n if (last === 0) return xml;\n parts.push(xml.substring(last));\n return parts.join(\"\");\n}\n\nexport function hasPlaceholders(xml: string): boolean {\n return xml.includes(\"{\");\n}\n\nexport function collectPlaceholderKeys(xml: string, prefix: string): string[] {\n const keys = new Set<string>();\n const search = `{${prefix}`;\n let pos = 0;\n\n while ((pos = xml.indexOf(search, pos)) !== -1) {\n const keyStart = pos + search.length;\n const keyEnd = xml.indexOf(\"}\", keyStart);\n if (keyEnd === -1) break;\n\n const key = xml.substring(keyStart, keyEnd);\n if (key.length > 0) keys.add(key);\n pos = keyEnd + 1;\n }\n\n return [...keys];\n}\n\nexport function replaceImagePlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n idFormat: IdFormat = \"rId\",\n): string {\n if (mediaData.length === 0) return xml;\n const map = new Map<string, string>();\n for (const [i, item] of mediaData.entries()) {\n map.set(item.fileName, formatId(offset, i, idFormat));\n }\n return replacePlaceholders(xml, map);\n}\n\nexport function getReferencedMedia(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n // Substring search, not brace-pair scanning: callers pass JSON.stringify\n // output (the patch path) where nested object braces would derail a\n // brace-pair walk past the actual placeholder tokens.\n return mediaArray.filter((image) => xml.includes(`{${image.fileName}}`));\n}\n\n/**\n * Combined find + replace for image placeholders in a single pass.\n *\n * Scans XML for `{fileName}` placeholders, replaces them with formatted IDs,\n * and returns the list of referenced media items for relationship registration.\n * More efficient than calling getReferencedMedia() + replaceImagePlaceholders() separately.\n */\nexport function findAndReplaceImagePlaceholders(\n xml: string,\n mediaArray: { fileName: string }[],\n offset: number,\n idFormat: IdFormat = \"rId\",\n sourceRids?: ReadonlyMap<string, string>,\n): { xml: string; referenced: { fileName: string }[] } {\n if (mediaArray.length === 0 || !hasPlaceholders(xml)) {\n return { xml, referenced: [] };\n }\n // Build fileName → mediaItem lookup\n const itemMap = new Map<string, { fileName: string }>();\n for (const item of mediaArray) {\n itemMap.set(item.fileName, item);\n }\n\n const referenced: { fileName: string }[] = [];\n const replaceMap = new Map<string, string>();\n const parts: string[] = [];\n let last = 0;\n let pos = 0;\n\n for (;;) {\n const found = nextPlaceholder(xml, pos);\n if (found === undefined) break;\n const [open, close] = found;\n const key = xml.substring(open + 1, close);\n const item = itemMap.get(key);\n if (item !== undefined) {\n let id = replaceMap.get(key);\n if (id === undefined) {\n // Source round-trip: when the source rels captured the rId for this\n // media file, the body XML must reference that exact rId — the\n // structured compiler's rels will then point to the same target. Using\n // an offset-derived id here would dangle the body's `r:embed` against\n // a rel pointing at a different media item.\n const override = sourceRids?.get(key);\n // Use the referenced-local position (not the global media index) so the\n // generated IDs align with the caller's per-part addRelationship(offset+i)\n // loop. Using the global index desyncs the body's r:embed from the part's\n // .rels when a part references only a subset of the global media array\n // (e.g. headers/footers, whose images sit at high global indices).\n id = override ?? formatId(offset, referenced.length, idFormat);\n replaceMap.set(key, id);\n referenced.push(item);\n }\n parts.push(xml.substring(last, open), id);\n last = close + 1;\n }\n pos = close + 1;\n }\n\n if (last === 0) return { xml, referenced: [] };\n parts.push(xml.substring(last));\n return { xml: parts.join(\"\"), referenced };\n}\n\n/**\n * Replace all placeholder types in a single pass.\n *\n * Combines image, chart, smartart, and arbitrary key-value replacements\n * into one regex scan of the XML string. Used by compilers to avoid\n * multiple full-string passes on large documents.\n */\nexport function replaceAllPlaceholders(\n xml: string,\n entries: Array<{ prefix?: string; key: string; value: string }>,\n): string {\n if (entries.length === 0 || !hasPlaceholders(xml)) return xml;\n const map = new Map<string, string>();\n for (const { prefix, key, value } of entries) {\n map.set(prefix ? `${prefix}${key}` : key, value);\n }\n return replacePlaceholders(xml, map);\n}\n\nexport function replaceChartPlaceholders(\n xml: string,\n chartKeys: string[],\n offset: number,\n idFormat: IdFormat = \"rId\",\n): string {\n if (chartKeys.length === 0) return xml;\n const map = new Map<string, string>();\n for (let i = 0; i < chartKeys.length; i++) {\n map.set(`chart:${chartKeys[i]}`, formatId(offset, i, idFormat));\n }\n return replacePlaceholders(xml, map);\n}\n\nimport type { RelationshipType } from \"../opc/relationships\";\n\nexport interface SmartArtRelOptions {\n pathPrefix: string;\n styleRelType: RelationshipType;\n /**\n * Whether a SmartArt carries the optional diagramDrawing part (the Office\n * render cache). Unset means every SmartArt does — a fresh authoring\n * package never carries it, so round-trip callers pass the source fact.\n */\n hasDrawing?: (key: string) => boolean;\n}\n\nexport function replaceSmartArtPlaceholders(\n xml: string,\n keys: string[],\n dataOffset: number,\n idFormat: IdFormat = \"rId\",\n): string {\n if (keys.length === 0) return xml;\n const count = keys.length;\n const loOffset = dataOffset + count;\n const qsOffset = loOffset + count;\n const csOffset = qsOffset + count;\n\n const map = new Map<string, string>();\n for (let i = 0; i < count; i++) {\n map.set(`smartart:${keys[i]}`, formatId(dataOffset, i, idFormat));\n map.set(`smartart-lo:${keys[i]}`, formatId(loOffset, i, idFormat));\n map.set(`smartart-qs:${keys[i]}`, formatId(qsOffset, i, idFormat));\n map.set(`smartart-cs:${keys[i]}`, formatId(csOffset, i, idFormat));\n }\n return replacePlaceholders(xml, map);\n}\n\nexport function addSmartArtRelationships(\n keys: string[],\n addRel: (id: number, type: RelationshipType, target: string, targetMode?: string) => void,\n baseOffset: number,\n globalStartIndex: number,\n options: SmartArtRelOptions,\n): void {\n const { pathPrefix, styleRelType, hasDrawing } = options;\n const count = keys.length;\n const loOffset = baseOffset + count;\n const qsOffset = loOffset + count;\n const csOffset = qsOffset + count;\n\n for (let i = 0; i < keys.length; i++) {\n const gi = globalStartIndex + i;\n addRel(\n baseOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData\",\n `${pathPrefix}diagrams/data${gi + 1}.xml`,\n );\n addRel(\n loOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout\",\n `${pathPrefix}diagrams/layout${gi + 1}.xml`,\n );\n addRel(qsOffset + i, styleRelType, `${pathPrefix}diagrams/quickStyle${gi + 1}.xml`);\n addRel(\n csOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors\",\n `${pathPrefix}diagrams/colors${gi + 1}.xml`,\n );\n if (hasDrawing === undefined || hasDrawing(keys[i]!)) {\n const drOffset = csOffset + count;\n addRel(\n drOffset + i,\n \"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing\",\n `${pathPrefix}diagrams/drawing${gi + 1}.xml`,\n );\n }\n }\n}\n\n// ── Numbering placeholders (DOCX) ──\n\n/** Replace `{reference-instance}` placeholders with numId values. */\nexport function replaceNumberingPlaceholders(\n xml: string,\n concreteNumberings: readonly { reference: string; instance: number; numId: number }[],\n): string {\n if (concreteNumberings.length === 0) return xml;\n const map = new Map<string, string>();\n for (const { reference, instance, numId } of concreteNumberings) {\n map.set(`${reference}-${instance}`, numId.toString());\n }\n return replacePlaceholders(xml, map);\n}\n\n// ── Media/Video placeholders (PPTX) ──\n\n/** Replace `{media:fileName}` placeholders with relationship IDs. */\nexport function replaceMediaPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, mediaData, offset, \"media:\");\n}\n\n/** Replace `{video:fileName}` placeholders with relationship IDs. */\nexport function replaceVideoPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, mediaData, offset, \"video:\");\n}\n\n/** Replace `{audio:fileName}` placeholders with relationship IDs. */\nexport function replaceAudioPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, mediaData, offset, \"audio:\");\n}\n\n/** Replace `{ole:fileName}` placeholders with relationship IDs. */\nexport function replaceOlePlaceholders(\n xml: string,\n embeddings: { fileName: string }[],\n offset: number,\n): string {\n return replacePrefixedPlaceholders(xml, embeddings, offset, \"ole:\");\n}\n\nfunction replacePrefixedPlaceholders(\n xml: string,\n mediaData: { fileName: string }[],\n offset: number,\n prefix: string,\n): string {\n if (mediaData.length === 0) return xml;\n const map = new Map<string, string>();\n for (const [i, item] of mediaData.entries()) {\n map.set(`${prefix}${item.fileName}`, formatId(offset, i, \"rId\"));\n }\n return replacePlaceholders(xml, map);\n}\n\n/** Collect media items referenced by `{media:...}` placeholders in XML. */\nexport function getMediaRefs(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"media:\", mediaArray);\n}\n\n/** Collect media items referenced by `{video:...}` placeholders in XML. */\nexport function getVideoRefs(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"video:\", mediaArray);\n}\n\n/** Collect media items referenced by `{audio:...}` placeholders in XML. */\nexport function getAudioRefs(\n xml: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"audio:\", mediaArray);\n}\n\n/** Collect OLE embeddings referenced by `{ole:...}` placeholders in XML. */\nexport function getOleRefs(\n xml: string,\n embeddings: { fileName: string }[],\n): { fileName: string }[] {\n return collectPrefixedRefs(xml, \"ole:\", embeddings);\n}\n\nfunction collectPrefixedRefs(\n xml: string,\n prefix: string,\n mediaArray: { fileName: string }[],\n): { fileName: string }[] {\n const keys = new Set<string>();\n const search = `{${prefix}`;\n let pos = 0;\n while ((pos = xml.indexOf(search, pos)) !== -1) {\n const keyStart = pos + search.length;\n const keyEnd = xml.indexOf(\"}\", keyStart);\n if (keyEnd === -1) break;\n keys.add(xml.substring(keyStart, keyEnd));\n pos = keyEnd + 1;\n }\n return mediaArray.filter((m) => keys.has(m.fileName));\n}\n\n// ── Hyperlink placeholders (PPTX) ──\n\n/** Replace `{prefix:key}` placeholders with relationship IDs. */\nfunction replaceKeyedPlaceholders(\n xml: string,\n items: { key: string }[],\n offset: number,\n prefix: string,\n): string {\n if (items.length === 0) return xml;\n const map = new Map<string, string>();\n for (const [i, item] of items.entries()) {\n map.set(`${prefix}${item.key}`, formatId(offset, i, \"rId\"));\n }\n return replacePlaceholders(xml, map);\n}\n\n/** Replace `{hlink:key}` placeholders with relationship IDs. */\nexport function replaceHyperlinkPlaceholders(\n xml: string,\n hyperlinks: { key: string }[],\n offset: number,\n): string {\n return replaceKeyedPlaceholders(xml, hyperlinks, offset, \"hlink:\");\n}\n\n/** Replace `{img-link:key}` placeholders with relationship IDs. */\nexport function replaceImageLinkPlaceholders(\n xml: string,\n links: { key: string }[],\n offset: number,\n): string {\n return replaceKeyedPlaceholders(xml, links, offset, \"img-link:\");\n}\n\n/** Replace `{ole-link:key}` placeholders with relationship IDs. */\nexport function replaceOleLinkPlaceholders(\n xml: string,\n links: { key: string }[],\n offset: number,\n): string {\n return replaceKeyedPlaceholders(xml, links, offset, \"ole-link:\");\n}\n"],"mappings":";;;;AAmBA,MAAM,4BAAY,IAAI,WAAW,GAAG;AACpC,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,KAAK;CAC5B,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK,IAAI,IAAI,IAAK,MAAM,IAAK,aAAa,MAAM;CACvE,UAAU,KAAK;AACjB;AAEA,SAAS,aAAa,MAA0B;CAC9C,IAAI,MAAM;CAGV,KAAK,MAAM,QAAQ,MACjB,MAAM,WAAW,MAAM,QAAQ,OAAU,QAAQ;CAEnD,OAAO,CAAC;AACV;AASA,IAAI;AACJ,IAAI;AACJ,IAAI;AACJ,IAAI;AAOJ,MAAM,SACJ,WAMA;AACF,IAAI,OAAO,QAAQ,gBAAgB,YAAY;CAC7C,kBAAkB,MAAkB,UAClC,OAAO,YAAa,MAAM,EAAE,MAAM,CAAC;CACrC,IAAI,OAAO,OAAO,gBAAgB,YAChC,kBAAkB,SAAiC,OAAO,YAAa,IAAI;AAE/E;AAQA,IAAI;CAGF,MAAM,OAAO,MAAM,OAAO;CAC1B,IAAI,OAAO,KAAK,mBAAmB,YAAY,MAAM,IAAI,MAAM,mBAAmB;CAClF,IAAI,mBAAmB,KAAA,GACrB,kBAAkB,MAAkB,UAClC,KAAK,eAAe,MAAM,EAAE,MAAM,CAAC;CAEvC,uBAAuB,MAAkB,UACvC,IAAI,SAAqB,SAAS,WAChC,KAAK,WAAW,MAAM,EAAE,MAAM,IAAI,KAAK,WAAW;EAChD,IAAI,KAAK,OAAO,GAAG;OACd,QAAQ,MAAM;CACrB,CAAC,CACH;CACF,eACE,OAAO,KAAK,UAAU,cAAc,SAAqB,KAAK,MAAM,IAAI,IAAI;CAG9E,IAAI,OAAO,KAAK,mBAAmB,cAAc,mB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