diff --git a/api/classes/bibliography.Citation.html b/api/classes/bibliography.Citation.html
index 638bcc4700..70f3f1a4f7 100644
--- a/api/classes/bibliography.Citation.html
+++ b/api/classes/bibliography.Citation.html
@@ -25,14 +25,14 @@ it again when it updates the document's fields, or when the style is changed.
diff --git a/api/classes/charts.ChartDataPatch.html b/api/classes/charts.ChartDataPatch.html
index 8c55accf4e..64e5c1e4e2 100644
--- a/api/classes/charts.ChartDataPatch.html
+++ b/api/classes/charts.ChartDataPatch.html
@@ -45,7 +45,7 @@ placeholder in the document's text is left as it is.
diff --git a/api/classes/embedded-files.EmbeddedFileRun.html b/api/classes/embedded-files.EmbeddedFileRun.html
index 85bad351c7..0091ad3082 100644
--- a/api/classes/embedded-files.EmbeddedFileRun.html
+++ b/api/classes/embedded-files.EmbeddedFileRun.html
@@ -46,7 +46,7 @@ object sits inline with text, in a paragraph, including in a table, header, foot
diff --git a/api/classes/index.AbstractNumbering.html b/api/classes/index.AbstractNumbering.html
index 18c476ab2b..573cad4b64 100644
--- a/api/classes/index.AbstractNumbering.html
+++ b/api/classes/index.AbstractNumbering.html
@@ -35,7 +35,7 @@ Each abstract definition can contain up to 9 levels.
diff --git a/api/classes/index.Body.html b/api/classes/index.Body.html
index e0c1d5ace0..db542a7473 100644
--- a/api/classes/index.Body.html
+++ b/api/classes/index.Body.html
@@ -37,7 +37,7 @@ section. The last section's properties are stored as a direct child of the body
diff --git a/api/classes/index.Bookmark.html b/api/classes/index.Bookmark.html
index 23087945ac..31571eda34 100644
--- a/api/classes/index.Bookmark.html
+++ b/api/classes/index.Bookmark.html
@@ -31,7 +31,7 @@ of a start marker, content, and an end marker.
diff --git a/api/classes/index.BookmarkEnd.html b/api/classes/index.BookmarkEnd.html
index f070ffda1c..d01eef75c1 100644
--- a/api/classes/index.BookmarkEnd.html
+++ b/api/classes/index.BookmarkEnd.html
@@ -35,7 +35,7 @@ taken from bookmarkUniqueNumericId (see BookmarkStart)
diff --git a/api/classes/index.BookmarkStart.html b/api/classes/index.BookmarkStart.html
index 742f6d1a80..70615f69ee 100644
--- a/api/classes/index.BookmarkStart.html
+++ b/api/classes/index.BookmarkStart.html
@@ -37,7 +37,7 @@ same as a Bookmark's.
diff --git a/api/classes/index.CellMerge.html b/api/classes/index.CellMerge.html
index 55236f0bd9..8da6423a98 100644
--- a/api/classes/index.CellMerge.html
+++ b/api/classes/index.CellMerge.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.CellMergeAttributes.html b/api/classes/index.CellMergeAttributes.html
index 805e04048f..c4dd7219b9 100644
--- a/api/classes/index.CellMergeAttributes.html
+++ b/api/classes/index.CellMergeAttributes.html
@@ -30,7 +30,7 @@ can define an xmlKeys map to specify the transformation.
diff --git a/api/classes/index.CheckBoxSymbolElement.html b/api/classes/index.CheckBoxSymbolElement.html
index 6faee468ca..22a135b9e2 100644
--- a/api/classes/index.CheckBoxSymbolElement.html
+++ b/api/classes/index.CheckBoxSymbolElement.html
@@ -33,7 +33,7 @@ specifying the Unicode character and font to render.
diff --git a/api/classes/index.CheckBoxUtil.html b/api/classes/index.CheckBoxUtil.html
index d8b33fee7f..cb8f205ce1 100644
--- a/api/classes/index.CheckBoxUtil.html
+++ b/api/classes/index.CheckBoxUtil.html
@@ -33,7 +33,7 @@ including its checked state and the symbols used for checked and unchecked state
diff --git a/api/classes/index.CommentRangeEnd.html b/api/classes/index.CommentRangeEnd.html
index f84808318c..9e858b36de 100644
--- a/api/classes/index.CommentRangeEnd.html
+++ b/api/classes/index.CommentRangeEnd.html
@@ -36,7 +36,7 @@ Must be paired with a CommentRangeStart with the same ID.
diff --git a/api/classes/index.CommentRangeStart.html b/api/classes/index.CommentRangeStart.html
index 0b8aacf09b..6ae01423e4 100644
--- a/api/classes/index.CommentRangeStart.html
+++ b/api/classes/index.CommentRangeStart.html
@@ -36,7 +36,7 @@ Must be paired with a CommentRangeEnd with the same ID.
diff --git a/api/classes/index.CommentReference.html b/api/classes/index.CommentReference.html
index 070386861f..e748035bac 100644
--- a/api/classes/index.CommentReference.html
+++ b/api/classes/index.CommentReference.html
@@ -36,7 +36,7 @@ It should be placed after the CommentRangeEnd element.
diff --git a/api/classes/index.Comments.html b/api/classes/index.Comments.html
index 152cdd9e57..0090123ac0 100644
--- a/api/classes/index.Comments.html
+++ b/api/classes/index.Comments.html
@@ -35,7 +35,7 @@ threading is activated and thread data is generated for commentsExtended.xml.
diff --git a/api/classes/index.CommentsIds.html b/api/classes/index.CommentsIds.html
index 3ea48c028d..53174db1dd 100644
--- a/api/classes/index.CommentsIds.html
+++ b/api/classes/index.CommentsIds.html
@@ -27,7 +27,7 @@ to a stable w16cid:durableId preserved by Word across edits.
diff --git a/api/classes/index.ConcreteHyperlink.html b/api/classes/index.ConcreteHyperlink.html
index bfd94764fb..f8ccdac254 100644
--- a/api/classes/index.ConcreteHyperlink.html
+++ b/api/classes/index.ConcreteHyperlink.html
@@ -30,7 +30,7 @@ Use InternalHyperlink or ExternalHyperlink for creating hyperlinks in documents.
diff --git a/api/classes/index.DeletedTableCell.html b/api/classes/index.DeletedTableCell.html
index 70d36bb4d8..846b179eb3 100644
--- a/api/classes/index.DeletedTableCell.html
+++ b/api/classes/index.DeletedTableCell.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.DeletedTableRow.html b/api/classes/index.DeletedTableRow.html
index 46170a12c8..f550ee42ba 100644
--- a/api/classes/index.DeletedTableRow.html
+++ b/api/classes/index.DeletedTableRow.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.DocumentDefaults.html b/api/classes/index.DocumentDefaults.html
index a51672d325..df8de1d413 100644
--- a/api/classes/index.DocumentDefaults.html
+++ b/api/classes/index.DocumentDefaults.html
@@ -34,7 +34,7 @@ paragraphs and runs in a document unless overridden by a style or direct formatt
diff --git a/api/classes/index.DrawingPatch.html b/api/classes/index.DrawingPatch.html
index 8078a79607..6b200667ed 100644
--- a/api/classes/index.DrawingPatch.html
+++ b/api/classes/index.DrawingPatch.html
@@ -20,7 +20,7 @@ replaces a picture's image. So is ChartDataPatch from docx/ch
diff --git a/api/classes/index.EditableRangeStart.html b/api/classes/index.EditableRangeStart.html
index a02947fd68..1cf993da49 100644
--- a/api/classes/index.EditableRangeStart.html
+++ b/api/classes/index.EditableRangeStart.html
@@ -36,7 +36,7 @@ The id must be different from every other editable range's. The document's
diff --git a/api/classes/index.EndnoteIdReference.html b/api/classes/index.EndnoteIdReference.html
index 8d9119e855..b7988b97e1 100644
--- a/api/classes/index.EndnoteIdReference.html
+++ b/api/classes/index.EndnoteIdReference.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.EndnoteReferenceRun.html b/api/classes/index.EndnoteReferenceRun.html
index 04f140b6a7..909570335d 100644
--- a/api/classes/index.EndnoteReferenceRun.html
+++ b/api/classes/index.EndnoteReferenceRun.html
@@ -31,7 +31,7 @@ own, which is added to the document's endnotes when the run is written.
diff --git a/api/classes/index.EndnoteReferenceRunAttributes.html b/api/classes/index.EndnoteReferenceRunAttributes.html
index 01a1362e45..bd47c8b8cc 100644
--- a/api/classes/index.EndnoteReferenceRunAttributes.html
+++ b/api/classes/index.EndnoteReferenceRunAttributes.html
@@ -30,7 +30,7 @@ can define an xmlKeys map to specify the transformation.
diff --git a/api/classes/index.Endnotes.html b/api/classes/index.Endnotes.html
index e065515b1f..e2f9d4b6c6 100644
--- a/api/classes/index.Endnotes.html
+++ b/api/classes/index.Endnotes.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.ExternalHyperlink.html b/api/classes/index.ExternalHyperlink.html
index 79e1ad394b..5c86fe9754 100644
--- a/api/classes/index.ExternalHyperlink.html
+++ b/api/classes/index.ExternalHyperlink.html
@@ -42,7 +42,7 @@ Word appends the anchor to the relationship target as described in MS-OI29500 §
diff --git a/api/classes/index.FileChild.html b/api/classes/index.FileChild.html
index 49e631bf6a..b134a57d01 100644
--- a/api/classes/index.FileChild.html
+++ b/api/classes/index.FileChild.html
@@ -29,7 +29,7 @@ to the document body. Examples include Paragraph and Table.
diff --git a/api/classes/index.FootNotes.html b/api/classes/index.FootNotes.html
index 5d2505c7fb..65a3438aca 100644
--- a/api/classes/index.FootNotes.html
+++ b/api/classes/index.FootNotes.html
@@ -36,7 +36,7 @@ line used when footnotes continue across pages.
diff --git a/api/classes/index.FooterWrapper.html b/api/classes/index.FooterWrapper.html
index 7df9762d62..d484f30f24 100644
--- a/api/classes/index.FooterWrapper.html
+++ b/api/classes/index.FooterWrapper.html
@@ -29,7 +29,7 @@ Each section can have multiple footers for different page types.
diff --git a/api/classes/index.FootnoteReference.html b/api/classes/index.FootnoteReference.html
index 78f0f0788e..e77cc6a955 100644
--- a/api/classes/index.FootnoteReference.html
+++ b/api/classes/index.FootnoteReference.html
@@ -27,7 +27,7 @@ and the footnote content by using a unique identifier.
diff --git a/api/classes/index.FootnoteReferenceRun.html b/api/classes/index.FootnoteReferenceRun.html
index 241d2566cf..1dc7514175 100644
--- a/api/classes/index.FootnoteReferenceRun.html
+++ b/api/classes/index.FootnoteReferenceRun.html
@@ -36,7 +36,7 @@ in, such as by a function that makes paragraphs, then brings its footnotes with
diff --git a/api/classes/index.GridSpan.html b/api/classes/index.GridSpan.html
index 2b48caded5..60de287aa4 100644
--- a/api/classes/index.GridSpan.html
+++ b/api/classes/index.GridSpan.html
@@ -34,7 +34,7 @@ in the table grid. This is used to merge cells horizontally (column span).
diff --git a/api/classes/index.HeaderWrapper.html b/api/classes/index.HeaderWrapper.html
index ceab8d4738..cba7b7ae5a 100644
--- a/api/classes/index.HeaderWrapper.html
+++ b/api/classes/index.HeaderWrapper.html
@@ -29,7 +29,7 @@ Each section can have multiple headers for different page types.
diff --git a/api/classes/index.HpsMeasureElement.html b/api/classes/index.HpsMeasureElement.html
index b9a08f7213..7b32455fed 100644
--- a/api/classes/index.HpsMeasureElement.html
+++ b/api/classes/index.HpsMeasureElement.html
@@ -33,7 +33,7 @@ Values can be specified as numbers (interpreted as half-points) or with explicit
diff --git a/api/classes/index.IgnoreIfEmptyXmlComponent.html b/api/classes/index.IgnoreIfEmptyXmlComponent.html
index a43899a379..3c628b1177 100644
--- a/api/classes/index.IgnoreIfEmptyXmlComponent.html
+++ b/api/classes/index.IgnoreIfEmptyXmlComponent.html
@@ -40,7 +40,7 @@ to be excluded from the output.
diff --git a/api/classes/index.ImagePatch.html b/api/classes/index.ImagePatch.html
index 65141dc78d..910e567735 100644
--- a/api/classes/index.ImagePatch.html
+++ b/api/classes/index.ImagePatch.html
@@ -33,14 +33,14 @@ document's text is left as it is: use an ImageRun in a PatchT
diff --git a/api/classes/index.ImageRun.html b/api/classes/index.ImageRun.html
index 9bcbb59d24..2423c0e0fb 100644
--- a/api/classes/index.ImageRun.html
+++ b/api/classes/index.ImageRun.html
@@ -33,7 +33,7 @@ including JPG, PNG, GIF, BMP, and SVG. Optionally wraps the run in
diff --git a/api/classes/index.ImportedXmlComponent.html b/api/classes/index.ImportedXmlComponent.html
index 577846812a..fc49a01573 100644
--- a/api/classes/index.ImportedXmlComponent.html
+++ b/api/classes/index.ImportedXmlComponent.html
@@ -30,7 +30,7 @@ templates or when you need to include pre-existing XML fragments.
diff --git a/api/classes/index.InitializableXmlComponent.html b/api/classes/index.InitializableXmlComponent.html
index 102d44739a..c7c90e0d5a 100644
--- a/api/classes/index.InitializableXmlComponent.html
+++ b/api/classes/index.InitializableXmlComponent.html
@@ -30,7 +30,7 @@ create a new component that shares or extends the children of an existing compon
diff --git a/api/classes/index.InsertedTableCell.html b/api/classes/index.InsertedTableCell.html
index a239323fcb..cdca20e906 100644
--- a/api/classes/index.InsertedTableCell.html
+++ b/api/classes/index.InsertedTableCell.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.InsertedTableRow.html b/api/classes/index.InsertedTableRow.html
index 2227d7834d..02b38392d7 100644
--- a/api/classes/index.InsertedTableRow.html
+++ b/api/classes/index.InsertedTableRow.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.InsertedTextRun.html b/api/classes/index.InsertedTextRun.html
index c210bbb554..0a544d4de5 100644
--- a/api/classes/index.InsertedTextRun.html
+++ b/api/classes/index.InsertedTextRun.html
@@ -37,7 +37,7 @@ made the insertion and when.
diff --git a/api/classes/index.InternalHyperlink.html b/api/classes/index.InternalHyperlink.html
index 64f699ced9..1ac1753c3e 100644
--- a/api/classes/index.InternalHyperlink.html
+++ b/api/classes/index.InternalHyperlink.html
@@ -36,7 +36,7 @@ The bookmark must exist in the document for the hyperlink to function.
diff --git a/api/classes/index.LastRenderedPageBreak.html b/api/classes/index.LastRenderedPageBreak.html
index a2f661c85e..83246813b5 100644
--- a/api/classes/index.LastRenderedPageBreak.html
+++ b/api/classes/index.LastRenderedPageBreak.html
@@ -23,7 +23,7 @@ This is typically generated by Word and not created manually.
diff --git a/api/classes/index.MathDegree.html b/api/classes/index.MathDegree.html
index 6d079fb569..309f2c6754 100644
--- a/api/classes/index.MathDegree.html
+++ b/api/classes/index.MathDegree.html
@@ -28,7 +28,7 @@ For square roots, this element is typically hidden.
diff --git a/api/classes/index.MathFunctionName.html b/api/classes/index.MathFunctionName.html
index 4be2125365..0e1b29f8a6 100644
--- a/api/classes/index.MathFunctionName.html
+++ b/api/classes/index.MathFunctionName.html
@@ -28,7 +28,7 @@ that appears before the function argument.
diff --git a/api/classes/index.MathFunctionProperties.html b/api/classes/index.MathFunctionProperties.html
index 31ad6f4303..db1998a560 100644
--- a/api/classes/index.MathFunctionProperties.html
+++ b/api/classes/index.MathFunctionProperties.html
@@ -28,7 +28,7 @@ such as function name alignment and spacing.
diff --git a/api/classes/index.MathLimitUpper.html b/api/classes/index.MathLimitUpper.html
index 3b3b4cfc40..5d4b46d4f1 100644
--- a/api/classes/index.MathLimitUpper.html
+++ b/api/classes/index.MathLimitUpper.html
@@ -36,7 +36,7 @@ commonly used for mathematical notation like lim with conditions above.
diff --git a/api/classes/index.MathPreSubSuperScript.html b/api/classes/index.MathPreSubSuperScript.html
index 9af1e7e1b1..35ac8bfe49 100644
--- a/api/classes/index.MathPreSubSuperScript.html
+++ b/api/classes/index.MathPreSubSuperScript.html
@@ -36,7 +36,7 @@ positioned before (to the left of) the base, commonly used in tensor notation.
diff --git a/api/classes/index.MathRadicalProperties.html b/api/classes/index.MathRadicalProperties.html
index 873d55cc56..5a0987f4d4 100644
--- a/api/classes/index.MathRadicalProperties.html
+++ b/api/classes/index.MathRadicalProperties.html
@@ -28,7 +28,7 @@ such as whether to hide the degree (for square roots).
diff --git a/api/classes/index.MathRun.html b/api/classes/index.MathRun.html
index aebe42318a..899f7d7ed3 100644
--- a/api/classes/index.MathRun.html
+++ b/api/classes/index.MathRun.html
@@ -36,7 +36,7 @@ similar to how Run contains text in regular paragraphs.
diff --git a/api/classes/index.MathSubSuperScript.html b/api/classes/index.MathSubSuperScript.html
index c7c50d0f75..15c5b11b12 100644
--- a/api/classes/index.MathSubSuperScript.html
+++ b/api/classes/index.MathSubSuperScript.html
@@ -36,7 +36,7 @@ commonly used for tensor notation or indexed variables with exponents.
diff --git a/api/classes/index.Media.html b/api/classes/index.Media.html
index 5f0c6fef56..cbb70f32e6 100644
--- a/api/classes/index.Media.html
+++ b/api/classes/index.Media.html
@@ -24,7 +24,7 @@ is stored with a unique key for retrieval.
diff --git a/api/classes/index.NextAttributeComponent.html b/api/classes/index.NextAttributeComponent.html
index 4f07b5e6cb..5e932b0342 100644
--- a/api/classes/index.NextAttributeComponent.html
+++ b/api/classes/index.NextAttributeComponent.html
@@ -34,7 +34,7 @@ This gives more control but is more verbose than XmlAttributeComponent.
diff --git a/api/classes/index.OnOffElement.html b/api/classes/index.OnOffElement.html
index 07fe328360..cb1dc1dcee 100644
--- a/api/classes/index.OnOffElement.html
+++ b/api/classes/index.OnOffElement.html
@@ -34,7 +34,7 @@ it is explicitly disabled. When the value is true, the attribute is often omitte
diff --git a/api/classes/index.Packer.html b/api/classes/index.Packer.html
index ed77f8c489..2bc7fb789b 100644
--- a/api/classes/index.Packer.html
+++ b/api/classes/index.Packer.html
@@ -26,7 +26,7 @@ of the document structure into OOXML format and compression into a .docx ZIP arc
diff --git a/api/classes/index.PageBorders.html b/api/classes/index.PageBorders.html
index db08b38fca..a7da5f7593 100644
--- a/api/classes/index.PageBorders.html
+++ b/api/classes/index.PageBorders.html
@@ -34,7 +34,7 @@ including which pages display the borders and how they are positioned.
diff --git a/api/classes/index.PageTextDirection.html b/api/classes/index.PageTextDirection.html
index 654bc2cc0c..d5f1a86a9d 100644
--- a/api/classes/index.PageTextDirection.html
+++ b/api/classes/index.PageTextDirection.html
@@ -30,7 +30,7 @@ for all pages in a section.
diff --git a/api/classes/index.Paragraph.html b/api/classes/index.Paragraph.html
index 8eefe386b1..8f564f15c0 100644
--- a/api/classes/index.Paragraph.html
+++ b/api/classes/index.Paragraph.html
@@ -36,7 +36,7 @@ various inline elements such as text runs, images, hyperlinks, and bookmarks.
diff --git a/api/classes/index.ParagraphPropertiesChange.html b/api/classes/index.ParagraphPropertiesChange.html
index 33ad2b67a4..ed38ca6fe8 100644
--- a/api/classes/index.ParagraphPropertiesChange.html
+++ b/api/classes/index.ParagraphPropertiesChange.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.ParagraphPropertiesDefaults.html b/api/classes/index.ParagraphPropertiesDefaults.html
index 0c8a776540..e891f9a550 100644
--- a/api/classes/index.ParagraphPropertiesDefaults.html
+++ b/api/classes/index.ParagraphPropertiesDefaults.html
@@ -34,7 +34,7 @@ to all paragraphs in the document unless overridden.
diff --git a/api/classes/index.PositionalTab.html b/api/classes/index.PositionalTab.html
index 5310457562..5d60dd38b6 100644
--- a/api/classes/index.PositionalTab.html
+++ b/api/classes/index.PositionalTab.html
@@ -37,7 +37,7 @@ an exact alignment and position within the paragraph.
diff --git a/api/classes/index.RunPropertiesDefaults.html b/api/classes/index.RunPropertiesDefaults.html
index 45bd0e0ce0..3f9d903a79 100644
--- a/api/classes/index.RunPropertiesDefaults.html
+++ b/api/classes/index.RunPropertiesDefaults.html
@@ -34,7 +34,7 @@ to all text runs in the document unless overridden by styles or direct formattin
diff --git a/api/classes/index.SectionProperties.html b/api/classes/index.SectionProperties.html
index a5d3fbd20f..97a17b7833 100644
--- a/api/classes/index.SectionProperties.html
+++ b/api/classes/index.SectionProperties.html
@@ -35,7 +35,7 @@ A document can contain multiple sections with different properties.
diff --git a/api/classes/index.SectionPropertiesChange.html b/api/classes/index.SectionPropertiesChange.html
index 5ebb3f8b59..715f15a83a 100644
--- a/api/classes/index.SectionPropertiesChange.html
+++ b/api/classes/index.SectionPropertiesChange.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.SimpleField.html b/api/classes/index.SimpleField.html
index cc0de96381..2e20c2e3e5 100644
--- a/api/classes/index.SimpleField.html
+++ b/api/classes/index.SimpleField.html
@@ -43,7 +43,7 @@ reads them as a w:fldSimple. They have no cached value, so one give
diff --git a/api/classes/index.SimpleMailMergeField.html b/api/classes/index.SimpleMailMergeField.html
index 26cff61391..194a1f986d 100644
--- a/api/classes/index.SimpleMailMergeField.html
+++ b/api/classes/index.SimpleMailMergeField.html
@@ -30,7 +30,7 @@ It creates a MERGEFIELD that will be populated with data during mail merge.
diff --git a/api/classes/index.StringContainer.html b/api/classes/index.StringContainer.html
index c6f44c4dfe..7ce41cb2bd 100644
--- a/api/classes/index.StringContainer.html
+++ b/api/classes/index.StringContainer.html
@@ -30,7 +30,7 @@ rather than an attribute.
diff --git a/api/classes/index.StringEnumValueElement.html b/api/classes/index.StringEnumValueElement.html
index 0fc7a339d8..75461829b2 100644
--- a/api/classes/index.StringEnumValueElement.html
+++ b/api/classes/index.StringEnumValueElement.html
@@ -33,7 +33,7 @@ type parameter to enforce type safety for enum values.
diff --git a/api/classes/index.StyleForParagraph.html b/api/classes/index.StyleForParagraph.html
index 4ee38a65b8..54d82d93b9 100644
--- a/api/classes/index.StyleForParagraph.html
+++ b/api/classes/index.StyleForParagraph.html
@@ -35,7 +35,7 @@ run-level properties (font, size, color) for text within the paragraph.
diff --git a/api/classes/index.StyleLevel.html b/api/classes/index.StyleLevel.html
index 9452683653..9037b6fbf1 100644
--- a/api/classes/index.StyleLevel.html
+++ b/api/classes/index.StyleLevel.html
@@ -20,7 +20,7 @@ custom styles to be included in the table of contents at specific levels.
diff --git a/api/classes/index.Styles.html b/api/classes/index.Styles.html
index 230b26bafb..8fc58c08a0 100644
--- a/api/classes/index.Styles.html
+++ b/api/classes/index.Styles.html
@@ -35,7 +35,7 @@ a way to define consistent formatting across a document.
diff --git a/api/classes/index.TDirection.html b/api/classes/index.TDirection.html
index 1f7d32021d..182dd93604 100644
--- a/api/classes/index.TDirection.html
+++ b/api/classes/index.TDirection.html
@@ -34,7 +34,7 @@ useful for creating rotated text or supporting different writing systems.
diff --git a/api/classes/index.Table.html b/api/classes/index.Table.html
index 51aefca194..c30f914ede 100644
--- a/api/classes/index.Table.html
+++ b/api/classes/index.Table.html
@@ -36,7 +36,7 @@ Tables are used to organize content into a grid structure.
diff --git a/api/classes/index.TableBorders.html b/api/classes/index.TableBorders.html
index 3a209ec14d..1f69899929 100644
--- a/api/classes/index.TableBorders.html
+++ b/api/classes/index.TableBorders.html
@@ -32,7 +32,7 @@ line, unless fillMissingSides is false, when it is left to the tabl
diff --git a/api/classes/index.TableCellBorders.html b/api/classes/index.TableCellBorders.html
index de44bb627d..d92c74e8b9 100644
--- a/api/classes/index.TableCellBorders.html
+++ b/api/classes/index.TableCellBorders.html
@@ -34,7 +34,7 @@ can be configured independently with different styles, colors, and widths.
diff --git a/api/classes/index.TableOfContents.html b/api/classes/index.TableOfContents.html
index e9c007ef08..45f2f7a4b0 100644
--- a/api/classes/index.TableOfContents.html
+++ b/api/classes/index.TableOfContents.html
@@ -43,7 +43,7 @@ table of contents, with Update Table, rather than as a content control named by
diff --git a/api/classes/index.TableRow.html b/api/classes/index.TableRow.html
index 7d07091305..c37628435a 100644
--- a/api/classes/index.TableRow.html
+++ b/api/classes/index.TableRow.html
@@ -37,7 +37,7 @@ isn't written, as Word can't open a document with one.
diff --git a/api/classes/index.TableRowProperties.html b/api/classes/index.TableRowProperties.html
index 8d9f2819e1..3e2b5eb9af 100644
--- a/api/classes/index.TableRowProperties.html
+++ b/api/classes/index.TableRowProperties.html
@@ -30,7 +30,7 @@ whether it can split across pages, and whether it's a header row.
diff --git a/api/classes/index.TableRowPropertiesChange.html b/api/classes/index.TableRowPropertiesChange.html
index c5795aa9ca..53a75a488e 100644
--- a/api/classes/index.TableRowPropertiesChange.html
+++ b/api/classes/index.TableRowPropertiesChange.html
@@ -31,7 +31,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/index.VerticalMerge.html b/api/classes/index.VerticalMerge.html
index 1b6624b4de..6cde92bef7 100644
--- a/api/classes/index.VerticalMerge.html
+++ b/api/classes/index.VerticalMerge.html
@@ -35,7 +35,7 @@ This is used to create row spans in tables.
diff --git a/api/classes/index.WpsShapeRun.html b/api/classes/index.WpsShapeRun.html
index cd22cc20b7..401874dc25 100644
--- a/api/classes/index.WpsShapeRun.html
+++ b/api/classes/index.WpsShapeRun.html
@@ -28,7 +28,7 @@ options for fills, lines, effects and text layout, and can be any of the preset
diff --git a/api/classes/index.XmlAttributeComponent.html b/api/classes/index.XmlAttributeComponent.html
index b35d11a332..437503bacc 100644
--- a/api/classes/index.XmlAttributeComponent.html
+++ b/api/classes/index.XmlAttributeComponent.html
@@ -41,7 +41,7 @@ can define an xmlKeys map to specify the transformation.
diff --git a/api/classes/index.XmlComponent.html b/api/classes/index.XmlComponent.html
index 00bebf7044..a45d21baa1 100644
--- a/api/classes/index.XmlComponent.html
+++ b/api/classes/index.XmlComponent.html
@@ -128,7 +128,7 @@ the intermediate object format used by the xml serialization library.
diff --git a/api/classes/math.MathBrackets.html b/api/classes/math.MathBrackets.html
index ad4441972d..8715218b2c 100644
--- a/api/classes/math.MathBrackets.html
+++ b/api/classes/math.MathBrackets.html
@@ -22,14 +22,14 @@ with what they hold.
diff --git a/api/classes/math.MathLargeOperator.html b/api/classes/math.MathLargeOperator.html
index 66628d5be3..9a170da1b7 100644
--- a/api/classes/math.MathLargeOperator.html
+++ b/api/classes/math.MathLargeOperator.html
@@ -21,14 +21,14 @@ it applies to. MathSum and MathIntegral are two of the
diff --git a/api/classes/math.MathMatrix.html b/api/classes/math.MathMatrix.html
index efcb46dcd4..65e39be9a9 100644
--- a/api/classes/math.MathMatrix.html
+++ b/api/classes/math.MathMatrix.html
@@ -23,14 +23,14 @@ and Pages centre every column.
diff --git a/api/classes/math.MathPhantom.html b/api/classes/math.MathPhantom.html
index 16c6f9868c..9dcb93ec90 100644
--- a/api/classes/math.MathPhantom.html
+++ b/api/classes/math.MathPhantom.html
@@ -21,14 +21,14 @@ line things up with it. Or math that is seen but takes up no room, or less, as <
diff --git a/api/classes/shapes.ShapeCanvasRun.html b/api/classes/shapes.ShapeCanvasRun.html
index b723c2dced..e263bc465c 100644
--- a/api/classes/shapes.ShapeCanvasRun.html
+++ b/api/classes/shapes.ShapeCanvasRun.html
@@ -35,7 +35,7 @@ written in mc:AlternateContent, with the group as its fallback, unl
diff --git a/api/classes/shapes.ShapeGroupRun.html b/api/classes/shapes.ShapeGroupRun.html
index 7a837cfa2f..d377281584 100644
--- a/api/classes/shapes.ShapeGroupRun.html
+++ b/api/classes/shapes.ShapeGroupRun.html
@@ -35,7 +35,7 @@ when shapes are moved on a
diff --git a/api/classes/shapes.ShapeRun.html b/api/classes/shapes.ShapeRun.html
index c2992fea89..cad664f2a8 100644
--- a/api/classes/shapes.ShapeRun.html
+++ b/api/classes/shapes.ShapeRun.html
@@ -33,7 +33,7 @@ and arrowheads, and text inside it. It sits inline with text unless floati
diff --git a/api/classes/watermarks.ImageWatermark.html b/api/classes/watermarks.ImageWatermark.html
index 5c51571177..1390d2be30 100644
--- a/api/classes/watermarks.ImageWatermark.html
+++ b/api/classes/watermarks.ImageWatermark.html
@@ -46,7 +46,7 @@ way as an ImageRun.
diff --git a/api/classes/watermarks.TextWatermark.html b/api/classes/watermarks.TextWatermark.html
index 07711916db..6f1f4bb66d 100644
--- a/api/classes/watermarks.TextWatermark.html
+++ b/api/classes/watermarks.TextWatermark.html
@@ -44,7 +44,7 @@ recognizes it and can remove or replace it through that command.
\n option - causes the field result to be the paragraph number without trailing periods. No information about prior numbered levels is displayed unless it is included as part of the current level.
diff --git a/api/functions/html.htmlToContent.html b/api/functions/html.htmlToContent.html
index d9f65a08b9..f63180c732 100644
--- a/api/functions/html.htmlToContent.html
+++ b/api/functions/html.htmlToContent.html
@@ -50,7 +50,7 @@ read as a browser reads it, and what the document can't have, such as a video, i
diff --git a/api/functions/html.htmlToRuns.html b/api/functions/html.htmlToRuns.html
index 5dd6566c90..5dc4919c30 100644
--- a/api/functions/html.htmlToRuns.html
+++ b/api/functions/html.htmlToRuns.html
@@ -39,7 +39,7 @@ and lists is kept, without the tables and lists, with a warning, as a paragraph
diff --git a/api/functions/index.convertToXmlComponent.html b/api/functions/index.convertToXmlComponent.html
index 7406c65c3e..2123c681cc 100644
--- a/api/functions/index.convertToXmlComponent.html
+++ b/api/functions/index.convertToXmlComponent.html
@@ -35,7 +35,7 @@ ImportedXmlComponent objects that match the structure of the original XML.
diff --git a/api/functions/index.createEmphasisMark.html b/api/functions/index.createEmphasisMark.html
index 955c96fe2d..437124d0bc 100644
--- a/api/functions/index.createEmphasisMark.html
+++ b/api/functions/index.createEmphasisMark.html
@@ -37,7 +37,7 @@ text to emphasize it. This is commonly used in East Asian typography.
diff --git a/api/functions/index.createFrameProperties.html b/api/functions/index.createFrameProperties.html
index bd8753740a..d912e0ea4e 100644
--- a/api/functions/index.createFrameProperties.html
+++ b/api/functions/index.createFrameProperties.html
@@ -41,7 +41,7 @@ drop cap effects and various text wrapping options.
diff --git a/api/functions/index.createHorizontalPosition.html b/api/functions/index.createHorizontalPosition.html
index 77e16c9fd8..45275c8556 100644
--- a/api/functions/index.createHorizontalPosition.html
+++ b/api/functions/index.createHorizontalPosition.html
@@ -40,7 +40,7 @@ object relative to a base element (page, margin, column, etc.).
diff --git a/api/functions/index.createMathAccentCharacter.html b/api/functions/index.createMathAccentCharacter.html
index 6748e95402..f80cc8a720 100644
--- a/api/functions/index.createMathAccentCharacter.html
+++ b/api/functions/index.createMathAccentCharacter.html
@@ -31,7 +31,7 @@ such as summation (∑), integral (∫), or product (∏) symbols.
diff --git a/api/functions/index.createMathNAryProperties.html b/api/functions/index.createMathNAryProperties.html
index f0a66e745a..5fcd4de2d8 100644
--- a/api/functions/index.createMathNAryProperties.html
+++ b/api/functions/index.createMathNAryProperties.html
@@ -31,7 +31,7 @@ and integrals, including the operator character and limit positioning.
diff --git a/api/functions/index.createMathSubScriptElement.html b/api/functions/index.createMathSubScriptElement.html
index 2c37cab225..7226d10064 100644
--- a/api/functions/index.createMathSubScriptElement.html
+++ b/api/functions/index.createMathSubScriptElement.html
@@ -31,7 +31,7 @@ script objects, and other structures that support subscripts.
diff --git a/api/functions/index.createMathSuperScriptElement.html b/api/functions/index.createMathSuperScriptElement.html
index d8836a0131..9fdda3a736 100644
--- a/api/functions/index.createMathSuperScriptElement.html
+++ b/api/functions/index.createMathSuperScriptElement.html
@@ -31,7 +31,7 @@ script objects, and other structures that support superscripts.
diff --git a/api/functions/index.createPageNumberType.html b/api/functions/index.createPageNumberType.html
index 70dbf72fd7..5a27bbe1f0 100644
--- a/api/functions/index.createPageNumberType.html
+++ b/api/functions/index.createPageNumberType.html
@@ -37,7 +37,7 @@ for all pages in a section.
diff --git a/api/functions/index.createSectionType.html b/api/functions/index.createSectionType.html
index 4adc2f4445..cb5fa8ae86 100644
--- a/api/functions/index.createSectionType.html
+++ b/api/functions/index.createSectionType.html
@@ -37,7 +37,7 @@ where the new section begins relative to the previous section.
diff --git a/api/functions/index.createTableFloatProperties.html b/api/functions/index.createTableFloatProperties.html
index bbbc6d209e..05e35514fc 100644
--- a/api/functions/index.createTableFloatProperties.html
+++ b/api/functions/index.createTableFloatProperties.html
@@ -38,7 +38,7 @@ The overlap option isn't part of it: the table properties write it as w:tblOverl
diff --git a/api/functions/index.createTableLook.html b/api/functions/index.createTableLook.html
index 39a39f2286..63aad04151 100644
--- a/api/functions/index.createTableLook.html
+++ b/api/functions/index.createTableLook.html
@@ -34,7 +34,7 @@ styles to apply special formatting to specific regions of the table.
diff --git a/api/functions/index.createTableRowHeight.html b/api/functions/index.createTableRowHeight.html
index d7bb94bc0e..a25205f973 100644
--- a/api/functions/index.createTableRowHeight.html
+++ b/api/functions/index.createTableRowHeight.html
@@ -38,7 +38,7 @@ determining how the height should be applied.
diff --git a/api/functions/index.createWrapNone.html b/api/functions/index.createWrapNone.html
index 42a575ace7..b2198e4d67 100644
--- a/api/functions/index.createWrapNone.html
+++ b/api/functions/index.createWrapNone.html
@@ -23,7 +23,7 @@ without wrapping around it.
diff --git a/api/functions/index.createWrapSquare.html b/api/functions/index.createWrapSquare.html
index cf4d50eec2..a69d75d25f 100644
--- a/api/functions/index.createWrapSquare.html
+++ b/api/functions/index.createWrapSquare.html
@@ -32,7 +32,7 @@ of the drawing on the specified side(s).
diff --git a/api/functions/index.createWrapThrough.html b/api/functions/index.createWrapThrough.html
index 6330fc9a76..5127044d69 100644
--- a/api/functions/index.createWrapThrough.html
+++ b/api/functions/index.createWrapThrough.html
@@ -36,7 +36,7 @@ fills any open space inside the drawing, such as the middle of a ring.
diff --git a/api/functions/index.createWrapTight.html b/api/functions/index.createWrapTight.html
index 2d10ed7fd0..2f5c0324ab 100644
--- a/api/functions/index.createWrapTight.html
+++ b/api/functions/index.createWrapTight.html
@@ -36,7 +36,7 @@ of the drawing rather than its rectangular bounding box.
diff --git a/api/functions/index.dateTimeValue.html b/api/functions/index.dateTimeValue.html
index 2d8b8154b8..0f2fe6ee77 100644
--- a/api/functions/index.dateTimeValue.html
+++ b/api/functions/index.dateTimeValue.html
@@ -36,7 +36,7 @@ This matches the xsd:dateTime format required by OOXML.
diff --git a/api/functions/index.elementOf.html b/api/functions/index.elementOf.html
index 13160b859b..898158f337 100644
--- a/api/functions/index.elementOf.html
+++ b/api/functions/index.elementOf.html
@@ -31,7 +31,7 @@ is constructed with its element as rootKey.
diff --git a/api/functions/index.fillPartPageNumbers.html b/api/functions/index.fillPartPageNumbers.html
index 62e36fc361..d276cb9a37 100644
--- a/api/functions/index.fillPartPageNumbers.html
+++ b/api/functions/index.fillPartPageNumbers.html
@@ -35,7 +35,7 @@ are left as they are
diff --git a/api/functions/index.fillSequenceNumbers.html b/api/functions/index.fillSequenceNumbers.html
index 6022bd854a..8705649310 100644
--- a/api/functions/index.fillSequenceNumbers.html
+++ b/api/functions/index.fillSequenceNumbers.html
@@ -27,7 +27,7 @@ tables of contents are filled in from its headings, as Word leaves a heading's S
diff --git a/api/functions/index.hpsMeasureValue.html b/api/functions/index.hpsMeasureValue.html
index a5067cf71f..97906312f0 100644
--- a/api/functions/index.hpsMeasureValue.html
+++ b/api/functions/index.hpsMeasureValue.html
@@ -36,7 +36,7 @@ HPS (half-points) are commonly used for font sizes.
diff --git a/api/functions/index.isXmlComponent.html b/api/functions/index.isXmlComponent.html
index 8da0341139..fe676d747b 100644
--- a/api/functions/index.isXmlComponent.html
+++ b/api/functions/index.isXmlComponent.html
@@ -32,7 +32,7 @@ method that would write it.
diff --git a/api/functions/index.patchDocument.html b/api/functions/index.patchDocument.html
index 5bec08da24..782da8f350 100644
--- a/api/functions/index.patchDocument.html
+++ b/api/functions/index.patchDocument.html
@@ -42,7 +42,7 @@ the original document structure and optionally the original formatting.
Reads a theme, such as the theme of a Word document or template, as the options of a document's theme. The new
+document then has the theme's colors and fonts, so the styles, tables and text that use them look as they do in the
+file the theme came from:
+
+
its name;
+
its colors, each an RGB color or a system color's last value;
+
its fonts for headings and body text, with their fonts for East Asian text, complex scripts and each other script.
+
+
The fills, lines and effects of shapes styled by the theme are Office's in the new document, as docx writes them.
+
It reads the colors or fonts Word saves on their own too, from Design > Colors > Customize Colors or Design > Fonts >
+Customize Fonts, as the theme's colors or fonts.
A Word document or template (.docx, .docm, .dotx or .dotm), a PowerPoint presentation (.pptx), an Excel
+workbook (.xlsx), an Office theme (.thmx), or the XML of a theme, such as a document's word/theme/theme1.xml, or of a
+theme's colors or fonts, as text or bytes
// The template's styles, and its theme, whose colors and fonts its styles use constdoc = newDocument({ theme:readTheme(fs.readFileSync("template.dotx")), externalStyles:fs.readFileSync("styles.xml", "utf-8"), sections: [], });
+
diff --git a/api/functions/index.universalMeasureToTwips.html b/api/functions/index.universalMeasureToTwips.html
index 44343bfa6a..e1ff6b074b 100644
--- a/api/functions/index.universalMeasureToTwips.html
+++ b/api/functions/index.universalMeasureToTwips.html
@@ -35,7 +35,7 @@ Strings are converted according to their unit suffix.
diff --git a/api/functions/layout.estimatePageNumbersWith.html b/api/functions/layout.estimatePageNumbersWith.html
index 448c1dd58c..b8faf5281f 100644
--- a/api/functions/layout.estimatePageNumbersWith.html
+++ b/api/functions/layout.estimatePageNumbersWith.html
@@ -51,7 +51,7 @@ whose number it didn't work out is left out, and the entry is written without a
diff --git a/api/functions/layout.layoutDocument.html b/api/functions/layout.layoutDocument.html
index 4db0e07053..3fdc787f5d 100644
--- a/api/functions/layout.layoutDocument.html
+++ b/api/functions/layout.layoutDocument.html
@@ -40,7 +40,7 @@ text box, it stops, and gives the pages up to there, with why in stoppedAt
diff --git a/api/functions/layout.measureWithPretext.html b/api/functions/layout.measureWithPretext.html
index f539827a03..beacedf680 100644
--- a/api/functions/layout.measureWithPretext.html
+++ b/api/functions/layout.measureWithPretext.html
@@ -40,7 +40,7 @@ measures text in another, and Pretext keeps the widths it measured.
diff --git a/api/functions/macros.createMacros.html b/api/functions/macros.createMacros.html
index b37d19c92c..c7074eff53 100644
--- a/api/functions/macros.createMacros.html
+++ b/api/functions/macros.createMacros.html
@@ -47,7 +47,7 @@ by ThisDocument, the project, Project, or a library it uses, VBA, Word, stdole,
diff --git a/api/functions/math.latexToMath.html b/api/functions/math.latexToMath.html
index b05622a75f..aedb270c6a 100644
--- a/api/functions/math.latexToMath.html
+++ b/api/functions/math.latexToMath.html
@@ -44,7 +44,7 @@ cases and aligned equations, with \tag for their numbers. The math
diff --git a/api/interfaces/index.IXmlableObject.html b/api/interfaces/index.IXmlableObject.html
index 2945c46110..96df9c41f3 100644
--- a/api/interfaces/index.IXmlableObject.html
+++ b/api/interfaces/index.IXmlableObject.html
@@ -31,7 +31,7 @@ to generate the final XML output. Objects typically have a structure like:
diff --git a/api/modules/index.html b/api/modules/index.html
index b28498210d..e8720f7ed8 100644
--- a/api/modules/index.html
+++ b/api/modules/index.html
@@ -35,7 +35,7 @@ serves as the main entry point for creating Word documents.
diff --git a/api/types/bibliography.Source.html b/api/types/bibliography.Source.html
index f7b5e52d96..63fe7af11f 100644
--- a/api/types/bibliography.Source.html
+++ b/api/types/bibliography.Source.html
@@ -23,7 +23,7 @@ each field's description says which types of source Word asks for it with.
diff --git a/api/types/charts.BarChartBaseOptions.html b/api/types/charts.BarChartBaseOptions.html
index 26e55d8472..2562d949c1 100644
--- a/api/types/charts.BarChartBaseOptions.html
+++ b/api/types/charts.BarChartBaseOptions.html
@@ -31,7 +31,7 @@ Default is Office's: -27 for column charts and 0 for bar charts. Stacked bars al
@@ -49,14 +49,14 @@ bar, line or area chart spaces them by date
Sales. 2025: Jan 10, Feb 20.", and none for a decorative chart. An empty description removes it
+
diff --git a/api/types/charts.CategoryChartOptions.html b/api/types/charts.CategoryChartOptions.html
index 8b8c0e3df7..19dee7b886 100644
--- a/api/types/charts.CategoryChartOptions.html
+++ b/api/types/charts.CategoryChartOptions.html
@@ -59,7 +59,7 @@ in years, are labelled in rows, the groups below their categories
diff --git a/api/types/charts.ChartAxisCrossing.html b/api/types/charts.ChartAxisCrossing.html
index f11bd079ec..531b6a468d 100644
--- a/api/types/charts.ChartAxisCrossing.html
+++ b/api/types/charts.ChartAxisCrossing.html
@@ -20,7 +20,7 @@ the value is the category's number, from 1, or when the categories are dates, a
diff --git a/api/types/charts.ChartAxisGroup.html b/api/types/charts.ChartAxisGroup.html
index bfa5d37f2a..6ff62e064c 100644
--- a/api/types/charts.ChartAxisGroup.html
+++ b/api/types/charts.ChartAxisGroup.html
@@ -19,7 +19,7 @@ chart's are along the bottom and the top.
diff --git a/api/types/charts.ChartCategoryGroup.html b/api/types/charts.ChartCategoryGroup.html
index c909c3a91d..0424af73b0 100644
--- a/api/types/charts.ChartCategoryGroup.html
+++ b/api/types/charts.ChartCategoryGroup.html
@@ -20,7 +20,7 @@ categories, or groups of its own, such as the months of each quarter of each yea
@@ -67,21 +67,21 @@ a point, and where they fit best on a pie. A chart's position is for the series
another way keep Office's, unless their own labels give one
diff --git a/api/types/charts.ChartDataPatchOptions.html b/api/types/charts.ChartDataPatchOptions.html
index 76e67ead2b..1915acde1c 100644
--- a/api/types/charts.ChartDataPatchOptions.html
+++ b/api/types/charts.ChartDataPatchOptions.html
@@ -19,7 +19,7 @@ series' points, or for a stock chart its prices.
diff --git a/api/types/charts.ChartErrorBarsAmount.html b/api/types/charts.ChartErrorBarsAmount.html
index ff555053bf..2a25db236a 100644
--- a/api/types/charts.ChartErrorBarsAmount.html
+++ b/api/types/charts.ChartErrorBarsAmount.html
@@ -64,7 +64,7 @@ deviations, or the standard error.
diff --git a/api/types/charts.ChartLineDash.html b/api/types/charts.ChartLineDash.html
index 3ac972a389..fb8f4f9e77 100644
--- a/api/types/charts.ChartLineDash.html
+++ b/api/types/charts.ChartLineDash.html
@@ -19,7 +19,7 @@ and so on.
diff --git a/api/types/charts.ChartPointLabel.html b/api/types/charts.ChartPointLabel.html
index ff3cdbee81..fda6745871 100644
--- a/api/types/charts.ChartPointLabel.html
+++ b/api/types/charts.ChartPointLabel.html
@@ -19,7 +19,7 @@ format and its font. Anything left out is as the series' labels have it.
diff --git a/api/types/charts.ChartTrendline.html b/api/types/charts.ChartTrendline.html
index f13234a8ce..25be45f896 100644
--- a/api/types/charts.ChartTrendline.html
+++ b/api/types/charts.ChartTrendline.html
@@ -20,7 +20,7 @@ forecast. It is drawn as a dotted line in the series' colour, and has an entry i
@@ -57,7 +57,7 @@ forecast. It is drawn as a dotted line in the series' colour, and has an entry i
along the x axis. Default is 0. Not for moving averages
@@ -73,35 +73,35 @@ the x axis. Default is 0. Not for moving averages
linear, exponential and polynomial trendlines, and above 0 for exponential ones
+
diff --git a/api/types/charts.ChartValueAxis.html b/api/types/charts.ChartValueAxis.html
index 0919817509..53718a7f9e 100644
--- a/api/types/charts.ChartValueAxis.html
+++ b/api/types/charts.ChartValueAxis.html
@@ -43,7 +43,7 @@ of 0 or less can't be shown. Default is a linear scale
diff --git a/api/types/charts.ComboChartSeriesType.html b/api/types/charts.ComboChartSeriesType.html
index 75be15868f..1165fb2568 100644
--- a/api/types/charts.ComboChartSeriesType.html
+++ b/api/types/charts.ComboChartSeriesType.html
@@ -19,7 +19,7 @@ or an area. A chart with series of more than one type is Word's "Combo"
@@ -59,14 +59,14 @@ with undefined, takes the next of the theme's accent colours
one for each slice in the order of the categories, where undefined leaves a slice in. Default is 0
+
diff --git a/api/types/charts.SplitPieChartBaseOptions.html b/api/types/charts.SplitPieChartBaseOptions.html
index 52e8778426..b41b800f2b 100644
--- a/api/types/charts.SplitPieChartBaseOptions.html
+++ b/api/types/charts.SplitPieChartBaseOptions.html
@@ -42,7 +42,7 @@ second pie or a stacked bar, joined to the slice of the pie that stands for them
@@ -66,7 +66,7 @@ Excel, Word or PowerPoint, and any other file, such as a sound, a video or a PDF
for Windows opens with the application the computer opens its type with. A packaged file keeps the name
@@ -74,7 +74,7 @@ for Windows opens with the application the computer opens its type with. A packa
it until the file is opened and changed in its application, which then draws the file again
+
diff --git a/api/types/html.HtmlImage.html b/api/types/html.HtmlImage.html
index 600c16aea0..4b524db089 100644
--- a/api/types/html.HtmlImage.html
+++ b/api/types/html.HtmlImage.html
@@ -16,7 +16,7 @@
SVG given without one is shown as nothing there.
@@ -51,7 +51,7 @@ an object of each address and its image, or a function that gives the image for
has none. An address is looked for as it is written, and then resolved against baseUrl.
@@ -59,7 +59,7 @@ has none. An address is looked for as it is written, and then resolved against <
of a document with docx's default page size and margins. Wider images are scaled down.
@@ -68,14 +68,14 @@ the foot of the page each is referred to on, by default, or "endnotes
page has them. Word's own HTML says which of its notes are footnotes and which are endnotes, which they stay.
@@ -86,7 +86,7 @@ element give it different styles, the most specific selector's is used, as in CS
document, such as in its styles option or the template it patches.
+
@@ -94,7 +94,7 @@ document, such as in its styles option or the template it patches.<
editor it comes from. Rules in @media print blocks are used, and those in other @media blocks aren't.
+
@@ -103,7 +103,7 @@ of their datetime attribute, or this time, or now: an ISO 8601 date
2026-10-13T09:30:00Z. Without it, they are underlined and struck through, as a browser shows them.
+
diff --git a/api/types/index.AttributePayload.html b/api/types/index.AttributePayload.html
index ab365dc321..44e81f6bac 100644
--- a/api/types/index.AttributePayload.html
+++ b/api/types/index.AttributePayload.html
@@ -21,7 +21,7 @@ control over attribute name mapping.
diff --git a/api/types/index.DocumentMacroEvent.html b/api/types/index.DocumentMacroEvent.html
index 754a0ff32b..48e1c37626 100644
--- a/api/types/index.DocumentMacroEvent.html
+++ b/api/types/index.DocumentMacroEvent.html
@@ -19,7 +19,7 @@ name in VBA, after "Document_", such as "open" for Doc
Specifies the additional length, in EMUs, which shall be added to the bottom edge of the DrawingML object to determine its actual bottom edge including effects.
Specifies the additional length, in EMUs, which shall be added to the left edge of the DrawingML object to determine its actual left edge including effects.
Specifies the additional length, in EMUs, which shall be added to the right edge of the DrawingML object to determine its actual right edge including effects.
Specifies the additional length, in EMUs, which shall be added to the top edge of the DrawingML object to determine its actual top edge including effects.
@@ -63,14 +63,14 @@ name. The page references to a bookmark that isn't in it are left blank.
the first of them on may not be Word's. Nothing of them is written into the document.
+
@@ -88,7 +88,7 @@ those in headers, footers and notes.
in headers and footers only on its pages, show. Those of a section whose number is undefined are left blank.
+
diff --git a/api/types/index.GraphicMediaData.html b/api/types/index.GraphicMediaData.html
index 5af5614a9b..7e5c7172e4 100644
--- a/api/types/index.GraphicMediaData.html
+++ b/api/types/index.GraphicMediaData.html
@@ -25,7 +25,7 @@ graphic it is. This is how docx/shapes writes its shapes.
diff --git a/api/types/index.IContext.html b/api/types/index.IContext.html
index 998aaf3ad4..1fd8ef6a68 100644
--- a/api/types/index.IContext.html
+++ b/api/types/index.IContext.html
@@ -18,7 +18,7 @@ during the conversion of components to XML.
diff --git a/api/types/index.ICropOptions.html b/api/types/index.ICropOptions.html
index d9699e35dc..d1d2b991bf 100644
--- a/api/types/index.ICropOptions.html
+++ b/api/types/index.ICropOptions.html
@@ -19,7 +19,7 @@ side of the image.
The grid can define a grid which snaps all East Asian characters to grid positions, but leaves Latin text with its default spacing; a grid which adds the specified character pitch to each character on each row; or a grid which affects only the line pitch for the current section.
Specifies that the paragraph (or at least part of it) should be rendered on the same page as the next paragraph when possible. If multiple paragraphs are to be kept together but they exceed a page, then the set of paragraphs begin on a new page and page breaks are used thereafter as needed.
diff --git a/api/types/index.IRunOptions.html b/api/types/index.IRunOptions.html
index f00d920898..de04014646 100644
--- a/api/types/index.IRunOptions.html
+++ b/api/types/index.IRunOptions.html
@@ -21,7 +21,7 @@ The children property can contain various inline content elements.
diff --git a/api/types/index.IRunStylePropertiesOptions.html b/api/types/index.IRunStylePropertiesOptions.html
index 7e709000e1..0010bcd3c5 100644
--- a/api/types/index.IRunStylePropertiesOptions.html
+++ b/api/types/index.IRunStylePropertiesOptions.html
@@ -19,7 +19,7 @@ including font, size, bold, italic, underline, color, and other character format
@@ -159,87 +159,87 @@ other with the same group are fitted to it together.
highlights all the run's text. docx used to write it as w:highlightCs, which is in no schema.
+
@@ -248,34 +248,34 @@ as Word's style separator does. It is meant for a paragraph's mark, with v
new Paragraph({ run: { vanish: true, specVanish: true } }). Without vanish, Word doesn't hide the mark.
+
diff --git a/api/types/index.ITableCellBorders.html b/api/types/index.ITableCellBorders.html
index 692895e3da..89abd2f7a8 100644
--- a/api/types/index.ITableCellBorders.html
+++ b/api/types/index.ITableCellBorders.html
@@ -23,7 +23,7 @@ the two lines that cross the cell from corner to corner.
@@ -57,49 +57,49 @@ the two lines that cross the cell from corner to corner.
It splits a header cell into a label for its row, below the line, and one for its column, above it.
@@ -46,7 +46,7 @@ If relativeHorizontalPosition is also specified, then the absoluteHorizontalPosi
If the attribute is omitted, the value is assumed to be zero.
@@ -57,7 +57,7 @@ If relativeVerticalPosition is also specified, then the absoluteVerticalPosition
If the attribute is omitted, the value is assumed to be zero.
@@ -65,7 +65,7 @@ If the attribute is omitted, the value is assumed to be zero.
below the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -85,7 +85,7 @@ If omitted, the value is assumed to be page.
to the left of the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -125,7 +125,7 @@ across the column by relativeHorizontalPosition's left, center or right when the
The anchors, absolute positions, distances from the text and overlap are for a floating table, and aren't written.
+
@@ -133,7 +133,7 @@ The anchors, absolute positions, distances from the text and overlap are for a f
to the right of the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -141,7 +141,7 @@ to the right of the table. The value is in twentieths of a point. If omitted, th
above the table. The value is in twentieths of a point. If omitted, the value is assumed to be zero.
+
@@ -88,7 +88,7 @@ When true, horizontal banding (alternating row colors) is disabled.
When false or undefined, horizontal banding is enabled if defined in the table style.
+
@@ -97,7 +97,7 @@ When true, vertical banding (alternating column colors) is disabled.
When false or undefined, vertical banding is enabled if defined in the table style.
+
diff --git a/api/types/index.ITableOfContentsOptions.html b/api/types/index.ITableOfContentsOptions.html
index 147446bf76..8cc0cac9b7 100644
--- a/api/types/index.ITableOfContentsOptions.html
+++ b/api/types/index.ITableOfContentsOptions.html
@@ -23,7 +23,7 @@ Options correspond to field switches in the TOC field code.
@@ -59,7 +59,7 @@ The identifier designated by text in this switch's field-argument corresponds to
Use captionLabelIncludingNumbers (\c) to build a table of captions with labels and numbers.
@@ -85,7 +85,7 @@ the bookmark named by text in this switch's field-argument.
that separate an entry and its page number. The default is a tab with leader dots.
+
@@ -96,21 +96,21 @@ to the style with a style ID of HeadingX (e.g. 1 corresponds to Heading1).
If no heading range is specified, all heading levels used in the document are listed.
+
@@ -119,21 +119,21 @@ Page numbers are omitted from all levels unless a range of entry levels is speci
text in this switch's field-argument. A range is specified as for \l.
+
@@ -168,7 +168,7 @@ with each doublet being a comma-separated set of style name and table of content
text in this switch's field-argument (which is typically a letter).
+
@@ -178,14 +178,14 @@ where startLevel and endLevel are integers, and startLevel has a value equal-to
TC fields that assign entries to lower levels are skipped.
+
@@ -79,66 +79,66 @@ parent cell) when the document is packed, so the table renders the same in every
consumer. Supply explicit values to take full control of the grid.
+
diff --git a/api/types/index.ITableRowOptions.html b/api/types/index.ITableRowOptions.html
index 55ba056400..49a0f610cb 100644
--- a/api/types/index.ITableRowOptions.html
+++ b/api/types/index.ITableRowOptions.html
@@ -35,7 +35,7 @@ the group on one page.
diff --git a/api/types/index.IThemeColorsOptions.html b/api/types/index.IThemeColorsOptions.html
index 60a1f01ebf..6743c039df 100644
--- a/api/types/index.IThemeColorsOptions.html
+++ b/api/types/index.IThemeColorsOptions.html
@@ -21,7 +21,7 @@ when the theme's colors change. The colors not given are Office's.
The fonts for text in particular scripts, by the script's ISO 15924 code, such as { Jpan: "Meiryo", Arab: "Arial" }
+for Japanese and Arabic text. They take the place of Office's fonts for those scripts, and Office's fonts are kept
+for the others
diff --git a/api/types/index.IXmlAttribute.html b/api/types/index.IXmlAttribute.html
index 18ac8a77a4..12b9ebb4f2 100644
--- a/api/types/index.IXmlAttribute.html
+++ b/api/types/index.IXmlAttribute.html
@@ -17,7 +17,7 @@
numbers, or booleans, which will be converted to strings in the final XML.
diff --git a/api/types/index.ImagePatchOptions.html b/api/types/index.ImagePatchOptions.html
index 4f67a30b86..1f26d2b72b 100644
--- a/api/types/index.ImagePatchOptions.html
+++ b/api/types/index.ImagePatchOptions.html
@@ -35,7 +35,7 @@ it the template's proportions, or give a size with its own
diff --git a/api/types/index.InputDataType.html b/api/types/index.InputDataType.html
index 35413abac5..fbc686da47 100644
--- a/api/types/index.InputDataType.html
+++ b/api/types/index.InputDataType.html
@@ -17,7 +17,7 @@
arrays, and streams, such as fs.createReadStream's or Packer.toStream's.
diff --git a/api/types/index.MathRunStyle.html b/api/types/index.MathRunStyle.html
index 523f18469f..e079eab6b8 100644
--- a/api/types/index.MathRunStyle.html
+++ b/api/types/index.MathRunStyle.html
@@ -23,7 +23,7 @@
alphabet other than roman is plain unless given a style, as LaTeX draws its alphabets upright.
diff --git a/api/types/index.NoteContent.html b/api/types/index.NoteContent.html
index 20d34d0334..872a877c44 100644
--- a/api/types/index.NoteContent.html
+++ b/api/types/index.NoteContent.html
@@ -19,7 +19,7 @@ with an id none of them has, when the run is written in the document's body.
diff --git a/api/types/index.NumberingDefinition.html b/api/types/index.NumberingDefinition.html
index 83c193192b..601fe47b04 100644
--- a/api/types/index.NumberingDefinition.html
+++ b/api/types/index.NumberingDefinition.html
@@ -23,7 +23,7 @@ to the document's numbering when the paragraph is written.
diff --git a/api/types/index.OleObjectRelationshipType.html b/api/types/index.OleObjectRelationshipType.html
index 5318fa7c19..9cdf74b1e0 100644
--- a/api/types/index.OleObjectRelationshipType.html
+++ b/api/types/index.OleObjectRelationshipType.html
@@ -17,7 +17,7 @@ OLE package. It isn't one of the
diff --git a/api/types/index.OutputByType.html b/api/types/index.OutputByType.html
index fe9191f319..c807eddc4f 100644
--- a/api/types/index.OutputByType.html
+++ b/api/types/index.OutputByType.html
@@ -24,7 +24,7 @@ format determines the return type. Based on JSZip's output types.
diff --git a/api/types/index.PackagePartOptions.html b/api/types/index.PackagePartOptions.html
index af9faa9577..89dd214fca 100644
--- a/api/types/index.PackagePartOptions.html
+++ b/api/types/index.PackagePartOptions.html
@@ -23,7 +23,7 @@
docx/embedded-files embeds, gives it, so the options of a part made without it have a RelationshipType
diff --git a/api/types/index.PageNumberEstimator.html b/api/types/index.PageNumberEstimator.html
index a74ccd864e..6a7c78a7e0 100644
--- a/api/types/index.PageNumberEstimator.html
+++ b/api/types/index.PageNumberEstimator.html
@@ -48,7 +48,7 @@ whose number it didn't work out is left out, and the entry is written without a
diff --git a/api/types/index.ParagraphChild.html b/api/types/index.ParagraphChild.html
index c3d74d3933..d99d2436de 100644
--- a/api/types/index.ParagraphChild.html
+++ b/api/types/index.ParagraphChild.html
@@ -17,7 +17,7 @@ This union type represents all valid inline content elements that can appear
within a paragraph in WordprocessingML.
diff --git a/api/types/index.PatchDocumentProperties.html b/api/types/index.PatchDocumentProperties.html
index be4d11184e..683ecd62d6 100644
--- a/api/types/index.PatchDocumentProperties.html
+++ b/api/types/index.PatchDocumentProperties.html
@@ -16,7 +16,7 @@
as the document's tags and description as its comments.
diff --git a/api/types/index.RelationshipType.html b/api/types/index.RelationshipType.html
index 2494fe7f2c..2eace97654 100644
--- a/api/types/index.RelationshipType.html
+++ b/api/types/index.RelationshipType.html
@@ -17,7 +17,7 @@
Each type corresponds to a specific kind of document component or resource.
diff --git a/api/types/index.TableRowsPatch.html b/api/types/index.TableRowsPatch.html
index d0f4d6be11..c3ddef5172 100644
--- a/api/types/index.TableRowsPatch.html
+++ b/api/types/index.TableRowsPatch.html
@@ -32,7 +32,7 @@ none. The other patches are applied after the rows are repeated, so a placeholde
@@ -55,14 +55,14 @@ A field's patch can repeat rows of a table in the copy in turn, whose fields are
repeated for each part, with its item's fields, and an item without parts has no row
diff --git a/api/types/index.TemplatePageNumberEstimator.html b/api/types/index.TemplatePageNumberEstimator.html
index d70e1bfb0e..9e68be18f4 100644
--- a/api/types/index.TemplatePageNumberEstimator.html
+++ b/api/types/index.TemplatePageNumberEstimator.html
@@ -33,7 +33,7 @@ pages, are written with it.
Specifies the height of the containing block of the shape. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the left of the containing block of the shape relative to the element left of it in the flow of the page. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. This property shall not be used for shapes anchored inline.
Specifies the position of the bottom of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the left of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the right of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the position of the top of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the type of positioning used to place an element. Default is static. When the element is contained inside a group, this property must be absolute.
Specifies relative horizontal position data for objects in WordprocessingML documents. This modifies the mso-position-horizontal property. Default is text.
Specifies relative vertical position data for objects in WordprocessingML documents. This modifies the mso-position-vertical property. Default is text.
Specifies the position of the top of the containing block of the shape relative to the element above it in the flow of the page. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. This property shall not be used for shapes anchored inline.
Specifies the width of the containing block of the shape. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element.
Specifies the distance from the bottom of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies the distance from the left side of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies the distance from the right side of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies the distance from the top of the shape to the text that wraps around it. Default is 0 pt. Note that this property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.
Specifies whether the wrap coordinates were customized by the user. If the wrap coordinates are generated by an editor, this property is true; otherwise they were customized by a user. Default is false.
diff --git a/api/types/index.XmlElement.html b/api/types/index.XmlElement.html
index 8b40d2d8c6..6738649191 100644
--- a/api/types/index.XmlElement.html
+++ b/api/types/index.XmlElement.html
@@ -26,7 +26,7 @@ and the rest in instruction.
@@ -63,7 +63,7 @@ nearest to Word's lays it out. It still stops where it has no guess, such as at
is off, so the numbers written are Word's, as near as the layout knows, or blank.
+
@@ -73,7 +73,7 @@ break, and tabs move to their stops, as Word lays them out, and lines are as tal
width tables, so the layout stops at text in a font that isn't in them and isn't given as a file or embedded.
+
diff --git a/api/types/layout.MeasureWidth.html b/api/types/layout.MeasureWidth.html
index 2f7fe4748e..b583eb7a0c 100644
--- a/api/types/layout.MeasureWidth.html
+++ b/api/types/layout.MeasureWidth.html
@@ -33,7 +33,7 @@ between characters and the width of scaled text, which the document's formatting
diff --git a/api/types/shapes.ConnectorEnd.html b/api/types/shapes.ConnectorEnd.html
index 1b41532d70..7ea9f3af33 100644
--- a/api/types/shapes.ConnectorEnd.html
+++ b/api/types/shapes.ConnectorEnd.html
@@ -38,7 +38,7 @@ bottom-left corner. On a shape without connection points, the connector ends at
diff --git a/api/types/shapes.CustomShapeGeometry.html b/api/types/shapes.CustomShapeGeometry.html
index fc01296353..7489c500ff 100644
--- a/api/types/shapes.CustomShapeGeometry.html
+++ b/api/types/shapes.CustomShapeGeometry.html
@@ -50,7 +50,7 @@ fill the shape. Later paths are drawn over earlier ones
diff --git a/api/types/shapes.CustomShapePath.html b/api/types/shapes.CustomShapePath.html
index 158a06e97e..6a426b19c6 100644
--- a/api/types/shapes.CustomShapePath.html
+++ b/api/types/shapes.CustomShapePath.html
@@ -20,7 +20,7 @@ own, so paths can overlap without cutting holes in each other.
diff --git a/api/types/shapes.CustomShapePathFill.html b/api/types/shapes.CustomShapePathFill.html
index b871af7a50..97ed5aac31 100644
--- a/api/types/shapes.CustomShapePathFill.html
+++ b/api/types/shapes.CustomShapePathFill.html
@@ -19,7 +19,7 @@ fill made lighter or darker, as Word's preset shapes shade the top of a cube or
diff --git a/api/types/shapes.IShapeCanvasOptions.html b/api/types/shapes.IShapeCanvasOptions.html
index 3d68700cb6..401d5b5abd 100644
--- a/api/types/shapes.IShapeCanvasOptions.html
+++ b/api/types/shapes.IShapeCanvasOptions.html
@@ -64,7 +64,7 @@ The shapes are not scaled.
diff --git a/api/types/shapes.IShapeConnectorOptions.html b/api/types/shapes.IShapeConnectorOptions.html
index 0f6501b1c1..e41c86f8a3 100644
--- a/api/types/shapes.IShapeConnectorOptions.html
+++ b/api/types/shapes.IShapeConnectorOptions.html
@@ -23,7 +23,7 @@ or several connectors join the same two shapes, their ends are spread out along
@@ -64,21 +64,21 @@ or several connectors join the same two shapes, their ends are spread out along
shape, so Word doesn't move it when the connector moves
diff --git a/api/types/shapes.IShapeGroupChildOptions.html b/api/types/shapes.IShapeGroupChildOptions.html
index 7c6bd8e445..5811d6eeb7 100644
--- a/api/types/shapes.IShapeGroupChildOptions.html
+++ b/api/types/shapes.IShapeGroupChildOptions.html
@@ -20,7 +20,7 @@ in pixels, unless a layout places it, and id names it
diff --git a/api/types/shapes.IShapeGroupOptions.html b/api/types/shapes.IShapeGroupOptions.html
index 17b15811ba..b25091cd62 100644
--- a/api/types/shapes.IShapeGroupOptions.html
+++ b/api/types/shapes.IShapeGroupOptions.html
@@ -50,7 +50,7 @@ the box around the children. A different size scales every shape in the group.
diff --git a/api/types/shapes.IShapeNestedGroupOptions.html b/api/types/shapes.IShapeNestedGroupOptions.html
index 6a446fa44f..b8ad26c57b 100644
--- a/api/types/shapes.IShapeNestedGroupOptions.html
+++ b/api/types/shapes.IShapeNestedGroupOptions.html
@@ -47,7 +47,7 @@ box around the children, and a different size scales every child
diff --git a/api/types/shapes.IShapeOptions.html b/api/types/shapes.IShapeOptions.html
index 6331d1b024..e2b364d72a 100644
--- a/api/types/shapes.IShapeOptions.html
+++ b/api/types/shapes.IShapeOptions.html
@@ -23,7 +23,7 @@ or startAngle and endAngle for a "pie"
diff --git a/api/types/shapes.PresetShapeAdjustments.html b/api/types/shapes.PresetShapeAdjustments.html
index d508ba2027..6d66e4bcfe 100644
--- a/api/types/shapes.PresetShapeAdjustments.html
+++ b/api/types/shapes.PresetShapeAdjustments.html
@@ -21,7 +21,7 @@ allows, so a value that is too large acts like the largest allowed value.
diff --git a/api/types/shapes.ShapeAdjustments.html b/api/types/shapes.ShapeAdjustments.html
index 4c2b51883d..97e9f6d9cb 100644
--- a/api/types/shapes.ShapeAdjustments.html
+++ b/api/types/shapes.ShapeAdjustments.html
@@ -23,7 +23,7 @@ It is never for shapes without handles, which take no adjustments.<
diff --git a/api/types/shapes.ShapeFlowLayout.html b/api/types/shapes.ShapeFlowLayout.html
index e1faeb0df4..139202e0ab 100644
--- a/api/types/shapes.ShapeFlowLayout.html
+++ b/api/types/shapes.ShapeFlowLayout.html
@@ -20,7 +20,7 @@ that connect to it, and the shapes on each level are ordered so connectors cross
@@ -52,26 +52,26 @@ with a lane goes in the band of that name, and shapes without one g
across the direction the flow runs in, each with a header at the start of the flow
diff --git a/api/types/shapes.ShapeHorizontalPosition.html b/api/types/shapes.ShapeHorizontalPosition.html
index d908cb1a09..fe6cecf1c4 100644
--- a/api/types/shapes.ShapeHorizontalPosition.html
+++ b/api/types/shapes.ShapeHorizontalPosition.html
@@ -26,7 +26,7 @@ a base of the page, the space between its margins, or one of its margins
diff --git a/api/types/shapes.ShapeLayout.html b/api/types/shapes.ShapeLayout.html
index bc26333475..37d627f62a 100644
--- a/api/types/shapes.ShapeLayout.html
+++ b/api/types/shapes.ShapeLayout.html
@@ -20,7 +20,7 @@ layout, which is placed around them. Connectors are routed after the shapes are
diff --git a/api/types/shapes.ShapeSize.html b/api/types/shapes.ShapeSize.html
index e7d7e466e7..d0b56460fb 100644
--- a/api/types/shapes.ShapeSize.html
+++ b/api/types/shapes.ShapeSize.html
@@ -19,7 +19,7 @@ percentage of the space between the page's margins, or of what floating.si
diff --git a/api/types/shapes.ShapeTextWarp.html b/api/types/shapes.ShapeTextWarp.html
index c20f730897..18f5bc7461 100644
--- a/api/types/shapes.ShapeTextWarp.html
+++ b/api/types/shapes.ShapeTextWarp.html
@@ -19,7 +19,7 @@ The ...Filled arches, circle and button spread the text over the wh
diff --git a/api/types/shapes.ShapeThemeColor.html b/api/types/shapes.ShapeThemeColor.html
index 11f1e6be5d..6015994314 100644
--- a/api/types/shapes.ShapeThemeColor.html
+++ b/api/types/shapes.ShapeThemeColor.html
@@ -20,7 +20,7 @@ same as docx's ThemeColor, which text, borders and sha
diff --git a/api/types/shapes.ShapeTransformation.html b/api/types/shapes.ShapeTransformation.html
index 3b02df6fbc..9cf5e27bd4 100644
--- a/api/types/shapes.ShapeTransformation.html
+++ b/api/types/shapes.ShapeTransformation.html
@@ -30,7 +30,7 @@ between the margins for a floating shape, such as "100%"<
diff --git a/api/types/shapes.ShapeTreeLayout.html b/api/types/shapes.ShapeTreeLayout.html
index 86dfe69d23..987703a47b 100644
--- a/api/types/shapes.ShapeTreeLayout.html
+++ b/api/types/shapes.ShapeTreeLayout.html
@@ -20,7 +20,7 @@ children are placed side by side below their parent, which is centred over them.
diff --git a/api/types/shapes.ShapeVerticalPosition.html b/api/types/shapes.ShapeVerticalPosition.html
index 6819795ed8..9be983ea5c 100644
--- a/api/types/shapes.ShapeVerticalPosition.html
+++ b/api/types/shapes.ShapeVerticalPosition.html
@@ -26,7 +26,7 @@ a base of the page, the space between its margins, or one of its margins
diff --git a/api/variables/bibliography.CitationStyle.html b/api/variables/bibliography.CitationStyle.html
index aa386d691a..fd1eaa94b6 100644
--- a/api/variables/bibliography.CitationStyle.html
+++ b/api/variables/bibliography.CitationStyle.html
@@ -70,7 +70,7 @@ citation of a book by Anna Baker from 2010 is in its description.
diff --git a/api/variables/bibliography.SourceType.html b/api/variables/bibliography.SourceType.html
index cb39e7db5f..70b18f9f8e 100644
--- a/api/variables/bibliography.SourceType.html
+++ b/api/variables/bibliography.SourceType.html
@@ -90,7 +90,7 @@ source can have any field. Word's own name for each, as it writes it in the docu
diff --git a/api/variables/index.CharacterSet.html b/api/variables/index.CharacterSet.html
index 419161b3fd..b84373b93e 100644
--- a/api/variables/index.CharacterSet.html
+++ b/api/variables/index.CharacterSet.html
@@ -60,7 +60,7 @@ Maps character set names to their hexadecimal identifiers.
diff --git a/api/variables/index.DocumentAttributeNamespaces.html b/api/variables/index.DocumentAttributeNamespaces.html
index 212eabf9e4..33a61e6ef1 100644
--- a/api/variables/index.DocumentAttributeNamespaces.html
+++ b/api/variables/index.DocumentAttributeNamespaces.html
@@ -94,7 +94,7 @@ in a document, including WordprocessingML, DrawingML, VML, and others.
When this value is set, the input specified via the user interface may be restricted to the number of lines per page and characters per line, with the consumer or producer translating this information based on the current font data to get the resulting line and character pitch values
diff --git a/api/variables/index.DropCapType.html b/api/variables/index.DropCapType.html
index 8229103670..99732242d3 100644
--- a/api/variables/index.DropCapType.html
+++ b/api/variables/index.DropCapType.html
@@ -32,7 +32,7 @@ beginning of a paragraph. This enum defines how the drop cap should be positione
diff --git a/api/variables/index.EMPTY_OBJECT.html b/api/variables/index.EMPTY_OBJECT.html
index 9528782b44..da3d29004b 100644
--- a/api/variables/index.EMPTY_OBJECT.html
+++ b/api/variables/index.EMPTY_OBJECT.html
@@ -20,7 +20,7 @@ has no children or attributes.
diff --git a/api/variables/index.EmphasisMarkType.html b/api/variables/index.EmphasisMarkType.html
index 58e265032f..652e8887fc 100644
--- a/api/variables/index.EmphasisMarkType.html
+++ b/api/variables/index.EmphasisMarkType.html
@@ -31,7 +31,7 @@ Emphasis marks are commonly used in East Asian typography.
Specifies that this header or footer shall appear on the first page in this section. The appearance of this header or footer is contingent on the setting of the titlePg element (§2.10.6).
diff --git a/api/variables/index.LevelFormat.html b/api/variables/index.LevelFormat.html
index 7e02a00763..138346d797 100644
--- a/api/variables/index.LevelFormat.html
+++ b/api/variables/index.LevelFormat.html
@@ -281,7 +281,7 @@ decimal, roman numerals, letters, and various international formats.
diff --git a/api/variables/index.PageTextDirectionType.html b/api/variables/index.PageTextDirectionType.html
index b136817f36..5348943ebe 100644
--- a/api/variables/index.PageTextDirectionType.html
+++ b/api/variables/index.PageTextDirectionType.html
@@ -28,7 +28,7 @@ vertically (top-to-bottom), commonly used for East Asian languages.
Top-to-bottom, right-to-left (vertical East Asian text flow)
diff --git a/api/variables/index.RelativeVerticalPosition.html b/api/variables/index.RelativeVerticalPosition.html
index 6a7a09fc28..1fef3e5dd8 100644
--- a/api/variables/index.RelativeVerticalPosition.html
+++ b/api/variables/index.RelativeVerticalPosition.html
@@ -33,7 +33,7 @@ paragraph after it, with text beside it, so the table is written in line with th
diff --git a/api/variables/index.ShadingType.html b/api/variables/index.ShadingType.html
index fc754e842c..ca963003f5 100644
--- a/api/variables/index.ShadingType.html
+++ b/api/variables/index.ShadingType.html
@@ -103,7 +103,7 @@ color and the pattern color.
diff --git a/api/variables/index.TextEffect.html b/api/variables/index.TextEffect.html
index 6a4f68b850..b487826490 100644
--- a/api/variables/index.TextEffect.html
+++ b/api/variables/index.TextEffect.html
@@ -56,7 +56,7 @@ these effects are deprecated and may not be supported by all applications.
diff --git a/api/variables/index.VerticalAlign.html b/api/variables/index.VerticalAlign.html
index ac1fc0f8f2..627eaa3cb3 100644
--- a/api/variables/index.VerticalAlign.html
+++ b/api/variables/index.VerticalAlign.html
@@ -32,7 +32,7 @@ backward-compatibility and will be removed in the next major release.
diff --git a/api/variables/index.VerticalAlignTable.html b/api/variables/index.VerticalAlignTable.html
index ac7b2d6735..5a979a086f 100644
--- a/api/variables/index.VerticalAlignTable.html
+++ b/api/variables/index.VerticalAlignTable.html
@@ -28,7 +28,7 @@ are valid according to ECMA-376 (§17.18.87 ST_VerticalJc within <w:tcP
diff --git a/api/variables/index.VerticalMergeType.html b/api/variables/index.VerticalMergeType.html
index 42e92e5d95..6f9cc30fb2 100644
--- a/api/variables/index.VerticalMergeType.html
+++ b/api/variables/index.VerticalMergeType.html
@@ -29,7 +29,7 @@ This cell continues a vertical merge started by a cell above it.
This cell begins a new vertical merge region.
diff --git a/api/variables/index.bookmarkUniqueNumericId.html b/api/variables/index.bookmarkUniqueNumericId.html
index 76984a88c7..6d377ab131 100644
--- a/api/variables/index.bookmarkUniqueNumericId.html
+++ b/api/variables/index.bookmarkUniqueNumericId.html
@@ -27,7 +27,7 @@ than a generator per instance.
diff --git a/api/variables/index.docPropertiesUniqueNumericId.html b/api/variables/index.docPropertiesUniqueNumericId.html
index 516fb785ac..83762e99cd 100644
--- a/api/variables/index.docPropertiesUniqueNumericId.html
+++ b/api/variables/index.docPropertiesUniqueNumericId.html
@@ -28,7 +28,7 @@ one counter rather than a generator per instance.
diff --git a/api/variables/index.fitTextUniqueNumericId.html b/api/variables/index.fitTextUniqueNumericId.html
index 8b48483e1e..a5a850e637 100644
--- a/api/variables/index.fitTextUniqueNumericId.html
+++ b/api/variables/index.fitTextUniqueNumericId.html
@@ -27,7 +27,7 @@ don't meet the groups people give, which count up.
diff --git a/api/variables/layout.estimatePageNumbers.html b/api/variables/layout.estimatePageNumbers.html
index 3721820c77..cea284c66f 100644
--- a/api/variables/layout.estimatePageNumbers.html
+++ b/api/variables/layout.estimatePageNumbers.html
@@ -52,7 +52,7 @@ to a tab stop past it, as Word writes it (listNumbers).
diff --git a/live-examples/lib/index.d.ts b/live-examples/lib/index.d.ts
index 1e96492f8f..f5599d6950 100644
--- a/live-examples/lib/index.d.ts
+++ b/live-examples/lib/index.d.ts
@@ -8563,6 +8563,12 @@ export declare type IThemeFontOptions = {
readonly eastAsia?: string;
/** The font for complex scripts, such as Arabic and Hebrew. By default Word picks a font for each script */
readonly complexScript?: string;
+ /**
+ * The fonts for text in particular scripts, by the script's ISO 15924 code, such as `{ Jpan: "Meiryo", Arab: "Arial" }`
+ * for Japanese and Arabic text. They take the place of Office's fonts for those scripts, and Office's fonts are kept
+ * for the others
+ */
+ readonly scripts?: Readonly>;
};
/**
@@ -12049,6 +12055,41 @@ export declare const PrettifyType: {
readonly WITH_TAB: "\t";
};
+/**
+ * Reads a theme, such as the theme of a Word document or template, as the options of a document's `theme`. The new
+ * document then has the theme's colors and fonts, so the styles, tables and text that use them look as they do in the
+ * file the theme came from:
+ *
+ * - its name;
+ * - its colors, each an RGB color or a system color's last value;
+ * - its fonts for headings and body text, with their fonts for East Asian text, complex scripts and each other script.
+ *
+ * The fills, lines and effects of shapes styled by the theme are Office's in the new document, as `docx` writes them.
+ *
+ * It reads the colors or fonts Word saves on their own too, from Design > Colors > Customize Colors or Design > Fonts >
+ * Customize Fonts, as the theme's `colors` or `fonts`.
+ *
+ * @param data - A Word document or template (.docx, .docm, .dotx or .dotm), a PowerPoint presentation (.pptx), an Excel
+ * workbook (.xlsx), an Office theme (.thmx), or the XML of a theme, such as a document's word/theme/theme1.xml, or of a
+ * theme's colors or fonts, as text or bytes
+ * @returns The theme's options, to give `Document`'s `theme`, or to change before giving it
+ * @throws If the data isn't one of those, or the file has no theme
+ *
+ * @example
+ * ```typescript
+ * import * as fs from "fs";
+ * import { Document, readTheme } from "docx";
+ *
+ * // The template's styles, and its theme, whose colors and fonts its styles use
+ * const doc = new Document({
+ * theme: readTheme(fs.readFileSync("template.dotx")),
+ * externalStyles: fs.readFileSync("styles.xml", "utf-8"),
+ * sections: [],
+ * });
+ * ```
+ */
+export declare const readTheme: (data: string | Uint8Array | ArrayBuffer) => IThemeOptions;
+
/**
* The data of images, for `ImageRun` and the patcher's `ImagePatch`: their formats, read from their bytes when not given,
* and their bytes, from a data URI.
diff --git a/live-examples/lib/index.iife.js b/live-examples/lib/index.iife.js
index b2051d157f..cbba2bbd3c 100644
--- a/live-examples/lib/index.iife.js
+++ b/live-examples/lib/index.iife.js
@@ -22714,9 +22714,21 @@ MAX: 9026 };
const latin = typeof font === "string" ? font : font === null || font === void 0 ? void 0 : font.latin;
return latin !== null && latin !== void 0 ? latin : OFFICE_FONTS[use].latin;
};
+ /**
+ * The font for each script of one of a theme's fonts: Office's, in Office's order, with those given in their place, and
+ * then the scripts Office has no font for, in the order given.
+ */
+ var themeScriptFonts = (use, scripts = {}) => {
+ const office = OFFICE_SCRIPT_FONTS.map(([script, headings, body = headings]) => {
+ var _scripts$script;
+ return [script, (_scripts$script = scripts[script]) !== null && _scripts$script !== void 0 ? _scripts$script : use === "headings" ? headings : body];
+ });
+ const officeScripts = new Set(office.map(([script]) => script));
+ return [...office, ...Object.entries(scripts).filter(([script]) => !officeScripts.has(script))];
+ };
var createFontCollection = (use, fonts) => {
const font = fonts[use];
- const { eastAsia = "", complexScript = "" } = typeof font === "object" ? font : {};
+ const { eastAsia = "", complexScript = "", scripts } = typeof font === "object" ? font : {};
const latin = themeLatinFont(use, fonts);
const office = OFFICE_FONTS[use];
return new BuilderElement({
@@ -22725,7 +22737,7 @@ MAX: 9026 };
createTextFont("a:latin", latin, latin === office.latin ? office.panose : void 0),
createTextFont("a:ea", eastAsia),
createTextFont("a:cs", complexScript),
- ...OFFICE_SCRIPT_FONTS.map(([script, headings, body = headings]) => new BuilderElement({
+ ...themeScriptFonts(use, scripts).map(([script, typeface]) => new BuilderElement({
name: "a:font",
attributes: {
script: {
@@ -22734,7 +22746,7 @@ MAX: 9026 };
},
typeface: {
key: "typeface",
- value: use === "headings" ? headings : body
+ value: typeface
}
}
}))
@@ -23118,6 +23130,1246 @@ MAX: 9026 };
}
};
//#endregion
+ //#region src/util/package-paths.ts
+ /**
+ * The paths of a package's parts, such as word/document.xml in a .docx file, and the targets of the relationships
+ * between them.
+ *
+ * @module
+ */
+ /**
+ * The path of a part's relationships part, such as word/_rels/document.xml.rels for word/document.xml.
+ */
+ var relationshipsPathOf = (path) => {
+ const slash = path.lastIndexOf("/");
+ return `${path.slice(0, slash + 1)}_rels/${path.slice(slash + 1)}.rels`;
+ };
+ /**
+ * The part a relationships part belongs to, or "" for the package's own (_rels/.rels), whose targets are from its root.
+ */
+ var sourceOfRelationships = (path) => path.replace(/(^|\/)_rels\/([^/]*)\.rels$/, "$1$2");
+ var folderOf = (path) => path.slice(0, path.lastIndexOf("/") + 1);
+ /**
+ * The path of the part a relationship's target refers to: relative to the folder of the part the relationship belongs
+ * to, or from the package's root if it starts with "/". Backslashes, which some applications write, are read as slashes.
+ *
+ * @param from - The path of the part the relationship belongs to
+ */
+ var resolveTarget = (from, target) => {
+ const normalized = target.replace(/\\/g, "/");
+ return (normalized.startsWith("/") ? normalized : `${folderOf(from)}${normalized}`).split("/").reduce((segments, segment) => {
+ if (segment === "" || segment === ".") return segments;
+ return segment === ".." ? segments.slice(0, -1) : [...segments, segment];
+ }, []).join("/");
+ };
+ /**
+ * A relationship's target for a part, relative to the folder of the part the relationship belongs to, such as
+ * "../embeddings/Microsoft_Excel_Worksheet1.xlsx" from word/charts/chart1.xml.
+ *
+ * @param from - The path of the part the relationship belongs to
+ * @param to - The path of the part it refers to
+ */
+ var relativeTarget = (from, to) => {
+ const folders = folderOf(from).split("/").filter(Boolean);
+ const segments = to.split("/");
+ const common = folders.findIndex((folder, index) => index >= segments.length - 1 || segments[index] !== folder);
+ const shared = common === -1 ? folders.length : common;
+ return [...folders.slice(shared).map(() => ".."), ...segments.slice(shared)].join("/");
+ };
+ /**
+ * Whether two paths are the same part's. Part names are compared without regard to case, as the Open Packaging
+ * Conventions compare them, so a relationship's target such as "Theme/THEME1.xml" from word/document.xml names
+ * word/theme/theme1.xml.
+ */
+ var isSamePart = (path, other) => path.toLowerCase() === other.toLowerCase();
+ //#endregion
+ //#region node_modules/fflate/esm/browser.js
+ var u8 = Uint8Array;
+ var u16 = Uint16Array;
+ var i32 = Int32Array;
+ var fleb = new u8([
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 5,
+ 0,
+ 0,
+ 0,
+ 0
+ ]);
+ var fdeb = new u8([
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 1,
+ 2,
+ 2,
+ 3,
+ 3,
+ 4,
+ 4,
+ 5,
+ 5,
+ 6,
+ 6,
+ 7,
+ 7,
+ 8,
+ 8,
+ 9,
+ 9,
+ 10,
+ 10,
+ 11,
+ 11,
+ 12,
+ 12,
+ 13,
+ 13,
+ 0,
+ 0
+ ]);
+ var clim = new u8([
+ 16,
+ 17,
+ 18,
+ 0,
+ 8,
+ 7,
+ 9,
+ 6,
+ 10,
+ 5,
+ 11,
+ 4,
+ 12,
+ 3,
+ 13,
+ 2,
+ 14,
+ 1,
+ 15
+ ]);
+ var freb = function(eb, start) {
+ var b = new u16(31);
+ for (var i = 0; i < 31; ++i) b[i] = start += 1 << eb[i - 1];
+ var r = new i32(b[30]);
+ for (var i = 1; i < 30; ++i) for (var j = b[i]; j < b[i + 1]; ++j) r[j] = j - b[i] << 5 | i;
+ return {
+ b,
+ r
+ };
+ };
+ var _a = freb(fleb, 2);
+ var fl = _a.b;
+ var revfl = _a.r;
+ fl[28] = 258, revfl[258] = 28;
+ var _b = freb(fdeb, 0);
+ var fd = _b.b;
+ var revfd = _b.r;
+ var rev = new u16(32768);
+ for (var i = 0; i < 32768; ++i) {
+ var x = (i & 43690) >> 1 | (i & 21845) << 1;
+ x = (x & 52428) >> 2 | (x & 13107) << 2;
+ x = (x & 61680) >> 4 | (x & 3855) << 4;
+ rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
+ }
+ var hMap = (function(cd, mb, r) {
+ var s = cd.length;
+ var i = 0;
+ var l = new u16(mb);
+ for (; i < s; ++i) if (cd[i]) ++l[cd[i] - 1];
+ var le = new u16(mb);
+ for (i = 1; i < mb; ++i) le[i] = le[i - 1] + l[i - 1] << 1;
+ var co;
+ if (r) {
+ co = new u16(1 << mb);
+ var rvb = 15 - mb;
+ for (i = 0; i < s; ++i) if (cd[i]) {
+ var sv = i << 4 | cd[i];
+ var r_1 = mb - cd[i];
+ var v = le[cd[i] - 1]++ << r_1;
+ for (var m = v | (1 << r_1) - 1; v <= m; ++v) co[rev[v] >> rvb] = sv;
+ }
+ } else {
+ co = new u16(s);
+ for (i = 0; i < s; ++i) if (cd[i]) co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
+ }
+ return co;
+ });
+ var flt = new u8(288);
+ for (var i = 0; i < 144; ++i) flt[i] = 8;
+ for (var i = 144; i < 256; ++i) flt[i] = 9;
+ for (var i = 256; i < 280; ++i) flt[i] = 7;
+ for (var i = 280; i < 288; ++i) flt[i] = 8;
+ var fdt = new u8(32);
+ for (var i = 0; i < 32; ++i) fdt[i] = 5;
+ var flm = /*#__PURE__*/ hMap(flt, 9, 0);
+ var flrm = /*#__PURE__*/ hMap(flt, 9, 1);
+ var fdm = /*#__PURE__*/ hMap(fdt, 5, 0);
+ var fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);
+ var max = function(a) {
+ var m = a[0];
+ for (var i = 1; i < a.length; ++i) if (a[i] > m) m = a[i];
+ return m;
+ };
+ var bits = function(d, p, m) {
+ var o = p / 8 | 0;
+ return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
+ };
+ var bits16 = function(d, p) {
+ var o = p / 8 | 0;
+ return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
+ };
+ var shft = function(p) {
+ return (p + 7) / 8 | 0;
+ };
+ var slc = function(v, s, e) {
+ if (s == null || s < 0) s = 0;
+ if (e == null || e > v.length) e = v.length;
+ return new u8(v.subarray(s, e));
+ };
+ var ec = [
+ "unexpected EOF",
+ "invalid block type",
+ "invalid length/literal",
+ "invalid distance",
+ "stream finished",
+ "no stream handler",
+ ,
+ "no callback",
+ "invalid UTF-8 data",
+ "extra field too long",
+ "date not in range 1980-2099",
+ "filename too long",
+ "stream finishing",
+ "invalid zip data"
+ ];
+ var err = function(ind, msg, nt) {
+ var e = new Error(msg || ec[ind]);
+ e.code = ind;
+ if (Error.captureStackTrace) Error.captureStackTrace(e, err);
+ if (!nt) throw e;
+ return e;
+ };
+ var inflt = function(dat, st, buf, dict) {
+ var sl = dat.length, dl = dict ? dict.length : 0;
+ if (!sl || st.f && !st.l) return buf || new u8(0);
+ var noBuf = !buf;
+ var resize = noBuf || st.i != 2;
+ var noSt = st.i;
+ if (noBuf) buf = new u8(sl * 3);
+ var cbuf = function(l) {
+ var bl = buf.length;
+ if (l > bl) {
+ var nbuf = new u8(Math.max(bl * 2, l));
+ nbuf.set(buf);
+ buf = nbuf;
+ }
+ };
+ var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
+ var tbts = sl * 8;
+ do {
+ if (!lm) {
+ final = bits(dat, pos, 1);
+ var type = bits(dat, pos + 1, 3);
+ pos += 3;
+ if (!type) {
+ var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
+ if (t > sl) {
+ if (noSt) err(0);
+ break;
+ }
+ if (resize) cbuf(bt + l);
+ buf.set(dat.subarray(s, t), bt);
+ st.b = bt += l, st.p = pos = t * 8, st.f = final;
+ continue;
+ } else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
+ else if (type == 2) {
+ var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
+ var tl = hLit + bits(dat, pos + 5, 31) + 1;
+ pos += 14;
+ var ldt = new u8(tl);
+ var clt = new u8(19);
+ for (var i = 0; i < hcLen; ++i) clt[clim[i]] = bits(dat, pos + i * 3, 7);
+ pos += hcLen * 3;
+ var clb = max(clt), clbmsk = (1 << clb) - 1;
+ var clm = hMap(clt, clb, 1);
+ for (var i = 0; i < tl;) {
+ var r = clm[bits(dat, pos, clbmsk)];
+ pos += r & 15;
+ var s = r >> 4;
+ if (s < 16) ldt[i++] = s;
+ else {
+ var c = 0, n = 0;
+ if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
+ else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3;
+ else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7;
+ while (n--) ldt[i++] = c;
+ }
+ }
+ var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
+ lbt = max(lt);
+ dbt = max(dt);
+ lm = hMap(lt, lbt, 1);
+ dm = hMap(dt, dbt, 1);
+ } else err(1);
+ if (pos > tbts) {
+ if (noSt) err(0);
+ break;
+ }
+ }
+ if (resize) cbuf(bt + 131072);
+ var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
+ var lpos = pos;
+ for (;; lpos = pos) {
+ var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
+ pos += c & 15;
+ if (pos > tbts) {
+ if (noSt) err(0);
+ break;
+ }
+ if (!c) err(2);
+ if (sym < 256) buf[bt++] = sym;
+ else if (sym == 256) {
+ lpos = pos, lm = null;
+ break;
+ } else {
+ var add = sym - 254;
+ if (sym > 264) {
+ var i = sym - 257, b = fleb[i];
+ add = bits(dat, pos, (1 << b) - 1) + fl[i];
+ pos += b;
+ }
+ var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
+ if (!d) err(3);
+ pos += d & 15;
+ var dt = fd[dsym];
+ if (dsym > 3) {
+ var b = fdeb[dsym];
+ dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
+ }
+ if (pos > tbts) {
+ if (noSt) err(0);
+ break;
+ }
+ if (resize) cbuf(bt + 131072);
+ var end = bt + add;
+ if (bt < dt) {
+ var shift = dl - dt, dend = Math.min(dt, end);
+ if (shift + bt < 0) err(3);
+ for (; bt < dend; ++bt) buf[bt] = dict[shift + bt];
+ }
+ for (; bt < end; ++bt) buf[bt] = buf[bt - dt];
+ }
+ }
+ st.l = lm, st.p = lpos, st.b = bt, st.f = final;
+ if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
+ } while (!final);
+ return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
+ };
+ var wbits = function(d, p, v) {
+ v <<= p & 7;
+ var o = p / 8 | 0;
+ d[o] |= v;
+ d[o + 1] |= v >> 8;
+ };
+ var wbits16 = function(d, p, v) {
+ v <<= p & 7;
+ var o = p / 8 | 0;
+ d[o] |= v;
+ d[o + 1] |= v >> 8;
+ d[o + 2] |= v >> 16;
+ };
+ var hTree = function(d, mb) {
+ var t = [];
+ for (var i = 0; i < d.length; ++i) if (d[i]) t.push({
+ s: i,
+ f: d[i]
+ });
+ var s = t.length;
+ var t2 = t.slice();
+ if (!s) return {
+ t: et,
+ l: 0
+ };
+ if (s == 1) {
+ var v = new u8(t[0].s + 1);
+ v[t[0].s] = 1;
+ return {
+ t: v,
+ l: 1
+ };
+ }
+ t.sort(function(a, b) {
+ return a.f - b.f;
+ });
+ t.push({
+ s: -1,
+ f: 25001
+ });
+ var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;
+ t[0] = {
+ s: -1,
+ f: l.f + r.f,
+ l,
+ r
+ };
+ while (i1 != s - 1) {
+ l = t[t[i0].f < t[i2].f ? i0++ : i2++];
+ r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];
+ t[i1++] = {
+ s: -1,
+ f: l.f + r.f,
+ l,
+ r
+ };
+ }
+ var maxSym = t2[0].s;
+ for (var i = 1; i < s; ++i) if (t2[i].s > maxSym) maxSym = t2[i].s;
+ var tr = new u16(maxSym + 1);
+ var mbt = ln(t[i1 - 1], tr, 0);
+ if (mbt > mb) {
+ var i = 0, dt = 0;
+ var lft = mbt - mb, cst = 1 << lft;
+ t2.sort(function(a, b) {
+ return tr[b.s] - tr[a.s] || a.f - b.f;
+ });
+ for (; i < s; ++i) {
+ var i2_1 = t2[i].s;
+ if (tr[i2_1] > mb) {
+ dt += cst - (1 << mbt - tr[i2_1]);
+ tr[i2_1] = mb;
+ } else break;
+ }
+ dt >>= lft;
+ while (dt > 0) {
+ var i2_2 = t2[i].s;
+ if (tr[i2_2] < mb) dt -= 1 << mb - tr[i2_2]++ - 1;
+ else ++i;
+ }
+ for (; i >= 0 && dt; --i) {
+ var i2_3 = t2[i].s;
+ if (tr[i2_3] == mb) {
+ --tr[i2_3];
+ ++dt;
+ }
+ }
+ mbt = mb;
+ }
+ return {
+ t: new u8(tr),
+ l: mbt
+ };
+ };
+ var ln = function(n, l, d) {
+ return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
+ };
+ var lc = function(c) {
+ var s = c.length;
+ while (s && !c[--s]);
+ var cl = new u16(++s);
+ var cli = 0, cln = c[0], cls = 1;
+ var w = function(v) {
+ cl[cli++] = v;
+ };
+ for (var i = 1; i <= s; ++i) if (c[i] == cln && i != s) ++cls;
+ else {
+ if (!cln && cls > 2) {
+ for (; cls > 138; cls -= 138) w(32754);
+ if (cls > 2) {
+ w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
+ cls = 0;
+ }
+ } else if (cls > 3) {
+ w(cln), --cls;
+ for (; cls > 6; cls -= 6) w(8304);
+ if (cls > 2) w(cls - 3 << 5 | 8208), cls = 0;
+ }
+ while (cls--) w(cln);
+ cls = 1;
+ cln = c[i];
+ }
+ return {
+ c: cl.subarray(0, cli),
+ n: s
+ };
+ };
+ var clen = function(cf, cl) {
+ var l = 0;
+ for (var i = 0; i < cl.length; ++i) l += cf[i] * cl[i];
+ return l;
+ };
+ var wfblk = function(out, pos, dat) {
+ var s = dat.length;
+ var o = shft(pos + 2);
+ out[o] = s & 255;
+ out[o + 1] = s >> 8;
+ out[o + 2] = out[o] ^ 255;
+ out[o + 3] = out[o + 1] ^ 255;
+ for (var i = 0; i < s; ++i) out[o + i + 4] = dat[i];
+ return (o + 4 + s) * 8;
+ };
+ var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
+ wbits(out, p++, final);
+ ++lf[256];
+ var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;
+ var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;
+ var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
+ var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
+ var lcfreq = new u16(19);
+ for (var i = 0; i < lclt.length; ++i) ++lcfreq[lclt[i] & 31];
+ for (var i = 0; i < lcdt.length; ++i) ++lcfreq[lcdt[i] & 31];
+ var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
+ var nlcc = 19;
+ for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc);
+ var flen = bl + 5 << 3;
+ var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
+ var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
+ if (bs >= 0 && flen <= ftlen && flen <= dtlen) return wfblk(out, p, dat.subarray(bs, bs + bl));
+ var lm, ll, dm, dl;
+ wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
+ if (dtlen < ftlen) {
+ lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
+ var llm = hMap(lct, mlcb, 0);
+ wbits(out, p, nlc - 257);
+ wbits(out, p + 5, ndc - 1);
+ wbits(out, p + 10, nlcc - 4);
+ p += 14;
+ for (var i = 0; i < nlcc; ++i) wbits(out, p + 3 * i, lct[clim[i]]);
+ p += 3 * nlcc;
+ var lcts = [lclt, lcdt];
+ for (var it = 0; it < 2; ++it) {
+ var clct = lcts[it];
+ for (var i = 0; i < clct.length; ++i) {
+ var len = clct[i] & 31;
+ wbits(out, p, llm[len]), p += lct[len];
+ if (len > 15) wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;
+ }
+ }
+ } else lm = flm, ll = flt, dm = fdm, dl = fdt;
+ for (var i = 0; i < li; ++i) {
+ var sym = syms[i];
+ if (sym > 255) {
+ var len = sym >> 18 & 31;
+ wbits16(out, p, lm[len + 257]), p += ll[len + 257];
+ if (len > 7) wbits(out, p, sym >> 23 & 31), p += fleb[len];
+ var dst = sym & 31;
+ wbits16(out, p, dm[dst]), p += dl[dst];
+ if (dst > 3) wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
+ } else wbits16(out, p, lm[sym]), p += ll[sym];
+ }
+ wbits16(out, p, lm[256]);
+ return p + ll[256];
+ };
+ var deo = /*#__PURE__*/ new i32([
+ 65540,
+ 131080,
+ 131088,
+ 131104,
+ 262176,
+ 1048704,
+ 1048832,
+ 2114560,
+ 2117632
+ ]);
+ var et = /*#__PURE__*/ new u8(0);
+ var dflt = function(dat, lvl, plvl, pre, post, st) {
+ var s = st.z || dat.length;
+ var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post);
+ var w = o.subarray(pre, o.length - post);
+ var lst = st.l;
+ var pos = (st.r || 0) & 7;
+ if (lvl) {
+ if (pos) w[0] = st.r >> 3;
+ var opt = deo[lvl - 1];
+ var n = opt >> 13, c = opt & 8191;
+ var msk_1 = (1 << plvl) - 1;
+ var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
+ var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
+ var hsh = function(i) {
+ return (dat[i] ^ dat[i + 1] << bs1_1 ^ dat[i + 2] << bs2_1) & msk_1;
+ };
+ var syms = new i32(25e3);
+ var lf = new u16(288), df = new u16(32);
+ var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
+ for (; i + 2 < s; ++i) {
+ var hv = hsh(i);
+ var imod = i & 32767, pimod = head[hv];
+ prev[imod] = pimod;
+ head[hv] = imod;
+ if (wi <= i) {
+ var rem = s - i;
+ if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) {
+ pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);
+ li = lc_1 = eb = 0, bs = i;
+ for (var j = 0; j < 286; ++j) lf[j] = 0;
+ for (var j = 0; j < 30; ++j) df[j] = 0;
+ }
+ var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
+ if (rem > 2 && hv == hsh(i - dif)) {
+ var maxn = Math.min(n, rem) - 1;
+ var maxd = Math.min(32767, i);
+ var ml = Math.min(258, rem);
+ while (dif <= maxd && --ch_1 && imod != pimod) {
+ if (dat[i + l] == dat[i + l - dif]) {
+ var nl = 0;
+ for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl);
+ if (nl > l) {
+ l = nl, d = dif;
+ if (nl > maxn) break;
+ var mmd = Math.min(dif, nl - 2);
+ var md = 0;
+ for (var j = 0; j < mmd; ++j) {
+ var ti = i - dif + j & 32767;
+ var cd = ti - prev[ti] & 32767;
+ if (cd > md) md = cd, pimod = ti;
+ }
+ }
+ }
+ imod = pimod, pimod = prev[imod];
+ dif += imod - pimod & 32767;
+ }
+ }
+ if (d) {
+ syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
+ var lin = revfl[l] & 31, din = revfd[d] & 31;
+ eb += fleb[lin] + fdeb[din];
+ ++lf[257 + lin];
+ ++df[din];
+ wi = i + l;
+ ++lc_1;
+ } else {
+ syms[li++] = dat[i];
+ ++lf[dat[i]];
+ }
+ }
+ }
+ for (i = Math.max(i, wi); i < s; ++i) {
+ syms[li++] = dat[i];
+ ++lf[dat[i]];
+ }
+ pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);
+ if (!lst) {
+ st.r = pos & 7 | w[pos / 8 | 0] << 3;
+ pos -= 7;
+ st.h = head, st.p = prev, st.i = i, st.w = wi;
+ }
+ } else {
+ for (var i = st.w || 0; i < s + lst; i += 65535) {
+ var e = i + 65535;
+ if (e >= s) {
+ w[pos / 8 | 0] = lst;
+ e = s;
+ }
+ pos = wfblk(w, pos + 1, dat.subarray(i, e));
+ }
+ st.i = s;
+ }
+ return slc(o, 0, pre + shft(pos) + post);
+ };
+ var crct = /*#__PURE__*/ (function() {
+ var t = /* @__PURE__ */ new Int32Array(256);
+ for (var i = 0; i < 256; ++i) {
+ var c = i, k = 9;
+ while (--k) c = (c & 1 && -306674912) ^ c >>> 1;
+ t[i] = c;
+ }
+ return t;
+ })();
+ var crc = function() {
+ var c = -1;
+ return {
+ p: function(d) {
+ var cr = c;
+ for (var i = 0; i < d.length; ++i) cr = crct[cr & 255 ^ d[i]] ^ cr >>> 8;
+ c = cr;
+ },
+ d: function() {
+ return ~c;
+ }
+ };
+ };
+ var dopt = function(dat, opt, pre, post, st) {
+ if (!st) {
+ st = { l: 1 };
+ if (opt.dictionary) {
+ var dict = opt.dictionary.subarray(-32768);
+ var newDat = new u8(dict.length + dat.length);
+ newDat.set(dict);
+ newDat.set(dat, dict.length);
+ dat = newDat;
+ st.w = dict.length;
+ }
+ }
+ return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
+ };
+ var mrg = function(a, b) {
+ var o = {};
+ for (var k in a) o[k] = a[k];
+ for (var k in b) o[k] = b[k];
+ return o;
+ };
+ var b2 = function(d, b) {
+ return d[b] | d[b + 1] << 8;
+ };
+ var b4 = function(d, b) {
+ return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;
+ };
+ var b8 = function(d, b) {
+ return b4(d, b) + b4(d, b + 4) * 4294967296;
+ };
+ var wbytes = function(d, b, v) {
+ for (; v; ++b) d[b] = v, v >>>= 8;
+ };
+ /**
+ * Compresses data with DEFLATE without any wrapper
+ * @param data The data to compress
+ * @param opts The compression options
+ * @returns The deflated version of the data
+ */
+ function deflateSync(data, opts) {
+ return dopt(data, opts || {}, 0, 0);
+ }
+ function inflateSync(data, opts) {
+ return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
+ }
+ var fltn = function(d, p, t, o) {
+ for (var k in d) {
+ var val = d[k], n = p + k, op = o;
+ if (Array.isArray(val)) op = mrg(o, val[1]), val = val[0];
+ if (ArrayBuffer.isView(val)) t[n] = [val, op];
+ else {
+ t[n += "/"] = [new u8(0), op];
+ fltn(val, n, t, o);
+ }
+ }
+ };
+ var te = typeof TextEncoder != "undefined" && /*#__PURE__*/ new TextEncoder();
+ var td = typeof TextDecoder != "undefined" && /*#__PURE__*/ new TextDecoder();
+ try {
+ td.decode(et, { stream: true });
+ } catch (e) {}
+ var dutf8 = function(d) {
+ for (var r = "", i = 0;;) {
+ var c = d[i++];
+ var eb = (c > 127) + (c > 223) + (c > 239);
+ if (i + eb > d.length) return {
+ s: r,
+ r: slc(d, i - 1)
+ };
+ if (!eb) r += String.fromCharCode(c);
+ else if (eb == 3) c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
+ else if (eb & 1) r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);
+ else r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);
+ }
+ };
+ /**
+ * Converts a string into a Uint8Array for use with compression/decompression methods
+ * @param str The string to encode
+ * @param latin1 Whether or not to interpret the data as Latin-1. This should
+ * not need to be true unless decoding a binary string.
+ * @returns The string encoded in UTF-8/Latin-1 binary
+ */
+ function strToU8(str, latin1) {
+ if (latin1) {
+ var ar_1 = new u8(str.length);
+ for (var i = 0; i < str.length; ++i) ar_1[i] = str.charCodeAt(i);
+ return ar_1;
+ }
+ if (te) return te.encode(str);
+ var l = str.length;
+ var ar = new u8(str.length + (str.length >> 1));
+ var ai = 0;
+ var w = function(v) {
+ ar[ai++] = v;
+ };
+ for (var i = 0; i < l; ++i) {
+ if (ai + 5 > ar.length) {
+ var n = new u8(ai + 8 + (l - i << 1));
+ n.set(ar);
+ ar = n;
+ }
+ var c = str.charCodeAt(i);
+ if (c < 128 || latin1) w(c);
+ else if (c < 2048) w(192 | c >> 6), w(128 | c & 63);
+ else if (c > 55295 && c < 57344) c = 65536 + (c & 1047552) | str.charCodeAt(++i) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);
+ else w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);
+ }
+ return slc(ar, 0, ai);
+ }
+ /**
+ * Converts a Uint8Array to a string
+ * @param dat The data to decode to string
+ * @param latin1 Whether or not to interpret the data as Latin-1. This should
+ * not need to be true unless encoding to binary string.
+ * @returns The original UTF-8/Latin-1 string
+ */
+ function strFromU8(dat, latin1) {
+ if (latin1) {
+ var r = "";
+ for (var i = 0; i < dat.length; i += 16384) r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
+ return r;
+ } else if (td) return td.decode(dat);
+ else {
+ var _a = dutf8(dat), s = _a.s, r = _a.r;
+ if (r.length) err(8);
+ return s;
+ }
+ }
+ var slzh = function(d, b) {
+ return b + 30 + b2(d, b + 26) + b2(d, b + 28);
+ };
+ var zh = function(d, b, z) {
+ var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
+ var _a = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a[0], su = _a[1], off = _a[2];
+ return [
+ b2(d, b + 10),
+ sc,
+ su,
+ fn,
+ es + efl + b2(d, b + 32),
+ off
+ ];
+ };
+ var z64hs = function(d, b, l, z, sc, su, off) {
+ var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
+ var nf = nsc + nsu + noff;
+ if (z && nf) {
+ for (; b + 4 < e; b += 4 + b2(d, b + 2)) if (b2(d, b) == 1) return [
+ nsc ? b8(d, b + 4 + 8 * nsu) : sc,
+ nsu ? b8(d, b + 4) : su,
+ noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
+ 1
+ ];
+ if (z < 2) err(13);
+ }
+ return [
+ sc,
+ su,
+ off,
+ 0
+ ];
+ };
+ var exfl = function(ex) {
+ var le = 0;
+ if (ex) for (var k in ex) {
+ var l = ex[k].length;
+ if (l > 65535) err(9);
+ le += l + 4;
+ }
+ return le;
+ };
+ var wzh = function(d, b, f, fn, u, c, ce, co) {
+ var fl = fn.length, ex = f.extra, col = co && co.length;
+ var exl = exfl(ex);
+ wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4;
+ if (ce != null) d[b++] = 20, d[b++] = f.os;
+ d[b] = 20, b += 2;
+ d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;
+ d[b++] = f.compression & 255, d[b++] = f.compression >> 8;
+ var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;
+ if (y < 0 || y > 119) err(10);
+ wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;
+ if (c != -1) {
+ wbytes(d, b, f.crc);
+ wbytes(d, b + 4, c < 0 ? -c - 2 : c);
+ wbytes(d, b + 8, f.size);
+ }
+ wbytes(d, b + 12, fl);
+ wbytes(d, b + 14, exl), b += 16;
+ if (ce != null) {
+ wbytes(d, b, col);
+ wbytes(d, b + 6, f.attrs);
+ wbytes(d, b + 10, ce), b += 14;
+ }
+ d.set(fn, b);
+ b += fl;
+ if (exl) for (var k in ex) {
+ var exf = ex[k], l = exf.length;
+ wbytes(d, b, +k);
+ wbytes(d, b + 2, l);
+ d.set(exf, b + 4), b += 4 + l;
+ }
+ if (col) d.set(co, b), b += col;
+ return b;
+ };
+ var wzf = function(o, b, c, d, e) {
+ wbytes(o, b, 101010256);
+ wbytes(o, b + 8, c);
+ wbytes(o, b + 10, c);
+ wbytes(o, b + 12, d);
+ wbytes(o, b + 16, e);
+ };
+ /**
+ * Synchronously creates a ZIP file. Prefer using `zip` for better performance
+ * with more than one file.
+ * @param data The directory structure for the ZIP archive
+ * @param opts The main options, merged with per-file options
+ * @returns The generated ZIP archive
+ */
+ function zipSync(data, opts) {
+ if (!opts) opts = {};
+ var r = {};
+ var files = [];
+ fltn(data, "", r, opts);
+ var o = 0;
+ var tot = 0;
+ for (var fn in r) {
+ var _a = r[fn], file = _a[0], p = _a[1];
+ var compression = p.level == 0 ? 0 : 8;
+ var f = strToU8(fn), s = f.length;
+ var com = p.comment, m = com && strToU8(com), ms = m && m.length;
+ var exl = exfl(p.extra);
+ if (s > 65535) err(11);
+ var d = compression ? deflateSync(file, p) : file, l = d.length;
+ var c = crc();
+ c.p(file);
+ files.push(mrg(p, {
+ size: file.length,
+ crc: c.d(),
+ c: d,
+ f,
+ m,
+ u: s != fn.length || m && com.length != ms,
+ o,
+ compression
+ }));
+ o += 30 + s + exl + l;
+ tot += 76 + 2 * (s + exl) + (ms || 0) + l;
+ }
+ var out = new u8(tot + 22), oe = o, cdl = tot - o;
+ for (var i = 0; i < files.length; ++i) {
+ var f = files[i];
+ wzh(out, f.o, f, f.f, f.u, f.c.length);
+ var badd = 30 + f.f.length + exfl(f.extra);
+ out.set(f.c, f.o + badd);
+ wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
+ }
+ wzf(out, o, files.length, cdl, oe);
+ return out;
+ }
+ /**
+ * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
+ * performance with more than one file.
+ * @param data The raw compressed ZIP file
+ * @param opts The ZIP extraction options
+ * @returns The decompressed files
+ */
+ function unzipSync(data, opts) {
+ var files = {};
+ var e = data.length - 22;
+ for (; b4(data, e) != 101010256; --e) if (!e || data.length - e > 65558) err(13);
+ var c = b2(data, e + 8);
+ if (!c) return {};
+ var o = b4(data, e + 16);
+ var z = b4(data, e - 20) == 117853008;
+ if (z) {
+ var ze = b4(data, e - 12);
+ z = b4(data, ze) == 101075792;
+ if (z) {
+ c = b4(data, ze + 32);
+ o = b4(data, ze + 48);
+ }
+ }
+ var fltr = opts && opts.filter;
+ for (var i = 0; i < c; ++i) {
+ var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);
+ o = no;
+ if (!fltr || fltr({
+ name: fn,
+ size: sc,
+ originalSize: su,
+ compression: c_2
+ })) {
+ if (!c_2) files[fn] = slc(data, b, b + sc);
+ else if (c_2 == 8) files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });
+ else err(14, "unknown compression type " + c_2);
+ }
+ }
+ return files;
+ }
+ //#endregion
+ //#region src/util/zip.ts
+ /**
+ * Zips and unzips packages, such as .docx files, and gives a zip file in the output types of `Packer` and
+ * `patchDocument`.
+ *
+ * @module
+ */
+ /**
+ * The bytes of a file in a package. Bytes from another realm, such as a vm context's Buffer, are read through this
+ * realm's `Uint8Array`, as fflate tells a file's bytes from a folder of files by `instanceof Uint8Array`.
+ */
+ var bytesOf$2 = (data) => typeof data === "string" ? encodeUtf8(data) : ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
+ /**
+ * Zips a package's files, each compressed with DEFLATE, in the order they are given. A path given twice keeps its first
+ * place and its last data, so a file can be replaced.
+ */
+ var zipFiles = (files) => zipSync(Object.fromEntries([...files].map(([path, data]) => [path, bytesOf$2(data)])));
+ var MAX_DEFLATE_RATIO = 1032;
+ var wrongSize = (path) => /* @__PURE__ */ new Error(`Corrupted zip: ${path} isn't the size the zip file gives it`);
+ /**
+ * The files in a zip file by their paths, in the zip file's order. Its folders, which hold nothing, are left out, and so
+ * are the files `include` leaves out, which aren't inflated.
+ *
+ * A file must be as large as the zip file says, as JSZip, which docx used to unzip with, checked. fflate takes room for
+ * that size before inflating a file, so sizes that can't be are refused before it does: compressed data that together
+ * is larger than the zip file it's in, or a size more than DEFLATE can inflate a file's compressed data to. That keeps
+ * the room taken to what DEFLATE can give for the zip file. fflate cuts a file short at a size smaller than its data,
+ * which only parsing the zip file again would show.
+ */
+ var unzipFiles = (data, include = () => true) => {
+ const sizes = /* @__PURE__ */ new Map();
+ let compressed = 0;
+ const files = unzipSync(data, { filter: ({ name, size, originalSize }) => {
+ if (name.endsWith("/") || !include(name)) return false;
+ compressed += size;
+ if (compressed > data.length || originalSize > size * MAX_DEFLATE_RATIO) throw wrongSize(name);
+ sizes.set(name, originalSize);
+ return true;
+ } });
+ const wrong = Object.entries(files).find(([path, file]) => file.length !== sizes.get(path));
+ if (wrong !== void 0) throw wrongSize(wrong[0]);
+ return new Map(Object.entries(files));
+ };
+ /** A zip file as a string with a character for each byte, as JSZip, which docx used to zip with, gave it */
+ var binaryStringOf = (data) => {
+ let text = "";
+ for (let start = 0; start < data.length; start += 32768) text += String.fromCharCode(...data.subarray(start, start + 32768));
+ return text;
+ };
+ var unsupported = (type) => /* @__PURE__ */ new Error(`${type} is not supported by this platform`);
+ var OUTPUTS = {
+ uint8array: (data) => data,
+ arraybuffer: (data) => data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength),
+ array: (data) => Array.from(data),
+ string: binaryStringOf,
+ binarystring: binaryStringOf,
+ base64: (data) => btoa(binaryStringOf(data)),
+ blob: (data, mimeType) => {
+ if (typeof Blob === "undefined") throw unsupported("blob");
+ return new Blob([data], { type: mimeType });
+ },
+ nodebuffer: (data) => {
+ if (typeof Buffer === "undefined") throw unsupported("nodebuffer");
+ return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
+ },
+ text: () => {
+ throw unsupported("text");
+ }
+ };
+ /**
+ * A zip file in one of the output types of `Packer` and `patchDocument`. The type's case doesn't matter, as it didn't
+ * to JSZip.
+ *
+ * @param mimeType - The type a Blob is given
+ */
+ var zipOutput = (data, type, mimeType) => {
+ const output = Object.prototype.hasOwnProperty.call(OUTPUTS, type.toLowerCase()) ? OUTPUTS[type.toLowerCase()] : void 0;
+ if (output === void 0) throw unsupported(type);
+ return output(data, mimeType);
+ };
+ //#endregion
+ //#region src/file/theme/read-theme.ts
+ /**
+ * Reads themes: the theme of a Word document or template, of another Office file, or of a theme file, as the options of
+ * a document's `theme`, so a document `docx` writes can have it, and the colors of a document's theme for the patcher.
+ *
+ * @module
+ */
+ var COLOR_NAMES = /* @__PURE__ */ new Map([
+ ["dk1", "dark1"],
+ ["lt1", "light1"],
+ ["dk2", "dark2"],
+ ["lt2", "light2"],
+ ["accent1", "accent1"],
+ ["accent2", "accent2"],
+ ["accent3", "accent3"],
+ ["accent4", "accent4"],
+ ["accent5", "accent5"],
+ ["accent6", "accent6"],
+ ["hlink", "hyperlink"],
+ ["folHlink", "followedHyperlink"]
+ ]);
+ var DEFAULT_SYSTEM_COLORS = /* @__PURE__ */ new Map([["dark1", "windowText"], ["light1", "window"]]);
+ var MAIN_PART_TYPES = /* @__PURE__ */ new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", "http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument"]);
+ var THEME_TYPES = /* @__PURE__ */ new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", "http://purl.oclc.org/ooxml/officeDocument/relationships/theme"]);
+ var localName$1 = (element) => {
+ var _element$name$slice, _element$name;
+ return (_element$name$slice = element === null || element === void 0 || (_element$name = element.name) === null || _element$name === void 0 ? void 0 : _element$name.slice(element.name.indexOf(":") + 1)) !== null && _element$name$slice !== void 0 ? _element$name$slice : "";
+ };
+ var childElements = (element) => {
+ var _element$elements$fil, _element$elements;
+ return (_element$elements$fil = element === null || element === void 0 || (_element$elements = element.elements) === null || _element$elements === void 0 ? void 0 : _element$elements.filter((item) => item.type === "element")) !== null && _element$elements$fil !== void 0 ? _element$elements$fil : [];
+ };
+ var child = (element, name) => childElements(element).find((item) => localName$1(item) === name);
+ var attribute = (element, name) => {
+ var _element$attributes;
+ const value = element === null || element === void 0 || (_element$attributes = element.attributes) === null || _element$attributes === void 0 ? void 0 : _element$attributes[name];
+ return value === void 0 ? void 0 : String(value);
+ };
+ var isZip = (bytes) => bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4;
+ var decode$1 = (bytes) => new TextDecoder(bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8").decode(bytes);
+ var defined = (object) => Object.fromEntries(Object.entries(object).filter(([, value]) => value !== void 0));
+ /**
+ * The part that a part's relationship of one of `types` refers to, such as the package's main part, which the package
+ * itself (`""`) refers to.
+ */
+ var relatedPart = (files, from, types) => {
+ const relationships = files.get(relationshipsPathOf(from));
+ const target = attribute(relationships && childElements(child(parseXml(decode$1(relationships)), "Relationships")).find((item) => {
+ var _attribute;
+ return types.has((_attribute = attribute(item, "Type")) !== null && _attribute !== void 0 ? _attribute : "");
+ }), "Target");
+ return target === void 0 ? void 0 : resolveTarget(from, target);
+ };
+ /**
+ * The path of the theme a part of a package refers to, such as word/theme/theme1.xml for a Word document's
+ * word/document.xml.
+ */
+ var themePathOf = (files, part) => relatedPart(files, part, THEME_TYPES);
+ /**
+ * The XML of a package's theme: the theme its main part refers to, such as word/theme/theme1.xml in a Word document.
+ *
+ * @throws If the package has no main part, or its main part has no theme
+ */
+ var packageThemeXml = (bytes) => {
+ const relationships = unzipFiles(bytes, (path) => path.endsWith(".rels"));
+ const mainPart = relatedPart(relationships, "", MAIN_PART_TYPES);
+ if (mainPart === void 0) throw new Error("Invalid file: a zip file that isn't a Word, PowerPoint or Excel file or an Office theme (.thmx)");
+ const themePath = themePathOf(relationships, mainPart);
+ const theme = themePath === void 0 ? void 0 : [...unzipFiles(bytes, (path) => isSamePart(path, themePath)).values()][0];
+ if (theme === void 0) throw new Error(`The file has no theme: its main part, ${mainPart}, refers to none`);
+ return decode$1(theme);
+ };
+ /**
+ * A theme color's 6-digit hex color: an RGB color's value, or a system color's last value. Unless `withSystemColors`,
+ * the first dark and light colors are left out when they are the system's window text and window colors, as `docx`
+ * writes them then.
+ */
+ var colorValue = (name, color, withSystemColors) => {
+ const [value] = childElements(color);
+ const hex = localName$1(value) === "srgbClr" ? attribute(value, "val") : localName$1(value) === "sysClr" && (withSystemColors || attribute(value, "val") !== DEFAULT_SYSTEM_COLORS.get(name)) ? attribute(value, "lastClr") : void 0;
+ return hex !== void 0 && /^[0-9A-Fa-f]{6}$/.test(hex) ? hex.toUpperCase() : void 0;
+ };
+ var readColors = (scheme, withSystemColors = false) => Object.fromEntries(childElements(scheme).flatMap((color) => {
+ const name = COLOR_NAMES.get(localName$1(color));
+ const value = name && colorValue(name, color, withSystemColors);
+ return name && value ? [[name, value]] : [];
+ }));
+ /**
+ * The colors of a theme's XML, each a 6-digit hex color, with the first dark and light colors as their last values when
+ * they are system colors. The patcher writes theme colors in patches with the hex colors they come to in them.
+ */
+ var readThemeColorValues = (xml) => {
+ const [root] = childElements(parseXml(xml));
+ const scheme = localName$1(root) === "theme" ? child(child(root, "themeElements"), "clrScheme") : void 0;
+ return scheme ? readColors(scheme, true) : {};
+ };
+ var typefaceOf = (font) => attribute(font, "typeface") || void 0;
+ var readFont = (collection) => {
+ const scripts = childElements(collection).filter((font) => localName$1(font) === "font").flatMap((font) => {
+ const script = attribute(font, "script");
+ const typeface = attribute(font, "typeface");
+ return script && typeface !== void 0 ? [[script, typeface]] : [];
+ });
+ return defined({
+ latin: typefaceOf(child(collection, "latin")),
+ eastAsia: typefaceOf(child(collection, "ea")),
+ complexScript: typefaceOf(child(collection, "cs")),
+ scripts: scripts.length > 0 ? Object.fromEntries(scripts) : void 0
+ });
+ };
+ var readFonts = (scheme) => ({
+ headings: readFont(child(scheme, "majorFont")),
+ body: readFont(child(scheme, "minorFont"))
+ });
+ /**
+ * The XML of the theme the data is or has: the XML itself, as text or bytes, or the theme of a package.
+ */
+ var xmlOf = (data) => {
+ if (typeof data === "string") return data;
+ const bytes = ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
+ return isZip(bytes) ? packageThemeXml(bytes) : decode$1(bytes);
+ };
+ /**
+ * Reads a theme, such as the theme of a Word document or template, as the options of a document's `theme`. The new
+ * document then has the theme's colors and fonts, so the styles, tables and text that use them look as they do in the
+ * file the theme came from:
+ *
+ * - its name;
+ * - its colors, each an RGB color or a system color's last value;
+ * - its fonts for headings and body text, with their fonts for East Asian text, complex scripts and each other script.
+ *
+ * The fills, lines and effects of shapes styled by the theme are Office's in the new document, as `docx` writes them.
+ *
+ * It reads the colors or fonts Word saves on their own too, from Design > Colors > Customize Colors or Design > Fonts >
+ * Customize Fonts, as the theme's `colors` or `fonts`.
+ *
+ * @param data - A Word document or template (.docx, .docm, .dotx or .dotm), a PowerPoint presentation (.pptx), an Excel
+ * workbook (.xlsx), an Office theme (.thmx), or the XML of a theme, such as a document's word/theme/theme1.xml, or of a
+ * theme's colors or fonts, as text or bytes
+ * @returns The theme's options, to give `Document`'s `theme`, or to change before giving it
+ * @throws If the data isn't one of those, or the file has no theme
+ *
+ * @example
+ * ```typescript
+ * import * as fs from "fs";
+ * import { Document, readTheme } from "docx";
+ *
+ * // The template's styles, and its theme, whose colors and fonts its styles use
+ * const doc = new Document({
+ * theme: readTheme(fs.readFileSync("template.dotx")),
+ * externalStyles: fs.readFileSync("styles.xml", "utf-8"),
+ * sections: [],
+ * });
+ * ```
+ */
+ var readTheme = (data) => {
+ const [root] = childElements(parseXml(xmlOf(data)));
+ if (localName$1(root) === "clrScheme") return { colors: readColors(root) };
+ if (localName$1(root) === "fontScheme") return { fonts: readFonts(root) };
+ if (localName$1(root) !== "theme") {
+ var _root$name;
+ throw new Error(`Invalid theme: expected the XML of a theme, such as a document's word/theme/theme1.xml, but its root element is ${(_root$name = root === null || root === void 0 ? void 0 : root.name) !== null && _root$name !== void 0 ? _root$name : "missing"}`);
+ }
+ const elements = child(root, "themeElements");
+ const colorScheme = child(elements, "clrScheme");
+ const fontScheme = child(elements, "fontScheme");
+ return defined({
+ name: attribute(root, "name") || void 0,
+ colors: colorScheme && readColors(colorScheme),
+ fonts: fontScheme && readFonts(fontScheme)
+ });
+ };
+ //#endregion
//#region src/file/file.ts
/**
* File module for WordprocessingML documents.
@@ -30480,7 +31732,7 @@ MAX: 9026 };
module.exports = pipeline;
}));
//#endregion
- //#region node_modules/fflate/esm/browser.js
+ //#region src/file/fonts/obfuscate-ttf-to-odttf.ts
var import_stream_browserify = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = Stream;
var EE = require_events().EventEmitter;
@@ -30547,1020 +31799,6 @@ MAX: 9026 };
return dest;
};
})))();
- var u8 = Uint8Array;
- var u16 = Uint16Array;
- var i32 = Int32Array;
- var fleb = new u8([
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 1,
- 1,
- 1,
- 1,
- 2,
- 2,
- 2,
- 2,
- 3,
- 3,
- 3,
- 3,
- 4,
- 4,
- 4,
- 4,
- 5,
- 5,
- 5,
- 5,
- 0,
- 0,
- 0,
- 0
- ]);
- var fdeb = new u8([
- 0,
- 0,
- 0,
- 0,
- 1,
- 1,
- 2,
- 2,
- 3,
- 3,
- 4,
- 4,
- 5,
- 5,
- 6,
- 6,
- 7,
- 7,
- 8,
- 8,
- 9,
- 9,
- 10,
- 10,
- 11,
- 11,
- 12,
- 12,
- 13,
- 13,
- 0,
- 0
- ]);
- var clim = new u8([
- 16,
- 17,
- 18,
- 0,
- 8,
- 7,
- 9,
- 6,
- 10,
- 5,
- 11,
- 4,
- 12,
- 3,
- 13,
- 2,
- 14,
- 1,
- 15
- ]);
- var freb = function(eb, start) {
- var b = new u16(31);
- for (var i = 0; i < 31; ++i) b[i] = start += 1 << eb[i - 1];
- var r = new i32(b[30]);
- for (var i = 1; i < 30; ++i) for (var j = b[i]; j < b[i + 1]; ++j) r[j] = j - b[i] << 5 | i;
- return {
- b,
- r
- };
- };
- var _a = freb(fleb, 2);
- var fl = _a.b;
- var revfl = _a.r;
- fl[28] = 258, revfl[258] = 28;
- var _b = freb(fdeb, 0);
- var fd = _b.b;
- var revfd = _b.r;
- var rev = new u16(32768);
- for (var i = 0; i < 32768; ++i) {
- var x = (i & 43690) >> 1 | (i & 21845) << 1;
- x = (x & 52428) >> 2 | (x & 13107) << 2;
- x = (x & 61680) >> 4 | (x & 3855) << 4;
- rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
- }
- var hMap = (function(cd, mb, r) {
- var s = cd.length;
- var i = 0;
- var l = new u16(mb);
- for (; i < s; ++i) if (cd[i]) ++l[cd[i] - 1];
- var le = new u16(mb);
- for (i = 1; i < mb; ++i) le[i] = le[i - 1] + l[i - 1] << 1;
- var co;
- if (r) {
- co = new u16(1 << mb);
- var rvb = 15 - mb;
- for (i = 0; i < s; ++i) if (cd[i]) {
- var sv = i << 4 | cd[i];
- var r_1 = mb - cd[i];
- var v = le[cd[i] - 1]++ << r_1;
- for (var m = v | (1 << r_1) - 1; v <= m; ++v) co[rev[v] >> rvb] = sv;
- }
- } else {
- co = new u16(s);
- for (i = 0; i < s; ++i) if (cd[i]) co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
- }
- return co;
- });
- var flt = new u8(288);
- for (var i = 0; i < 144; ++i) flt[i] = 8;
- for (var i = 144; i < 256; ++i) flt[i] = 9;
- for (var i = 256; i < 280; ++i) flt[i] = 7;
- for (var i = 280; i < 288; ++i) flt[i] = 8;
- var fdt = new u8(32);
- for (var i = 0; i < 32; ++i) fdt[i] = 5;
- var flm = /*#__PURE__*/ hMap(flt, 9, 0);
- var flrm = /*#__PURE__*/ hMap(flt, 9, 1);
- var fdm = /*#__PURE__*/ hMap(fdt, 5, 0);
- var fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);
- var max = function(a) {
- var m = a[0];
- for (var i = 1; i < a.length; ++i) if (a[i] > m) m = a[i];
- return m;
- };
- var bits = function(d, p, m) {
- var o = p / 8 | 0;
- return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
- };
- var bits16 = function(d, p) {
- var o = p / 8 | 0;
- return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
- };
- var shft = function(p) {
- return (p + 7) / 8 | 0;
- };
- var slc = function(v, s, e) {
- if (s == null || s < 0) s = 0;
- if (e == null || e > v.length) e = v.length;
- return new u8(v.subarray(s, e));
- };
- var ec = [
- "unexpected EOF",
- "invalid block type",
- "invalid length/literal",
- "invalid distance",
- "stream finished",
- "no stream handler",
- ,
- "no callback",
- "invalid UTF-8 data",
- "extra field too long",
- "date not in range 1980-2099",
- "filename too long",
- "stream finishing",
- "invalid zip data"
- ];
- var err = function(ind, msg, nt) {
- var e = new Error(msg || ec[ind]);
- e.code = ind;
- if (Error.captureStackTrace) Error.captureStackTrace(e, err);
- if (!nt) throw e;
- return e;
- };
- var inflt = function(dat, st, buf, dict) {
- var sl = dat.length, dl = dict ? dict.length : 0;
- if (!sl || st.f && !st.l) return buf || new u8(0);
- var noBuf = !buf;
- var resize = noBuf || st.i != 2;
- var noSt = st.i;
- if (noBuf) buf = new u8(sl * 3);
- var cbuf = function(l) {
- var bl = buf.length;
- if (l > bl) {
- var nbuf = new u8(Math.max(bl * 2, l));
- nbuf.set(buf);
- buf = nbuf;
- }
- };
- var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
- var tbts = sl * 8;
- do {
- if (!lm) {
- final = bits(dat, pos, 1);
- var type = bits(dat, pos + 1, 3);
- pos += 3;
- if (!type) {
- var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
- if (t > sl) {
- if (noSt) err(0);
- break;
- }
- if (resize) cbuf(bt + l);
- buf.set(dat.subarray(s, t), bt);
- st.b = bt += l, st.p = pos = t * 8, st.f = final;
- continue;
- } else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
- else if (type == 2) {
- var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
- var tl = hLit + bits(dat, pos + 5, 31) + 1;
- pos += 14;
- var ldt = new u8(tl);
- var clt = new u8(19);
- for (var i = 0; i < hcLen; ++i) clt[clim[i]] = bits(dat, pos + i * 3, 7);
- pos += hcLen * 3;
- var clb = max(clt), clbmsk = (1 << clb) - 1;
- var clm = hMap(clt, clb, 1);
- for (var i = 0; i < tl;) {
- var r = clm[bits(dat, pos, clbmsk)];
- pos += r & 15;
- var s = r >> 4;
- if (s < 16) ldt[i++] = s;
- else {
- var c = 0, n = 0;
- if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
- else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3;
- else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7;
- while (n--) ldt[i++] = c;
- }
- }
- var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
- lbt = max(lt);
- dbt = max(dt);
- lm = hMap(lt, lbt, 1);
- dm = hMap(dt, dbt, 1);
- } else err(1);
- if (pos > tbts) {
- if (noSt) err(0);
- break;
- }
- }
- if (resize) cbuf(bt + 131072);
- var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
- var lpos = pos;
- for (;; lpos = pos) {
- var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
- pos += c & 15;
- if (pos > tbts) {
- if (noSt) err(0);
- break;
- }
- if (!c) err(2);
- if (sym < 256) buf[bt++] = sym;
- else if (sym == 256) {
- lpos = pos, lm = null;
- break;
- } else {
- var add = sym - 254;
- if (sym > 264) {
- var i = sym - 257, b = fleb[i];
- add = bits(dat, pos, (1 << b) - 1) + fl[i];
- pos += b;
- }
- var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
- if (!d) err(3);
- pos += d & 15;
- var dt = fd[dsym];
- if (dsym > 3) {
- var b = fdeb[dsym];
- dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
- }
- if (pos > tbts) {
- if (noSt) err(0);
- break;
- }
- if (resize) cbuf(bt + 131072);
- var end = bt + add;
- if (bt < dt) {
- var shift = dl - dt, dend = Math.min(dt, end);
- if (shift + bt < 0) err(3);
- for (; bt < dend; ++bt) buf[bt] = dict[shift + bt];
- }
- for (; bt < end; ++bt) buf[bt] = buf[bt - dt];
- }
- }
- st.l = lm, st.p = lpos, st.b = bt, st.f = final;
- if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
- } while (!final);
- return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
- };
- var wbits = function(d, p, v) {
- v <<= p & 7;
- var o = p / 8 | 0;
- d[o] |= v;
- d[o + 1] |= v >> 8;
- };
- var wbits16 = function(d, p, v) {
- v <<= p & 7;
- var o = p / 8 | 0;
- d[o] |= v;
- d[o + 1] |= v >> 8;
- d[o + 2] |= v >> 16;
- };
- var hTree = function(d, mb) {
- var t = [];
- for (var i = 0; i < d.length; ++i) if (d[i]) t.push({
- s: i,
- f: d[i]
- });
- var s = t.length;
- var t2 = t.slice();
- if (!s) return {
- t: et,
- l: 0
- };
- if (s == 1) {
- var v = new u8(t[0].s + 1);
- v[t[0].s] = 1;
- return {
- t: v,
- l: 1
- };
- }
- t.sort(function(a, b) {
- return a.f - b.f;
- });
- t.push({
- s: -1,
- f: 25001
- });
- var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;
- t[0] = {
- s: -1,
- f: l.f + r.f,
- l,
- r
- };
- while (i1 != s - 1) {
- l = t[t[i0].f < t[i2].f ? i0++ : i2++];
- r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];
- t[i1++] = {
- s: -1,
- f: l.f + r.f,
- l,
- r
- };
- }
- var maxSym = t2[0].s;
- for (var i = 1; i < s; ++i) if (t2[i].s > maxSym) maxSym = t2[i].s;
- var tr = new u16(maxSym + 1);
- var mbt = ln(t[i1 - 1], tr, 0);
- if (mbt > mb) {
- var i = 0, dt = 0;
- var lft = mbt - mb, cst = 1 << lft;
- t2.sort(function(a, b) {
- return tr[b.s] - tr[a.s] || a.f - b.f;
- });
- for (; i < s; ++i) {
- var i2_1 = t2[i].s;
- if (tr[i2_1] > mb) {
- dt += cst - (1 << mbt - tr[i2_1]);
- tr[i2_1] = mb;
- } else break;
- }
- dt >>= lft;
- while (dt > 0) {
- var i2_2 = t2[i].s;
- if (tr[i2_2] < mb) dt -= 1 << mb - tr[i2_2]++ - 1;
- else ++i;
- }
- for (; i >= 0 && dt; --i) {
- var i2_3 = t2[i].s;
- if (tr[i2_3] == mb) {
- --tr[i2_3];
- ++dt;
- }
- }
- mbt = mb;
- }
- return {
- t: new u8(tr),
- l: mbt
- };
- };
- var ln = function(n, l, d) {
- return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
- };
- var lc = function(c) {
- var s = c.length;
- while (s && !c[--s]);
- var cl = new u16(++s);
- var cli = 0, cln = c[0], cls = 1;
- var w = function(v) {
- cl[cli++] = v;
- };
- for (var i = 1; i <= s; ++i) if (c[i] == cln && i != s) ++cls;
- else {
- if (!cln && cls > 2) {
- for (; cls > 138; cls -= 138) w(32754);
- if (cls > 2) {
- w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
- cls = 0;
- }
- } else if (cls > 3) {
- w(cln), --cls;
- for (; cls > 6; cls -= 6) w(8304);
- if (cls > 2) w(cls - 3 << 5 | 8208), cls = 0;
- }
- while (cls--) w(cln);
- cls = 1;
- cln = c[i];
- }
- return {
- c: cl.subarray(0, cli),
- n: s
- };
- };
- var clen = function(cf, cl) {
- var l = 0;
- for (var i = 0; i < cl.length; ++i) l += cf[i] * cl[i];
- return l;
- };
- var wfblk = function(out, pos, dat) {
- var s = dat.length;
- var o = shft(pos + 2);
- out[o] = s & 255;
- out[o + 1] = s >> 8;
- out[o + 2] = out[o] ^ 255;
- out[o + 3] = out[o + 1] ^ 255;
- for (var i = 0; i < s; ++i) out[o + i + 4] = dat[i];
- return (o + 4 + s) * 8;
- };
- var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
- wbits(out, p++, final);
- ++lf[256];
- var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;
- var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;
- var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
- var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
- var lcfreq = new u16(19);
- for (var i = 0; i < lclt.length; ++i) ++lcfreq[lclt[i] & 31];
- for (var i = 0; i < lcdt.length; ++i) ++lcfreq[lcdt[i] & 31];
- var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
- var nlcc = 19;
- for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc);
- var flen = bl + 5 << 3;
- var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
- var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
- if (bs >= 0 && flen <= ftlen && flen <= dtlen) return wfblk(out, p, dat.subarray(bs, bs + bl));
- var lm, ll, dm, dl;
- wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
- if (dtlen < ftlen) {
- lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
- var llm = hMap(lct, mlcb, 0);
- wbits(out, p, nlc - 257);
- wbits(out, p + 5, ndc - 1);
- wbits(out, p + 10, nlcc - 4);
- p += 14;
- for (var i = 0; i < nlcc; ++i) wbits(out, p + 3 * i, lct[clim[i]]);
- p += 3 * nlcc;
- var lcts = [lclt, lcdt];
- for (var it = 0; it < 2; ++it) {
- var clct = lcts[it];
- for (var i = 0; i < clct.length; ++i) {
- var len = clct[i] & 31;
- wbits(out, p, llm[len]), p += lct[len];
- if (len > 15) wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;
- }
- }
- } else lm = flm, ll = flt, dm = fdm, dl = fdt;
- for (var i = 0; i < li; ++i) {
- var sym = syms[i];
- if (sym > 255) {
- var len = sym >> 18 & 31;
- wbits16(out, p, lm[len + 257]), p += ll[len + 257];
- if (len > 7) wbits(out, p, sym >> 23 & 31), p += fleb[len];
- var dst = sym & 31;
- wbits16(out, p, dm[dst]), p += dl[dst];
- if (dst > 3) wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
- } else wbits16(out, p, lm[sym]), p += ll[sym];
- }
- wbits16(out, p, lm[256]);
- return p + ll[256];
- };
- var deo = /*#__PURE__*/ new i32([
- 65540,
- 131080,
- 131088,
- 131104,
- 262176,
- 1048704,
- 1048832,
- 2114560,
- 2117632
- ]);
- var et = /*#__PURE__*/ new u8(0);
- var dflt = function(dat, lvl, plvl, pre, post, st) {
- var s = st.z || dat.length;
- var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post);
- var w = o.subarray(pre, o.length - post);
- var lst = st.l;
- var pos = (st.r || 0) & 7;
- if (lvl) {
- if (pos) w[0] = st.r >> 3;
- var opt = deo[lvl - 1];
- var n = opt >> 13, c = opt & 8191;
- var msk_1 = (1 << plvl) - 1;
- var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
- var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
- var hsh = function(i) {
- return (dat[i] ^ dat[i + 1] << bs1_1 ^ dat[i + 2] << bs2_1) & msk_1;
- };
- var syms = new i32(25e3);
- var lf = new u16(288), df = new u16(32);
- var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
- for (; i + 2 < s; ++i) {
- var hv = hsh(i);
- var imod = i & 32767, pimod = head[hv];
- prev[imod] = pimod;
- head[hv] = imod;
- if (wi <= i) {
- var rem = s - i;
- if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) {
- pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);
- li = lc_1 = eb = 0, bs = i;
- for (var j = 0; j < 286; ++j) lf[j] = 0;
- for (var j = 0; j < 30; ++j) df[j] = 0;
- }
- var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
- if (rem > 2 && hv == hsh(i - dif)) {
- var maxn = Math.min(n, rem) - 1;
- var maxd = Math.min(32767, i);
- var ml = Math.min(258, rem);
- while (dif <= maxd && --ch_1 && imod != pimod) {
- if (dat[i + l] == dat[i + l - dif]) {
- var nl = 0;
- for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl);
- if (nl > l) {
- l = nl, d = dif;
- if (nl > maxn) break;
- var mmd = Math.min(dif, nl - 2);
- var md = 0;
- for (var j = 0; j < mmd; ++j) {
- var ti = i - dif + j & 32767;
- var cd = ti - prev[ti] & 32767;
- if (cd > md) md = cd, pimod = ti;
- }
- }
- }
- imod = pimod, pimod = prev[imod];
- dif += imod - pimod & 32767;
- }
- }
- if (d) {
- syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
- var lin = revfl[l] & 31, din = revfd[d] & 31;
- eb += fleb[lin] + fdeb[din];
- ++lf[257 + lin];
- ++df[din];
- wi = i + l;
- ++lc_1;
- } else {
- syms[li++] = dat[i];
- ++lf[dat[i]];
- }
- }
- }
- for (i = Math.max(i, wi); i < s; ++i) {
- syms[li++] = dat[i];
- ++lf[dat[i]];
- }
- pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);
- if (!lst) {
- st.r = pos & 7 | w[pos / 8 | 0] << 3;
- pos -= 7;
- st.h = head, st.p = prev, st.i = i, st.w = wi;
- }
- } else {
- for (var i = st.w || 0; i < s + lst; i += 65535) {
- var e = i + 65535;
- if (e >= s) {
- w[pos / 8 | 0] = lst;
- e = s;
- }
- pos = wfblk(w, pos + 1, dat.subarray(i, e));
- }
- st.i = s;
- }
- return slc(o, 0, pre + shft(pos) + post);
- };
- var crct = /*#__PURE__*/ (function() {
- var t = /* @__PURE__ */ new Int32Array(256);
- for (var i = 0; i < 256; ++i) {
- var c = i, k = 9;
- while (--k) c = (c & 1 && -306674912) ^ c >>> 1;
- t[i] = c;
- }
- return t;
- })();
- var crc = function() {
- var c = -1;
- return {
- p: function(d) {
- var cr = c;
- for (var i = 0; i < d.length; ++i) cr = crct[cr & 255 ^ d[i]] ^ cr >>> 8;
- c = cr;
- },
- d: function() {
- return ~c;
- }
- };
- };
- var dopt = function(dat, opt, pre, post, st) {
- if (!st) {
- st = { l: 1 };
- if (opt.dictionary) {
- var dict = opt.dictionary.subarray(-32768);
- var newDat = new u8(dict.length + dat.length);
- newDat.set(dict);
- newDat.set(dat, dict.length);
- dat = newDat;
- st.w = dict.length;
- }
- }
- return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
- };
- var mrg = function(a, b) {
- var o = {};
- for (var k in a) o[k] = a[k];
- for (var k in b) o[k] = b[k];
- return o;
- };
- var b2 = function(d, b) {
- return d[b] | d[b + 1] << 8;
- };
- var b4 = function(d, b) {
- return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;
- };
- var b8 = function(d, b) {
- return b4(d, b) + b4(d, b + 4) * 4294967296;
- };
- var wbytes = function(d, b, v) {
- for (; v; ++b) d[b] = v, v >>>= 8;
- };
- /**
- * Compresses data with DEFLATE without any wrapper
- * @param data The data to compress
- * @param opts The compression options
- * @returns The deflated version of the data
- */
- function deflateSync(data, opts) {
- return dopt(data, opts || {}, 0, 0);
- }
- function inflateSync(data, opts) {
- return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
- }
- var fltn = function(d, p, t, o) {
- for (var k in d) {
- var val = d[k], n = p + k, op = o;
- if (Array.isArray(val)) op = mrg(o, val[1]), val = val[0];
- if (ArrayBuffer.isView(val)) t[n] = [val, op];
- else {
- t[n += "/"] = [new u8(0), op];
- fltn(val, n, t, o);
- }
- }
- };
- var te = typeof TextEncoder != "undefined" && /*#__PURE__*/ new TextEncoder();
- var td = typeof TextDecoder != "undefined" && /*#__PURE__*/ new TextDecoder();
- try {
- td.decode(et, { stream: true });
- } catch (e) {}
- var dutf8 = function(d) {
- for (var r = "", i = 0;;) {
- var c = d[i++];
- var eb = (c > 127) + (c > 223) + (c > 239);
- if (i + eb > d.length) return {
- s: r,
- r: slc(d, i - 1)
- };
- if (!eb) r += String.fromCharCode(c);
- else if (eb == 3) c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
- else if (eb & 1) r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);
- else r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);
- }
- };
- /**
- * Converts a string into a Uint8Array for use with compression/decompression methods
- * @param str The string to encode
- * @param latin1 Whether or not to interpret the data as Latin-1. This should
- * not need to be true unless decoding a binary string.
- * @returns The string encoded in UTF-8/Latin-1 binary
- */
- function strToU8(str, latin1) {
- if (latin1) {
- var ar_1 = new u8(str.length);
- for (var i = 0; i < str.length; ++i) ar_1[i] = str.charCodeAt(i);
- return ar_1;
- }
- if (te) return te.encode(str);
- var l = str.length;
- var ar = new u8(str.length + (str.length >> 1));
- var ai = 0;
- var w = function(v) {
- ar[ai++] = v;
- };
- for (var i = 0; i < l; ++i) {
- if (ai + 5 > ar.length) {
- var n = new u8(ai + 8 + (l - i << 1));
- n.set(ar);
- ar = n;
- }
- var c = str.charCodeAt(i);
- if (c < 128 || latin1) w(c);
- else if (c < 2048) w(192 | c >> 6), w(128 | c & 63);
- else if (c > 55295 && c < 57344) c = 65536 + (c & 1047552) | str.charCodeAt(++i) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);
- else w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);
- }
- return slc(ar, 0, ai);
- }
- /**
- * Converts a Uint8Array to a string
- * @param dat The data to decode to string
- * @param latin1 Whether or not to interpret the data as Latin-1. This should
- * not need to be true unless encoding to binary string.
- * @returns The original UTF-8/Latin-1 string
- */
- function strFromU8(dat, latin1) {
- if (latin1) {
- var r = "";
- for (var i = 0; i < dat.length; i += 16384) r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
- return r;
- } else if (td) return td.decode(dat);
- else {
- var _a = dutf8(dat), s = _a.s, r = _a.r;
- if (r.length) err(8);
- return s;
- }
- }
- var slzh = function(d, b) {
- return b + 30 + b2(d, b + 26) + b2(d, b + 28);
- };
- var zh = function(d, b, z) {
- var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
- var _a = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a[0], su = _a[1], off = _a[2];
- return [
- b2(d, b + 10),
- sc,
- su,
- fn,
- es + efl + b2(d, b + 32),
- off
- ];
- };
- var z64hs = function(d, b, l, z, sc, su, off) {
- var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
- var nf = nsc + nsu + noff;
- if (z && nf) {
- for (; b + 4 < e; b += 4 + b2(d, b + 2)) if (b2(d, b) == 1) return [
- nsc ? b8(d, b + 4 + 8 * nsu) : sc,
- nsu ? b8(d, b + 4) : su,
- noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
- 1
- ];
- if (z < 2) err(13);
- }
- return [
- sc,
- su,
- off,
- 0
- ];
- };
- var exfl = function(ex) {
- var le = 0;
- if (ex) for (var k in ex) {
- var l = ex[k].length;
- if (l > 65535) err(9);
- le += l + 4;
- }
- return le;
- };
- var wzh = function(d, b, f, fn, u, c, ce, co) {
- var fl = fn.length, ex = f.extra, col = co && co.length;
- var exl = exfl(ex);
- wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4;
- if (ce != null) d[b++] = 20, d[b++] = f.os;
- d[b] = 20, b += 2;
- d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8;
- d[b++] = f.compression & 255, d[b++] = f.compression >> 8;
- var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;
- if (y < 0 || y > 119) err(10);
- wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4;
- if (c != -1) {
- wbytes(d, b, f.crc);
- wbytes(d, b + 4, c < 0 ? -c - 2 : c);
- wbytes(d, b + 8, f.size);
- }
- wbytes(d, b + 12, fl);
- wbytes(d, b + 14, exl), b += 16;
- if (ce != null) {
- wbytes(d, b, col);
- wbytes(d, b + 6, f.attrs);
- wbytes(d, b + 10, ce), b += 14;
- }
- d.set(fn, b);
- b += fl;
- if (exl) for (var k in ex) {
- var exf = ex[k], l = exf.length;
- wbytes(d, b, +k);
- wbytes(d, b + 2, l);
- d.set(exf, b + 4), b += 4 + l;
- }
- if (col) d.set(co, b), b += col;
- return b;
- };
- var wzf = function(o, b, c, d, e) {
- wbytes(o, b, 101010256);
- wbytes(o, b + 8, c);
- wbytes(o, b + 10, c);
- wbytes(o, b + 12, d);
- wbytes(o, b + 16, e);
- };
- /**
- * Synchronously creates a ZIP file. Prefer using `zip` for better performance
- * with more than one file.
- * @param data The directory structure for the ZIP archive
- * @param opts The main options, merged with per-file options
- * @returns The generated ZIP archive
- */
- function zipSync(data, opts) {
- if (!opts) opts = {};
- var r = {};
- var files = [];
- fltn(data, "", r, opts);
- var o = 0;
- var tot = 0;
- for (var fn in r) {
- var _a = r[fn], file = _a[0], p = _a[1];
- var compression = p.level == 0 ? 0 : 8;
- var f = strToU8(fn), s = f.length;
- var com = p.comment, m = com && strToU8(com), ms = m && m.length;
- var exl = exfl(p.extra);
- if (s > 65535) err(11);
- var d = compression ? deflateSync(file, p) : file, l = d.length;
- var c = crc();
- c.p(file);
- files.push(mrg(p, {
- size: file.length,
- crc: c.d(),
- c: d,
- f,
- m,
- u: s != fn.length || m && com.length != ms,
- o,
- compression
- }));
- o += 30 + s + exl + l;
- tot += 76 + 2 * (s + exl) + (ms || 0) + l;
- }
- var out = new u8(tot + 22), oe = o, cdl = tot - o;
- for (var i = 0; i < files.length; ++i) {
- var f = files[i];
- wzh(out, f.o, f, f.f, f.u, f.c.length);
- var badd = 30 + f.f.length + exfl(f.extra);
- out.set(f.c, f.o + badd);
- wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
- }
- wzf(out, o, files.length, cdl, oe);
- return out;
- }
- /**
- * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
- * performance with more than one file.
- * @param data The raw compressed ZIP file
- * @param opts The ZIP extraction options
- * @returns The decompressed files
- */
- function unzipSync(data, opts) {
- var files = {};
- var e = data.length - 22;
- for (; b4(data, e) != 101010256; --e) if (!e || data.length - e > 65558) err(13);
- var c = b2(data, e + 8);
- if (!c) return {};
- var o = b4(data, e + 16);
- var z = b4(data, e - 20) == 117853008;
- if (z) {
- var ze = b4(data, e - 12);
- z = b4(data, ze) == 101075792;
- if (z) {
- c = b4(data, ze + 32);
- o = b4(data, ze + 48);
- }
- }
- var fltr = opts && opts.filter;
- for (var i = 0; i < c; ++i) {
- var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);
- o = no;
- if (!fltr || fltr({
- name: fn,
- size: sc,
- originalSize: su,
- compression: c_2
- })) {
- if (!c_2) files[fn] = slc(data, b, b + sc);
- else if (c_2 == 8) files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });
- else err(14, "unknown compression type " + c_2);
- }
- }
- return files;
- }
- //#endregion
- //#region src/util/zip.ts
- /**
- * Zips and unzips packages, such as .docx files, and gives a zip file in the output types of `Packer` and
- * `patchDocument`.
- *
- * @module
- */
- /**
- * The bytes of a file in a package. Bytes from another realm, such as a vm context's Buffer, are read through this
- * realm's `Uint8Array`, as fflate tells a file's bytes from a folder of files by `instanceof Uint8Array`.
- */
- var bytesOf$2 = (data) => typeof data === "string" ? encodeUtf8(data) : ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
- /**
- * Zips a package's files, each compressed with DEFLATE, in the order they are given. A path given twice keeps its first
- * place and its last data, so a file can be replaced.
- */
- var zipFiles = (files) => zipSync(Object.fromEntries([...files].map(([path, data]) => [path, bytesOf$2(data)])));
- var MAX_DEFLATE_RATIO = 1032;
- var wrongSize = (path) => /* @__PURE__ */ new Error(`Corrupted zip: ${path} isn't the size the zip file gives it`);
- /**
- * The files in a zip file by their paths, in the zip file's order. Its folders, which hold nothing, are left out, and so
- * are the files `include` leaves out, which aren't inflated.
- *
- * A file must be as large as the zip file says, as JSZip, which docx used to unzip with, checked. fflate takes room for
- * that size before inflating a file, so sizes that can't be are refused before it does: compressed data that together
- * is larger than the zip file it's in, or a size more than DEFLATE can inflate a file's compressed data to. That keeps
- * the room taken to what DEFLATE can give for the zip file. fflate cuts a file short at a size smaller than its data,
- * which only parsing the zip file again would show.
- */
- var unzipFiles = (data, include = () => true) => {
- const sizes = /* @__PURE__ */ new Map();
- let compressed = 0;
- const files = unzipSync(data, { filter: ({ name, size, originalSize }) => {
- if (name.endsWith("/") || !include(name)) return false;
- compressed += size;
- if (compressed > data.length || originalSize > size * MAX_DEFLATE_RATIO) throw wrongSize(name);
- sizes.set(name, originalSize);
- return true;
- } });
- const wrong = Object.entries(files).find(([path, file]) => file.length !== sizes.get(path));
- if (wrong !== void 0) throw wrongSize(wrong[0]);
- return new Map(Object.entries(files));
- };
- /** A zip file as a string with a character for each byte, as JSZip, which docx used to zip with, gave it */
- var binaryStringOf = (data) => {
- let text = "";
- for (let start = 0; start < data.length; start += 32768) text += String.fromCharCode(...data.subarray(start, start + 32768));
- return text;
- };
- var unsupported = (type) => /* @__PURE__ */ new Error(`${type} is not supported by this platform`);
- var OUTPUTS = {
- uint8array: (data) => data,
- arraybuffer: (data) => data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength),
- array: (data) => Array.from(data),
- string: binaryStringOf,
- binarystring: binaryStringOf,
- base64: (data) => btoa(binaryStringOf(data)),
- blob: (data, mimeType) => {
- if (typeof Blob === "undefined") throw unsupported("blob");
- return new Blob([data], { type: mimeType });
- },
- nodebuffer: (data) => {
- if (typeof Buffer === "undefined") throw unsupported("nodebuffer");
- return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
- },
- text: () => {
- throw unsupported("text");
- }
- };
- /**
- * A zip file in one of the output types of `Packer` and `patchDocument`. The type's case doesn't matter, as it didn't
- * to JSZip.
- *
- * @param mimeType - The type a Blob is given
- */
- var zipOutput = (data, type, mimeType) => {
- const output = Object.prototype.hasOwnProperty.call(OUTPUTS, type.toLowerCase()) ? OUTPUTS[type.toLowerCase()] : void 0;
- if (output === void 0) throw unsupported(type);
- return output(data, mimeType);
- };
- //#endregion
- //#region src/file/fonts/obfuscate-ttf-to-odttf.ts
/**
* Font obfuscation module for embedding fonts in WordprocessingML documents.
*
@@ -32724,36 +32962,6 @@ MAX: 9026 };
});
};
//#endregion
- //#region src/patcher/patch-type.ts
- /**
- * The types of patch `patchDocument` applies.
- *
- * @module
- */
- /**
- * Patch type enumeration.
- *
- * Determines how the replacement content should be inserted into the document.
- *
- * @publicApi
- */
- var PatchType = {
- /** Replace entire file-level elements (e.g., whole paragraphs) */
- DOCUMENT: "file",
- /** Replace content within paragraphs (inline replacement) */
- PARAGRAPH: "paragraph",
- /**
- * Repeat the rows of a table that hold the placeholder's fields, such as `{{items.name}}`, once for each row of
- * data. See {@link TableRowsPatch}
- */
- TABLE_ROWS: "tableRows",
- /**
- * Change a drawing whose alt text holds the placeholder, and the parts it refers to, such as the data of a chart made
- * in Word. See {@link DrawingPatch}
- */
- DRAWING: "drawing"
- };
- //#endregion
//#region src/patcher/relationship-manager.ts
/**
* Extracts the numeric ID from a relationship ID string.
@@ -32840,6 +33048,254 @@ MAX: 9026 };
}]
});
//#endregion
+ //#region src/patcher/core-properties.ts
+ var CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
+ var CORE_PROPERTIES_CONTENT_TYPE = "application/vnd.openxmlformats-package.core-properties+xml";
+ var PACKAGE_RELATIONSHIPS_PATH = "_rels/.rels";
+ var CORE_PROPERTIES_PATH = "docProps/core.xml";
+ var NAMESPACES = {
+ cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
+ dc: "http://purl.org/dc/elements/1.1/"
+ };
+ var ELEMENTS = {
+ title: {
+ namespace: "dc",
+ name: "title"
+ },
+ subject: {
+ namespace: "dc",
+ name: "subject"
+ },
+ creator: {
+ namespace: "dc",
+ name: "creator"
+ },
+ keywords: {
+ namespace: "cp",
+ name: "keywords"
+ },
+ description: {
+ namespace: "dc",
+ name: "description"
+ },
+ lastModifiedBy: {
+ namespace: "cp",
+ name: "lastModifiedBy"
+ },
+ revision: {
+ namespace: "cp",
+ name: "revision"
+ }
+ };
+ var textOf = (value) => value === "" ? [] : [{
+ type: "text",
+ text: String(value)
+ }];
+ var localName = (element) => {
+ var _element$name;
+ return (_element$name = element.name) === null || _element$name === void 0 ? void 0 : _element$name.slice(element.name.indexOf(":") + 1);
+ };
+ /**
+ * The prefix, with its colon, that the root gives a namespace, or none if it's the default one. A root without the
+ * namespace is given it with its usual prefix.
+ */
+ var prefixOf = (root, namespace) => {
+ var _Object$entries$find;
+ const declaration = (_Object$entries$find = Object.entries(_objectSpread2({}, root.attributes)).find(([name, value]) => (name === "xmlns" || name.startsWith("xmlns:")) && value === NAMESPACES[namespace])) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0];
+ if (declaration === void 0) {
+ root.attributes = _objectSpread2(_objectSpread2({}, root.attributes), {}, { [`xmlns:${namespace}`]: NAMESPACES[namespace] });
+ return `${namespace}:`;
+ }
+ return declaration === "xmlns" ? "" : `${declaration.slice(6)}:`;
+ };
+ /**
+ * The text of a part, in UTF-16, from its byte order mark, or else in UTF-8.
+ */
+ var decode = (bytes) => {
+ const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
+ return new TextDecoder(encoding).decode(bytes);
+ };
+ /**
+ * The package's part at a path, if it has one. The patcher keeps a part in UTF-16, or one whose name doesn't end in
+ * .xml, with its other parts, as it found it, so that is read and moved to its XML parts, to be written in UTF-8 with
+ * them, rather than written over them as it was.
+ */
+ var readPart = (parts, binaryParts, path) => {
+ var _part$declaration;
+ const bytes = binaryParts.get(path);
+ if (bytes === void 0) return parts.get(path);
+ const part = toJson(decode(bytes));
+ if ((_part$declaration = part.declaration) === null || _part$declaration === void 0 ? void 0 : _part$declaration.attributes) part.declaration.attributes.encoding = "UTF-8";
+ binaryParts.delete(path);
+ parts.set(path, part);
+ return part;
+ };
+ /**
+ * The path of the package's core properties part, found from its relationships. A package without one is given a
+ * relationship to docProps/core.xml.
+ */
+ var corePropertiesPathOf = (parts) => {
+ var _parts$get, _getFirstLevelElement;
+ const relationships = (_parts$get = parts.get(PACKAGE_RELATIONSHIPS_PATH)) !== null && _parts$get !== void 0 ? _parts$get : createRelationshipFile();
+ const target = (_getFirstLevelElement = getFirstLevelElements(relationships, "Relationships").find((relationship) => {
+ var _relationship$attribu;
+ return ((_relationship$attribu = relationship.attributes) === null || _relationship$attribu === void 0 ? void 0 : _relationship$attribu.Type) === CORE_PROPERTIES_RELATIONSHIP_TYPE;
+ })) === null || _getFirstLevelElement === void 0 || (_getFirstLevelElement = _getFirstLevelElement.attributes) === null || _getFirstLevelElement === void 0 ? void 0 : _getFirstLevelElement.Target;
+ if (typeof target === "string") return resolveTarget("", target);
+ appendRelationship(relationships, getNextRelationshipIndex(relationships), CORE_PROPERTIES_RELATIONSHIP_TYPE, CORE_PROPERTIES_PATH);
+ parts.set(PACKAGE_RELATIONSHIPS_PATH, relationships);
+ return CORE_PROPERTIES_PATH;
+ };
+ /**
+ * Sets the given properties of a document in its core properties part, replacing the template's, and leaves the
+ * others as they are. A template without the part is given one.
+ *
+ * @param parts - The package's XML parts, by their paths, which the part is set in
+ * @param binaryParts - The package's other parts, by their paths, which the part is taken from if it's one of them
+ * @param addContentTypeOverride - Adds the content type of the part, if it's new
+ */
+ var patchCoreProperties = (parts, binaryParts, properties, { addContentTypeOverride }) => {
+ var _part$elements, _root$elements;
+ const path = corePropertiesPathOf(parts);
+ const existing = readPart(parts, binaryParts, path);
+ const part = existing !== null && existing !== void 0 ? existing : {
+ declaration: { attributes: {
+ version: "1.0",
+ encoding: "UTF-8",
+ standalone: "yes"
+ } },
+ elements: [{
+ type: "element",
+ name: "cp:coreProperties",
+ attributes: { "xmlns:cp": NAMESPACES.cp },
+ elements: []
+ }]
+ };
+ if (existing === void 0) {
+ parts.set(path, part);
+ addContentTypeOverride(CORE_PROPERTIES_CONTENT_TYPE, `/${path}`);
+ }
+ const root = (_part$elements = part.elements) === null || _part$elements === void 0 ? void 0 : _part$elements.find((element) => localName(element) === "coreProperties");
+ if (root === void 0) throw new Error(`Could not find the core properties in ${path}`);
+ (_root$elements = root.elements) !== null && _root$elements !== void 0 || (root.elements = []);
+ for (const [key, { namespace, name }] of Object.entries(ELEMENTS)) {
+ const value = properties[key];
+ if (value === void 0) continue;
+ const element = root.elements.find((item) => localName(item) === name);
+ if (element) element.elements = textOf(value);
+ else root.elements.push({
+ type: "element",
+ name: `${prefixOf(root, namespace)}${name}`,
+ elements: textOf(value)
+ });
+ }
+ };
+ //#endregion
+ //#region src/patcher/drawing-ids.ts
+ var DRAWINGS = /* @__PURE__ */ new Set(["wp:inline", "wp:anchor"]);
+ var ID_ELEMENTS = /* @__PURE__ */ new Set([
+ "wp:docPr",
+ "wps:cNvPr",
+ "wpg:cNvPr"
+ ]);
+ var REFERENCE_ELEMENTS = /* @__PURE__ */ new Set(["a:stCxn", "a:endCxn"]);
+ var idOf$1 = (element, names) => {
+ var _element$name, _element$attributes;
+ if (!names.has((_element$name = element.name) !== null && _element$name !== void 0 ? _element$name : "")) return;
+ const id = Number((_element$attributes = element.attributes) === null || _element$attributes === void 0 ? void 0 : _element$attributes.id);
+ return Number.isInteger(id) ? id : void 0;
+ };
+ /**
+ * Finds the id of every drawing in an element, at any depth, and of the shapes in them, such as in a group.
+ *
+ * @param element - The element to search, such as a part's root
+ * @returns The ids, once for each element that has one
+ */
+ var findDrawingIds = (element) => {
+ var _element$elements;
+ const id = idOf$1(element, ID_ELEMENTS);
+ return [...id === void 0 ? [] : [id], ...((_element$elements = element.elements) !== null && _element$elements !== void 0 ? _element$elements : []).flatMap(findDrawingIds)];
+ };
+ var ownIdsOf = (drawing) => {
+ const idsIn = (element) => {
+ var _element$elements2;
+ const id = idOf$1(element, ID_ELEMENTS);
+ return [...id === void 0 ? [] : [id], ...((_element$elements2 = element.elements) !== null && _element$elements2 !== void 0 ? _element$elements2 : []).flatMap((child) => {
+ var _child$name;
+ return DRAWINGS.has((_child$name = child.name) !== null && _child$name !== void 0 ? _child$name : "") ? [] : idsIn(child);
+ })];
+ };
+ return idsIn(drawing);
+ };
+ /**
+ * Creates a function that renumbers the drawings in content being inserted, so none has an id another drawing in the
+ * document has. Word finds a document whose drawings share an id unreadable, even when they are in different parts,
+ * such as a header and the body. A drawing's id is chosen when it is created, without knowing which ids the template
+ * has, and content inserted more than once would have the same ids each time.
+ *
+ * A drawing keeps its ids if nothing in the document has them yet, and otherwise gets the next unused ones. The
+ * connectors in a drawing then still join the shapes they did.
+ *
+ * @param idsInDocument - The ids of the drawings already in the document, and of the shapes in them
+ * @returns A function that returns the elements with their drawings renumbered
+ */
+ var renumberDrawingsAvoiding = (idsInDocument) => {
+ const usedIds = new Set(idsInDocument);
+ let highestId = idsInDocument.reduce((highest, id) => Math.max(highest, id), 0);
+ const newIdFor = (id) => {
+ const newId = usedIds.has(id) ? highestId + 1 : id;
+ highestId = Math.max(highestId, newId);
+ usedIds.add(newId);
+ return newId;
+ };
+ const renumberDrawing = (drawing) => {
+ const newIds = new Map([...new Set(ownIdsOf(drawing))].map((id) => [id, newIdFor(id)]));
+ const renumberIn = (element) => {
+ var _element$name2, _idOf;
+ if (element !== drawing && DRAWINGS.has((_element$name2 = element.name) !== null && _element$name2 !== void 0 ? _element$name2 : "")) return renumberDrawing(element);
+ const id = (_idOf = idOf$1(element, ID_ELEMENTS)) !== null && _idOf !== void 0 ? _idOf : idOf$1(element, REFERENCE_ELEMENTS);
+ const newId = id === void 0 ? void 0 : newIds.get(id);
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, element), newId === void 0 ? {} : { attributes: _objectSpread2(_objectSpread2({}, element.attributes), {}, { id: String(newId) }) }), element.elements === void 0 ? {} : { elements: element.elements.map(renumberIn) });
+ };
+ return renumberIn(drawing);
+ };
+ const renumber = (element) => {
+ var _element$name3;
+ return DRAWINGS.has((_element$name3 = element.name) !== null && _element$name3 !== void 0 ? _element$name3 : "") ? renumberDrawing(element) : _objectSpread2(_objectSpread2({}, element), element.elements === void 0 ? {} : { elements: element.elements.map(renumber) });
+ };
+ return (elements) => elements.map(renumber);
+ };
+ //#endregion
+ //#region src/patcher/patch-type.ts
+ /**
+ * The types of patch `patchDocument` applies.
+ *
+ * @module
+ */
+ /**
+ * Patch type enumeration.
+ *
+ * Determines how the replacement content should be inserted into the document.
+ *
+ * @publicApi
+ */
+ var PatchType = {
+ /** Replace entire file-level elements (e.g., whole paragraphs) */
+ DOCUMENT: "file",
+ /** Replace content within paragraphs (inline replacement) */
+ PARAGRAPH: "paragraph",
+ /**
+ * Repeat the rows of a table that hold the placeholder's fields, such as `{{items.name}}`, once for each row of
+ * data. See {@link TableRowsPatch}
+ */
+ TABLE_ROWS: "tableRows",
+ /**
+ * Change a drawing whose alt text holds the placeholder, and the parts it refers to, such as the data of a chart made
+ * in Word. See {@link DrawingPatch}
+ */
+ DRAWING: "drawing"
+ };
+ //#endregion
//#region src/patcher/drawing-patch.ts
/**
* Patches for drawings in a template whose alt text holds a placeholder, such as a chart made in Word whose data a patch
@@ -32892,45 +33348,6 @@ MAX: 9026 };
var _properties$attribute, _properties$attribute2;
return [(_properties$attribute = properties.attributes) === null || _properties$attribute === void 0 ? void 0 : _properties$attribute.descr, (_properties$attribute2 = properties.attributes) === null || _properties$attribute2 === void 0 ? void 0 : _properties$attribute2.title].flatMap((text) => text === void 0 ? [] : [String(text)]);
};
- /**
- * The path of a part's relationships part, such as word/_rels/document.xml.rels for word/document.xml.
- */
- var relationshipsPathOf = (path) => {
- const slash = path.lastIndexOf("/");
- return `${path.slice(0, slash + 1)}_rels/${path.slice(slash + 1)}.rels`;
- };
- /**
- * The part a relationships part belongs to, or "" for the package's own (_rels/.rels), whose targets are from its root.
- */
- var sourceOfRelationships = (path) => path.replace(/(^|\/)_rels\/([^/]*)\.rels$/, "$1$2");
- var folderOf = (path) => path.slice(0, path.lastIndexOf("/") + 1);
- /**
- * The path of the part a relationship's target refers to: relative to the folder of the part the relationship belongs
- * to, or from the package's root if it starts with "/". Backslashes, which some applications write, are read as slashes.
- *
- * @param from - The path of the part the relationship belongs to
- */
- var resolveTarget = (from, target) => {
- const normalized = target.replace(/\\/g, "/");
- return (normalized.startsWith("/") ? normalized : `${folderOf(from)}${normalized}`).split("/").reduce((segments, segment) => {
- if (segment === "" || segment === ".") return segments;
- return segment === ".." ? segments.slice(0, -1) : [...segments, segment];
- }, []).join("/");
- };
- /**
- * A relationship's target for a part, relative to the folder of the part the relationship belongs to, such as
- * "../embeddings/Microsoft_Excel_Worksheet1.xlsx" from word/charts/chart1.xml.
- *
- * @param from - The path of the part the relationship belongs to
- * @param to - The path of the part it refers to
- */
- var relativeTarget = (from, to) => {
- const folders = folderOf(from).split("/").filter(Boolean);
- const segments = to.split("/");
- const common = folders.findIndex((folder, index) => index >= segments.length - 1 || segments[index] !== folder);
- const shared = common === -1 ? folders.length : common;
- return [...folders.slice(shared).map(() => ".."), ...segments.slice(shared)].join("/");
- };
var CONTENT_TYPES$1 = "[Content_Types].xml";
/**
* A relationships part's relationships, which can be added to. A part without the `Relationships` element is given one.
@@ -33116,224 +33533,6 @@ MAX: 9026 };
}
};
//#endregion
- //#region src/patcher/core-properties.ts
- var CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
- var CORE_PROPERTIES_CONTENT_TYPE = "application/vnd.openxmlformats-package.core-properties+xml";
- var PACKAGE_RELATIONSHIPS_PATH = "_rels/.rels";
- var CORE_PROPERTIES_PATH = "docProps/core.xml";
- var NAMESPACES = {
- cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
- dc: "http://purl.org/dc/elements/1.1/"
- };
- var ELEMENTS = {
- title: {
- namespace: "dc",
- name: "title"
- },
- subject: {
- namespace: "dc",
- name: "subject"
- },
- creator: {
- namespace: "dc",
- name: "creator"
- },
- keywords: {
- namespace: "cp",
- name: "keywords"
- },
- description: {
- namespace: "dc",
- name: "description"
- },
- lastModifiedBy: {
- namespace: "cp",
- name: "lastModifiedBy"
- },
- revision: {
- namespace: "cp",
- name: "revision"
- }
- };
- var textOf = (value) => value === "" ? [] : [{
- type: "text",
- text: String(value)
- }];
- var localName$1 = (element) => {
- var _element$name;
- return (_element$name = element.name) === null || _element$name === void 0 ? void 0 : _element$name.slice(element.name.indexOf(":") + 1);
- };
- /**
- * The prefix, with its colon, that the root gives a namespace, or none if it's the default one. A root without the
- * namespace is given it with its usual prefix.
- */
- var prefixOf = (root, namespace) => {
- var _Object$entries$find;
- const declaration = (_Object$entries$find = Object.entries(_objectSpread2({}, root.attributes)).find(([name, value]) => (name === "xmlns" || name.startsWith("xmlns:")) && value === NAMESPACES[namespace])) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0];
- if (declaration === void 0) {
- root.attributes = _objectSpread2(_objectSpread2({}, root.attributes), {}, { [`xmlns:${namespace}`]: NAMESPACES[namespace] });
- return `${namespace}:`;
- }
- return declaration === "xmlns" ? "" : `${declaration.slice(6)}:`;
- };
- /**
- * The text of a part, in UTF-16, from its byte order mark, or else in UTF-8.
- */
- var decode = (bytes) => {
- const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
- return new TextDecoder(encoding).decode(bytes);
- };
- /**
- * The package's part at a path, if it has one. The patcher keeps a part in UTF-16, or one whose name doesn't end in
- * .xml, with its other parts, as it found it, so that is read and moved to its XML parts, to be written in UTF-8 with
- * them, rather than written over them as it was.
- */
- var readPart$1 = (parts, binaryParts, path) => {
- var _part$declaration;
- const bytes = binaryParts.get(path);
- if (bytes === void 0) return parts.get(path);
- const part = toJson(decode(bytes));
- if ((_part$declaration = part.declaration) === null || _part$declaration === void 0 ? void 0 : _part$declaration.attributes) part.declaration.attributes.encoding = "UTF-8";
- binaryParts.delete(path);
- parts.set(path, part);
- return part;
- };
- /**
- * The path of the package's core properties part, found from its relationships. A package without one is given a
- * relationship to docProps/core.xml.
- */
- var corePropertiesPathOf = (parts) => {
- var _parts$get, _getFirstLevelElement;
- const relationships = (_parts$get = parts.get(PACKAGE_RELATIONSHIPS_PATH)) !== null && _parts$get !== void 0 ? _parts$get : createRelationshipFile();
- const target = (_getFirstLevelElement = getFirstLevelElements(relationships, "Relationships").find((relationship) => {
- var _relationship$attribu;
- return ((_relationship$attribu = relationship.attributes) === null || _relationship$attribu === void 0 ? void 0 : _relationship$attribu.Type) === CORE_PROPERTIES_RELATIONSHIP_TYPE;
- })) === null || _getFirstLevelElement === void 0 || (_getFirstLevelElement = _getFirstLevelElement.attributes) === null || _getFirstLevelElement === void 0 ? void 0 : _getFirstLevelElement.Target;
- if (typeof target === "string") return resolveTarget("", target);
- appendRelationship(relationships, getNextRelationshipIndex(relationships), CORE_PROPERTIES_RELATIONSHIP_TYPE, CORE_PROPERTIES_PATH);
- parts.set(PACKAGE_RELATIONSHIPS_PATH, relationships);
- return CORE_PROPERTIES_PATH;
- };
- /**
- * Sets the given properties of a document in its core properties part, replacing the template's, and leaves the
- * others as they are. A template without the part is given one.
- *
- * @param parts - The package's XML parts, by their paths, which the part is set in
- * @param binaryParts - The package's other parts, by their paths, which the part is taken from if it's one of them
- * @param addContentTypeOverride - Adds the content type of the part, if it's new
- */
- var patchCoreProperties = (parts, binaryParts, properties, { addContentTypeOverride }) => {
- var _part$elements, _root$elements;
- const path = corePropertiesPathOf(parts);
- const existing = readPart$1(parts, binaryParts, path);
- const part = existing !== null && existing !== void 0 ? existing : {
- declaration: { attributes: {
- version: "1.0",
- encoding: "UTF-8",
- standalone: "yes"
- } },
- elements: [{
- type: "element",
- name: "cp:coreProperties",
- attributes: { "xmlns:cp": NAMESPACES.cp },
- elements: []
- }]
- };
- if (existing === void 0) {
- parts.set(path, part);
- addContentTypeOverride(CORE_PROPERTIES_CONTENT_TYPE, `/${path}`);
- }
- const root = (_part$elements = part.elements) === null || _part$elements === void 0 ? void 0 : _part$elements.find((element) => localName$1(element) === "coreProperties");
- if (root === void 0) throw new Error(`Could not find the core properties in ${path}`);
- (_root$elements = root.elements) !== null && _root$elements !== void 0 || (root.elements = []);
- for (const [key, { namespace, name }] of Object.entries(ELEMENTS)) {
- const value = properties[key];
- if (value === void 0) continue;
- const element = root.elements.find((item) => localName$1(item) === name);
- if (element) element.elements = textOf(value);
- else root.elements.push({
- type: "element",
- name: `${prefixOf(root, namespace)}${name}`,
- elements: textOf(value)
- });
- }
- };
- //#endregion
- //#region src/patcher/drawing-ids.ts
- var DRAWINGS = /* @__PURE__ */ new Set(["wp:inline", "wp:anchor"]);
- var ID_ELEMENTS = /* @__PURE__ */ new Set([
- "wp:docPr",
- "wps:cNvPr",
- "wpg:cNvPr"
- ]);
- var REFERENCE_ELEMENTS = /* @__PURE__ */ new Set(["a:stCxn", "a:endCxn"]);
- var idOf$1 = (element, names) => {
- var _element$name, _element$attributes;
- if (!names.has((_element$name = element.name) !== null && _element$name !== void 0 ? _element$name : "")) return;
- const id = Number((_element$attributes = element.attributes) === null || _element$attributes === void 0 ? void 0 : _element$attributes.id);
- return Number.isInteger(id) ? id : void 0;
- };
- /**
- * Finds the id of every drawing in an element, at any depth, and of the shapes in them, such as in a group.
- *
- * @param element - The element to search, such as a part's root
- * @returns The ids, once for each element that has one
- */
- var findDrawingIds = (element) => {
- var _element$elements;
- const id = idOf$1(element, ID_ELEMENTS);
- return [...id === void 0 ? [] : [id], ...((_element$elements = element.elements) !== null && _element$elements !== void 0 ? _element$elements : []).flatMap(findDrawingIds)];
- };
- var ownIdsOf = (drawing) => {
- const idsIn = (element) => {
- var _element$elements2;
- const id = idOf$1(element, ID_ELEMENTS);
- return [...id === void 0 ? [] : [id], ...((_element$elements2 = element.elements) !== null && _element$elements2 !== void 0 ? _element$elements2 : []).flatMap((child) => {
- var _child$name;
- return DRAWINGS.has((_child$name = child.name) !== null && _child$name !== void 0 ? _child$name : "") ? [] : idsIn(child);
- })];
- };
- return idsIn(drawing);
- };
- /**
- * Creates a function that renumbers the drawings in content being inserted, so none has an id another drawing in the
- * document has. Word finds a document whose drawings share an id unreadable, even when they are in different parts,
- * such as a header and the body. A drawing's id is chosen when it is created, without knowing which ids the template
- * has, and content inserted more than once would have the same ids each time.
- *
- * A drawing keeps its ids if nothing in the document has them yet, and otherwise gets the next unused ones. The
- * connectors in a drawing then still join the shapes they did.
- *
- * @param idsInDocument - The ids of the drawings already in the document, and of the shapes in them
- * @returns A function that returns the elements with their drawings renumbered
- */
- var renumberDrawingsAvoiding = (idsInDocument) => {
- const usedIds = new Set(idsInDocument);
- let highestId = idsInDocument.reduce((highest, id) => Math.max(highest, id), 0);
- const newIdFor = (id) => {
- const newId = usedIds.has(id) ? highestId + 1 : id;
- highestId = Math.max(highestId, newId);
- usedIds.add(newId);
- return newId;
- };
- const renumberDrawing = (drawing) => {
- const newIds = new Map([...new Set(ownIdsOf(drawing))].map((id) => [id, newIdFor(id)]));
- const renumberIn = (element) => {
- var _element$name2, _idOf;
- if (element !== drawing && DRAWINGS.has((_element$name2 = element.name) !== null && _element$name2 !== void 0 ? _element$name2 : "")) return renumberDrawing(element);
- const id = (_idOf = idOf$1(element, ID_ELEMENTS)) !== null && _idOf !== void 0 ? _idOf : idOf$1(element, REFERENCE_ELEMENTS);
- const newId = id === void 0 ? void 0 : newIds.get(id);
- return _objectSpread2(_objectSpread2(_objectSpread2({}, element), newId === void 0 ? {} : { attributes: _objectSpread2(_objectSpread2({}, element.attributes), {}, { id: String(newId) }) }), element.elements === void 0 ? {} : { elements: element.elements.map(renumberIn) });
- };
- return renumberIn(drawing);
- };
- const renumber = (element) => {
- var _element$name3;
- return DRAWINGS.has((_element$name3 = element.name) !== null && _element$name3 !== void 0 ? _element$name3 : "") ? renumberDrawing(element) : _objectSpread2(_objectSpread2({}, element), element.elements === void 0 ? {} : { elements: element.elements.map(renumber) });
- };
- return (elements) => elements.map(renumber);
- };
- //#endregion
//#region src/patcher/load-zip.ts
var isStream = (data) => typeof data === "object" && data !== null && "on" in data && typeof data.on === "function";
var isZipArchive = (data) => typeof data === "object" && data !== null && "generateAsync" in data && typeof data.generateAsync === "function";
@@ -34515,75 +34714,17 @@ MAX: 9026 };
*
* @module
*/
- var THEME_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
- var COLOR_NAMES = /* @__PURE__ */ new Map([
- ["dk1", "dark1"],
- ["lt1", "light1"],
- ["dk2", "dark2"],
- ["lt2", "light2"],
- ["accent1", "accent1"],
- ["accent2", "accent2"],
- ["accent3", "accent3"],
- ["accent4", "accent4"],
- ["accent5", "accent5"],
- ["accent6", "accent6"],
- ["hlink", "hyperlink"],
- ["folHlink", "followedHyperlink"]
- ]);
- var localName = (element) => {
- var _element$name;
- return (_element$name = element.name) === null || _element$name === void 0 ? void 0 : _element$name.slice(element.name.indexOf(":") + 1);
- };
- var child = (element, name) => {
- var _element$elements;
- return element === null || element === void 0 || (_element$elements = element.elements) === null || _element$elements === void 0 ? void 0 : _element$elements.find((item) => localName(item) === name);
- };
- /**
- * The hex value of a theme's color: an RGB color's value, or the last value of a system color, as Word writes them.
- * Other kinds of color aren't read.
- */
- var hexValue = (color) => {
- var _color$elements;
- const value = (_color$elements = color.elements) === null || _color$elements === void 0 ? void 0 : _color$elements.map((item) => {
- var _item$attributes, _item$attributes2;
- return localName(item) === "srgbClr" ? (_item$attributes = item.attributes) === null || _item$attributes === void 0 ? void 0 : _item$attributes.val : localName(item) === "sysClr" ? (_item$attributes2 = item.attributes) === null || _item$attributes2 === void 0 ? void 0 : _item$attributes2.lastClr : void 0;
- }).find((item) => item !== void 0);
- return typeof value === "string" && /^[0-9A-Fa-f]{6}$/.test(value) ? value.toUpperCase() : void 0;
- };
var isUtf16 = (bytes) => bytes[0] === 255 && bytes[1] === 254 || bytes[0] === 254 && bytes[1] === 255;
- var readPart = (files, path) => {
- const part = files.get(path);
- return part === void 0 || isUtf16(part) ? void 0 : toJson(decodeUtf8(part));
- };
- /**
- * The document's theme part, found from the document's relationships.
- */
- var readTheme = (files) => {
- var _child, _theme$attributes;
- const theme = (_child = child(readPart(files, "word/_rels/document.xml.rels"), "Relationships")) === null || _child === void 0 || (_child = _child.elements) === null || _child === void 0 ? void 0 : _child.find((item) => {
- var _item$attributes3;
- return ((_item$attributes3 = item.attributes) === null || _item$attributes3 === void 0 ? void 0 : _item$attributes3.Type) === THEME_RELATIONSHIP_TYPE;
- });
- const target = theme === null || theme === void 0 || (_theme$attributes = theme.attributes) === null || _theme$attributes === void 0 ? void 0 : _theme$attributes.Target;
- return typeof target === "string" ? readPart(files, resolveTarget("word/document.xml", target)) : void 0;
- };
/**
* Reads the colors of the document's theme. Colors it doesn't give, or gives in a way that isn't read, are Office's.
*
* @returns The theme's colors, or `undefined` if the document has no theme that can be read
*/
var readThemeColors = (files) => {
- var _scheme$elements;
- const theme = readTheme(files);
- if (theme === void 0) return;
- const scheme = child(child(child(theme, "theme"), "themeElements"), "clrScheme");
- const colors = ((_scheme$elements = scheme === null || scheme === void 0 ? void 0 : scheme.elements) !== null && _scheme$elements !== void 0 ? _scheme$elements : []).flatMap((color) => {
- var _localName;
- const name = COLOR_NAMES.get((_localName = localName(color)) !== null && _localName !== void 0 ? _localName : "");
- const value = hexValue(color);
- return name && value ? [[name, value]] : [];
- });
- return themeColorValues(Object.fromEntries(colors));
+ var _find;
+ const path = themePathOf(files, "word/document.xml");
+ const theme = path === void 0 ? void 0 : (_find = [...files].find(([name]) => isSamePart(name, path))) === null || _find === void 0 ? void 0 : _find[1];
+ return theme === void 0 || isUtf16(theme) ? void 0 : themeColorValues(readThemeColorValues(decodeUtf8(theme)));
};
//#endregion
//#region src/patcher/trim-placeholders.ts
@@ -35590,6 +35731,7 @@ MAX: 9026 };
exports.percentageValue = percentageValue;
exports.pointMeasureValue = pointMeasureValue;
exports.positiveUniversalMeasureValue = positiveUniversalMeasureValue;
+ exports.readTheme = readTheme;
exports.sectionMarginDefaults = sectionMarginDefaults;
exports.sectionPageSizeDefaults = sectionPageSizeDefaults;
exports.shortHexNumber = shortHexNumber;
diff --git a/usage/styling-with-xml.md b/usage/styling-with-xml.md
index 7b820e180f..37b7b99882 100644
--- a/usage/styling-with-xml.md
+++ b/usage/styling-with-xml.md
@@ -78,7 +78,30 @@ const doc = new Document({
Styles made in Word often name the theme's fonts and colors rather than a font or a color: "(Headings)" is written as `w:asciiTheme="majorHAnsi"`, and "Accent 1" as `w:themeColor="accent1"`. Word looks them up in the document's theme, which is the one `docx` writes, not the theme of the document your `styles.xml` came from. It's Office's theme, with Calibri Light for headings and Calibri for body text, unless the [`theme`](usage/themes.md) option changes it.
-To keep the fonts and colors of the document the styles came from, give its theme's fonts and colors in `theme`. They're in that document's `word/theme/theme1.xml`: the `typeface` of `a:latin` in `a:majorFont` is the font for headings, the one in `a:minorFont` is the font for body text, and `a:clrScheme` has the colors.
+To keep the fonts and colors of the document the styles came from, give it that document's theme, read with [`readTheme`](usage/themes.md#the-theme-of-a-word-document-or-template). It reads the document itself, or its `word/theme/theme1.xml`:
+
+```ts live
+import * as fs from "fs";
+import { Document, HeadingLevel, Paragraph, readTheme } from "docx";
+
+const doc = new Document({
+ externalStyles: fs.readFileSync("./demo/assets/custom-styles.xml", "utf-8"),
+ // The theme of the document the styles came from. Here, that of another document made in Word, with Cambria for headings
+ theme: readTheme(fs.readFileSync("./demo/assets/field-trip.docx")),
+ sections: [
+ {
+ children: [
+ // The styles' Heading 1 is in the theme's sixth accent color, darker 25%
+ new Paragraph({ text: "A heading in the theme's accent 6", heading: HeadingLevel.HEADING_1 }),
+ // Their Normal style is in the theme's font for body text
+ new Paragraph("Body text in the theme's font for body text"),
+ ],
+ },
+ ],
+});
+```
+
+Or give its theme's fonts and colors in `theme` yourself. They're in that document's `word/theme/theme1.xml`: the `typeface` of `a:latin` in `a:majorFont` is the font for headings, the one in `a:minorFont` is the font for body text, and `a:clrScheme` has the colors.
```ts live
import { Document, HeadingLevel, Paragraph } from "docx";
diff --git a/usage/themes.md b/usage/themes.md
index c29e5e80f5..ccabd3fed9 100644
--- a/usage/themes.md
+++ b/usage/themes.md
@@ -46,11 +46,11 @@ Colors and fonts that aren't given are Office's.
### Theme Options
-| Property | Type | Notes | Description |
-| -------- | --------------------- | -------- | --------------------------------------------------------------------------------------- |
-| `name` | `string` | Optional | The theme's name, as Word shows it. Default is `"Office Theme"` |
-| `colors` | `IThemeColorsOptions` | Optional | The theme's colors, each a 6-digit hex color such as `"4472C4"` |
-| `fonts` | `IThemeFontsOptions` | Optional | `headings` and `body`: a font name, or `{ latin, eastAsia, complexScript }` for scripts |
+| Property | Type | Notes | Description |
+| -------- | --------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `name` | `string` | Optional | The theme's name, as Word shows it. Default is `"Office Theme"` |
+| `colors` | `IThemeColorsOptions` | Optional | The theme's colors, each a 6-digit hex color such as `"4472C4"` |
+| `fonts` | `IThemeFontsOptions` | Optional | `headings` and `body`: a font name, or `{ latin, eastAsia, complexScript, scripts }` for other scripts. See [Fonts for other scripts](#fonts-for-other-scripts) |
### Theme Colors
@@ -73,6 +73,79 @@ Colors and fonts that aren't given are Office's.
+### Fonts for other scripts
+
+Each of the theme's fonts can have a font for East Asian text (`eastAsia`), a font for complex scripts such as Arabic and Hebrew (`complexScript`), and a font for each script of its own (`scripts`), by the script's [ISO 15924](https://en.wikipedia.org/wiki/ISO_15924) code, such as `Jpan` for Japanese, `Hans` for simplified Chinese or `Arab` for Arabic. Word uses them for text in those scripts that is in the theme's fonts.
+
+The fonts given in `scripts` take the place of Office's for those scripts, and Office's are kept for the others, as Office's theme has a font for each of about fifty scripts.
+
+```ts live
+import { Document, Paragraph, TextRun } from "docx";
+
+const doc = new Document({
+ theme: {
+ fonts: {
+ headings: { latin: "Georgia", scripts: { Jpan: "Yu Mincho" } },
+ body: { latin: "Verdana", scripts: { Jpan: "Meiryo", Arab: "Tahoma" } },
+ },
+ },
+ sections: [
+ {
+ children: [
+ new Paragraph({ children: [new TextRun({ text: "Body text, 本文", font: { theme: "body" } })] }),
+ new Paragraph({ children: [new TextRun({ text: "A heading, 見出し", font: { theme: "headings" } })] }),
+ ],
+ },
+ ],
+});
+```
+
+## The theme of a Word document or template
+
+Styles made in Word, such as those of a template given in [`externalStyles`](usage/styling-with-xml.md), usually name the theme's fonts and colors rather than a font or a color: "(Headings)", or a table's shading in "Accent 5, Lighter 60%". They look as they did in Word only with the theme of the document they came from. `readTheme` reads that theme, to give `theme`:
+
+```ts live
+import * as fs from "fs";
+import { Document, HeadingLevel, Paragraph, TextRun, readTheme } from "docx";
+
+// A document made in Word, whose theme is Office 2007's: Cambria for headings, Calibri for body text, and blue accents
+const theme = readTheme(fs.readFileSync("./demo/assets/field-trip.docx"));
+
+const doc = new Document({
+ theme,
+ styles: {
+ default: {
+ heading1: { run: { font: { theme: "headings" }, size: 32, color: { theme: "accent1" } } },
+ },
+ },
+ sections: [
+ {
+ children: [
+ new Paragraph({
+ heading: HeadingLevel.HEADING_1,
+ children: [new TextRun("In the theme's font for headings, and accent 1")],
+ }),
+ new Paragraph({
+ children: [
+ new TextRun({ text: "Accent 2, in the font for body text", color: { theme: "accent2" }, font: { theme: "body" } }),
+ ],
+ }),
+ ],
+ },
+ ],
+});
+```
+
+It reads:
+
+- a Word document or template (`.docx`, `.docm`, `.dotx` or `.dotm`), a PowerPoint presentation (`.pptx`), an Excel workbook (`.xlsx`) or an Office theme (`.thmx`), as bytes, such as a `Buffer`, a `Uint8Array` or an `ArrayBuffer`;
+- the XML of a theme, such as a document's `word/theme/theme1.xml`, as text or bytes;
+- the XML of colors or fonts that Word saves on their own, from **Design > Colors > Customize Colors** or **Design > Fonts > Customize Fonts**, as the theme's `colors` or `fonts`.
+
+It gives the options of `theme`: the theme's `name`, its `colors`, and its `fonts` for headings and body text, with their fonts for other scripts. Change them before giving them to `theme` if you like, such as `{ ...theme, colors: { ...theme.colors, accent1: "1F6F8B" } }`. The fills, lines and effects of the theme's shape styles are Office's in the new document, as they are for every theme `docx` writes.
+
+It throws for a file that isn't one of those, or that has no theme.
+
## Text in the theme's fonts
A run's or a style's `font` can be one of the theme's fonts: `{ theme: "headings" }` or `{ theme: "body" }`. It's the theme's font for every script, as Word's own styles use it.
@@ -102,7 +175,7 @@ const doc = new Document({
});
```
-The library's own styles don't use the theme's fonts, so text looks as it always has until a style or a run asks for them. Word's styles, such as those in `externalStyles` taken from a Word document, use them: Word's `Normal` style is in the theme's font for body text, and its headings in the font for headings. The theme is the one `docx` writes, not the theme of the document the styles came from, so give that theme's fonts and colors in `theme` to keep them.
+The library's own styles don't use the theme's fonts, so text looks as it always has until a style or a run asks for them. Word's styles, such as those in `externalStyles` taken from a Word document, use them: Word's `Normal` style is in the theme's font for body text, and its headings in the font for headings. The theme is the one `docx` writes, not the theme of the document the styles came from, so give that document's theme with [`readTheme`](#the-theme-of-a-word-document-or-template) to keep its fonts and colors.
## Text, tables and borders in the theme's colors
@@ -184,6 +257,12 @@ const doc = new Document({
## Examples
+### The theme of a Word document
+
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/styles/theme-from-a-document.ts ":include")
+
+_Source: https://github.com/dolanmiu/docx/blob/master/demo/styles/theme-from-a-document.ts_
+
### A theme of its own
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/styles/theme.ts ":include")
The unique identifier for this abstract numbering definition.