@embedpdf/engine-core 3.0.0-next.15 → 3.0.0-next.16
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/{AnnotationList-CkijRHet.d.cts → AnnotationList-DcyhF2kU.d.cts} +1836 -1308
- package/dist/{AnnotationList-CkijRHet.d.ts → AnnotationList-DcyhF2kU.d.ts} +1836 -1308
- package/dist/{Change-CjImsrN0.cjs → Change-Ct-dB8D5.cjs} +115 -2
- package/dist/Change-Ct-dB8D5.cjs.map +1 -0
- package/dist/{Change-CKoxfTNY.js → Change-tMR34hTU.js} +92 -3
- package/dist/Change-tMR34hTU.js.map +1 -0
- package/dist/{DocumentRenderService-BfFdFSwI.cjs → DocumentRenderService-9IjSQEIU.cjs} +2 -1
- package/dist/{DocumentRenderService-BfFdFSwI.cjs.map → DocumentRenderService-9IjSQEIU.cjs.map} +1 -1
- package/dist/{DocumentRenderService-DV3J9lMz.js → DocumentRenderService-DFrZ9wfW.js} +2 -1
- package/dist/{DocumentRenderService-DV3J9lMz.js.map → DocumentRenderService-DFrZ9wfW.js.map} +1 -1
- package/dist/{DocumentSecurityService-e6vp2de8.d.cts → DocumentSecurityService-D2zA4NKi.d.cts} +2 -2
- package/dist/{DocumentSecurityService-CU1M6Q7m.d.ts → DocumentSecurityService-YJV9df8P.d.ts} +2 -2
- package/dist/{LocalEngine-DFoBm4B3.d.cts → LocalEngine-DBt2-GWF.d.ts} +102 -18
- package/dist/{LocalEngine-DPriFujS.d.ts → LocalEngine-IA9zh3Jh.d.cts} +102 -18
- package/dist/{authority-DLMNR7ff.cjs → authority-BFp6XM04.cjs} +373 -52
- package/dist/authority-BFp6XM04.cjs.map +1 -0
- package/dist/{authority-B3BklsB4.js → authority-PuxpGFhJ.js} +320 -53
- package/dist/authority-PuxpGFhJ.js.map +1 -0
- package/dist/{builders-CNj0POeY.js → builders-DV62HA3I.js} +6 -2
- package/dist/builders-DV62HA3I.js.map +1 -0
- package/dist/{builders-Cgdp_YCn.cjs → builders-DgTAj_tP.cjs} +6 -2
- package/dist/builders-DgTAj_tP.cjs.map +1 -0
- package/dist/{calibrate-DJBXnhLE.cjs → calibrate-DJbi1wuK.cjs} +118 -25
- package/dist/calibrate-DJbi1wuK.cjs.map +1 -0
- package/dist/{calibrate-7T3fnP8-.js → calibrate-nQFgCuki.js} +83 -26
- package/dist/calibrate-nQFgCuki.js.map +1 -0
- package/dist/charmap-Cprti1ta.js.map +1 -1
- package/dist/charmap-aYlefQP9.cjs.map +1 -1
- package/dist/conformance.cjs +1744 -75
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +105 -10
- package/dist/conformance.d.ts +105 -10
- package/dist/conformance.js +1738 -76
- package/dist/conformance.js.map +1 -1
- package/dist/index.cjs +25 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/public.cjs +6 -4
- package/dist/public.d.cts +5 -5
- package/dist/public.d.ts +5 -5
- package/dist/public.js +5 -5
- package/dist/{resolver-CzxmD9Ck.js → resolver-BBggAxQc.js} +6 -3
- package/dist/resolver-BBggAxQc.js.map +1 -0
- package/dist/{resolver-D2OCtE8F.cjs → resolver-BWSWSF6R.cjs} +6 -3
- package/dist/resolver-BWSWSF6R.cjs.map +1 -0
- package/dist/{runtime-Cl0v56mm.d.ts → runtime-BaDKjxiu.d.ts} +67 -140
- package/dist/{runtime-p1WDzDo4.d.cts → runtime-CWEuiwbk.d.cts} +67 -140
- package/dist/runtime.cjs +267 -7
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -5
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.js +246 -8
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-DzlUNk38.js → schema-6S2VmlAj.js} +8 -2
- package/dist/schema-6S2VmlAj.js.map +1 -0
- package/dist/{schema-C-gU4vj7.cjs → schema-miH6tWQC.cjs} +13 -1
- package/dist/schema-miH6tWQC.cjs.map +1 -0
- package/dist/{schemas-D6xOGjqg.js → schemas-BE2QGOit.js} +256 -59
- package/dist/schemas-BE2QGOit.js.map +1 -0
- package/dist/{schemas-Berf1swF.cjs → schemas-DljJR9ut.cjs} +397 -80
- package/dist/schemas-DljJR9ut.cjs.map +1 -0
- package/dist/validation.cjs +1 -1
- package/dist/validation.d.cts +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +1 -1
- package/dist/{viewport-DlL5Bxbg.cjs → viewport-CHG9qQUb.cjs} +2 -2
- package/dist/{viewport-DlL5Bxbg.cjs.map → viewport-CHG9qQUb.cjs.map} +1 -1
- package/dist/{viewport-BJW13EGZ.js → viewport-DQR5LyX3.js} +2 -2
- package/dist/{viewport-BJW13EGZ.js.map → viewport-DQR5LyX3.js.map} +1 -1
- package/dist/wire.cjs +225 -57
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +3548 -1151
- package/dist/wire.d.ts +3548 -1151
- package/dist/wire.js +198 -53
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/dist/Change-CKoxfTNY.js.map +0 -1
- package/dist/Change-CjImsrN0.cjs.map +0 -1
- package/dist/authority-B3BklsB4.js.map +0 -1
- package/dist/authority-DLMNR7ff.cjs.map +0 -1
- package/dist/builders-CNj0POeY.js.map +0 -1
- package/dist/builders-Cgdp_YCn.cjs.map +0 -1
- package/dist/calibrate-7T3fnP8-.js.map +0 -1
- package/dist/calibrate-DJBXnhLE.cjs.map +0 -1
- package/dist/resolver-CzxmD9Ck.js.map +0 -1
- package/dist/resolver-D2OCtE8F.cjs.map +0 -1
- package/dist/schema-C-gU4vj7.cjs.map +0 -1
- package/dist/schema-DzlUNk38.js.map +0 -1
- package/dist/schemas-Berf1swF.cjs.map +0 -1
- package/dist/schemas-D6xOGjqg.js.map +0 -1
|
@@ -43,6 +43,7 @@ const caps = { doc: {
|
|
|
43
43
|
},
|
|
44
44
|
metadata: { modify: () => "doc.metadata.modify" },
|
|
45
45
|
attachments: { modify: () => "doc.attachments.modify" },
|
|
46
|
+
outline: { modify: () => "doc.outline.modify" },
|
|
46
47
|
redact: () => "doc.redact",
|
|
47
48
|
sign: Object.assign(() => "doc.sign", { certify: () => "doc.sign.certify" })
|
|
48
49
|
} };
|
|
@@ -146,7 +147,10 @@ function materializePdfPermissions(b) {
|
|
|
146
147
|
out.add("doc.metadata.modify");
|
|
147
148
|
out.add("doc.attachments.modify");
|
|
148
149
|
}
|
|
149
|
-
if (b.bit4 || b.bit11)
|
|
150
|
+
if (b.bit4 || b.bit11) {
|
|
151
|
+
out.add("doc.pages.assemble");
|
|
152
|
+
out.add("doc.outline.modify");
|
|
153
|
+
}
|
|
150
154
|
if (b.bit6) out.add("doc.annotate.modify");
|
|
151
155
|
if (b.bit4 || b.bit6 || b.bit9) {
|
|
152
156
|
out.add("doc.forms.fill");
|
|
@@ -181,4 +185,4 @@ Object.defineProperty(exports, "pdfPermissions", {
|
|
|
181
185
|
}
|
|
182
186
|
});
|
|
183
187
|
|
|
184
|
-
//# sourceMappingURL=builders-
|
|
188
|
+
//# sourceMappingURL=builders-DgTAj_tP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders-DgTAj_tP.cjs","names":[],"sources":["../src/auth/scope/builders.ts"],"sourcesContent":["import type { DocCapability, PdfBits } from './types';\n\n/**\n * Typed capability constants for customer-side JWT minting.\n *\n * The shape mirrors the dotted capability name so it reads naturally:\n * caps.doc.text.copy() // \"doc.text.copy\"\n * caps.doc.download() // \"doc.download\"\n * caps.doc.download.flattened() // \"doc.download.flattened\"\n * caps.doc.print.high() // \"doc.print.high\"\n *\n * Each leaf is a function returning the literal string (as `const`) so\n * TypeScript catches typos at the call site. Wrappers like `download`\n * and `print` are `Object.assign`'d to be callable and carry child\n * properties for the refinement capabilities.\n */\nexport const caps = {\n doc: {\n open: () => 'doc.open' as const,\n render: () => 'doc.render' as const,\n text: {\n select: () => 'doc.text.select' as const,\n copy: () => 'doc.text.copy' as const,\n search: () => 'doc.text.search' as const,\n },\n content: {\n copy: () => 'doc.content.copy' as const,\n },\n download: Object.assign(() => 'doc.download' as const, {\n flattened: () => 'doc.download.flattened' as const,\n }),\n print: Object.assign(() => 'doc.print' as const, {\n high: () => 'doc.print.high' as const,\n }),\n pages: {\n modify: () => 'doc.pages.modify' as const,\n assemble: () => 'doc.pages.assemble' as const,\n },\n forms: {\n read: () => 'doc.forms.read' as const,\n fill: () => 'doc.forms.fill' as const,\n modify: () => 'doc.forms.modify' as const,\n import: () => 'doc.forms.import' as const,\n script: () => 'doc.forms.script' as const,\n submit: () => 'doc.forms.submit' as const,\n },\n annotate: {\n read: () => 'doc.annotate.read' as const,\n modify: () => 'doc.annotate.modify' as const,\n import: () => 'doc.annotate.import' as const,\n },\n metadata: {\n modify: () => 'doc.metadata.modify' as const,\n },\n attachments: {\n modify: () => 'doc.attachments.modify' as const,\n },\n outline: {\n modify: () => 'doc.outline.modify' as const,\n },\n redact: () => 'doc.redact' as const,\n sign: Object.assign(() => 'doc.sign' as const, {\n certify: () => 'doc.sign.certify' as const,\n }),\n },\n} as const;\n\n/**\n * Builder factory for collab scope filters. Each entity:action pair\n * gets a sub-object with the four filter constructors.\n *\n * collab.annotations.create.self() → \"annotations:create:self\"\n * collab.annotations.create.group(\"legal\") → \"annotations:create:group=legal\"\n * collab.annotations.update.group(\"4\") → \"annotations:update:group=4\"\n * collab.annotations.delete.createdBy(\"u-7\") → \"annotations:delete:createdBy=u-7\"\n * collab.annotations.setGroup.group(\"legal\") → \"annotations:set-group:group=legal\"\n * collab.annotations.all.all() → \"annotations:*:all\" (action wildcard)\n * collab.fields.fill.group(\"buyer\") → \"fields:fill:group=buyer\"\n * collab.fields.sign.group(\"buyer\") → \"fields:sign:group=buyer\"\n * collab.fields.all.group(\"seller\") → \"fields:*:group=seller\"\n *\n * On create, the filter is evaluated against the caller's own identity\n * (no impersonation), so `:self` and `:all` trivially pass; `:group=X`\n * is the meaningful filter — it constrains creation to callers whose\n * default group is X.\n */\nexport const collab = {\n annotations: {\n create: makeFilterBuilder('annotations', 'create'),\n update: makeFilterBuilder('annotations', 'update'),\n delete: makeFilterBuilder('annotations', 'delete'),\n setGroup: makeGroupFilterBuilder('annotations', 'set-group'),\n /** Action wildcard — matches create, update, delete, and set-group with the given filter. */\n all: makeFilterBuilder('annotations', '*'),\n },\n /** Form fields, by group: a field records no creator, so only `:all` and `:group=X`. */\n fields: {\n fill: makeGroupFilterBuilder('fields', 'fill'),\n sign: makeGroupFilterBuilder('fields', 'sign'),\n setGroup: makeGroupFilterBuilder('fields', 'set-group'),\n /** Action wildcard — matches fill, sign, and set-group with the given filter. */\n all: makeGroupFilterBuilder('fields', '*'),\n },\n} as const;\n\ninterface FilterBuilder {\n all(): string;\n self(): string;\n createdBy(userId: string): string;\n group(groupId: string): string;\n}\n\nfunction makeFilterBuilder(entity: string, action: string): FilterBuilder {\n return {\n all: () => `${entity}:${action}:all`,\n self: () => `${entity}:${action}:self`,\n createdBy: (userId: string) => `${entity}:${action}:createdBy=${userId}`,\n group: (groupId: string) => `${entity}:${action}:group=${groupId}`,\n };\n}\n\n/**\n * The scopes that take only `:all` and `:group=X`: `set-group`, an\n * assignment authority rather than a per-record filter (assign-to-any vs\n * assign-to-X), and every field scope, since a field records no creator.\n * The builder exposes exactly those two — a typo at JWT mint time is caught\n * by the compiler instead of producing a JWT that fails at verify.\n */\ninterface GroupFilterBuilder {\n all(): string;\n group(groupId: string): string;\n}\n\nfunction makeGroupFilterBuilder(entity: string, action: string): GroupFilterBuilder {\n return {\n all: () => `${entity}:${action}:all`,\n group: (groupId: string) => `${entity}:${action}:group=${groupId}`,\n };\n}\n\n/**\n * Builder for the `pdf.permissions` virtual scope. Returns the literal\n * string; provided as a helper for parity with caps/collab in JWT\n * construction code.\n */\nexport const pdfPermissions = (): 'pdf.permissions' => 'pdf.permissions';\n\n/**\n * Materialise `pdf.permissions` into the concrete capability list it\n * would expand to under the given PDF bit configuration.\n *\n * Useful when the customer wants to start from PDF defaults and then\n * subtract specific capabilities — easier to build the JWT scope array\n * by filtering an explicit list than by composing virtual + denials.\n *\n * const defaults = materializePdfPermissions(pdfBits);\n * const scope = [\n * ...defaults.filter(s => s !== 'doc.text.copy'),\n * 'doc.download',\n * ];\n *\n * This is the one reading of the bits: the scope resolver and the\n * permission advisory both use it. It follows what Acrobat allows on a\n * file with these bits, which is broader than ISO 32000 in two places:\n * bit 4 (\"changing the document\") also allows filling in and signing, and\n * bit 5 (\"copying text and graphics\") governs taking the text out, not\n * finding or selecting it: Acrobat finds and selects text in a file that\n * forbids copying. A search's snippets reproduce the text, so they need\n * `doc.text.copy`.\n */\nexport function materializePdfPermissions(b: PdfBits): DocCapability[] {\n const out = new Set<DocCapability>();\n\n // Always — pdf.permissions means \"give me a working session\"\n out.add('doc.open');\n out.add('doc.render');\n // Reading existing annotations and form values is unconditional —\n // PDF bit 6 governs writes, not visibility.\n out.add('doc.annotate.read');\n out.add('doc.forms.read');\n // Finding and selecting text are too: bit 5 governs taking it out.\n out.add('doc.text.search');\n out.add('doc.text.select');\n\n if (b.bit5) {\n out.add('doc.text.copy');\n out.add('doc.content.copy');\n }\n if (b.bit3) out.add('doc.print');\n if (b.bit12 && b.bit3) out.add('doc.print.high');\n if (b.bit4) {\n out.add('doc.pages.modify');\n out.add('doc.redact');\n out.add('doc.metadata.modify');\n out.add('doc.attachments.modify');\n }\n // Bit 11 assembles pages, and creates outline items, even when bit 4 is\n // clear; bit 4 includes it.\n if (b.bit4 || b.bit11) {\n out.add('doc.pages.assemble');\n out.add('doc.outline.modify');\n }\n if (b.bit6) out.add('doc.annotate.modify');\n // Signing a signature field is filling it in. Acrobat (and PDFium's form\n // filler) let any of the three bits fill in.\n if (b.bit4 || b.bit6 || b.bit9) {\n out.add('doc.forms.fill');\n out.add('doc.sign');\n }\n // Changing existing fields takes both: Acrobat keeps them in fill mode\n // under bit 4 alone, and offers no form tools under bit 6 or 9 alone.\n if (b.bit6 && b.bit4) out.add('doc.forms.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QFSH1.cjs");
|
|
3
3
|
const require_charmap = require("./charmap-aYlefQP9.cjs");
|
|
4
|
+
//#region src/dto/PdfLinkTarget.ts
|
|
5
|
+
/**
|
|
6
|
+
* The action tree the engine writes for a target a write can make: one URI,
|
|
7
|
+
* GoTo or Named action, as a read of it returns it. Links and outline items
|
|
8
|
+
* both write their targets this way.
|
|
9
|
+
*/
|
|
10
|
+
function actionTreeOf(target) {
|
|
11
|
+
return {
|
|
12
|
+
root: target.kind === "uri" ? {
|
|
13
|
+
type: "uri",
|
|
14
|
+
subtype: "URI",
|
|
15
|
+
uri: target.uri,
|
|
16
|
+
isMap: false,
|
|
17
|
+
next: []
|
|
18
|
+
} : target.kind === "goto" ? {
|
|
19
|
+
type: "goto",
|
|
20
|
+
subtype: "GoTo",
|
|
21
|
+
destination: target.destination,
|
|
22
|
+
next: []
|
|
23
|
+
} : {
|
|
24
|
+
type: "named",
|
|
25
|
+
subtype: "Named",
|
|
26
|
+
name: target.name,
|
|
27
|
+
next: []
|
|
28
|
+
},
|
|
29
|
+
incomplete: false,
|
|
30
|
+
warningFlags: 0,
|
|
31
|
+
warnings: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/geometry/printSize.ts
|
|
36
|
+
/**
|
|
37
|
+
* The paper a print picture is sized for, in points: the larger of A4
|
|
38
|
+
* (595 × 842) and Letter (612 × 792) on each side.
|
|
39
|
+
*/
|
|
40
|
+
const PRINT_PAPER = {
|
|
41
|
+
long: 842,
|
|
42
|
+
short: 612
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The scale (pixels per point) of a print picture of a page `size` points
|
|
46
|
+
* big at `dpi` dots per inch of paper. A page that fits on the paper is
|
|
47
|
+
* drawn at its own size at that DPI; a bigger one gets no more pixels than
|
|
48
|
+
* it needs shrunk to fit, since the printer would throw the rest away. An
|
|
49
|
+
* A0 drawing printed on office paper needs no more; printed at its own
|
|
50
|
+
* size, it needs vectors (the print copy). Portrait or landscape doesn't
|
|
51
|
+
* matter.
|
|
52
|
+
*/
|
|
53
|
+
function printScale(size, dpi) {
|
|
54
|
+
const long = Math.max(size.width, size.height);
|
|
55
|
+
const short = Math.min(size.width, size.height);
|
|
56
|
+
const fit = Math.min(1, PRINT_PAPER.long / long, PRINT_PAPER.short / short);
|
|
57
|
+
return dpi / 72 * fit;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
4
60
|
//#region src/geometry/renderSize.ts
|
|
5
61
|
/**
|
|
6
62
|
* The pixel size of a render: an area of `width` × `height` points, turned
|
|
7
63
|
* by `rotation` (width and height swap on a quarter turn) and sized by
|
|
8
|
-
* `viewport`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
64
|
+
* `viewport`. A `dpi` viewport sizes a print picture for its paper
|
|
65
|
+
* ({@link printScale}). The local worker allocates exactly this; the cloud
|
|
66
|
+
* client reports it without rendering. `InvalidArg` for a viewport that
|
|
67
|
+
* isn't positive.
|
|
11
68
|
*/
|
|
12
69
|
function renderSize(area, rotation, viewport) {
|
|
13
70
|
const swap = rotation === 90 || rotation === 270;
|
|
@@ -21,7 +78,7 @@ function renderSize(area, rotation, viewport) {
|
|
|
21
78
|
height: Math.max(1, Math.round(width * baseHeight / baseWidth))
|
|
22
79
|
};
|
|
23
80
|
}
|
|
24
|
-
const scale = viewport.scale ?? 1;
|
|
81
|
+
const scale = viewport.kind === "dpi" ? printScale(area, viewport.dpi) : viewport.scale ?? 1;
|
|
25
82
|
if (!Number.isFinite(scale) || scale <= 0) throw new require_format.EngineError(require_format.EngineErrorCode.InvalidArg, "render viewport scale must be positive");
|
|
26
83
|
return {
|
|
27
84
|
width: Math.max(1, Math.round(baseWidth * scale)),
|
|
@@ -327,6 +384,19 @@ function reasonMessage(reason) {
|
|
|
327
384
|
}
|
|
328
385
|
}
|
|
329
386
|
//#endregion
|
|
387
|
+
//#region src/identity/OutlineItemRef.ts
|
|
388
|
+
/** Build the address for an outline item from its object number. */
|
|
389
|
+
function toOutlineItemRef(objectNumber) {
|
|
390
|
+
return {
|
|
391
|
+
kind: "objectNumber",
|
|
392
|
+
objectNumber
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/** Structural equality for two outline item addresses. */
|
|
396
|
+
function outlineItemRefsEqual(a, b) {
|
|
397
|
+
return a.kind === b.kind && a.objectNumber === b.objectNumber;
|
|
398
|
+
}
|
|
399
|
+
//#endregion
|
|
330
400
|
//#region src/resource/BinarySource.ts
|
|
331
401
|
function isBlob$1(value) {
|
|
332
402
|
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
@@ -690,6 +760,13 @@ const AnnotationTransfer = bundleCodec({
|
|
|
690
760
|
});
|
|
691
761
|
//#endregion
|
|
692
762
|
//#region src/dto/Attachment.ts
|
|
763
|
+
/**
|
|
764
|
+
* How much of a file the local engine decodes: a download of a larger file,
|
|
765
|
+
* from either home, is refused with `PayloadTooLarge`, before a small stream
|
|
766
|
+
* that inflates to gigabytes takes the tab down. A file's declared size
|
|
767
|
+
* can't be trusted. The cloud engine has its server's limit.
|
|
768
|
+
*/
|
|
769
|
+
const ATTACHMENT_LIMITS = { decodedBytes: 256 * 1024 * 1024 };
|
|
693
770
|
/** The ref of an attachment whose name-tree key you already hold. */
|
|
694
771
|
function toAttachmentRef(key) {
|
|
695
772
|
return {
|
|
@@ -817,26 +894,6 @@ function followingReads(current, resolved) {
|
|
|
817
894
|
};
|
|
818
895
|
return { actions: Object.keys(actions).length > 0 ? actions : null };
|
|
819
896
|
}
|
|
820
|
-
/** The action tree the engine writes for a link target: one URI or GoTo action. */
|
|
821
|
-
function actionTreeOf(target) {
|
|
822
|
-
return {
|
|
823
|
-
root: target.kind === "uri" ? {
|
|
824
|
-
type: "uri",
|
|
825
|
-
subtype: "URI",
|
|
826
|
-
uri: target.uri,
|
|
827
|
-
isMap: false,
|
|
828
|
-
next: []
|
|
829
|
-
} : {
|
|
830
|
-
type: "goto",
|
|
831
|
-
subtype: "GoTo",
|
|
832
|
-
destination: target.destination,
|
|
833
|
-
next: []
|
|
834
|
-
},
|
|
835
|
-
incomplete: false,
|
|
836
|
-
warningFlags: 0,
|
|
837
|
-
warnings: []
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
897
|
//#endregion
|
|
841
898
|
//#region src/annotation/defaults.ts
|
|
842
899
|
const RED = "#ff0000";
|
|
@@ -2411,6 +2468,12 @@ Object.defineProperty(exports, "ANNOTATION_RESOURCE_ROLE_NAMES", {
|
|
|
2411
2468
|
return ANNOTATION_RESOURCE_ROLE_NAMES;
|
|
2412
2469
|
}
|
|
2413
2470
|
});
|
|
2471
|
+
Object.defineProperty(exports, "ATTACHMENT_LIMITS", {
|
|
2472
|
+
enumerable: true,
|
|
2473
|
+
get: function() {
|
|
2474
|
+
return ATTACHMENT_LIMITS;
|
|
2475
|
+
}
|
|
2476
|
+
});
|
|
2414
2477
|
Object.defineProperty(exports, "AbortError", {
|
|
2415
2478
|
enumerable: true,
|
|
2416
2479
|
get: function() {
|
|
@@ -2435,12 +2498,24 @@ Object.defineProperty(exports, "METRES", {
|
|
|
2435
2498
|
return METRES;
|
|
2436
2499
|
}
|
|
2437
2500
|
});
|
|
2501
|
+
Object.defineProperty(exports, "PRINT_PAPER", {
|
|
2502
|
+
enumerable: true,
|
|
2503
|
+
get: function() {
|
|
2504
|
+
return PRINT_PAPER;
|
|
2505
|
+
}
|
|
2506
|
+
});
|
|
2438
2507
|
Object.defineProperty(exports, "SEARCH_FOLD_VERSION", {
|
|
2439
2508
|
enumerable: true,
|
|
2440
2509
|
get: function() {
|
|
2441
2510
|
return SEARCH_FOLD_VERSION;
|
|
2442
2511
|
}
|
|
2443
2512
|
});
|
|
2513
|
+
Object.defineProperty(exports, "actionTreeOf", {
|
|
2514
|
+
enumerable: true,
|
|
2515
|
+
get: function() {
|
|
2516
|
+
return actionTreeOf;
|
|
2517
|
+
}
|
|
2518
|
+
});
|
|
2444
2519
|
Object.defineProperty(exports, "annotationDefaultsOf", {
|
|
2445
2520
|
enumerable: true,
|
|
2446
2521
|
get: function() {
|
|
@@ -2633,6 +2708,12 @@ Object.defineProperty(exports, "measureFromRatio", {
|
|
|
2633
2708
|
return measureFromRatio;
|
|
2634
2709
|
}
|
|
2635
2710
|
});
|
|
2711
|
+
Object.defineProperty(exports, "outlineItemRefsEqual", {
|
|
2712
|
+
enumerable: true,
|
|
2713
|
+
get: function() {
|
|
2714
|
+
return outlineItemRefsEqual;
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2636
2717
|
Object.defineProperty(exports, "pageAnnotationDraftOf", {
|
|
2637
2718
|
enumerable: true,
|
|
2638
2719
|
get: function() {
|
|
@@ -2813,6 +2894,12 @@ Object.defineProperty(exports, "pdfRectOf", {
|
|
|
2813
2894
|
return pdfRectOf;
|
|
2814
2895
|
}
|
|
2815
2896
|
});
|
|
2897
|
+
Object.defineProperty(exports, "printScale", {
|
|
2898
|
+
enumerable: true,
|
|
2899
|
+
get: function() {
|
|
2900
|
+
return printScale;
|
|
2901
|
+
}
|
|
2902
|
+
});
|
|
2816
2903
|
Object.defineProperty(exports, "renderAreaTransform", {
|
|
2817
2904
|
enumerable: true,
|
|
2818
2905
|
get: function() {
|
|
@@ -2909,6 +2996,12 @@ Object.defineProperty(exports, "toOriginalRange", {
|
|
|
2909
2996
|
return toOriginalRange;
|
|
2910
2997
|
}
|
|
2911
2998
|
});
|
|
2999
|
+
Object.defineProperty(exports, "toOutlineItemRef", {
|
|
3000
|
+
enumerable: true,
|
|
3001
|
+
get: function() {
|
|
3002
|
+
return toOutlineItemRef;
|
|
3003
|
+
}
|
|
3004
|
+
});
|
|
2912
3005
|
Object.defineProperty(exports, "withFileFromResource", {
|
|
2913
3006
|
enumerable: true,
|
|
2914
3007
|
get: function() {
|
|
@@ -2916,4 +3009,4 @@ Object.defineProperty(exports, "withFileFromResource", {
|
|
|
2916
3009
|
}
|
|
2917
3010
|
});
|
|
2918
3011
|
|
|
2919
|
-
//# sourceMappingURL=calibrate-
|
|
3012
|
+
//# sourceMappingURL=calibrate-DJbi1wuK.cjs.map
|