js.documents 14.4.56 → 14.4.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codecs/read.cjs +2 -2
- package/dist/codecs/read.js +1 -1
- package/dist/composition-plan-CfvhXeOC.cjs +627 -0
- package/dist/composition-plan-DU9nPPN7.d.cts +102 -0
- package/dist/composition-plan-f0zaExUW.js +508 -0
- package/dist/composition-plan-l6QPO4FX.d.ts +102 -0
- package/dist/convert/composition-plan.cjs +7 -0
- package/dist/convert/composition-plan.d.cts +2 -0
- package/dist/convert/composition-plan.d.ts +2 -0
- package/dist/convert/composition-plan.js +2 -0
- package/dist/convert/composition-to-pdf.cjs +12 -12
- package/dist/convert/composition-to-pdf.d.cts +1 -1
- package/dist/convert/composition-to-pdf.d.ts +1 -1
- package/dist/convert/composition-to-pdf.js +2 -2
- package/dist/convert/composition.cjs +16 -511
- package/dist/convert/composition.d.cts +2 -85
- package/dist/convert/composition.d.ts +2 -85
- package/dist/convert/composition.js +2 -502
- package/dist/convert/convert.cjs +2 -2
- package/dist/convert/convert.js +1 -1
- package/dist/convert/from-package.cjs +3 -3
- package/dist/convert/from-package.js +2 -2
- package/dist/convert/from-pdf.cjs +18 -18
- package/dist/convert/from-pdf.js +2 -2
- package/dist/convert/local.cjs +3 -3
- package/dist/convert/local.js +1 -1
- package/dist/edit/odp/slide.cjs +4 -4
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/odp/slide.js +1 -1
- package/dist/edit/odt/content.d.cts +1 -1
- package/dist/edit/odt/content.d.ts +1 -1
- package/dist/edit/odt/editor.cjs +4 -4
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/editor.js +1 -1
- package/dist/edit/odt/table-grid.cjs +23 -0
- package/dist/edit/odt/table-grid.d.cts +54 -0
- package/dist/edit/odt/table-grid.d.ts +54 -0
- package/dist/edit/odt/table-grid.js +2 -0
- package/dist/edit/odt/table.cjs +12 -653
- package/dist/edit/odt/table.d.cts +2 -2
- package/dist/edit/odt/table.d.ts +2 -2
- package/dist/edit/odt/table.js +2 -647
- package/dist/{evaluate-BbOsgdmN.d.cts → evaluate-BSEUxiUK.d.cts} +3 -1
- package/dist/evaluate-CEzsBx3w.cjs +564 -0
- package/dist/{evaluate-C7fmk69X.d.ts → evaluate-D8fG2ZeB.d.ts} +3 -1
- package/dist/evaluate-IK-3aMv5.js +445 -0
- package/dist/evaluate-columns-CyqKHkIW.d.cts +41 -0
- package/dist/evaluate-columns-cOo8fOfT.d.ts +41 -0
- package/dist/index.cjs +24 -24
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +8 -8
- package/dist/latex/lint.cjs +2 -2
- package/dist/latex/lint.js +1 -1
- package/dist/latex/lower-fold.cjs +6 -0
- package/dist/latex/lower-fold.d.cts +17 -0
- package/dist/latex/lower-fold.d.ts +17 -0
- package/dist/latex/lower-fold.js +2 -0
- package/dist/latex/lower.cjs +11 -617
- package/dist/latex/lower.d.cts +18 -1
- package/dist/latex/lower.d.ts +18 -1
- package/dist/latex/lower.js +2 -616
- package/dist/latex/symbols.d.cts +1 -15
- package/dist/latex/symbols.d.ts +1 -15
- package/dist/latex/temml.d.cts +1 -24
- package/dist/latex/temml.d.ts +1 -24
- package/dist/layout/engine.cjs +2 -2
- package/dist/layout/engine.js +1 -1
- package/dist/layout/reconstruct-lines.cjs +315 -0
- package/dist/layout/reconstruct-lines.d.cts +2 -0
- package/dist/layout/reconstruct-lines.d.ts +2 -0
- package/dist/layout/reconstruct-lines.js +297 -0
- package/dist/layout/reconstruct-presentations-prod.cjs +9 -0
- package/dist/layout/reconstruct-presentations-prod.d.cts +26 -0
- package/dist/layout/reconstruct-presentations-prod.d.ts +26 -0
- package/dist/layout/reconstruct-presentations-prod.js +2 -0
- package/dist/layout/reconstruct-tables.cjs +5 -0
- package/dist/layout/reconstruct-tables.d.cts +22 -0
- package/dist/layout/reconstruct-tables.d.ts +22 -0
- package/dist/layout/reconstruct-tables.js +2 -0
- package/dist/layout/reconstruct.cjs +11 -1545
- package/dist/layout/reconstruct.d.cts +2 -14
- package/dist/layout/reconstruct.d.ts +2 -14
- package/dist/layout/reconstruct.js +2 -1542
- package/dist/layout/shared.cjs +2 -2
- package/dist/layout/shared.js +1 -1
- package/dist/layout/sheets-render.cjs +19 -0
- package/dist/layout/sheets-render.d.cts +41 -0
- package/dist/layout/sheets-render.d.ts +41 -0
- package/dist/layout/sheets-render.js +2 -0
- package/dist/layout/sheets.cjs +10 -544
- package/dist/layout/sheets.d.cts +13 -2
- package/dist/layout/sheets.d.ts +13 -2
- package/dist/layout/sheets.js +2 -543
- package/dist/layout/slides.cjs +2 -2
- package/dist/layout/slides.js +1 -1
- package/dist/layout-DIJzJk4x.js +526 -0
- package/dist/layout-iuiyl_Fk.cjs +621 -0
- package/dist/layout-types-oSbHvZid.d.cts +13 -0
- package/dist/layout-types-oSbHvZid.d.ts +13 -0
- package/dist/lower-DCs3rWI7.js +618 -0
- package/dist/lower-DzOb13w4.cjs +701 -0
- package/dist/markdown/math.cjs +2 -2
- package/dist/markdown/math.js +1 -1
- package/dist/mathml/layout-stretch.cjs +16 -0
- package/dist/mathml/layout-stretch.d.cts +24 -0
- package/dist/mathml/layout-stretch.d.ts +24 -0
- package/dist/mathml/layout-stretch.js +2 -0
- package/dist/mathml/layout-types.d.cts +1 -12
- package/dist/mathml/layout-types.d.ts +1 -12
- package/dist/mathml/layout.cjs +3 -525
- package/dist/mathml/layout.d.cts +2 -2
- package/dist/mathml/layout.d.ts +2 -2
- package/dist/mathml/layout.js +1 -523
- package/dist/odb/formula/evaluate.d.cts +1 -1
- package/dist/odb/formula/evaluate.d.ts +1 -1
- package/dist/odb/report/render.d.cts +1 -1
- package/dist/odb/report/render.d.ts +1 -1
- package/dist/odb/report/source.cjs +2 -2
- package/dist/odb/report/source.d.cts +1 -1
- package/dist/odb/report/source.d.ts +1 -1
- package/dist/odb/report/source.js +1 -1
- package/dist/odb/sql/evaluate-columns.cjs +122 -0
- package/dist/odb/sql/evaluate-columns.d.cts +2 -0
- package/dist/odb/sql/evaluate-columns.d.ts +2 -0
- package/dist/odb/sql/evaluate-columns.js +114 -0
- package/dist/odb/sql/evaluate-predicates.cjs +16 -0
- package/dist/odb/sql/evaluate-predicates.d.cts +23 -0
- package/dist/odb/sql/evaluate-predicates.d.ts +23 -0
- package/dist/odb/sql/evaluate-predicates.js +2 -0
- package/dist/odb/sql/evaluate.cjs +7 -556
- package/dist/odb/sql/evaluate.d.cts +2 -2
- package/dist/odb/sql/evaluate.d.ts +2 -2
- package/dist/odb/sql/evaluate.js +2 -552
- package/dist/read-BSH--XB4.js +682 -0
- package/dist/read-CahCZMwG.cjs +759 -0
- package/dist/reconstruct-BKOCAedo.d.ts +29 -0
- package/dist/reconstruct-D4TEteZ6.d.cts +29 -0
- package/dist/reconstruct-lines-B7t66ICm.d.cts +33 -0
- package/dist/reconstruct-lines-B7t66ICm.d.ts +33 -0
- package/dist/reconstruct-presentations-prod-B5fkPiRZ.js +1256 -0
- package/dist/reconstruct-presentations-prod-X315aBmI.cjs +1375 -0
- package/dist/sheets-BQCpNXsE.cjs +700 -0
- package/dist/sheets-DWDvGN-g.js +545 -0
- package/dist/svg/read-geometry.cjs +10 -0
- package/dist/svg/read-geometry.d.cts +24 -0
- package/dist/svg/read-geometry.d.ts +24 -0
- package/dist/svg/read-geometry.js +2 -0
- package/dist/svg/read.cjs +6 -680
- package/dist/svg/read.d.cts +17 -2
- package/dist/svg/read.d.ts +17 -2
- package/dist/svg/read.js +2 -679
- package/dist/symbols-BlzXfLEe.d.cts +16 -0
- package/dist/symbols-CKm2r4D0.d.ts +16 -0
- package/dist/table-B5gSMY7w.js +649 -0
- package/dist/{table-DrE6jEWv.d.cts → table-BK_Ao-Y6.d.cts} +9 -1
- package/dist/{table-B5htMG3g.d.ts → table-CxY85YUj.d.ts} +9 -1
- package/dist/table-DqUIOSPV.cjs +840 -0
- package/dist/temml-1-I9N9DD.d.cts +25 -0
- package/dist/temml-1-I9N9DD.d.ts +25 -0
- package/package.json +2 -2
|
@@ -1,85 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { t as ContentVariant } from "../capability-BmRwrPL9.js";
|
|
4
|
-
import { i as SvgDiagnosticSink } from "../diagnostics-DVAXKgcf.js";
|
|
5
|
-
import { i as CellTypeInferenceSink } from "../cell-typing-BQ-xQ5X5.js";
|
|
6
|
-
import { t as OmmlDiagnostic } from "../shared-DHu5jDJf.js";
|
|
7
|
-
import { Package } from "ooxml.js";
|
|
8
|
-
import { ContentDocument, DocumentTree, FontSubstitution, ProvidedFont } from "document-schema.js";
|
|
9
|
-
import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
|
|
10
|
-
import { MarkdownImageResolver } from "markdown-codec";
|
|
11
|
-
//#region src/convert/composition.d.ts
|
|
12
|
-
declare const FORMAT_NODES: Readonly<Record<ContentFormat, FormatNode>>;
|
|
13
|
-
type SourcePackage = Package;
|
|
14
|
-
interface UnifiedConversionOptions {
|
|
15
|
-
readonly signal?: AbortSignal;
|
|
16
|
-
readonly onDocument?: (pkg: DocumentTree) => void;
|
|
17
|
-
readonly fonts?: readonly ProvidedFont[];
|
|
18
|
-
readonly onFontSubstitution?: (substitution: FontSubstitution) => void;
|
|
19
|
-
readonly onSubstitution?: (substitution: WinAnsiSubstitution, context: {
|
|
20
|
-
readonly pageIndex: number;
|
|
21
|
-
}) => void;
|
|
22
|
-
readonly sink?: PdfDiagnosticSink;
|
|
23
|
-
readonly onMathDiagnostic?: (diagnostic: OmmlDiagnostic, context: {
|
|
24
|
-
readonly sourcePath?: string;
|
|
25
|
-
}) => void;
|
|
26
|
-
readonly images?: MarkdownImageResolver;
|
|
27
|
-
readonly delimiter?: string;
|
|
28
|
-
readonly sheet?: string;
|
|
29
|
-
readonly onCellTypeInference?: CellTypeInferenceSink;
|
|
30
|
-
readonly page?: number;
|
|
31
|
-
readonly onSvgDiagnostic?: SvgDiagnosticSink;
|
|
32
|
-
readonly clock?: ClockPort;
|
|
33
|
-
}
|
|
34
|
-
type ContentFormat = "docx" | "pptx" | "xlsx" | "odt" | "odp" | "ods" | "odg" | "svg" | "csv" | "markdown" | "rtf" | "doc" | "xls" | "ppt" | "epub";
|
|
35
|
-
type LayoutVariant = Exclude<ContentVariant, "formula">;
|
|
36
|
-
interface PackageFormatNode {
|
|
37
|
-
readonly variant: LayoutVariant;
|
|
38
|
-
readonly family: "ooxml" | "odf";
|
|
39
|
-
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => SourcePackage;
|
|
40
|
-
readonly read: (pkg: SourcePackage, options?: UnifiedConversionOptions) => ContentDocument;
|
|
41
|
-
readonly build: (content: ContentDocument, options?: UnifiedConversionOptions) => SourcePackage;
|
|
42
|
-
readonly encode: (pkg: SourcePackage) => Uint8Array<ArrayBuffer>;
|
|
43
|
-
readonly hasSourcePackage: true;
|
|
44
|
-
}
|
|
45
|
-
interface TextFormatNode {
|
|
46
|
-
readonly variant: LayoutVariant;
|
|
47
|
-
readonly family: "markdown" | "csv" | "svg" | "rtf" | "doc" | "xls" | "ppt" | "epub";
|
|
48
|
-
readonly decode: (bytes: Uint8Array<ArrayBuffer>) => string;
|
|
49
|
-
readonly read: (text: string, options?: UnifiedConversionOptions) => ContentDocument;
|
|
50
|
-
readonly build: (content: ContentDocument, options?: UnifiedConversionOptions) => string;
|
|
51
|
-
readonly encode: (text: string) => Uint8Array<ArrayBuffer>;
|
|
52
|
-
readonly hasSourcePackage: false;
|
|
53
|
-
}
|
|
54
|
-
type FormatNode = PackageFormatNode | TextFormatNode;
|
|
55
|
-
declare function isTextFormatNode(node: FormatNode): node is TextFormatNode;
|
|
56
|
-
type ReadOnlyContentFormat = "wpd";
|
|
57
|
-
interface ReadOnlyFormatNode {
|
|
58
|
-
readonly variant: LayoutVariant;
|
|
59
|
-
readonly read: (bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions) => ContentDocument;
|
|
60
|
-
}
|
|
61
|
-
declare const READ_ONLY_FORMAT_NODES: Readonly<Record<ReadOnlyContentFormat, ReadOnlyFormatNode>>;
|
|
62
|
-
type SourceContentFormat = ContentFormat | ReadOnlyContentFormat;
|
|
63
|
-
declare function isReadOnlyContentFormat(format: DocumentFormat): format is ReadOnlyContentFormat;
|
|
64
|
-
declare const LAYOUT_CAPABLE: ReadonlySet<SourceContentFormat>;
|
|
65
|
-
declare function executeBridge(source: SourceContentFormat, target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
|
|
66
|
-
declare function executeFromPdf(target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
|
|
67
|
-
type HopExecutor = "bridge" | "toPdf" | "fromPdf";
|
|
68
|
-
interface CompositionHop {
|
|
69
|
-
readonly executor: HopExecutor;
|
|
70
|
-
readonly from: DocumentFormat;
|
|
71
|
-
readonly to: DocumentFormat;
|
|
72
|
-
}
|
|
73
|
-
interface ConversionPlan {
|
|
74
|
-
readonly hops: readonly CompositionHop[];
|
|
75
|
-
}
|
|
76
|
-
declare function resolveCompositionPlan(source: DocumentFormat, target: DocumentFormat): ConversionPlan | undefined;
|
|
77
|
-
interface CompositionExecutorBinding {
|
|
78
|
-
readonly bridge: (source: SourceContentFormat, target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions) => Uint8Array<ArrayBuffer>;
|
|
79
|
-
readonly fromPdf: (target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions) => Uint8Array<ArrayBuffer>;
|
|
80
|
-
readonly toPdf?: (source: SourceContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions) => Uint8Array<ArrayBuffer>;
|
|
81
|
-
}
|
|
82
|
-
declare function runCompositionPlan(plan: ConversionPlan, bytes: Uint8Array<ArrayBuffer>, options: UnifiedConversionOptions | undefined, executors: CompositionExecutorBinding): Uint8Array<ArrayBuffer>;
|
|
83
|
-
declare function convertDocumentFromPdf(target: ContentFormat, bytes: Uint8Array<ArrayBuffer>, options?: UnifiedConversionOptions): Uint8Array<ArrayBuffer>;
|
|
84
|
-
//#endregion
|
|
85
|
-
export { CompositionExecutorBinding, CompositionHop, ContentFormat, ConversionPlan, FORMAT_NODES, FormatNode, HopExecutor, LAYOUT_CAPABLE, READ_ONLY_FORMAT_NODES, ReadOnlyContentFormat, ReadOnlyFormatNode, SourceContentFormat, UnifiedConversionOptions, convertDocumentFromPdf, executeBridge, executeFromPdf, isReadOnlyContentFormat, isTextFormatNode, resolveCompositionPlan, runCompositionPlan };
|
|
1
|
+
import { A as isTextFormatNode, C as THROUGH_PDF_EDGE_COST, D as executeBridge, E as convertDocumentFromPdf, O as executeFromPdf, S as SourceContentFormat, T as UnifiedConversionOptions, _ as READ_ONLY_CONTENT_FORMATS, b as ReadOnlyContentFormat, d as CompositionExecutorBinding, f as ContentFormat, g as MAX_CONVERSION_PATH_NODES, h as LAYOUT_CAPABLE, j as runCompositionPlan, k as isReadOnlyContentFormat, m as FormatNode, p as FORMAT_NODES, u as CONTENT_FORMATS, v as READ_ONLY_FORMAT_NODES, w as TRANSFORMS, x as ReadOnlyFormatNode, y as RECONSTRUCTORS } from "../composition-plan-l6QPO4FX.js";
|
|
2
|
+
export { CONTENT_FORMATS, CompositionExecutorBinding, ContentFormat, FORMAT_NODES, FormatNode, LAYOUT_CAPABLE, MAX_CONVERSION_PATH_NODES, READ_ONLY_CONTENT_FORMATS, READ_ONLY_FORMAT_NODES, RECONSTRUCTORS, ReadOnlyContentFormat, ReadOnlyFormatNode, SourceContentFormat, THROUGH_PDF_EDGE_COST, TRANSFORMS, UnifiedConversionOptions, convertDocumentFromPdf, executeBridge, executeFromPdf, isReadOnlyContentFormat, isTextFormatNode, runCompositionPlan };
|
|
@@ -1,502 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { buildDocxPackage } from "../edit/docx/content.js";
|
|
4
|
-
import { buildPptxPackage } from "../edit/pptx/content.js";
|
|
5
|
-
import { buildOdtPackage } from "../edit/odt/content.js";
|
|
6
|
-
import { buildOdpPackage } from "../edit/odp/content.js";
|
|
7
|
-
import { buildOdsPackage } from "../edit/ods/content.js";
|
|
8
|
-
import { buildOdgPackage } from "../edit/odg/content.js";
|
|
9
|
-
import { buildMarkdownText } from "../markdown/write.js";
|
|
10
|
-
import { readMarkdownContent as readMarkdownContent$1 } from "../markdown/read.js";
|
|
11
|
-
import { t as readPptContent } from "../read--7mUJ4w7.js";
|
|
12
|
-
import { writePptContent } from "../ppt/write.js";
|
|
13
|
-
import { readDocxContent as readDocxContent$1 } from "../ooxml/docx/read.js";
|
|
14
|
-
import { readPptxContent as readPptxContent$1 } from "../ooxml/pptx/read.js";
|
|
15
|
-
import { readOdtContent as readOdtContent$1 } from "../odf/odt/read.js";
|
|
16
|
-
import { readOdpContent as readOdpContent$1 } from "../odf/odp/read.js";
|
|
17
|
-
import { readOdsContent as readOdsContent$1 } from "../odf/ods/read.js";
|
|
18
|
-
import { readOdgContent as readOdgContent$1 } from "../odf/odg/read.js";
|
|
19
|
-
import { decodeMarkdownText, encodeMarkdownText } from "../markdown/text.js";
|
|
20
|
-
import { decodeCsvText, encodeCsvText } from "../csv/text.js";
|
|
21
|
-
import { readCsvContent } from "../csv/read.js";
|
|
22
|
-
import { buildCsvText } from "../csv/write.js";
|
|
23
|
-
import { readSvgContent } from "../svg/read.js";
|
|
24
|
-
import { buildSvgText } from "../svg/write.js";
|
|
25
|
-
import { throwIfAborted } from "../ports/abort.js";
|
|
26
|
-
import { reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing } from "../layout/reconstruct.js";
|
|
27
|
-
import { stampPdfPackageTables } from "./pdf-package-tables.js";
|
|
28
|
-
import { drawingToPresentation, presentationToDrawing, presentationToWordprocessing, spreadsheetToWordprocessing, wordprocessingToPresentation } from "./variant-bridges.js";
|
|
29
|
-
import { UnsupportedConversionError } from "./capability.js";
|
|
30
|
-
import { buildXlsxPackageFromContent, decodePackage, encodePackage, readXlsxContent } from "ooxml.js";
|
|
31
|
-
import { assembleTree } from "document-schema.js";
|
|
32
|
-
import { decodePackage as decodePackage$1, encodePackage as encodePackage$1 } from "odf.js";
|
|
33
|
-
import { readDocContent, writeDocContent } from "doc-codec";
|
|
34
|
-
import { readXlsContent, writeXlsContent } from "xls-codec";
|
|
35
|
-
import { readRtfContent, rtfBytesFromLatin1, writeRtfContent } from "rtf-codec";
|
|
36
|
-
import { readEpubContent, writeEpubContent } from "epub-codec";
|
|
37
|
-
import "markdown-codec";
|
|
38
|
-
import { readWpdContent } from "wpd-codec";
|
|
39
|
-
import { readPdf } from "pdf-codec/read";
|
|
40
|
-
//#region src/convert/composition.ts
|
|
41
|
-
const LATIN1_MAX_CODE = 255;
|
|
42
|
-
const HEX_RADIX = 16;
|
|
43
|
-
const UNICODE_HEX_DIGITS = 4;
|
|
44
|
-
const THROUGH_PDF_EDGE_COST = 3;
|
|
45
|
-
const MAX_CONVERSION_PATH_NODES = 4;
|
|
46
|
-
const FORMAT_NODES = {
|
|
47
|
-
docx: {
|
|
48
|
-
variant: "wordprocessing",
|
|
49
|
-
family: "ooxml",
|
|
50
|
-
decode: (bytes) => decodePackage(bytes),
|
|
51
|
-
read: (pkg, options) => readDocxContent$1(pkg, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
52
|
-
build: (content, options) => buildDocxPackage(content, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
53
|
-
encode: (pkg) => encodePackage(pkg),
|
|
54
|
-
hasSourcePackage: true
|
|
55
|
-
},
|
|
56
|
-
pptx: {
|
|
57
|
-
variant: "presentation",
|
|
58
|
-
family: "ooxml",
|
|
59
|
-
decode: (bytes) => decodePackage(bytes),
|
|
60
|
-
read: (pkg, options) => readPptxContent$1(pkg, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
61
|
-
build: (content, options) => buildPptxPackage(content, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
62
|
-
encode: (pkg) => encodePackage(pkg),
|
|
63
|
-
hasSourcePackage: true
|
|
64
|
-
},
|
|
65
|
-
xlsx: {
|
|
66
|
-
variant: "spreadsheet",
|
|
67
|
-
family: "ooxml",
|
|
68
|
-
decode: (bytes) => decodePackage(bytes),
|
|
69
|
-
read: (pkg) => readXlsxContent(pkg),
|
|
70
|
-
build: (content) => buildXlsxPackageFromContent(content),
|
|
71
|
-
encode: (pkg) => encodePackage(pkg),
|
|
72
|
-
hasSourcePackage: true
|
|
73
|
-
},
|
|
74
|
-
odt: {
|
|
75
|
-
variant: "wordprocessing",
|
|
76
|
-
family: "odf",
|
|
77
|
-
decode: (bytes) => decodePackage$1(bytes),
|
|
78
|
-
read: (pkg) => readOdtContent$1(pkg),
|
|
79
|
-
build: (content) => buildOdtPackage(content),
|
|
80
|
-
encode: (pkg) => encodePackage$1(pkg),
|
|
81
|
-
hasSourcePackage: true
|
|
82
|
-
},
|
|
83
|
-
odp: {
|
|
84
|
-
variant: "presentation",
|
|
85
|
-
family: "odf",
|
|
86
|
-
decode: (bytes) => decodePackage$1(bytes),
|
|
87
|
-
read: (pkg) => readOdpContent$1(pkg),
|
|
88
|
-
build: (content) => buildOdpPackage(content),
|
|
89
|
-
encode: (pkg) => encodePackage$1(pkg),
|
|
90
|
-
hasSourcePackage: true
|
|
91
|
-
},
|
|
92
|
-
ods: {
|
|
93
|
-
variant: "spreadsheet",
|
|
94
|
-
family: "odf",
|
|
95
|
-
decode: (bytes) => decodePackage$1(bytes),
|
|
96
|
-
read: (pkg) => readOdsContent$1(pkg),
|
|
97
|
-
build: (content) => buildOdsPackage(content),
|
|
98
|
-
encode: (pkg) => encodePackage$1(pkg),
|
|
99
|
-
hasSourcePackage: true
|
|
100
|
-
},
|
|
101
|
-
odg: {
|
|
102
|
-
variant: "drawing",
|
|
103
|
-
family: "odf",
|
|
104
|
-
decode: (bytes) => decodePackage$1(bytes),
|
|
105
|
-
read: (pkg) => readOdgContent$1(pkg),
|
|
106
|
-
build: (content) => buildOdgPackage(content),
|
|
107
|
-
encode: (pkg) => encodePackage$1(pkg),
|
|
108
|
-
hasSourcePackage: true
|
|
109
|
-
},
|
|
110
|
-
svg: {
|
|
111
|
-
variant: "drawing",
|
|
112
|
-
family: "svg",
|
|
113
|
-
decode: (bytes) => decodeSvgText(bytes),
|
|
114
|
-
read: (text, options) => readSvgContent(text, { onSvgDiagnostic: options?.onSvgDiagnostic }),
|
|
115
|
-
build: (content, options) => buildSvgText(content, {
|
|
116
|
-
page: options?.page,
|
|
117
|
-
onSvgDiagnostic: options?.onSvgDiagnostic
|
|
118
|
-
}),
|
|
119
|
-
encode: (text) => encodeSvgText(text),
|
|
120
|
-
hasSourcePackage: false
|
|
121
|
-
},
|
|
122
|
-
markdown: {
|
|
123
|
-
variant: "wordprocessing",
|
|
124
|
-
family: "markdown",
|
|
125
|
-
decode: (bytes) => decodeMarkdownText(bytes),
|
|
126
|
-
read: (text, options) => readMarkdownContent$1(text, {
|
|
127
|
-
signal: options?.signal,
|
|
128
|
-
images: options?.images
|
|
129
|
-
}),
|
|
130
|
-
build: (content) => buildMarkdownText(content),
|
|
131
|
-
encode: (text) => encodeMarkdownText(text),
|
|
132
|
-
hasSourcePackage: false
|
|
133
|
-
},
|
|
134
|
-
csv: {
|
|
135
|
-
variant: "spreadsheet",
|
|
136
|
-
family: "csv",
|
|
137
|
-
decode: (bytes) => decodeCsvText(bytes),
|
|
138
|
-
read: (text, options) => readCsvContent(text, {
|
|
139
|
-
delimiter: options?.delimiter,
|
|
140
|
-
onCellTypeInference: options?.onCellTypeInference
|
|
141
|
-
}),
|
|
142
|
-
build: (content, options) => buildCsvText(content, {
|
|
143
|
-
delimiter: options?.delimiter,
|
|
144
|
-
sheet: options?.sheet
|
|
145
|
-
}),
|
|
146
|
-
encode: (text) => encodeCsvText(text),
|
|
147
|
-
hasSourcePackage: false
|
|
148
|
-
},
|
|
149
|
-
rtf: {
|
|
150
|
-
variant: "wordprocessing",
|
|
151
|
-
family: "rtf",
|
|
152
|
-
decode: (bytes) => bytesToLatin1(bytes),
|
|
153
|
-
read: (text, options) => readRtfContent(text, { signal: options?.signal }).document,
|
|
154
|
-
build: (content) => bytesToLatin1(writeRtfContent(content)),
|
|
155
|
-
encode: (text) => requireArrayBufferBytes(rtfBytesFromLatin1(text)),
|
|
156
|
-
hasSourcePackage: false
|
|
157
|
-
},
|
|
158
|
-
doc: {
|
|
159
|
-
variant: "wordprocessing",
|
|
160
|
-
family: "doc",
|
|
161
|
-
decode: (bytes) => bytesToLatin1(bytes),
|
|
162
|
-
read: (text, options) => {
|
|
163
|
-
throwIfAborted(options?.signal);
|
|
164
|
-
return readDocContent(latin1ToBytes(text));
|
|
165
|
-
},
|
|
166
|
-
build: (content) => bytesToLatin1(writeDocContent(content)),
|
|
167
|
-
encode: (text) => latin1ToBytes(text),
|
|
168
|
-
hasSourcePackage: false
|
|
169
|
-
},
|
|
170
|
-
epub: {
|
|
171
|
-
variant: "wordprocessing",
|
|
172
|
-
family: "epub",
|
|
173
|
-
decode: (bytes) => bytesToLatin1(bytes),
|
|
174
|
-
read: (text, options) => {
|
|
175
|
-
throwIfAborted(options?.signal);
|
|
176
|
-
return readEpubContent(latin1ToBytes(text));
|
|
177
|
-
},
|
|
178
|
-
build: (content) => bytesToLatin1(writeEpubContent(content)),
|
|
179
|
-
encode: (text) => latin1ToBytes(text),
|
|
180
|
-
hasSourcePackage: false
|
|
181
|
-
},
|
|
182
|
-
xls: {
|
|
183
|
-
variant: "spreadsheet",
|
|
184
|
-
family: "xls",
|
|
185
|
-
decode: (bytes) => bytesToLatin1(bytes),
|
|
186
|
-
read: (text, options) => {
|
|
187
|
-
throwIfAborted(options?.signal);
|
|
188
|
-
return readXlsContent(latin1ToBytes(text));
|
|
189
|
-
},
|
|
190
|
-
build: (content) => {
|
|
191
|
-
if (content.kind !== "spreadsheet") throw new Error("FORMAT_NODES.xls.build: expected a spreadsheet ContentDocument");
|
|
192
|
-
return bytesToLatin1(writeXlsContent(content));
|
|
193
|
-
},
|
|
194
|
-
encode: (text) => latin1ToBytes(text),
|
|
195
|
-
hasSourcePackage: false
|
|
196
|
-
},
|
|
197
|
-
ppt: {
|
|
198
|
-
variant: "presentation",
|
|
199
|
-
family: "ppt",
|
|
200
|
-
decode: (bytes) => bytesToLatin1(bytes),
|
|
201
|
-
read: (text, options) => {
|
|
202
|
-
throwIfAborted(options?.signal);
|
|
203
|
-
return readPptContent(latin1ToBytes(text));
|
|
204
|
-
},
|
|
205
|
-
build: (content) => bytesToLatin1(writePptContent(content)),
|
|
206
|
-
encode: (text) => latin1ToBytes(text),
|
|
207
|
-
hasSourcePackage: false
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
const CONTENT_FORMATS = [
|
|
211
|
-
"docx",
|
|
212
|
-
"pptx",
|
|
213
|
-
"xlsx",
|
|
214
|
-
"odt",
|
|
215
|
-
"odp",
|
|
216
|
-
"ods",
|
|
217
|
-
"odg",
|
|
218
|
-
"svg",
|
|
219
|
-
"csv",
|
|
220
|
-
"markdown",
|
|
221
|
-
"rtf",
|
|
222
|
-
"doc",
|
|
223
|
-
"xls",
|
|
224
|
-
"ppt",
|
|
225
|
-
"epub"
|
|
226
|
-
];
|
|
227
|
-
function isTextFormatNode(node) {
|
|
228
|
-
return !node.hasSourcePackage;
|
|
229
|
-
}
|
|
230
|
-
const READ_ONLY_CONTENT_FORMATS = ["wpd"];
|
|
231
|
-
const READ_ONLY_FORMAT_NODES = { wpd: {
|
|
232
|
-
variant: "wordprocessing",
|
|
233
|
-
read: (bytes) => readWpdContent(bytes)
|
|
234
|
-
} };
|
|
235
|
-
function isReadOnlyContentFormat(format) {
|
|
236
|
-
return READ_ONLY_CONTENT_FORMATS.includes(format);
|
|
237
|
-
}
|
|
238
|
-
function readSourceContent(format, bytes, options) {
|
|
239
|
-
if (isReadOnlyContentFormat(format)) {
|
|
240
|
-
const node = READ_ONLY_FORMAT_NODES[format];
|
|
241
|
-
return {
|
|
242
|
-
content: node.read(bytes, options),
|
|
243
|
-
variant: node.variant
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
const node = FORMAT_NODES[format];
|
|
247
|
-
if (isTextFormatNode(node)) {
|
|
248
|
-
const text = node.decode(bytes);
|
|
249
|
-
return {
|
|
250
|
-
content: node.read(text, options),
|
|
251
|
-
variant: node.variant
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
const pkg = node.decode(bytes);
|
|
255
|
-
return {
|
|
256
|
-
content: node.read(pkg, options),
|
|
257
|
-
variant: node.variant
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
const LATIN1_CHUNK_SIZE = 8192;
|
|
261
|
-
function bytesToLatin1(bytes) {
|
|
262
|
-
let text = "";
|
|
263
|
-
for (let start = 0; start < bytes.length; start += LATIN1_CHUNK_SIZE) text += String.fromCharCode(...bytes.subarray(start, start + LATIN1_CHUNK_SIZE));
|
|
264
|
-
return text;
|
|
265
|
-
}
|
|
266
|
-
function latin1ToBytes(text) {
|
|
267
|
-
const bytes = new Uint8Array(text.length);
|
|
268
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
269
|
-
const code = text.charCodeAt(index);
|
|
270
|
-
if (code > LATIN1_MAX_CODE) throw new TypeError(`latin1ToBytes: character at index ${String(index)} is U+${code.toString(HEX_RADIX).toUpperCase().padStart(UNICODE_HEX_DIGITS, "0")}, above U+00FF — this string no longer holds the file's original bytes`);
|
|
271
|
-
bytes[index] = code;
|
|
272
|
-
}
|
|
273
|
-
return bytes;
|
|
274
|
-
}
|
|
275
|
-
const LAYOUT_CAPABLE = /* @__PURE__ */ new Set([
|
|
276
|
-
"docx",
|
|
277
|
-
"pptx",
|
|
278
|
-
"odt",
|
|
279
|
-
"odp",
|
|
280
|
-
"ods",
|
|
281
|
-
"odg",
|
|
282
|
-
"svg",
|
|
283
|
-
"markdown",
|
|
284
|
-
"wpd"
|
|
285
|
-
]);
|
|
286
|
-
const TRANSFORMS = {
|
|
287
|
-
"wordprocessing->presentation": (doc) => {
|
|
288
|
-
if (doc.kind !== "wordprocessing") throw new Error("wordprocessingToPresentation: expected a wordprocessing ContentDocument");
|
|
289
|
-
return wordprocessingToPresentation(doc);
|
|
290
|
-
},
|
|
291
|
-
"presentation->wordprocessing": (doc) => {
|
|
292
|
-
if (doc.kind !== "presentation") throw new Error("presentationToWordprocessing: expected a presentation ContentDocument");
|
|
293
|
-
return presentationToWordprocessing(doc);
|
|
294
|
-
},
|
|
295
|
-
"drawing->presentation": (doc) => {
|
|
296
|
-
if (doc.kind !== "drawing") throw new Error("drawingToPresentation: expected a drawing ContentDocument");
|
|
297
|
-
return drawingToPresentation(doc);
|
|
298
|
-
},
|
|
299
|
-
"presentation->drawing": (doc) => {
|
|
300
|
-
if (doc.kind !== "presentation") throw new Error("presentationToDrawing: expected a presentation ContentDocument");
|
|
301
|
-
return presentationToDrawing(doc);
|
|
302
|
-
},
|
|
303
|
-
"spreadsheet->wordprocessing": (doc) => {
|
|
304
|
-
if (doc.kind !== "spreadsheet") throw new Error("spreadsheetToWordprocessing: expected a spreadsheet ContentDocument");
|
|
305
|
-
return spreadsheetToWordprocessing(doc);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
const RECONSTRUCTORS = {
|
|
309
|
-
wordprocessing: reconstructWordprocessing,
|
|
310
|
-
presentation: reconstructPresentation,
|
|
311
|
-
drawing: reconstructDrawing,
|
|
312
|
-
spreadsheet: reconstructSpreadsheet
|
|
313
|
-
};
|
|
314
|
-
function executeBridge(source, target, bytes, options) {
|
|
315
|
-
throwIfAborted(options?.signal);
|
|
316
|
-
const targetNode = FORMAT_NODES[target];
|
|
317
|
-
const { content, variant: sourceVariant } = readSourceContent(source, bytes, options);
|
|
318
|
-
if (content.kind !== sourceVariant) throw new Error(`executeBridge: ${source} read returned a non-${sourceVariant} ContentDocument`);
|
|
319
|
-
let buildContent = content;
|
|
320
|
-
if (sourceVariant !== targetNode.variant) {
|
|
321
|
-
const key = `${sourceVariant}->${targetNode.variant}`;
|
|
322
|
-
const transform = TRANSFORMS[key];
|
|
323
|
-
if (transform === void 0) throw new Error(`executeBridge: no transform registered for ${key}`);
|
|
324
|
-
buildContent = transform(content);
|
|
325
|
-
}
|
|
326
|
-
throwIfAborted(options?.signal);
|
|
327
|
-
let out;
|
|
328
|
-
if (isTextFormatNode(targetNode)) {
|
|
329
|
-
const text = targetNode.build(buildContent, options);
|
|
330
|
-
out = targetNode.encode(text);
|
|
331
|
-
} else {
|
|
332
|
-
const pkg = targetNode.build(buildContent, options);
|
|
333
|
-
out = targetNode.encode(pkg);
|
|
334
|
-
}
|
|
335
|
-
options?.onDocument?.(assembleTree(buildContent));
|
|
336
|
-
return out;
|
|
337
|
-
}
|
|
338
|
-
function executeFromPdf(target, bytes, options) {
|
|
339
|
-
const node = FORMAT_NODES[target];
|
|
340
|
-
const layout = readPdf(bytes, {
|
|
341
|
-
signal: options?.signal,
|
|
342
|
-
sink: options?.sink
|
|
343
|
-
});
|
|
344
|
-
const content = RECONSTRUCTORS[node.variant](layout, {
|
|
345
|
-
signal: options?.signal,
|
|
346
|
-
onCellTypeInference: options?.onCellTypeInference
|
|
347
|
-
});
|
|
348
|
-
const pages = layout.pages.map((page) => ({
|
|
349
|
-
widthPt: page.widthPt,
|
|
350
|
-
heightPt: page.heightPt
|
|
351
|
-
}));
|
|
352
|
-
let out;
|
|
353
|
-
if (isTextFormatNode(node)) {
|
|
354
|
-
const text = node.build(content, options);
|
|
355
|
-
out = node.encode(text);
|
|
356
|
-
} else {
|
|
357
|
-
const pkg = node.build(content);
|
|
358
|
-
out = node.encode(pkg);
|
|
359
|
-
}
|
|
360
|
-
const reported = assembleTree(content, pages);
|
|
361
|
-
stampPdfPackageTables(reported, layout);
|
|
362
|
-
options?.onDocument?.(reported);
|
|
363
|
-
return out;
|
|
364
|
-
}
|
|
365
|
-
function buildCompositionGraph() {
|
|
366
|
-
const adj = /* @__PURE__ */ new Map();
|
|
367
|
-
const addDirected = (from, to, cost) => {
|
|
368
|
-
const list = adj.get(from);
|
|
369
|
-
if (list === void 0) adj.set(from, [{
|
|
370
|
-
to,
|
|
371
|
-
cost
|
|
372
|
-
}]);
|
|
373
|
-
else list.push({
|
|
374
|
-
to,
|
|
375
|
-
cost
|
|
376
|
-
});
|
|
377
|
-
};
|
|
378
|
-
const addEdge = (from, to, cost) => {
|
|
379
|
-
addDirected(from, to, cost);
|
|
380
|
-
addDirected(to, from, cost);
|
|
381
|
-
};
|
|
382
|
-
for (const a of CONTENT_FORMATS) for (const b of CONTENT_FORMATS) {
|
|
383
|
-
if (a === b) continue;
|
|
384
|
-
if (FORMAT_NODES[a].variant === FORMAT_NODES[b].variant) addEdge(a, b, 1);
|
|
385
|
-
}
|
|
386
|
-
for (const key of Object.keys(TRANSFORMS)) {
|
|
387
|
-
const parts = key.split("->");
|
|
388
|
-
const fromVariant = parts[0];
|
|
389
|
-
const toVariant = parts[1];
|
|
390
|
-
if (fromVariant === void 0 || toVariant === void 0) continue;
|
|
391
|
-
for (const a of CONTENT_FORMATS) {
|
|
392
|
-
if (FORMAT_NODES[a].variant !== fromVariant) continue;
|
|
393
|
-
for (const b of CONTENT_FORMATS) {
|
|
394
|
-
if (FORMAT_NODES[b].variant !== toVariant) continue;
|
|
395
|
-
addDirected(a, b, 2);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
for (const format of CONTENT_FORMATS) if (LAYOUT_CAPABLE.has(format)) addEdge(format, "pdf", THROUGH_PDF_EDGE_COST);
|
|
400
|
-
for (const source of READ_ONLY_CONTENT_FORMATS) {
|
|
401
|
-
const variant = READ_ONLY_FORMAT_NODES[source].variant;
|
|
402
|
-
for (const target of CONTENT_FORMATS) {
|
|
403
|
-
const targetVariant = FORMAT_NODES[target].variant;
|
|
404
|
-
if (targetVariant === variant) addDirected(source, target, 1);
|
|
405
|
-
else if (TRANSFORMS[`${variant}->${targetVariant}`] !== void 0) addDirected(source, target, 2);
|
|
406
|
-
}
|
|
407
|
-
if (LAYOUT_CAPABLE.has(source)) addDirected(source, "pdf", THROUGH_PDF_EDGE_COST);
|
|
408
|
-
}
|
|
409
|
-
return adj;
|
|
410
|
-
}
|
|
411
|
-
const COMPOSITION_GRAPH = buildCompositionGraph();
|
|
412
|
-
function shortestPath(source, target) {
|
|
413
|
-
if (source === target) return;
|
|
414
|
-
const distances = /* @__PURE__ */ new Map([[source, 0]]);
|
|
415
|
-
const previous = /* @__PURE__ */ new Map();
|
|
416
|
-
const visited = /* @__PURE__ */ new Set();
|
|
417
|
-
while (true) {
|
|
418
|
-
let current = void 0;
|
|
419
|
-
let currentDist = Infinity;
|
|
420
|
-
for (const [node, dist] of distances) if (!visited.has(node) && dist < currentDist) {
|
|
421
|
-
current = node;
|
|
422
|
-
currentDist = dist;
|
|
423
|
-
}
|
|
424
|
-
if (current === void 0 || current === target) break;
|
|
425
|
-
visited.add(current);
|
|
426
|
-
for (const edge of COMPOSITION_GRAPH.get(current) ?? []) {
|
|
427
|
-
if (visited.has(edge.to)) continue;
|
|
428
|
-
const alt = currentDist + edge.cost;
|
|
429
|
-
const known = distances.get(edge.to);
|
|
430
|
-
if (known === void 0 || alt < known) {
|
|
431
|
-
distances.set(edge.to, alt);
|
|
432
|
-
previous.set(edge.to, current);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
if (distances.get(target) === void 0) return;
|
|
437
|
-
const path = [];
|
|
438
|
-
let cursor = target;
|
|
439
|
-
while (cursor !== void 0) {
|
|
440
|
-
path.unshift(cursor);
|
|
441
|
-
cursor = previous.get(cursor);
|
|
442
|
-
}
|
|
443
|
-
return path;
|
|
444
|
-
}
|
|
445
|
-
function resolveCompositionPlan(source, target) {
|
|
446
|
-
const path = shortestPath(source, target);
|
|
447
|
-
if (path === void 0) return;
|
|
448
|
-
if (path.length > MAX_CONVERSION_PATH_NODES) return;
|
|
449
|
-
const hops = [];
|
|
450
|
-
for (let i = 0; i + 1 < path.length; i++) {
|
|
451
|
-
const from = path[i];
|
|
452
|
-
const to = path[i + 1];
|
|
453
|
-
if (from === void 0 || to === void 0) return;
|
|
454
|
-
const executor = to === "pdf" ? "toPdf" : from === "pdf" ? "fromPdf" : "bridge";
|
|
455
|
-
hops.push({
|
|
456
|
-
executor,
|
|
457
|
-
from,
|
|
458
|
-
to
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
return { hops };
|
|
462
|
-
}
|
|
463
|
-
function isContentFormat(format) {
|
|
464
|
-
return format !== "pdf" && format !== "odf" && !isReadOnlyContentFormat(format);
|
|
465
|
-
}
|
|
466
|
-
function isSourceContentFormat(format) {
|
|
467
|
-
return isContentFormat(format) || isReadOnlyContentFormat(format);
|
|
468
|
-
}
|
|
469
|
-
function runCompositionPlan(plan, bytes, options, executors) {
|
|
470
|
-
let current = bytes;
|
|
471
|
-
for (let i = 0; i < plan.hops.length; i++) {
|
|
472
|
-
const hop = plan.hops[i];
|
|
473
|
-
if (hop === void 0) throw new Error("runCompositionPlan: resolveCompositionPlan returned a malformed hop");
|
|
474
|
-
const hopOptions = i === plan.hops.length - 1 ? options : options === void 0 ? void 0 : {
|
|
475
|
-
...options,
|
|
476
|
-
onDocument: void 0
|
|
477
|
-
};
|
|
478
|
-
if (hop.executor === "toPdf") {
|
|
479
|
-
if (!isSourceContentFormat(hop.from)) throw new Error(`runCompositionPlan: toPdf source '${hop.from}' is not a content format`);
|
|
480
|
-
const toPdf = executors.toPdf;
|
|
481
|
-
if (toPdf === void 0) throw new Error(`runCompositionPlan: the plan's ${hop.from} -> ${hop.to} hop needs a toPdf executor, but this binding carries none (the read-only entry cannot render PDFs)`);
|
|
482
|
-
current = toPdf(hop.from, current, hopOptions);
|
|
483
|
-
} else if (hop.executor === "fromPdf") {
|
|
484
|
-
if (!isContentFormat(hop.to)) throw new Error(`runCompositionPlan: fromPdf target '${hop.to}' is not a content format`);
|
|
485
|
-
current = executors.fromPdf(hop.to, current, hopOptions);
|
|
486
|
-
} else {
|
|
487
|
-
if (!isSourceContentFormat(hop.from) || !isContentFormat(hop.to)) throw new Error(`runCompositionPlan: bridge endpoints '${hop.from}' -> '${hop.to}' are not both content formats`);
|
|
488
|
-
current = executors.bridge(hop.from, hop.to, current, hopOptions);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return current;
|
|
492
|
-
}
|
|
493
|
-
function convertDocumentFromPdf(target, bytes, options) {
|
|
494
|
-
const plan = resolveCompositionPlan("pdf", target);
|
|
495
|
-
if (plan === void 0) throw new UnsupportedConversionError("pdf", target);
|
|
496
|
-
return runCompositionPlan(plan, bytes, options, {
|
|
497
|
-
bridge: executeBridge,
|
|
498
|
-
fromPdf: executeFromPdf
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
//#endregion
|
|
502
|
-
export { FORMAT_NODES, LAYOUT_CAPABLE, READ_ONLY_FORMAT_NODES, convertDocumentFromPdf, executeBridge, executeFromPdf, isReadOnlyContentFormat, isTextFormatNode, resolveCompositionPlan, runCompositionPlan };
|
|
1
|
+
import { _ as executeFromPdf, b as runCompositionPlan, c as LAYOUT_CAPABLE, d as READ_ONLY_FORMAT_NODES, f as RECONSTRUCTORS, g as executeBridge, h as convertDocumentFromPdf, l as MAX_CONVERSION_PATH_NODES, m as TRANSFORMS, o as CONTENT_FORMATS, p as THROUGH_PDF_EDGE_COST, s as FORMAT_NODES, u as READ_ONLY_CONTENT_FORMATS, v as isReadOnlyContentFormat, y as isTextFormatNode } from "../composition-plan-f0zaExUW.js";
|
|
2
|
+
export { CONTENT_FORMATS, FORMAT_NODES, LAYOUT_CAPABLE, MAX_CONVERSION_PATH_NODES, READ_ONLY_CONTENT_FORMATS, READ_ONLY_FORMAT_NODES, RECONSTRUCTORS, THROUGH_PDF_EDGE_COST, TRANSFORMS, convertDocumentFromPdf, executeBridge, executeFromPdf, isReadOnlyContentFormat, isTextFormatNode, runCompositionPlan };
|
package/dist/convert/convert.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_model_geometry = require("../model/geometry.cjs");
|
|
3
3
|
const require_model_metadata = require("../model/metadata.cjs");
|
|
4
4
|
const require_edit_docx_content = require("../edit/docx/content.cjs");
|
|
5
|
-
const
|
|
5
|
+
const require_layout = require("../layout-iuiyl_Fk.cjs");
|
|
6
6
|
const require_edit_odt_content = require("../edit/odt/content.cjs");
|
|
7
7
|
const require_fonts_registry = require("../fonts/registry.cjs");
|
|
8
8
|
const require_odf_formula_read = require("../odf/formula/read.cjs");
|
|
@@ -58,7 +58,7 @@ function odfToPdf(bytes, options) {
|
|
|
58
58
|
metadata: require_model_metadata.resolveMetadataTimestamps(read.metadata, options?.clock)
|
|
59
59
|
};
|
|
60
60
|
const metrics = (0, pdf_codec.loadMathFont)().metricsAt(STANDALONE_FORMULA_SIZE_PT);
|
|
61
|
-
const { box } =
|
|
61
|
+
const { box } = require_layout.layoutFormula(content.formula.mathml, {
|
|
62
62
|
metrics,
|
|
63
63
|
sizePt: STANDALONE_FORMULA_SIZE_PT,
|
|
64
64
|
color: document_schema_js.COLOR_BLACK
|
package/dist/convert/convert.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { resolveMetadataTimestamps } from "../model/metadata.js";
|
|
3
3
|
import { buildDocxPackage } from "../edit/docx/content.js";
|
|
4
|
-
import { layoutFormula } from "../
|
|
4
|
+
import { t as layoutFormula } from "../layout-DIJzJk4x.js";
|
|
5
5
|
import { buildOdtPackage } from "../edit/odt/content.js";
|
|
6
6
|
import { extractSourceFonts } from "../fonts/registry.js";
|
|
7
7
|
import { readOdfFormulaContent as readOdfFormulaContent$1 } from "../odf/formula/read.js";
|
|
@@ -2,10 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_model_geometry = require("../model/geometry.cjs");
|
|
3
3
|
const require_model_bytes = require("../model/bytes.cjs");
|
|
4
4
|
const require_model_formula = require("../model/formula.cjs");
|
|
5
|
-
const
|
|
5
|
+
const require_layout = require("../layout-iuiyl_Fk.cjs");
|
|
6
6
|
const require_layout_text_layout = require("../layout/text-layout.cjs");
|
|
7
7
|
const require_layout_shared = require("../layout/shared.cjs");
|
|
8
|
-
require("../
|
|
8
|
+
require("../sheets-BQCpNXsE.cjs");
|
|
9
9
|
const require_layout_drawing = require("../layout/drawing.cjs");
|
|
10
10
|
const require_convert_capability = require("./capability.cjs");
|
|
11
11
|
const require_codecs_registry = require("../codecs/registry.cjs");
|
|
@@ -210,7 +210,7 @@ function emitEmbeddedObjectBlock(state, block) {
|
|
|
210
210
|
for (const frame of block.frames ?? []) {
|
|
211
211
|
if (pageOfFrame(state, frame) === void 0) continue;
|
|
212
212
|
const sizePt = require_layout_shared.formulaSizePtForFrame(formula.mathml, frame, metricsAt);
|
|
213
|
-
const { box } =
|
|
213
|
+
const { box } = require_layout.layoutFormula(formula.mathml, {
|
|
214
214
|
metrics: metricsAt(sizePt),
|
|
215
215
|
sizePt,
|
|
216
216
|
color: document_schema_js.COLOR_BLACK
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { requireArrayBufferBytes } from "../model/bytes.js";
|
|
3
3
|
import { formulaOfBlock } from "../model/formula.js";
|
|
4
|
-
import { layoutFormula } from "../
|
|
4
|
+
import { t as layoutFormula } from "../layout-DIJzJk4x.js";
|
|
5
5
|
import { atomizeForWrap, firstWrappedLineOf } from "../layout/text-layout.js";
|
|
6
6
|
import { formulaSizePtForFrame, pushCellBorderLines, registerImage, runFont } from "../layout/shared.js";
|
|
7
|
-
import "../
|
|
7
|
+
import "../sheets-DWDvGN-g.js";
|
|
8
8
|
import { convertVector } from "../layout/drawing.js";
|
|
9
9
|
import { READ_ONLY_FORMATS } from "./capability.js";
|
|
10
10
|
import { DOCUMENT_FORMAT_CODECS } from "../codecs/registry.js";
|