js.documents 14.4.32 → 14.4.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/{blr-types-CMN0QKUE.d.cts → blr-types-deHhtYjv.d.cts} +2 -1
  2. package/dist/{blr-types-CMN0QKUE.d.ts → blr-types-deHhtYjv.d.ts} +2 -1
  3. package/dist/convert/composition.cjs +65 -65
  4. package/dist/convert/composition.d.cts +1 -1
  5. package/dist/convert/composition.d.ts +1 -1
  6. package/dist/convert/composition.js +65 -65
  7. package/dist/edit/docx/table.cjs +1 -1
  8. package/dist/edit/docx/table.js +1 -1
  9. package/dist/edit/odg/page.d.cts +1 -1
  10. package/dist/edit/odg/page.d.ts +1 -1
  11. package/dist/edit/odg/vector.cjs +5 -0
  12. package/dist/edit/odg/vector.d.cts +2 -2
  13. package/dist/edit/odg/vector.d.ts +2 -2
  14. package/dist/edit/odg/vector.js +5 -1
  15. package/dist/edit/odp/slide.d.cts +1 -1
  16. package/dist/edit/odp/slide.d.ts +1 -1
  17. package/dist/edit/odt/automatic-styles.cjs +1 -1
  18. package/dist/edit/odt/automatic-styles.js +1 -1
  19. package/dist/edit/odt/content.cjs +32 -32
  20. package/dist/edit/odt/content.js +32 -32
  21. package/dist/edit/odt/table.cjs +1 -1
  22. package/dist/edit/odt/table.js +1 -1
  23. package/dist/edit/pdf/item.cjs +5 -0
  24. package/dist/edit/pdf/item.d.cts +2 -2
  25. package/dist/edit/pdf/item.d.ts +2 -2
  26. package/dist/edit/pdf/item.js +5 -1
  27. package/dist/edit/pdf/page.d.cts +1 -1
  28. package/dist/edit/pdf/page.d.ts +1 -1
  29. package/dist/evaluate-BbOsgdmN.d.cts +15 -0
  30. package/dist/evaluate-C7fmk69X.d.ts +15 -0
  31. package/dist/firebird/backup.d.cts +1 -1
  32. package/dist/firebird/backup.d.ts +1 -1
  33. package/dist/firebird/blr-types.cjs +5 -0
  34. package/dist/firebird/blr-types.d.cts +2 -2
  35. package/dist/firebird/blr-types.d.ts +2 -2
  36. package/dist/firebird/blr-types.js +5 -1
  37. package/dist/firebird/schema.d.cts +1 -1
  38. package/dist/firebird/schema.d.ts +1 -1
  39. package/dist/hsqldb/binary-script.d.cts +1 -1
  40. package/dist/hsqldb/binary-script.d.ts +1 -1
  41. package/dist/hsqldb/cache.d.cts +1 -1
  42. package/dist/hsqldb/cache.d.ts +1 -1
  43. package/dist/hsqldb/script.cjs +5 -0
  44. package/dist/hsqldb/script.d.cts +2 -2
  45. package/dist/hsqldb/script.d.ts +2 -2
  46. package/dist/hsqldb/script.js +5 -1
  47. package/dist/index.d.cts +6 -6
  48. package/dist/index.d.ts +6 -6
  49. package/dist/{item-SUC4uKDO.d.cts → item-B5d6CCqq.d.cts} +2 -1
  50. package/dist/{item-SUC4uKDO.d.ts → item-B5d6CCqq.d.ts} +2 -1
  51. package/dist/latex/lower.cjs +2 -2
  52. package/dist/latex/lower.js +2 -2
  53. package/dist/layout/lattice.cjs +1 -1
  54. package/dist/layout/lattice.js +1 -1
  55. package/dist/layout/reconstruct.cjs +3 -3
  56. package/dist/layout/reconstruct.js +3 -3
  57. package/dist/markdown/render.cjs +5 -0
  58. package/dist/markdown/render.d.cts +2 -1
  59. package/dist/markdown/render.d.ts +2 -1
  60. package/dist/markdown/render.js +5 -1
  61. package/dist/model/embedded-drawing.cjs +5 -0
  62. package/dist/model/embedded-drawing.d.cts +2 -1
  63. package/dist/model/embedded-drawing.d.ts +2 -1
  64. package/dist/model/embedded-drawing.js +5 -1
  65. package/dist/odb/csv.d.cts +1 -1
  66. package/dist/odb/csv.d.ts +1 -1
  67. package/dist/odb/formula/evaluate.cjs +5 -0
  68. package/dist/odb/formula/evaluate.d.cts +3 -2
  69. package/dist/odb/formula/evaluate.d.ts +3 -2
  70. package/dist/odb/formula/evaluate.js +5 -1
  71. package/dist/odb/formula/parser.d.cts +1 -1
  72. package/dist/odb/formula/parser.d.ts +1 -1
  73. package/dist/odb/read.d.cts +1 -1
  74. package/dist/odb/read.d.ts +1 -1
  75. package/dist/odb/report/render.cjs +5 -0
  76. package/dist/odb/report/render.d.cts +3 -2
  77. package/dist/odb/report/render.d.ts +3 -2
  78. package/dist/odb/report/render.js +5 -1
  79. package/dist/odb/report/source.d.cts +1 -1
  80. package/dist/odb/report/source.d.ts +1 -1
  81. package/dist/odb/spreadsheet.d.cts +1 -1
  82. package/dist/odb/spreadsheet.d.ts +1 -1
  83. package/dist/odb/sql/evaluate.cjs +21 -1
  84. package/dist/odb/sql/evaluate.d.cts +2 -2
  85. package/dist/odb/sql/evaluate.d.ts +2 -2
  86. package/dist/odb/sql/evaluate.js +18 -2
  87. package/dist/odb/sql/parser.cjs +12 -7
  88. package/dist/odb/sql/parser.d.cts +2 -2
  89. package/dist/odb/sql/parser.d.ts +2 -2
  90. package/dist/odb/sql/parser.js +12 -8
  91. package/dist/odb/values.cjs +5 -0
  92. package/dist/odb/values.d.cts +2 -2
  93. package/dist/odb/values.d.ts +2 -2
  94. package/dist/odb/values.js +5 -1
  95. package/dist/{parser-Oq6zLQsu.d.cts → parser-BTA1wXPd.d.cts} +2 -1
  96. package/dist/{parser-CfMvvMT1.d.ts → parser-CoIi0l9I.d.ts} +2 -1
  97. package/dist/ppt/write.cjs +5 -0
  98. package/dist/ppt/write.d.cts +2 -1
  99. package/dist/ppt/write.d.ts +2 -1
  100. package/dist/ppt/write.js +5 -1
  101. package/dist/{script-DsGGIzGU.d.cts → script-pkZ2Kor4.d.cts} +2 -1
  102. package/dist/{script-DsGGIzGU.d.ts → script-pkZ2Kor4.d.ts} +2 -1
  103. package/dist/svg/transform.cjs +5 -0
  104. package/dist/svg/transform.d.cts +2 -1
  105. package/dist/svg/transform.d.ts +2 -1
  106. package/dist/svg/transform.js +5 -1
  107. package/dist/svg/write.cjs +5 -0
  108. package/dist/svg/write.d.cts +2 -1
  109. package/dist/svg/write.d.ts +2 -1
  110. package/dist/svg/write.js +5 -1
  111. package/dist/{values-BBN9E8dV.d.cts → values-DcupkLKg.d.cts} +2 -1
  112. package/dist/{values-BBN9E8dV.d.ts → values-DcupkLKg.d.ts} +2 -1
  113. package/dist/{vector-DDP7hgvm.d.cts → vector-DWSXN_G2.d.cts} +2 -1
  114. package/dist/{vector-DDP7hgvm.d.ts → vector-DWSXN_G2.d.ts} +2 -1
  115. package/package.json +13 -13
  116. package/dist/evaluate-BnRKjJ1G.d.ts +0 -11
  117. package/dist/evaluate-CYYLwKtR.d.cts +0 -11
@@ -31,5 +31,6 @@ declare class FirebirdUnsupportedFieldTypeError extends Error {
31
31
  }
32
32
  declare function decodeBlrType(blrType: number): FirebirdPhysicalType;
33
33
  declare function describeFieldType(physical: FirebirdPhysicalType, lengthBytes: number, scale: number, characterLength: number | undefined, subType: number): string;
34
+ declare function assertNeverPhysical(value: never): never;
34
35
  //#endregion
35
- export { BLR_TIMESTAMP_TZ as C, FirebirdUnsupportedFieldTypeError as D, FirebirdPhysicalType as E, decodeBlrType as O, BLR_TIMESTAMP as S, BLR_VARYING2 as T, BLR_SQL_DATE as _, BLR_DEC128 as a, BLR_TEXT as b, BLR_D_FLOAT as c, BLR_FLOAT as d, BLR_INT128 as f, BLR_SHORT as g, BLR_QUAD as h, BLR_CSTRING2 as i, describeFieldType as k, BLR_EX_TIMESTAMP_TZ as l, BLR_LONG as m, BLR_BOOL as n, BLR_DEC64 as o, BLR_INT64 as p, BLR_CSTRING as r, BLR_DOUBLE as s, BLR_BLOB as t, BLR_EX_TIME_TZ as u, BLR_SQL_TIME as v, BLR_VARYING as w, BLR_TEXT2 as x, BLR_SQL_TIME_TZ as y };
36
+ export { describeFieldType as A, BLR_TIMESTAMP_TZ as C, FirebirdUnsupportedFieldTypeError as D, FirebirdPhysicalType as E, assertNeverPhysical as O, BLR_TIMESTAMP as S, BLR_VARYING2 as T, BLR_SQL_DATE as _, BLR_DEC128 as a, BLR_TEXT as b, BLR_D_FLOAT as c, BLR_FLOAT as d, BLR_INT128 as f, BLR_SHORT as g, BLR_QUAD as h, BLR_CSTRING2 as i, decodeBlrType as k, BLR_EX_TIMESTAMP_TZ as l, BLR_LONG as m, BLR_BOOL as n, BLR_DEC64 as o, BLR_INT64 as p, BLR_CSTRING as r, BLR_DOUBLE as s, BLR_BLOB as t, BLR_EX_TIME_TZ as u, BLR_SQL_TIME as v, BLR_VARYING as w, BLR_TEXT2 as x, BLR_SQL_TIME_TZ as y };
@@ -31,5 +31,6 @@ declare class FirebirdUnsupportedFieldTypeError extends Error {
31
31
  }
32
32
  declare function decodeBlrType(blrType: number): FirebirdPhysicalType;
33
33
  declare function describeFieldType(physical: FirebirdPhysicalType, lengthBytes: number, scale: number, characterLength: number | undefined, subType: number): string;
34
+ declare function assertNeverPhysical(value: never): never;
34
35
  //#endregion
35
- export { BLR_TIMESTAMP_TZ as C, FirebirdUnsupportedFieldTypeError as D, FirebirdPhysicalType as E, decodeBlrType as O, BLR_TIMESTAMP as S, BLR_VARYING2 as T, BLR_SQL_DATE as _, BLR_DEC128 as a, BLR_TEXT as b, BLR_D_FLOAT as c, BLR_FLOAT as d, BLR_INT128 as f, BLR_SHORT as g, BLR_QUAD as h, BLR_CSTRING2 as i, describeFieldType as k, BLR_EX_TIMESTAMP_TZ as l, BLR_LONG as m, BLR_BOOL as n, BLR_DEC64 as o, BLR_INT64 as p, BLR_CSTRING as r, BLR_DOUBLE as s, BLR_BLOB as t, BLR_EX_TIME_TZ as u, BLR_SQL_TIME as v, BLR_VARYING as w, BLR_TEXT2 as x, BLR_SQL_TIME_TZ as y };
36
+ export { describeFieldType as A, BLR_TIMESTAMP_TZ as C, FirebirdUnsupportedFieldTypeError as D, FirebirdPhysicalType as E, assertNeverPhysical as O, BLR_TIMESTAMP as S, BLR_VARYING2 as T, BLR_SQL_DATE as _, BLR_DEC128 as a, BLR_TEXT as b, BLR_D_FLOAT as c, BLR_FLOAT as d, BLR_INT128 as f, BLR_SHORT as g, BLR_QUAD as h, BLR_CSTRING2 as i, decodeBlrType as k, BLR_EX_TIMESTAMP_TZ as l, BLR_LONG as m, BLR_BOOL as n, BLR_DEC64 as o, BLR_INT64 as p, BLR_CSTRING as r, BLR_DOUBLE as s, BLR_BLOB as t, BLR_EX_TIME_TZ as u, BLR_SQL_TIME as v, BLR_VARYING as w, BLR_TEXT2 as x, BLR_SQL_TIME_TZ as y };
@@ -39,71 +39,6 @@ require("markdown-codec");
39
39
  let wpd_codec = require("wpd-codec");
40
40
  let pdf_codec_read = require("pdf-codec/read");
41
41
  //#region src/convert/composition.ts
42
- const CONTENT_FORMATS = [
43
- "docx",
44
- "pptx",
45
- "xlsx",
46
- "odt",
47
- "odp",
48
- "ods",
49
- "odg",
50
- "svg",
51
- "csv",
52
- "markdown",
53
- "rtf",
54
- "doc",
55
- "xls",
56
- "ppt",
57
- "epub"
58
- ];
59
- function isTextFormatNode(node) {
60
- return !node.hasSourcePackage;
61
- }
62
- const READ_ONLY_CONTENT_FORMATS = ["wpd"];
63
- const READ_ONLY_FORMAT_NODES = { wpd: {
64
- variant: "wordprocessing",
65
- read: (bytes) => (0, wpd_codec.readWpdContent)(bytes)
66
- } };
67
- function isReadOnlyContentFormat(format) {
68
- return READ_ONLY_CONTENT_FORMATS.includes(format);
69
- }
70
- function readSourceContent(format, bytes, options) {
71
- if (isReadOnlyContentFormat(format)) {
72
- const node = READ_ONLY_FORMAT_NODES[format];
73
- return {
74
- content: node.read(bytes, options),
75
- variant: node.variant
76
- };
77
- }
78
- const node = FORMAT_NODES[format];
79
- if (isTextFormatNode(node)) {
80
- const text = node.decode(bytes);
81
- return {
82
- content: node.read(text, options),
83
- variant: node.variant
84
- };
85
- }
86
- const pkg = node.decode(bytes);
87
- return {
88
- content: node.read(pkg, options),
89
- variant: node.variant
90
- };
91
- }
92
- const LATIN1_CHUNK_SIZE = 8192;
93
- function bytesToLatin1(bytes) {
94
- let text = "";
95
- for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
96
- return text;
97
- }
98
- function latin1ToBytes(text) {
99
- const bytes = new Uint8Array(text.length);
100
- for (let index = 0; index < text.length; index += 1) {
101
- const code = text.charCodeAt(index);
102
- if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
103
- bytes[index] = code;
104
- }
105
- return bytes;
106
- }
107
42
  const FORMAT_NODES = {
108
43
  docx: {
109
44
  variant: "wordprocessing",
@@ -268,6 +203,71 @@ const FORMAT_NODES = {
268
203
  hasSourcePackage: false
269
204
  }
270
205
  };
206
+ const CONTENT_FORMATS = [
207
+ "docx",
208
+ "pptx",
209
+ "xlsx",
210
+ "odt",
211
+ "odp",
212
+ "ods",
213
+ "odg",
214
+ "svg",
215
+ "csv",
216
+ "markdown",
217
+ "rtf",
218
+ "doc",
219
+ "xls",
220
+ "ppt",
221
+ "epub"
222
+ ];
223
+ function isTextFormatNode(node) {
224
+ return !node.hasSourcePackage;
225
+ }
226
+ const READ_ONLY_CONTENT_FORMATS = ["wpd"];
227
+ const READ_ONLY_FORMAT_NODES = { wpd: {
228
+ variant: "wordprocessing",
229
+ read: (bytes) => (0, wpd_codec.readWpdContent)(bytes)
230
+ } };
231
+ function isReadOnlyContentFormat(format) {
232
+ return READ_ONLY_CONTENT_FORMATS.includes(format);
233
+ }
234
+ function readSourceContent(format, bytes, options) {
235
+ if (isReadOnlyContentFormat(format)) {
236
+ const node = READ_ONLY_FORMAT_NODES[format];
237
+ return {
238
+ content: node.read(bytes, options),
239
+ variant: node.variant
240
+ };
241
+ }
242
+ const node = FORMAT_NODES[format];
243
+ if (isTextFormatNode(node)) {
244
+ const text = node.decode(bytes);
245
+ return {
246
+ content: node.read(text, options),
247
+ variant: node.variant
248
+ };
249
+ }
250
+ const pkg = node.decode(bytes);
251
+ return {
252
+ content: node.read(pkg, options),
253
+ variant: node.variant
254
+ };
255
+ }
256
+ const LATIN1_CHUNK_SIZE = 8192;
257
+ function bytesToLatin1(bytes) {
258
+ let text = "";
259
+ for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
260
+ return text;
261
+ }
262
+ function latin1ToBytes(text) {
263
+ const bytes = new Uint8Array(text.length);
264
+ for (let index = 0; index < text.length; index += 1) {
265
+ const code = text.charCodeAt(index);
266
+ if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
267
+ bytes[index] = code;
268
+ }
269
+ return bytes;
270
+ }
271
271
  const LAYOUT_CAPABLE = /* @__PURE__ */ new Set([
272
272
  "docx",
273
273
  "pptx",
@@ -9,6 +9,7 @@ import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
9
9
  import { MarkdownImageResolver } from "markdown-codec";
10
10
  import { Package } from "ooxml.js";
11
11
  //#region src/convert/composition.d.ts
12
+ declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
12
13
  type SourcePackage = Package;
13
14
  interface UnifiedConversionOptions {
14
15
  readonly signal?: AbortSignal;
@@ -60,7 +61,6 @@ interface ReadOnlyFormatNode {
60
61
  declare const READ_ONLY_FORMAT_NODES: Readonly<Record<ReadOnlyContentFormat, ReadOnlyFormatNode>>;
61
62
  type SourceContentFormat = ContentFormat | ReadOnlyContentFormat;
62
63
  declare function isReadOnlyContentFormat(format: DocumentFormat): format is ReadOnlyContentFormat;
63
- declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
64
64
  declare const LAYOUT_CAPABLE: ReadonlySet<SourceContentFormat>;
65
65
  declare function executeBridge(source: SourceContentFormat, target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
66
66
  declare function executeFromPdf(target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
@@ -9,6 +9,7 @@ import { ContentDocument, DocumentTree, FontSubstitution, ProvidedFont } from "d
9
9
  import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
10
10
  import { MarkdownImageResolver } from "markdown-codec";
11
11
  //#region src/convert/composition.d.ts
12
+ declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
12
13
  type SourcePackage = Package;
13
14
  interface UnifiedConversionOptions {
14
15
  readonly signal?: AbortSignal;
@@ -60,7 +61,6 @@ interface ReadOnlyFormatNode {
60
61
  declare const READ_ONLY_FORMAT_NODES: Readonly<Record<ReadOnlyContentFormat, ReadOnlyFormatNode>>;
61
62
  type SourceContentFormat = ContentFormat | ReadOnlyContentFormat;
62
63
  declare function isReadOnlyContentFormat(format: DocumentFormat): format is ReadOnlyContentFormat;
63
- declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
64
64
  declare const LAYOUT_CAPABLE: ReadonlySet<SourceContentFormat>;
65
65
  declare function executeBridge(source: SourceContentFormat, target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
66
66
  declare function executeFromPdf(target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
@@ -38,71 +38,6 @@ import "markdown-codec";
38
38
  import { readWpdContent } from "wpd-codec";
39
39
  import { readPdf } from "pdf-codec/read";
40
40
  //#region src/convert/composition.ts
41
- const CONTENT_FORMATS = [
42
- "docx",
43
- "pptx",
44
- "xlsx",
45
- "odt",
46
- "odp",
47
- "ods",
48
- "odg",
49
- "svg",
50
- "csv",
51
- "markdown",
52
- "rtf",
53
- "doc",
54
- "xls",
55
- "ppt",
56
- "epub"
57
- ];
58
- function isTextFormatNode(node) {
59
- return !node.hasSourcePackage;
60
- }
61
- const READ_ONLY_CONTENT_FORMATS = ["wpd"];
62
- const READ_ONLY_FORMAT_NODES = { wpd: {
63
- variant: "wordprocessing",
64
- read: (bytes) => readWpdContent(bytes)
65
- } };
66
- function isReadOnlyContentFormat(format) {
67
- return READ_ONLY_CONTENT_FORMATS.includes(format);
68
- }
69
- function readSourceContent(format, bytes, options) {
70
- if (isReadOnlyContentFormat(format)) {
71
- const node = READ_ONLY_FORMAT_NODES[format];
72
- return {
73
- content: node.read(bytes, options),
74
- variant: node.variant
75
- };
76
- }
77
- const node = FORMAT_NODES[format];
78
- if (isTextFormatNode(node)) {
79
- const text = node.decode(bytes);
80
- return {
81
- content: node.read(text, options),
82
- variant: node.variant
83
- };
84
- }
85
- const pkg = node.decode(bytes);
86
- return {
87
- content: node.read(pkg, options),
88
- variant: node.variant
89
- };
90
- }
91
- const LATIN1_CHUNK_SIZE = 8192;
92
- function bytesToLatin1(bytes) {
93
- let text = "";
94
- for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
95
- return text;
96
- }
97
- function latin1ToBytes(text) {
98
- const bytes = new Uint8Array(text.length);
99
- for (let index = 0; index < text.length; index += 1) {
100
- const code = text.charCodeAt(index);
101
- if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
102
- bytes[index] = code;
103
- }
104
- return bytes;
105
- }
106
41
  const FORMAT_NODES = {
107
42
  docx: {
108
43
  variant: "wordprocessing",
@@ -267,6 +202,71 @@ const FORMAT_NODES = {
267
202
  hasSourcePackage: false
268
203
  }
269
204
  };
205
+ const CONTENT_FORMATS = [
206
+ "docx",
207
+ "pptx",
208
+ "xlsx",
209
+ "odt",
210
+ "odp",
211
+ "ods",
212
+ "odg",
213
+ "svg",
214
+ "csv",
215
+ "markdown",
216
+ "rtf",
217
+ "doc",
218
+ "xls",
219
+ "ppt",
220
+ "epub"
221
+ ];
222
+ function isTextFormatNode(node) {
223
+ return !node.hasSourcePackage;
224
+ }
225
+ const READ_ONLY_CONTENT_FORMATS = ["wpd"];
226
+ const READ_ONLY_FORMAT_NODES = { wpd: {
227
+ variant: "wordprocessing",
228
+ read: (bytes) => readWpdContent(bytes)
229
+ } };
230
+ function isReadOnlyContentFormat(format) {
231
+ return READ_ONLY_CONTENT_FORMATS.includes(format);
232
+ }
233
+ function readSourceContent(format, bytes, options) {
234
+ if (isReadOnlyContentFormat(format)) {
235
+ const node = READ_ONLY_FORMAT_NODES[format];
236
+ return {
237
+ content: node.read(bytes, options),
238
+ variant: node.variant
239
+ };
240
+ }
241
+ const node = FORMAT_NODES[format];
242
+ if (isTextFormatNode(node)) {
243
+ const text = node.decode(bytes);
244
+ return {
245
+ content: node.read(text, options),
246
+ variant: node.variant
247
+ };
248
+ }
249
+ const pkg = node.decode(bytes);
250
+ return {
251
+ content: node.read(pkg, options),
252
+ variant: node.variant
253
+ };
254
+ }
255
+ const LATIN1_CHUNK_SIZE = 8192;
256
+ function bytesToLatin1(bytes) {
257
+ let text = "";
258
+ for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
259
+ return text;
260
+ }
261
+ function latin1ToBytes(text) {
262
+ const bytes = new Uint8Array(text.length);
263
+ for (let index = 0; index < text.length; index += 1) {
264
+ const code = text.charCodeAt(index);
265
+ if (code > 255) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(16).toUpperCase().padStart(4, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
266
+ bytes[index] = code;
267
+ }
268
+ return bytes;
269
+ }
270
270
  const LAYOUT_CAPABLE = /* @__PURE__ */ new Set([
271
271
  "docx",
272
272
  "pptx",
@@ -278,7 +278,7 @@ function physicalCells(cells) {
278
278
  function verticalSpan(rowsBelow, columnIndex) {
279
279
  let span = 1;
280
280
  for (const row of rowsBelow) {
281
- if (!row.find((cell) => cell.columnIndex === columnIndex)?.continuesVerticalMerge) break;
281
+ if (row.find((cell) => cell.columnIndex === columnIndex)?.continuesVerticalMerge !== true) break;
282
282
  span++;
283
283
  }
284
284
  return span;
@@ -277,7 +277,7 @@ function physicalCells(cells) {
277
277
  function verticalSpan(rowsBelow, columnIndex) {
278
278
  let span = 1;
279
279
  for (const row of rowsBelow) {
280
- if (!row.find((cell) => cell.columnIndex === columnIndex)?.continuesVerticalMerge) break;
280
+ if (row.find((cell) => cell.columnIndex === columnIndex)?.continuesVerticalMerge !== true) break;
281
281
  span++;
282
282
  }
283
283
  return span;
@@ -1,6 +1,6 @@
1
1
  import { t as ImageInit } from "../../image-D1z0T9Za.cjs";
2
2
  import { t as OdpShape } from "../../shape-Kmmxib5z.cjs";
3
- import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-DDP7hgvm.cjs";
3
+ import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-DWSXN_G2.cjs";
4
4
  import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "odf.js";
6
6
  //#region src/edit/odg/page.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as ImageInit } from "../../image-D1z0T9Za.js";
2
2
  import { t as OdpShape } from "../../shape-ZAfNsCC5.js";
3
- import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-DDP7hgvm.js";
3
+ import { a as OdgLineVector, l as PathVectorInit, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit } from "../../vector-DWSXN_G2.js";
4
4
  import { Box, ContentVector } from "document-schema.js";
5
5
  import { Package, XmlElement, XmlNode } from "odf.js";
6
6
  //#region src/edit/odg/page.d.ts
@@ -238,6 +238,7 @@ function appendVectorTo(container, pkg, vector, options) {
238
238
  case "rect":
239
239
  case "ellipse": return new OdgBoxVector(container, element, pkg);
240
240
  }
241
+ return assertNeverVectorKind(vector);
241
242
  }
242
243
  function buildUnanchoredVectorElement(pkg, vector, textFlowAnchored) {
243
244
  if (vector.kind === "line") return buildLineElement(pkg, {
@@ -266,11 +267,15 @@ function buildUnanchoredVectorElement(pkg, vector, textFlowAnchored) {
266
267
  if (vector.rotationDeg !== void 0) require_edit_geometry.applyOdfGeometry(element, vector.frame, vector.rotationDeg);
267
268
  return element;
268
269
  }
270
+ function assertNeverVectorKind(value) {
271
+ throw new Error(`documents.js: unhandled vector ${JSON.stringify(value)}`);
272
+ }
269
273
  //#endregion
270
274
  exports.OdgBoxVector = OdgBoxVector;
271
275
  exports.OdgLineVector = OdgLineVector;
272
276
  exports.OdgPathVector = OdgPathVector;
273
277
  exports.appendVectorTo = appendVectorTo;
278
+ exports.assertNeverVectorKind = assertNeverVectorKind;
274
279
  exports.buildEllipseElement = buildEllipseElement;
275
280
  exports.buildLineElement = buildLineElement;
276
281
  exports.buildPathElement = buildPathElement;
@@ -1,2 +1,2 @@
1
- import { _ as wrapVectorElement, a as OdgLineVector, c as OdgVectorKind, d as appendVectorTo, f as buildEllipseElement, g as buildVectorElement, h as buildRectElement, i as OdgBoxVectorKind, l as PathVectorInit, m as buildPathElement, n as LineVectorInit, o as OdgPathVector, p as buildLineElement, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit, u as VectorElementOptions } from "../../vector-DDP7hgvm.cjs";
2
- export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, OdgVector, OdgVectorKind, PathVectorInit, VectorElementOptions, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
1
+ import { _ as buildVectorElement, a as OdgLineVector, c as OdgVectorKind, d as appendVectorTo, f as assertNeverVectorKind, g as buildRectElement, h as buildPathElement, i as OdgBoxVectorKind, l as PathVectorInit, m as buildLineElement, n as LineVectorInit, o as OdgPathVector, p as buildEllipseElement, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit, u as VectorElementOptions, v as wrapVectorElement } from "../../vector-DWSXN_G2.cjs";
2
+ export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, OdgVector, OdgVectorKind, PathVectorInit, VectorElementOptions, appendVectorTo, assertNeverVectorKind, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
@@ -1,2 +1,2 @@
1
- import { _ as wrapVectorElement, a as OdgLineVector, c as OdgVectorKind, d as appendVectorTo, f as buildEllipseElement, g as buildVectorElement, h as buildRectElement, i as OdgBoxVectorKind, l as PathVectorInit, m as buildPathElement, n as LineVectorInit, o as OdgPathVector, p as buildLineElement, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit, u as VectorElementOptions } from "../../vector-DDP7hgvm.js";
2
- export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, OdgVector, OdgVectorKind, PathVectorInit, VectorElementOptions, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
1
+ import { _ as buildVectorElement, a as OdgLineVector, c as OdgVectorKind, d as appendVectorTo, f as assertNeverVectorKind, g as buildRectElement, h as buildPathElement, i as OdgBoxVectorKind, l as PathVectorInit, m as buildLineElement, n as LineVectorInit, o as OdgPathVector, p as buildEllipseElement, r as OdgBoxVector, s as OdgVector, t as BoxVectorInit, u as VectorElementOptions, v as wrapVectorElement } from "../../vector-DWSXN_G2.js";
2
+ export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, OdgVector, OdgVectorKind, PathVectorInit, VectorElementOptions, appendVectorTo, assertNeverVectorKind, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
@@ -237,6 +237,7 @@ function appendVectorTo(container, pkg, vector, options) {
237
237
  case "rect":
238
238
  case "ellipse": return new OdgBoxVector(container, element, pkg);
239
239
  }
240
+ return assertNeverVectorKind(vector);
240
241
  }
241
242
  function buildUnanchoredVectorElement(pkg, vector, textFlowAnchored) {
242
243
  if (vector.kind === "line") return buildLineElement(pkg, {
@@ -265,5 +266,8 @@ function buildUnanchoredVectorElement(pkg, vector, textFlowAnchored) {
265
266
  if (vector.rotationDeg !== void 0) applyOdfGeometry(element, vector.frame, vector.rotationDeg);
266
267
  return element;
267
268
  }
269
+ function assertNeverVectorKind(value) {
270
+ throw new Error(`documents.js: unhandled vector ${JSON.stringify(value)}`);
271
+ }
268
272
  //#endregion
269
- export { OdgBoxVector, OdgLineVector, OdgPathVector, appendVectorTo, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
273
+ export { OdgBoxVector, OdgLineVector, OdgPathVector, appendVectorTo, assertNeverVectorKind, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement, buildVectorElement, wrapVectorElement };
@@ -1,6 +1,6 @@
1
1
  import { t as ImageInit } from "../../image-D1z0T9Za.cjs";
2
2
  import { t as OdpShape } from "../../shape-Kmmxib5z.cjs";
3
- import { s as OdgVector } from "../../vector-DDP7hgvm.cjs";
3
+ import { s as OdgVector } from "../../vector-DWSXN_G2.cjs";
4
4
  import { o as TableInit, r as OdtTable } from "../../table-DrE6jEWv.cjs";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "odf.js";
@@ -1,6 +1,6 @@
1
1
  import { t as ImageInit } from "../../image-D1z0T9Za.js";
2
2
  import { t as OdpShape } from "../../shape-ZAfNsCC5.js";
3
- import { s as OdgVector } from "../../vector-DDP7hgvm.js";
3
+ import { s as OdgVector } from "../../vector-DWSXN_G2.js";
4
4
  import { o as TableInit, r as OdtTable } from "../../table-B5htMG3g.js";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "odf.js";
@@ -25,7 +25,7 @@ function nextStyleName(automaticStyles, tag, prefix) {
25
25
  for (const child of automaticStyles.children) {
26
26
  if (child.type !== "element" || child.tag !== tag) continue;
27
27
  const name = (0, ooxml_js.attr)(child, "style:name");
28
- if (!name?.startsWith(prefix)) continue;
28
+ if (name?.startsWith(prefix) !== true) continue;
29
29
  const rest = name.slice(prefix.length);
30
30
  const n = Number.parseInt(rest, 10);
31
31
  if (!Number.isNaN(n) && String(n) === rest && n > max) max = n;
@@ -24,7 +24,7 @@ function nextStyleName(automaticStyles, tag, prefix) {
24
24
  for (const child of automaticStyles.children) {
25
25
  if (child.type !== "element" || child.tag !== tag) continue;
26
26
  const name = attr(child, "style:name");
27
- if (!name?.startsWith(prefix)) continue;
27
+ if (name?.startsWith(prefix) !== true) continue;
28
28
  const rest = name.slice(prefix.length);
29
29
  const n = Number.parseInt(rest, 10);
30
30
  if (!Number.isNaN(n) && String(n) === rest && n > max) max = n;
@@ -10,6 +10,38 @@ const require_edit_odt_editor = require("./editor.cjs");
10
10
  let document_schema_js = require("document-schema.js");
11
11
  let odf_js = require("odf.js");
12
12
  //#region src/edit/odt/content.ts
13
+ var ConstructMarkerState = class {
14
+ open = [];
15
+ openConstruct(body, marker) {
16
+ const detail = marker.descriptor;
17
+ if (detail.kind === "anchor" && detail.anchorType === "bookmark") {
18
+ this.open.push({
19
+ kind: "bookmark",
20
+ name: detail.name
21
+ });
22
+ body.appendBookmarkStart(detail.name);
23
+ return;
24
+ }
25
+ if (detail.kind === "division") {
26
+ this.open.push({ kind: "region" });
27
+ body.openDivisionRegion(detail);
28
+ return;
29
+ }
30
+ if (detail.kind === "contentControl" && detail.controlType === "index") {
31
+ if (body.openIndexRegion(detail)) {
32
+ this.open.push({ kind: "region" });
33
+ return;
34
+ }
35
+ }
36
+ this.open.push({ kind: "dropped" });
37
+ }
38
+ closeConstruct(body) {
39
+ const entry = this.open.pop();
40
+ if (entry === void 0) return;
41
+ if (entry.kind === "bookmark") body.appendBookmarkEnd(entry.name);
42
+ else if (entry.kind === "region") body.closeRegion();
43
+ }
44
+ };
13
45
  function buildOdtPackage(content, options) {
14
46
  if (content.kind !== "wordprocessing") throw new Error("buildOdtPackage requires a wordprocessing ContentDocument");
15
47
  const clock = options?.clock ?? require_ports_clock.systemClock;
@@ -190,38 +222,6 @@ function appendCellBlock(cell, block) {
190
222
  altText: block.altText
191
223
  });
192
224
  }
193
- var ConstructMarkerState = class {
194
- open = [];
195
- openConstruct(body, marker) {
196
- const detail = marker.descriptor;
197
- if (detail.kind === "anchor" && detail.anchorType === "bookmark") {
198
- this.open.push({
199
- kind: "bookmark",
200
- name: detail.name
201
- });
202
- body.appendBookmarkStart(detail.name);
203
- return;
204
- }
205
- if (detail.kind === "division") {
206
- this.open.push({ kind: "region" });
207
- body.openDivisionRegion(detail);
208
- return;
209
- }
210
- if (detail.kind === "contentControl" && detail.controlType === "index") {
211
- if (body.openIndexRegion(detail)) {
212
- this.open.push({ kind: "region" });
213
- return;
214
- }
215
- }
216
- this.open.push({ kind: "dropped" });
217
- }
218
- closeConstruct(body) {
219
- const entry = this.open.pop();
220
- if (entry === void 0) return;
221
- if (entry.kind === "bookmark") body.appendBookmarkEnd(entry.name);
222
- else if (entry.kind === "region") body.closeRegion();
223
- }
224
- };
225
225
  function appendBlock(body, block, markers) {
226
226
  if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block, { headings: "element" });
227
227
  else if (block.kind === "image") body.appendParagraph().insertImageAfter({
@@ -9,6 +9,38 @@ import { OdtEditor } from "./editor.js";
9
9
  import { resolveCellFillColor, tableCellColumnSpan, tableCellRowSpan, tableGridColumnCount, walkTableGrid } from "document-schema.js";
10
10
  import { base64ToBytes } from "odf.js";
11
11
  //#region src/edit/odt/content.ts
12
+ var ConstructMarkerState = class {
13
+ open = [];
14
+ openConstruct(body, marker) {
15
+ const detail = marker.descriptor;
16
+ if (detail.kind === "anchor" && detail.anchorType === "bookmark") {
17
+ this.open.push({
18
+ kind: "bookmark",
19
+ name: detail.name
20
+ });
21
+ body.appendBookmarkStart(detail.name);
22
+ return;
23
+ }
24
+ if (detail.kind === "division") {
25
+ this.open.push({ kind: "region" });
26
+ body.openDivisionRegion(detail);
27
+ return;
28
+ }
29
+ if (detail.kind === "contentControl" && detail.controlType === "index") {
30
+ if (body.openIndexRegion(detail)) {
31
+ this.open.push({ kind: "region" });
32
+ return;
33
+ }
34
+ }
35
+ this.open.push({ kind: "dropped" });
36
+ }
37
+ closeConstruct(body) {
38
+ const entry = this.open.pop();
39
+ if (entry === void 0) return;
40
+ if (entry.kind === "bookmark") body.appendBookmarkEnd(entry.name);
41
+ else if (entry.kind === "region") body.closeRegion();
42
+ }
43
+ };
12
44
  function buildOdtPackage(content, options) {
13
45
  if (content.kind !== "wordprocessing") throw new Error("buildOdtPackage requires a wordprocessing ContentDocument");
14
46
  const clock = options?.clock ?? systemClock;
@@ -189,38 +221,6 @@ function appendCellBlock(cell, block) {
189
221
  altText: block.altText
190
222
  });
191
223
  }
192
- var ConstructMarkerState = class {
193
- open = [];
194
- openConstruct(body, marker) {
195
- const detail = marker.descriptor;
196
- if (detail.kind === "anchor" && detail.anchorType === "bookmark") {
197
- this.open.push({
198
- kind: "bookmark",
199
- name: detail.name
200
- });
201
- body.appendBookmarkStart(detail.name);
202
- return;
203
- }
204
- if (detail.kind === "division") {
205
- this.open.push({ kind: "region" });
206
- body.openDivisionRegion(detail);
207
- return;
208
- }
209
- if (detail.kind === "contentControl" && detail.controlType === "index") {
210
- if (body.openIndexRegion(detail)) {
211
- this.open.push({ kind: "region" });
212
- return;
213
- }
214
- }
215
- this.open.push({ kind: "dropped" });
216
- }
217
- closeConstruct(body) {
218
- const entry = this.open.pop();
219
- if (entry === void 0) return;
220
- if (entry.kind === "bookmark") body.appendBookmarkEnd(entry.name);
221
- else if (entry.kind === "region") body.closeRegion();
222
- }
223
- };
224
224
  function appendBlock(body, block, markers) {
225
225
  if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block, { headings: "element" });
226
226
  else if (block.kind === "image") body.appendParagraph().insertImageAfter({
@@ -314,7 +314,7 @@ function regionContains(outer, inner) {
314
314
  }
315
315
  function anchorRegions(grid) {
316
316
  return grid.rows.flatMap((positions, row) => positions.flatMap((position, column) => {
317
- if (!position?.isAnchor) return [];
317
+ if (position?.isAnchor !== true) return [];
318
318
  const spans = {
319
319
  blocks: [],
320
320
  colSpan: position.cell.colSpan,
@@ -313,7 +313,7 @@ function regionContains(outer, inner) {
313
313
  }
314
314
  function anchorRegions(grid) {
315
315
  return grid.rows.flatMap((positions, row) => positions.flatMap((position, column) => {
316
- if (!position?.isAnchor) return [];
316
+ if (position?.isAnchor !== true) return [];
317
317
  const spans = {
318
318
  blocks: [],
319
319
  colSpan: position.cell.colSpan,