@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.
Files changed (91) hide show
  1. package/dist/{AnnotationList-CkijRHet.d.cts → AnnotationList-DcyhF2kU.d.cts} +1836 -1308
  2. package/dist/{AnnotationList-CkijRHet.d.ts → AnnotationList-DcyhF2kU.d.ts} +1836 -1308
  3. package/dist/{Change-CjImsrN0.cjs → Change-Ct-dB8D5.cjs} +115 -2
  4. package/dist/Change-Ct-dB8D5.cjs.map +1 -0
  5. package/dist/{Change-CKoxfTNY.js → Change-tMR34hTU.js} +92 -3
  6. package/dist/Change-tMR34hTU.js.map +1 -0
  7. package/dist/{DocumentRenderService-BfFdFSwI.cjs → DocumentRenderService-9IjSQEIU.cjs} +2 -1
  8. package/dist/{DocumentRenderService-BfFdFSwI.cjs.map → DocumentRenderService-9IjSQEIU.cjs.map} +1 -1
  9. package/dist/{DocumentRenderService-DV3J9lMz.js → DocumentRenderService-DFrZ9wfW.js} +2 -1
  10. package/dist/{DocumentRenderService-DV3J9lMz.js.map → DocumentRenderService-DFrZ9wfW.js.map} +1 -1
  11. package/dist/{DocumentSecurityService-e6vp2de8.d.cts → DocumentSecurityService-D2zA4NKi.d.cts} +2 -2
  12. package/dist/{DocumentSecurityService-CU1M6Q7m.d.ts → DocumentSecurityService-YJV9df8P.d.ts} +2 -2
  13. package/dist/{LocalEngine-DFoBm4B3.d.cts → LocalEngine-DBt2-GWF.d.ts} +102 -18
  14. package/dist/{LocalEngine-DPriFujS.d.ts → LocalEngine-IA9zh3Jh.d.cts} +102 -18
  15. package/dist/{authority-DLMNR7ff.cjs → authority-BFp6XM04.cjs} +373 -52
  16. package/dist/authority-BFp6XM04.cjs.map +1 -0
  17. package/dist/{authority-B3BklsB4.js → authority-PuxpGFhJ.js} +320 -53
  18. package/dist/authority-PuxpGFhJ.js.map +1 -0
  19. package/dist/{builders-CNj0POeY.js → builders-DV62HA3I.js} +6 -2
  20. package/dist/builders-DV62HA3I.js.map +1 -0
  21. package/dist/{builders-Cgdp_YCn.cjs → builders-DgTAj_tP.cjs} +6 -2
  22. package/dist/builders-DgTAj_tP.cjs.map +1 -0
  23. package/dist/{calibrate-DJBXnhLE.cjs → calibrate-DJbi1wuK.cjs} +118 -25
  24. package/dist/calibrate-DJbi1wuK.cjs.map +1 -0
  25. package/dist/{calibrate-7T3fnP8-.js → calibrate-nQFgCuki.js} +83 -26
  26. package/dist/calibrate-nQFgCuki.js.map +1 -0
  27. package/dist/charmap-Cprti1ta.js.map +1 -1
  28. package/dist/charmap-aYlefQP9.cjs.map +1 -1
  29. package/dist/conformance.cjs +1744 -75
  30. package/dist/conformance.cjs.map +1 -1
  31. package/dist/conformance.d.cts +105 -10
  32. package/dist/conformance.d.ts +105 -10
  33. package/dist/conformance.js +1738 -76
  34. package/dist/conformance.js.map +1 -1
  35. package/dist/index.cjs +25 -6
  36. package/dist/index.d.cts +2 -2
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +7 -7
  39. package/dist/public.cjs +6 -4
  40. package/dist/public.d.cts +5 -5
  41. package/dist/public.d.ts +5 -5
  42. package/dist/public.js +5 -5
  43. package/dist/{resolver-CzxmD9Ck.js → resolver-BBggAxQc.js} +6 -3
  44. package/dist/resolver-BBggAxQc.js.map +1 -0
  45. package/dist/{resolver-D2OCtE8F.cjs → resolver-BWSWSF6R.cjs} +6 -3
  46. package/dist/resolver-BWSWSF6R.cjs.map +1 -0
  47. package/dist/{runtime-Cl0v56mm.d.ts → runtime-BaDKjxiu.d.ts} +67 -140
  48. package/dist/{runtime-p1WDzDo4.d.cts → runtime-CWEuiwbk.d.cts} +67 -140
  49. package/dist/runtime.cjs +267 -7
  50. package/dist/runtime.cjs.map +1 -1
  51. package/dist/runtime.d.cts +5 -5
  52. package/dist/runtime.d.ts +5 -5
  53. package/dist/runtime.js +246 -8
  54. package/dist/runtime.js.map +1 -1
  55. package/dist/{schema-DzlUNk38.js → schema-6S2VmlAj.js} +8 -2
  56. package/dist/schema-6S2VmlAj.js.map +1 -0
  57. package/dist/{schema-C-gU4vj7.cjs → schema-miH6tWQC.cjs} +13 -1
  58. package/dist/schema-miH6tWQC.cjs.map +1 -0
  59. package/dist/{schemas-D6xOGjqg.js → schemas-BE2QGOit.js} +256 -59
  60. package/dist/schemas-BE2QGOit.js.map +1 -0
  61. package/dist/{schemas-Berf1swF.cjs → schemas-DljJR9ut.cjs} +397 -80
  62. package/dist/schemas-DljJR9ut.cjs.map +1 -0
  63. package/dist/validation.cjs +1 -1
  64. package/dist/validation.d.cts +1 -1
  65. package/dist/validation.d.ts +1 -1
  66. package/dist/validation.js +1 -1
  67. package/dist/{viewport-DlL5Bxbg.cjs → viewport-CHG9qQUb.cjs} +2 -2
  68. package/dist/{viewport-DlL5Bxbg.cjs.map → viewport-CHG9qQUb.cjs.map} +1 -1
  69. package/dist/{viewport-BJW13EGZ.js → viewport-DQR5LyX3.js} +2 -2
  70. package/dist/{viewport-BJW13EGZ.js.map → viewport-DQR5LyX3.js.map} +1 -1
  71. package/dist/wire.cjs +225 -57
  72. package/dist/wire.cjs.map +1 -1
  73. package/dist/wire.d.cts +3548 -1151
  74. package/dist/wire.d.ts +3548 -1151
  75. package/dist/wire.js +198 -53
  76. package/dist/wire.js.map +1 -1
  77. package/package.json +1 -1
  78. package/dist/Change-CKoxfTNY.js.map +0 -1
  79. package/dist/Change-CjImsrN0.cjs.map +0 -1
  80. package/dist/authority-B3BklsB4.js.map +0 -1
  81. package/dist/authority-DLMNR7ff.cjs.map +0 -1
  82. package/dist/builders-CNj0POeY.js.map +0 -1
  83. package/dist/builders-Cgdp_YCn.cjs.map +0 -1
  84. package/dist/calibrate-7T3fnP8-.js.map +0 -1
  85. package/dist/calibrate-DJBXnhLE.cjs.map +0 -1
  86. package/dist/resolver-CzxmD9Ck.js.map +0 -1
  87. package/dist/resolver-D2OCtE8F.cjs.map +0 -1
  88. package/dist/schema-C-gU4vj7.cjs.map +0 -1
  89. package/dist/schema-DzlUNk38.js.map +0 -1
  90. package/dist/schemas-Berf1swF.cjs.map +0 -1
  91. package/dist/schemas-D6xOGjqg.js.map +0 -1
@@ -1,13 +1,70 @@
1
1
  import { $ as ANNOTATION_FIELD_SPACES_BY_NAME, A as shapeFieldsOf, G as assertRowResources, H as assertKnownFields, J as isBundlePageRef, O as DRAWN_RECT_KINDS, P as semanticEqual, Q as ANNOTATION_FIELD_SPACES, U as assertResourceIds, V as assertBundlePages, W as assertResourcesNamed, Y as isRecord, _t as pdfQuadBounds, dt as pdfPointsBounds, ft as pdfTurnOfDrawn, j as UNBAKED_KINDS, k as pdfShapeForRect, l as pdfResolveRectCommand, lt as pdfPointTurned, mt as isSamePdfRect, n as pdfPredictAnnotationDraft, nt as kindFactsOf, o as pdfPredictAnnotationPatch, ot as DEFAULT_RICH_TEXT_BODY, pt as pdfTurnOfUpright, q as invalidBundle, tt as ANNOTATION_RESOURCE_ROLES, ut as pdfPointUnturned, v as assertWritableMeasure, wt as pdfRectTurnedBounds } from "./resolveAnnotationDraft-CUpf0SMh.js";
2
2
  import { h as EngineError, u as encodePageKey, v as _defineProperty, y as EngineErrorCode } from "./format-Dgg428Kb.js";
3
3
  import { c as toBase64, o as decodedLengthOf, s as fromBase64 } from "./charmap-Cprti1ta.js";
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`. The local worker allocates exactly this; the cloud client
9
- * reports it without rendering. `InvalidArg` for a viewport that isn't
10
- * positive.
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 EngineError(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";
@@ -2399,6 +2456,6 @@ function measureFromRatio(paper, real, unit, options = {}) {
2399
2456
  return build(userUnit / 72 * .0254 * (real / paper) / METRES[unit], unit, `${paper}:${real}`, format);
2400
2457
  }
2401
2458
  //#endregion
2402
- export { pdfAppearanceTurnOf as $, createPdfTextLayout as A, renderTargetArea as At, mapActionNode as B, resolveAnnotationPatch as C, pageQuadOf as Ct, pageGeometryOf as D, pageTransform as Dt, createTextLayout as E, pdfRectOf as Et, pdfAnnotationOf as F, mapLinkTarget as G, mapAnnotationActions as H, pdfAnnotationPatchOf as I, pageDestinationOf as J, mapPageActions as K, pageMeasureOf as L, pageAnnotationOf as M, renderSize as Mt, pageAnnotationPatchOf as N, pageSearchSliceOf as O, renderAreaTransform as Ot, pdfAnnotationDraftOf as P, applyResolvedPatch as Q, pageViewportsOf as R, resolveAnnotationDraft as S, pagePointOf as St, shapeForRect as T, pdfQuadOf as Tt, mapDocumentActions as U, mapActionTree as V, mapFieldActions as W, ANNOTATION_DEFAULTS as X, pdfDestinationOf as Y, annotationDefaultsOf as Z, pagePointUnturned as _, isAbortError as _t, squareMetres as a, DEFAULT_BUNDLE_LIMITS as at, pageTurnOfDrawn as b, isRotatedGeometryRun as bt, foldText as c, ANNOTATION_RESOURCE_ROLE_NAMES as ct, appearanceTurnOf as d, hasAnnotationResources as dt, toAttachmentRef as et, applyAnnotationPatch as f, resolveAnnotationResources as ft, pagePointTurned as g, AbortError as gt, pageGlyphLooseQuad as h, resolveBinarySource as ht, areaUnitLabel as i, bundleCodec as it, pageAnnotationDraftOf as j, renderTransform as jt, pageTextSegmentOf as k, renderMatrix as kt, toOriginalRange as l, annotationResourceBuffers as lt, pageGlyphLooseBounds as m, sniffBinaryMetadata as mt, measureFromRatio as n, assertAnnotationBundle as nt, squareOf as o, assertWithinLimit as ot, drawnPointsOf as p, withFileFromResource as pt, mapTriggerActions as q, METRES as r, assertAnnotationBundleManifest as rt, SEARCH_FOLD_VERSION as s, manifestBytesOf as st, measureFromKnownLength as t, AnnotationTransfer as tt, annotationOfDraft as u, assertAnnotationResources as ut, pagePointsBounds as v, glyphLooseBounds as vt, resolveRectCommand as w, pdfPointOf as wt, pageTurnOfUpright as x, pageBoxOf as xt, pageQuadBounds as y, glyphLooseQuad as yt, pdfMeasureOf as z };
2459
+ export { pdfAppearanceTurnOf as $, createPdfTextLayout as A, pageTransform as At, mapActionNode as B, resolveAnnotationPatch as C, isRotatedGeometryRun as Ct, pageGeometryOf as D, pdfPointOf as Dt, createTextLayout as E, pageQuadOf as Et, pdfAnnotationOf as F, renderSize as Ft, mapLinkTarget as G, mapAnnotationActions as H, pdfAnnotationPatchOf as I, PRINT_PAPER as It, pageDestinationOf as J, mapPageActions as K, pageMeasureOf as L, printScale as Lt, pageAnnotationOf as M, renderMatrix as Mt, pageAnnotationPatchOf as N, renderTargetArea as Nt, pageSearchSliceOf as O, pdfQuadOf as Ot, pdfAnnotationDraftOf as P, renderTransform as Pt, applyResolvedPatch as Q, pageViewportsOf as R, actionTreeOf as Rt, resolveAnnotationDraft as S, glyphLooseQuad as St, shapeForRect as T, pagePointOf as Tt, mapDocumentActions as U, mapActionTree as V, mapFieldActions as W, ANNOTATION_DEFAULTS as X, pdfDestinationOf as Y, annotationDefaultsOf as Z, pagePointUnturned as _, outlineItemRefsEqual as _t, squareMetres as a, bundleCodec as at, pageTurnOfDrawn as b, isAbortError as bt, foldText as c, manifestBytesOf as ct, appearanceTurnOf as d, assertAnnotationResources as dt, ATTACHMENT_LIMITS as et, applyAnnotationPatch as f, hasAnnotationResources as ft, pagePointTurned as g, resolveBinarySource as gt, pageGlyphLooseQuad as h, sniffBinaryMetadata as ht, areaUnitLabel as i, assertAnnotationBundleManifest as it, pageAnnotationDraftOf as j, renderAreaTransform as jt, pageTextSegmentOf as k, pdfRectOf as kt, toOriginalRange as l, ANNOTATION_RESOURCE_ROLE_NAMES as lt, pageGlyphLooseBounds as m, withFileFromResource as mt, measureFromRatio as n, AnnotationTransfer as nt, squareOf as o, DEFAULT_BUNDLE_LIMITS as ot, drawnPointsOf as p, resolveAnnotationResources as pt, mapTriggerActions as q, METRES as r, assertAnnotationBundle as rt, SEARCH_FOLD_VERSION as s, assertWithinLimit as st, measureFromKnownLength as t, toAttachmentRef as tt, annotationOfDraft as u, annotationResourceBuffers as ut, pagePointsBounds as v, toOutlineItemRef as vt, resolveRectCommand as w, pageBoxOf as wt, pageTurnOfUpright as x, glyphLooseBounds as xt, pageQuadBounds as y, AbortError as yt, pdfMeasureOf as z };
2403
2460
 
2404
- //# sourceMappingURL=calibrate-7T3fnP8-.js.map
2461
+ //# sourceMappingURL=calibrate-nQFgCuki.js.map